• 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.
Also note, in TWS v983+ there is a setting to merge group and profile functionality. See details in Unification of Groups and Profiles

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", Decimal.ONE_HUNDRED);
    // 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", DecimalFunctions::stringToDecimal("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.

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

Place an Order for an Account Profile

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", Decimal.get(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", DecimalFunctions::stringToDecimal("200"), 100);
    modelOrder.account = "DF12345";
    modelOrder.modelCode = "Technology";
    m_pClient->placeOrder(m_orderId++, ContractSamples::USStock(), modelOrder);
  • 1  modelOrder = OrderSamples.LimitOrder("BUY", 200, 100)
    2  modelOrder.account = "DF12345"
    3  modelOrder.modelCode = "Technology" # model for tech stocks first created in TWS
    4  self.placeOrder(self.nextOrderId(), 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) {
    System.out.print(EWrapperMsgGenerator.softDollarTiers(tiers));
    }
  • 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("SoftDollarTiers. ReqId:", reqId)
    4  for tier in tiers:
    5  print("SoftDollarTier.", tier)