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:
- Install the Bloomberg™ Terminal.
- Contact Bloomberg Support and ask them to provision a FIX session for order routing.
- Ask Bloomberg Support for the CompIDs of your session.
- Contact the prime brokerage you plan to route to and confirm the FIX tags they require.
Save them somewhere safe. You need them when you deploy live algorithms.
Paper Trading
The Bloomberg™ FIX connection doesn't support paper trading, but you can follow these steps to simulate it with QuantConnect:
- In the
Initializeinitializemethod of your algorithm, set the Bloomberg FIX brokerage model. - Deploy your algorithm with the QuantConnect Paper Trading brokerage.
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 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
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:
| 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 |
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:
- Open the project you want to deploy.
- Click the
Deploy Live icon. - On the Deploy Live page, click the Brokerage field and then click from the drop-down menu.
- In the Sender Sub ID field, enter your QuantConnect user Id.
- In the On Behalf Of Comp ID field, enter the CompID that identifies your trading firm.
- In the Deliver To Comp ID field, enter the CompID of the prime brokerage that receives your orders.
- Click the Environment field and then click from the drop-down menu.
- Click the Node field and then click the live trading node that you want to use from the drop-down menu.
- (Optional) In the Data Provider section, click and change the data provider or add additional providers.
- If your brokerage account has existing cash holdings, follow these steps (see video):
- In the Algorithm Cash State section, click .
- Click .
- 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):
- In the Algorithm Holdings State section, click .
- Click .
- Enter the symbol ID, symbol, quantity, and average price.
- (Optional) Set up notifications.
- Configure the Automatically restart algorithm setting.
- Click .
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.
Bloomberg™ assigns this value when they provision your FIX session. It's FIX tag 115.
It's FIX tag 128. Contact your prime brokerage if you don't know their CompID.
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.
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.
