Search code examples
javaalgorithmic-tradinginteractive-brokers

m_account placeorder FA Java Interactive Brokers


I have an F account, and a U account. This will properly populate the API order tab in TWS but does not allocate the order the U account. How can I allocate this to the U account?

    nextOrderID = orderId;
    c.m_symbol = "SPY";
    c.m_exchange = "SMART";
    c.m_secType = "STK";
    c.m_currency = "USD";

    Order order = new Order();
    order.m_action = "BUY";
    order.m_totalQuantity = 1;
    order.m_lmtPrice = 1.00;
    order.m_orderType = "LMT";  
    String m_account = "U123123";
    int randomNum = ThreadLocalRandom.current().nextInt(1, 100 + 1);

    m_s.placeOrder(randomNum, c, order);

Solution

  • Simple answer, include in the order aspect:

         order.m_account = "U123123";