Trading and Orders
Financial Advisors
Group Routing
To place trades using a subset of client accounts, create Account Groups in Trader Workstation and then define the InteractiveBrokersOrderProperties
when you create orders.
DefaultOrderProperties = new InteractiveBrokersOrderProperties { FaGroup = "TestGroupEQ", FaMethod = "EqualQuantity", FaProfile = "TestProfileP", Account = "DU123456" };
self.DefaultOrderProperties = InteractiveBrokersOrderProperties() self.DefaultOrderProperties.FaGroup = "TestGroupEQ" self.DefaultOrderProperties.FaMethod = "EqualQuantity" self.DefaultOrderProperties.FaProfile = "TestProfileP" self.DefaultOrderProperties.Account = "DU123456"
SecurityHolding objects aggregate your positions across all the account groups. If you have two groups where group A has 10 shares of SPY and group B has -10 shares of SPY, then self.Portfolio["SPY"].Quantity
Portfolio["SPY"].Quantity
is zero.
Allocation Methods
The following table shows the supported allocation methods for FA group orders:
FaMethod | Description |
---|---|
"EqualQuantity" | Distributes shares equally between all accounts in the group. If you use this method, specify an order quantity. |
"NetLiq" | Distributes shares based on the net liquidation value of each account. The system calculates ratios based on the net liquidation value in each account and allocates shares based on these ratios. If you use this method, specify an order quantity. |
"AvailableEquity" | Distributes shares based on the amount of available equity in each account. The system calculates ratios based on the available equity in each account and allocates shares based on these ratios. If you use this method, specify an order quantity. |
"PctChange" | Increases or decreases an already existing position. Positive percents increase positions and negative percents decrease positions. If you use this method, specify a percent instead of an order quantity. |
public override void Initialize() { // Set the default order properties DefaultOrderProperties = new InteractiveBrokersOrderProperties() { FaGroup = "TestGroupEQ", FaMethod = "EqualQuantity", FaProfile = "TestProfileP", Account = "DU123456" }; } public override void OnData(Slice slice) { // Use default order order properties LimitOrder(_symbol, quantity, limitPrice); // Override the default order properties // "NetLiq" requires a order size input LimitOrder(_symbol, quantity, limitPrice, orderProperties: new InteractiveBrokersOrderProperties { FaMethod = "NetLiq" }); // "AvailableEquity" requires a order size input LimitOrder(_symbol, quantity, limitPrice, orderProperties: new InteractiveBrokersOrderProperties { FaMethod = "AvailableEquity" }); // "PctChange" requires a percentage of portfolio input SetHoldings(_symbol, pctPortfolio, orderProperties: new InteractiveBrokersOrderProperties { FaMethod = "PctChange" }); }
def Initialize(self) -> None: # Set the default order properties self.DefaultOrderProperties = InteractiveBrokersOrderProperties() self.DefaultOrderProperties.FaGroup = "TestGroupEQ" self.DefaultOrderProperties.FaMethod = "EqualQuantity" self.DefaultOrderProperties.FaProfile = "TestProfileP" self.DefaultOrderProperties.Account = "DU123456" def OnData(self, slice: Slice) -> None: # Override the default order properties # "NetLiq" requires a order size input order_properties = InteractiveBrokersOrderProperties() order_properties.FaMethod = "NetLiq" self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties) # "AvailableEquity" requires a order size input order_properties.FaMethod = "AvailableEquity" self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties) # "PctChange" requires a percentage of portfolio input order_properties.FaMethod = "PctChange" self.SetHoldings(self.symbol, pct_portfolio, orderProperties=order_properties)
Subscription Requirements
To use FA group orders through our Interactive Brokers integration, you need to connect as a member of a Trading Firm and Institution organization. If you aren't currently on either of these tiers, upgrade your organization.