Supported Models
Bloomberg FIX
Introduction
This page explains the BloombergFixBrokerageModel, including the asset classes it supports, its default security-level models, and its default markets.
SetBrokerageModel(BrokerageName.BloombergFix, AccountType.Margin);
self.set_brokerage_model(BrokerageName.BLOOMBERG_FIX, AccountType.MARGIN)
The BloombergFixBrokerageModel only supports margin accounts. If you pass AccountType.CashAccountType.CASH, it throws an exception.
For more information about this model, see the class reference and implementation.
For more information about this model, see the class reference and implementation.
Orders
The BloombergFixBrokerageModel supports six order types and order updates.
Order Types
The following table describes the available order types for each asset class that the BloombergFixBrokerageModel supports:
| Order Type | Equity | Equity Options | Index Options | Futures |
|---|---|---|---|---|
| Market | ![]() | ![]() | ![]() | ![]() |
| Market on open | ![]() | ![]() | ![]() | |
| Market on close | ![]() | ![]() | ![]() | ![]() |
| Limit | ![]() | ![]() | ![]() | ![]() |
| Stop market | ![]() | ![]() | ![]() | ![]() |
| Stop limit | ![]() | ![]() | ![]() | ![]() |
Market on open orders are unavailable for Futures. If you place one, the order is invalid.
Updates
The BloombergFixBrokerageModel supports order updates. The Bloomberg™ FixNet HUB accepts cancel/replace requests (FIX tag 35=G), so you can update the quantity, limit price, stop price, order type, and time in force of an open order.
Order Properties
The BloombergFixBrokerageModel supports custom order properties. The BloombergFixOrderProperties class inherits the FixOrderProperties class that every FIX connection shares. The following table describes the members of the BloombergFixOrderProperties object that you can set to customize order execution:
| Property | Data Type | Description | Default Value |
|---|---|---|---|
TimeInForcetime_in_force | TimeInForce | A TimeInForce instruction to apply to the order. | TimeInForce.GoodTilCanceledTimeInForce.GOOD_TIL_CANCELED |
HandleInstructionhandle_instruction | char?str/NoneType | The instruction for order handling on the broker floor. The following values are supported:
| |
Notesnotes | stringstr | The free form text instructions that may be sent to the broker. | |
LocateBrokerlocate_broker | stringstr | The broker that the shares are borrowed from for a short sale. Reads and writes the LocateBroker FIX tag 5700. | |
LocateReqdlocate_reqd | stringstr | Whether a locate is required for the short sale, "Y" or "N". Reads and writes the LocateReqd FIX tag 114. | |
AdditionalPropertiesadditional_properties | BaseExtendedDictionary<string, string>BaseExtendedDictionary[str, str] | The custom FIX tags to send with the order. The key is the FIX tag number and the value is the tag value. | An empty dictionary |
public override void Initialize()
{
// Set the default order properties to borrow the shares of short sales from a specific broker
DefaultOrderProperties = new BloombergFixOrderProperties
{
TimeInForce = TimeInForce.GoodTilCanceled,
LocateBroker = "BMTB",
LocateReqd = "Y"
};
} def initialize(self) -> None:
# Set the default order properties to borrow the shares of short sales from a specific broker
self.default_order_properties = BloombergFixOrderProperties()
self.default_order_properties.time_in_force = TimeInForce.GOOD_TIL_CANCELED
self.default_order_properties.locate_broker = "BMTB"
self.default_order_properties.locate_reqd = "Y"
Your FIX counterparty may require tags that the preceding properties don't cover. To send them with your orders, add them to the AdditionalPropertiesadditional_properties dictionary. For example, the following code marks the orders as direct market access (DMA) with tag 9301:
public override void Initialize()
{
// Set the default order properties to mark orders as direct market access (DMA)
var orderProperties = new BloombergFixOrderProperties();
orderProperties.AdditionalProperties["9301"] = "1";
DefaultOrderProperties = orderProperties;
} def initialize(self) -> None:
# Set the default order properties to mark orders as direct market access (DMA)
order_properties = BloombergFixOrderProperties()
order_properties.additional_properties["9301"] = "1"
self.default_order_properties = order_properties
The dictionary starts empty and you can't replace it with a plain Python dictionary. To add several tags at once, call the update method with a dictionary. To remove all the tags, call the clear method.
Handling Splits
If you're using raw data normalization and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a stock split occurs, the following properties of your orders automatically adjust to reflect the stock split:
- Quantity
- Limit price
- Stop price
- Trigger price
Fills
The following table shows the fill model that the BloombergFixBrokerageModel uses for each SecurityType:
SecurityType | Fill Model |
|---|---|
Equity | EquityFillModel |
Future | FutureFillModel |
Option and IndexOption | ImmediateFillModel |
Slippage
The BloombergFixBrokerageModel uses the NullSlippageModel.
Fees
The BloombergFixBrokerageModel uses the InteractiveBrokersFeeModel for Equity, Equity Option, and Future assets and the ConstantFeeModel with no fees for Index Option assets.
// For Equity, Equity Option, and Future assets: security.SetFeeModel(new InteractiveBrokersFeeModel()); // For Index Option assets: security.SetFeeModel(new ConstantFeeModel(0.0m));
# For Equity, Equity Option, and Future assets: security.set_fee_model(InteractiveBrokersFeeModel()) # For Index Option assets: security.set_fee_model(ConstantFeeModel(0))
The fees that your prime brokerage destination charges may differ. To model them, set a fee model.
Buying Power
The following table shows the buying power model that the BloombergFixBrokerageModel uses for each SecurityType:
SecurityType | Buying Power Model |
|---|---|
Equity | SecurityMarginModel with up to 2x leverage |
Option and IndexOption | OptionMarginModel |
Future | FutureMarginModel |
Settlement
The BloombergFixBrokerageModel uses the FutureSettlementModel for Future assets and the ImmediateSettlementModel for the remaining asset classes.
// For Future assets: security.SetSettlementModel(new FutureSettlementModel()); // For the remaining asset classes: security.SetSettlementModel(new ImmediateSettlementModel());
# For Future assets: security.set_settlement_model(FutureSettlementModel()) # For the remaining asset classes: security.set_settlement_model(ImmediateSettlementModel())
Margin Interest Rate
The BloombergFixBrokerageModel uses the NullMarginInterestRateModel.
Account Currency
The BloombergFixBrokerageModel doesn't set a default currency.
To change the algorithm's currency from USD to a different currency, see Set Account Currency.
