Brokerages

FIX Connections

Introduction

The Financial Information eXchange (FIX) is the standard electronic communications protocol for front-office messaging. The FIX community includes about 300 firms, including major investment banks.

Supported Connections

The following FIX connections are available on QuantConnect:

NameIntegration ImplementationModel Implementation
BloombergLean.Brokerages.Fix.BloombergBloombergFixBrokerageModel.cs
Raiffeisen Bank InternationalLean.Brokerages.RaiffeisenBankInternationalRBIBrokerageModel.cs
WolverineLean.Brokerages.WolverineWolverineBrokerageModel.cs

Order Properties

FIX connections support custom order properties. The following table describes the members of the FixOrderProperties 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.
AdditionalPropertiesadditional_propertiesDictionary<string, string>Dict[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.

Each FIX connection provides an order properties class that inherits the FixOrderProperties class. For example, the Bloomberg FIX connection provides the BloombergFixOrderProperties class.

Some FIX counterparties require extra tags on order messages. For example, a broker behind the Bloomberg FIX connection requires tag 9301=1 to mark orders as direct market access (DMA). To send extra tags with your orders, add them to the AdditionalPropertiesadditional_properties dictionary:

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

Portfolio State

FIX connections do not support fetching the portfolio state. You must provide the cash and holdings on deployment.

If your brokerage account has existing cash holdings, follow these steps (see video):

  1. In the Algorithm Cash State section, click Show.
  2. Click Add Currency.
  3. Enter the currency ticker (for example, USD or CAD) and a quantity.

If your brokerage account has existing position holdings, follow these steps (see video):

  1. In the Algorithm Holdings State section, click Show.
  2. Click Add Holding.
  3. Enter the symbol ID, symbol, quantity, and average price.

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: