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.

Asset Classes

The BloombergFixBrokerageModel supports trading the following asset classes:

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 TypeEquityEquity OptionsIndex OptionsFutures
Marketgreen checkgreen checkgreen checkgreen check
Market on opengreen checkgreen checkgreen check
Market on closegreen checkgreen checkgreen checkgreen check
Limitgreen checkgreen checkgreen checkgreen check
Stop marketgreen checkgreen checkgreen checkgreen check
Stop limitgreen checkgreen checkgreen checkgreen check

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:

PropertyData TypeDescriptionDefault Value
TimeInForcetime_in_forceTimeInForceA TimeInForce instruction to apply to the order.TimeInForce.GoodTilCanceledTimeInForce.GOOD_TIL_CANCELED
HandleInstructionhandle_instructionchar?str/NoneTypeThe instruction for order handling on the broker floor. The following values are supported:
  • FixOrderProperties.AutomatedExecutionOrderPrivateFixOrderProperties.AUTOMATED_EXECUTION_ORDER_PRIVATE: Automated execution order, private, no broker intervention
  • FixOrderProperties.AutomatedExecutionOrderPublicFixOrderProperties.AUTOMATED_EXECUTION_ORDER_PUBLIC: Automated execution order, public, broker intervention OK
  • FixOrderProperties.ManualOrderFixOrderProperties.MANUAL_ORDER: Staged order, broker intervention required
NotesnotesstringstrThe free form text instructions that may be sent to the broker.
LocateBrokerlocate_brokerstringstrThe broker that the shares are borrowed from for a short sale. Reads and writes the LocateBroker FIX tag 5700.
LocateReqdlocate_reqdstringstrWhether a locate is required for the short sale, "Y" or "N". Reads and writes the LocateReqd FIX tag 114.
AdditionalPropertiesadditional_propertiesBaseExtendedDictionary<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:

SecurityTypeFill Model
EquityEquityFillModel
FutureFutureFillModel
Option and IndexOptionImmediateFillModel

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:

SecurityTypeBuying Power Model
EquitySecurityMarginModel with up to 2x leverage
Option and IndexOptionOptionMarginModel
FutureFutureMarginModel

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.

Default Markets

The following table describes the default markets of each SecurityType for the BloombergFixBrokerageModel:

SecurityTypeMarket
EquityUSA
OptionUSA
IndexOptionUSA
FutureCME

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.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: