• C#
  • Java
  • VB
  • C++
  • Python
Contact us
Placing Orders to a FA account

Account Allocations

Financial Advisor users can invoke IBApi.EClient.placeOrder function while specifying corresponding Financial Advisor Fields in the IBApi.Order object. Important: Unlike in TWS, there is not a default account allocation for the API- it must be specified with every order placed.

Place an Order for a Single Managed Account

In linked accounts (not Financial Advisor accounts) in particular, it will be necessary to specify an account number in the IBApi::Order::account field with every order placed.

  • //Order faOrderOneAccount = OrderSamples.MarketOrder("BUY", 100);
    // Specify the Account Number directly
    // faOrderOneAccount.Account = "DU119915";
    //client.placeOrder(nextOrderId++, ContractSamples.USStock(), faOrderOneAccount);
  • Order faOrderOneAccount = OrderSamples.MarketOrder("BUY", 100);
    // Specify the Account Number directly
    faOrderOneAccount.account("DU119915");
    client.placeOrder(nextOrderId++, ContractSamples.USStock(), faOrderOneAccount);
  • Dim faOrderOneAccount As Order = OrderSamples.MarketOrder("BUY", 100)
    ' Specify the Account Number directly
    faOrderOneAccount.Account = "DU119915"
    client.placeOrder(increment(nextOrderId), ContractSamples.USStock(), faOrderOneAccount)
  • Order faOrderOneAccount = OrderSamples::MarketOrder("BUY", 100);
    // Specify the Account Number directly
    faOrderOneAccount.account = "DU119915";
    m_pClient->placeOrder(m_orderId++, ContractSamples::USStock(), faOrderOneAccount);
  • 1  faOrderOneAccount = OrderSamples.MarketOrder("BUY", 100)
    2  # Specify the Account Number directly
    3  faOrderOneAccount.account = "DU119915"
    4  self.placeOrder(self.nextOrderId(), ContractSamples.USStock(), faOrderOneAccount)

Place an Order for an Account Group

For EqualQuantity, NetLiq and AvailableEquity allocation methods, you need to specify the IBApi.Order.FaGroup and IBApi.Order.FaMethod parameters.

  • //Order faOrderGroupEQ = OrderSamples.LimitOrder("SELL", 200, 2000);
    //faOrderGroupEQ.FaGroup = "Group_Equal_Quantity";
    //faOrderGroupEQ.FaMethod = "EqualQuantity";
    //client.placeOrder(nextOrderId++, ContractSamples.SimpleFuture(), faOrderGroupEQ);
  • Order faOrderGroupEQ = OrderSamples.LimitOrder("SELL", 200, 2000);
    faOrderGroupEQ.faGroup("Group_Equal_Quantity");
    faOrderGroupEQ.faMethod("EqualQuantity");
    client.placeOrder(nextOrderId++, ContractSamples.USStock(), faOrderGroupEQ);
  • Dim faOrderGroupEQ As Order = OrderSamples.LimitOrder("SELL", 200, 2000)
    faOrderGroupEQ.FaGroup = "Group_Equal_Quantity"
    faOrderGroupEQ.FaMethod = "EqualQuantity"
    client.placeOrder(increment(nextOrderId), ContractSamples.SimpleFuture(), faOrderGroupEQ)
  • Order faOrderGroupEQ = OrderSamples::LimitOrder("SELL", 200, 2000);
    faOrderGroupEQ.faGroup = "Group_Equal_Quantity";
    faOrderGroupEQ.faMethod = "EqualQuantity";
    m_pClient->placeOrder(m_orderId++, ContractSamples::SimpleFuture(), faOrderGroupEQ);
  • 1  faOrderGroupEQ = OrderSamples.LimitOrder("SELL", 200, 2000)
    2  faOrderGroupEQ.faGroup = "Group_Equal_Quantity"
    3  faOrderGroupEQ.faMethod = "EqualQuantity"
    4  self.placeOrder(self.nextOrderId(), ContractSamples.SimpleFuture(), faOrderGroupEQ)

For PctChange allocation methods, you should NOT specify the order size but you need to specify IBApi.Order.FaPercentage parameter.

  • //Order faOrderGroupPC = OrderSamples.MarketOrder("BUY", 0); ;
    // You should not specify any order quantity for PctChange allocation method
    //faOrderGroupPC.FaGroup = "Pct_Change";
    //faOrderGroupPC.FaMethod = "PctChange";
    // faOrderGroupPC.FaPercentage = "100";
    //client.placeOrder(nextOrderId++, ContractSamples.EurGbpFx(), faOrderGroupPC);
  • Order faOrderGroupPC = OrderSamples.MarketOrder("BUY", 0);
    // You should not specify any order quantity for PctChange allocation method
    faOrderGroupPC.faGroup("Pct_Change");
    faOrderGroupPC.faMethod("PctChange");
    faOrderGroupPC.faPercentage("100");
    client.placeOrder(nextOrderId++, ContractSamples.EurGbpFx(), faOrderGroupPC);
  • Dim faOrderGroupPC As Order = OrderSamples.MarketOrder("BUY", 0)
    ' You should not specify any order quantity for PctChange allocation method
    faOrderGroupPC.FaGroup = "Pct_Change"
    faOrderGroupPC.FaMethod = "PctChange"
    faOrderGroupPC.FaPercentage = "100"
    client.placeOrder(increment(nextOrderId), ContractSamples.EurGbpFx(), faOrderGroupPC)
  • Order faOrderGroupPC;
    faOrderGroupPC.action = "BUY";
    faOrderGroupPC.orderType = "MKT";
    // You should not specify any order quantity for PctChange allocation method
    faOrderGroupPC.faGroup = "Pct_Change";
    faOrderGroupPC.faMethod = "PctChange";
    faOrderGroupPC.faPercentage = "100";
    m_pClient->placeOrder(m_orderId++, ContractSamples::EurGbpFx(), faOrderGroupPC);
  • 1  faOrderGroupPC = OrderSamples.MarketOrder("BUY", 0)
    2  # You should not specify any order quantity for PctChange allocation method
    3  faOrderGroupPC.faGroup = "Pct_Change"
    4  faOrderGroupPC.faMethod = "PctChange"
    5  faOrderGroupPC.faPercentage = "100"
    6  self.placeOrder(self.nextOrderId(), ContractSamples.EurGbpFx(), faOrderGroupPC)

Place an Order for an Account Profile

  • //Order faOrderProfile = OrderSamples.LimitOrder("BUY", 200, 100);
    //faOrderProfile.FaProfile = "Percent_60_40";
    //client.placeOrder(nextOrderId++, ContractSamples.EuropeanStock(), faOrderProfile);
  • Order faOrderProfile = OrderSamples.LimitOrder("BUY", 200, 100);
    faOrderProfile.faProfile("Percent_60_40");
    client.placeOrder(nextOrderId++, ContractSamples.EuropeanStock(), faOrderProfile);
  • Dim faOrderProfile As Order = OrderSamples.LimitOrder("BUY", 200, 100)
    faOrderProfile.FaProfile = "Percent_60_40"
    client.placeOrder(increment(nextOrderId), ContractSamples.EuropeanStock(), faOrderProfile)
  • Order faOrderProfile = OrderSamples::LimitOrder("BUY", 200, 100);
    faOrderProfile.faProfile = "Percent_60_40";
    m_pClient->placeOrder(m_orderId++, ContractSamples::EuropeanStock(), faOrderProfile);
  • 1  faOrderProfile = OrderSamples.LimitOrder("BUY", 200, 100)
    2  faOrderProfile.faProfile = "Percent_60_40"
    3  self.placeOrder(self.nextOrderId(), ContractSamples.EuropeanStock(), faOrderProfile)

Model Allocations

  • //Order modelOrder = OrderSamples.LimitOrder("BUY", 200, 100);
    //modelOrder.Account = "DF12345"; // master FA account number
    //modelOrder.ModelCode = "Technology"; // model for tech stocks first created in TWS
    //client.placeOrder(nextOrderId++, ContractSamples.USStock(), modelOrder);
  • Order modelOrder = OrderSamples.LimitOrder("BUY", 200, 100);
    modelOrder.account("DF12345"); // master FA account number
    modelOrder.modelCode("Technology"); // model for tech stocks first created in TWS
    client.placeOrder(nextOrderId++, ContractSamples.USStock(), modelOrder);
  • Dim modelOrder As Order = OrderSamples.LimitOrder("BUY", 200, 100)
    modelOrder.Account = "DF12345" 'master FA account number
    modelOrder.ModelCode = "Technology" 'model for tech stocks first created in TWS
    client.placeOrder(increment(nextOrderId), ContractSamples.USStock(), modelOrder)
  • Order modelOrder = OrderSamples::LimitOrder("BUY", 200, 100);
    modelOrder.account = "DF12345";
    modelOrder.modelCode = "Technology";
    m_pClient->placeOrder(m_orderId++, ContractSamples::USStock(), modelOrder);

Soft Dollar Tiers

Starting from API version 9.72.18 or higher and TWS Build 959 or higher, Financial Advisors, Hedge Fund and Mutual Fund are able to utilize the Soft Dollar Tiers feature via the API.

Request Soft Dollar Tiers

The IBApi.EClient.reqSoftDollarTiers function can be called to manually request current Soft Dollar Tiers structure from TWS.

  • client.reqSoftDollarTiers(4001);
  • client.reqSoftDollarTiers(4001);
  • client.reqSoftDollarTiers(4001)
  • m_pClient->reqSoftDollarTiers(4001);
  • 1  self.reqSoftDollarTiers(14001)

Receive Soft Dollar Tiers

The IBApi.EWrapper.softDollarTiers call back function is triggered for returning Soft Dollar Tiers Value, Name and Display Name.

  • public class EWrapperImpl : EWrapper
    {
    ...
    public void softDollarTiers(int reqId, SoftDollarTier[] tiers)
    {
    Console.WriteLine("Soft Dollar Tiers:");
    foreach (var tier in tiers)
    {
    Console.WriteLine(tier.DisplayName);
    }
    }
  • public class EWrapperImpl implements EWrapper {
    ...
    @Override
    public void softDollarTiers(int reqId, SoftDollarTier[] tiers) {
    for (SoftDollarTier tier : tiers) {
    System.out.print("tier: " + tier.toString() + ", ");
    }
    System.out.println();
    }
  • Public Class EWrapperImpl
    Implements EWrapper
    ...
    Public Sub softDollarTiers(reqid As Integer, tiers As SoftDollarTier()) Implements EWrapper.softDollarTiers
    Console.WriteLine("Soft Dollar Tiers:")
    For Each tier In tiers
    Console.WriteLine(tier.DisplayName)
    Next
    End Sub
  • class TestCppClient : public EWrapper
    {
    ...
    void TestCppClient::softDollarTiers(int reqId, const std::vector<SoftDollarTier> &tiers) {
    printf("Soft dollar tiers (%lu):", tiers.size());
    for (unsigned int i = 0; i < tiers.size(); i++) {
    printf("%s\n", tiers[i].displayName().c_str());
    }
    }
  • 1 class TestWrapper(wrapper.EWrapper):
    ...
    1  def softDollarTiers(self, reqId: int, tiers: list):
    2  super().softDollarTiers(reqId, tiers)
    3  print("Soft Dollar Tiers:", tiers)
    4