• C#
  • Java
  • VB
  • C++
  • Python
Use up and down arrows to select available result. Press enter to go to selected search result. Touch devices users can use touch and swipe gestures.
Contact us
Model Portfolios and the API

Advisors can use Model Portfolios to easily invest some or all of a client's assets into one or multiple custom-created portfolios, rather than tediously managing individual investments in single instruments.

More about Model Portfolios

The TWS API can access model portfolios in accounts where this functionality is available and a specific model has previously been setup in TWS. API functionality allows the client application to request model position update subscriptions, request model account update subscriptions, or place orders to a specific model.

Model Portfolio functionality not available in the TWS API:

  • Portfolio Model Creation
  • Portfolio Model Rebalancing
  • Portfolio Model Position or Cash Transfer

To request position updates from a specific model, the function IBApi::EClient::reqPositionsMulti can be used: Position Update Subscription by Model

To request model account updates, there is the function IBApi::EClient::reqAccountUpdatesMulti, see: Account Value Update Subscriptions by Model

To place an order to a model, the IBApi.Order.ModelCode field must be set accordingly, for example:

  • 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)