Brokerages

Bloomberg FIX

Introduction

QuantConnect enables you to run your algorithms in live mode with real-time market data.

The Bloomberg™ FIX connection routes your orders directly to the Bloomberg™ network over the Financial Information eXchange (FIX) protocol. It's an order routing connection, so it doesn't supply market data. Bloomberg™ FIX is in no way affiliated with or endorsed by Bloomberg™; it is simply an add-on.

This connection is separate from Terminal Link, which reaches the Bloomberg™ Execution Management System (EMSX) through the Bloomberg™ Server API (SAPI). The FIX connection talks to the Bloomberg™ FixNet HUB instead of the SAPI, so none of the SAPI setup applies. Both connections support the same asset classes, but they differ in the order types they accept, whether they accept order updates, and the account types they support.

To use the Bloomberg™ FIX connection, you need to be a member of an organization on the Institution tier.

To view how we model this connection, see the Bloomberg FIX brokerage model documentation.

Account Types

The Bloomberg™ FIX connection supports margin accounts. It routes orders to the prime brokerage that your FIX session points to, so you set the buying power in the wizard when you deploy. To set the account type in an algorithm, see the Bloomberg FIX brokerage model documentation.

Create an Account

You need a Bloomberg™ Terminal and a FIX entitlement on the Bloomberg™ network. Follow these steps to set up the connection:

  1. Install the Bloomberg™ Terminal.
  2. Contact Bloomberg Support and ask them to provision a FIX session for order routing.
  3. Ask Bloomberg Support for the CompIDs of your session.
  4. Save them somewhere safe. You need them when you deploy live algorithms.

  5. Contact the prime brokerage you plan to route to and confirm the FIX tags they require.

Paper Trading

The Bloomberg™ FIX connection doesn't support paper trading, but you can follow these steps to simulate it with QuantConnect:

  1. In the Initializeinitialize method of your algorithm, set the Bloomberg FIX brokerage model.
  2. Deploy your algorithm with the QuantConnect Paper Trading brokerage.

Asset Classes

Our Bloomberg™ FIX integration supports trading the following asset classes:

Data Providers

The Bloomberg™ FIX connection only routes orders, so it doesn't provide data. Use the QuantConnect data provider, a third-party data provider such as Polygon, or a brokerage that provides data.

Orders

We model the Bloomberg™ FIX connection by supporting its order types and order updates. When you deploy live algorithms, you can place manual orders through the IDE.

Order Types

The following table describes the available order types for each asset class that our Bloomberg™ FIX integration 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

We model the Bloomberg™ FIX connection by supporting 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

We model custom order properties from the Bloomberg™ FIX connection. 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

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:

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

Fees

Orders that you route through the Bloomberg™ FIX connection are subject to the fees of your prime brokerage destination. To view how we model these fees, see Fees.

Margin

Set your cash and holdings state in the wizard when you deploy with the Bloomberg™ FIX connection. We use these states to model buying power and margin calls to ensure your algorithm stays within the margin requirements.

Fills

In live trading, LEAN routes your orders over the FIX session to the prime brokerage that your session points to. The order fills and then routes back to you.

To view how we model Bloomberg™ FIX order fills, see Fills.

Compliance

Bloomberg™ is not affiliated with QuantConnect, nor does it endorse the Bloomberg™ FIX connection.

The following rules apply:

  • All users of the integration must hold a Bloomberg™ Terminal license.
  • The FIX session is only used for order routing and no data is permitted.
  • Bloomberg™ provisions the FIX session and the CompIDs it accepts, so you can only route orders to the prime brokerage destinations that your session covers.

Deploy Live Algorithms

You must have an available live trading node for each live trading algorithm you deploy.

Follow these steps to deploy a live algorithm:

  1. Open the project you want to deploy.
  2. Click the Lightning icon Deploy Live icon.
  3. On the Deploy Live page, click the Brokerage field and then click Bloomberg Fix from the drop-down menu.
  4. In the Sender Sub ID field, enter your QuantConnect user Id.
  5. The connection sends this value as FIX tag 50 so Bloomberg™ can map the orders to you. To get your QuantConnect user Id, request an API token. We email you your user Id and API token.

  6. In the On Behalf Of Comp ID field, enter the CompID that identifies your trading firm.
  7. Bloomberg™ assigns this value when they provision your FIX session. It's FIX tag 115.

  8. In the Deliver To Comp ID field, enter the CompID of the prime brokerage that receives your orders.
  9. It's FIX tag 128. Contact your prime brokerage if you don't know their CompID.

  10. Click the Environment field and then click Live from the drop-down menu.
  11. Click the Node field and then click the live trading node that you want to use from the drop-down menu.
  12. (Optional) In the Data Provider section, click Show and change the data provider or add additional providers.
  13. 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.
  14. 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.
  15. (Optional) Set up notifications.
  16. Configure the Automatically restart algorithm setting.
  17. By enabling automatic restarts, the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection.

  18. Click Deploy.

The deployment process can take up to 5 minutes. When the algorithm deploys, the live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings.

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: