---
title: "Bloomberg EMSX"
description: "LEAN can route orders to the Bloomberg™ EMSX API Server through our Quant Bridge plug-in. This product is in no way affiliated with or endorsed by Bloomberg™."
canonical: https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/brokerages/bloomberg-emsx
markdown: https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/brokerages/bloomberg-emsx.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/01%20Cloud%20Platform/10%20Live%20Trading/02%20Brokerages/17%20Bloomberg%20EMSX
modified: 2026-11-02
index: https://www.quantconnect.com/llms.txt
---

# Bloomberg EMSX

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Cloud Platform](https://www.quantconnect.com/docs/v2/cloud-platform.md) > [Live Trading](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading.md) > [Brokerages](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/brokerages.md) > Bloomberg EMSX

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

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

![Quant Bridge icon](https://cdn.quantconnect.com/i/tu/quant-bridge-logo.svg)

QuantConnect Cloud supports routing trades to the Bloomberg™ EMSX API Server. In this environment, you can route orders to any of the 1,300+ prime brokerages that Bloomberg supports and you get to leverage the data, server management, and data management from QuantConnect, giving you the best of both worlds. To use Quant Bridge, you need to be a member of an organization on the Trading Firm or Institution [tier](https://www.quantconnect.com/docs/v2/cloud-platform/organizations/tier-features.md).

QuantConnect Local Platform can integrate with the Bloomberg™ EMSX API Server or Desktop API (DAPI). This integration allows research, backtesting, opitimization, and live trading through the Bloomberg APIs, on-premises. Quant Bridge is in no way affiliated with or endorsed by Bloomberg™; it is simply an add-on.

## Account Types

Quant Bridge supports order routing via the Bloomberg™ EMSX API Server. It's treated as a margin account that's similiar to a FIX API, where you set the buying power in the wizard when you're deploying to a professional prime brokerage account.

## Asset Classes

Quant Bridge supports trading the following asset classes:

- [Equities](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity.md)
- [Equity Options](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/equity-options.md)
- [Index Options](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/index-options.md)
- [Futures](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/futures.md)

## Data Providers

The Bloomberg™ EMSX API Server doesn't provide data, so we recommend the [QuantConnect data provider](https://www.quantconnect.com/docs/v2/cloud-platform/datasets/quantconnect.md), which is free and supplies [US Equities](https://www.quantconnect.com/docs/v2/cloud-platform/datasets/quantconnect/us-equities.md), [US Equity Options](https://www.quantconnect.com/docs/v2/cloud-platform/datasets/quantconnect/us-equity-options.md), [US Index Options](https://www.quantconnect.com/docs/v2/cloud-platform/datasets/quantconnect/us-index-options.md), and [Futures](https://www.quantconnect.com/docs/v2/cloud-platform/datasets/quantconnect/futures.md) data during live trading. It also supplies [SPX and VIX Index data](https://www.quantconnect.com/docs/v2/cloud-platform/datasets/quantconnect/us-indices.md), which SPX and VIX Index Options need for the underlying index. For more information about live data providers, see [Datasets](https://www.quantconnect.com/docs/v2/cloud-platform/datasets.md).

This limitation applies to QuantConnect Cloud, which connects to the EMSX API Server. Local deployments connect to the Bloomberg™ Desktop API (DAPI) instead, so Quant Bridge can source live and historical data from your Bloomberg™ Terminal, within your Bloomberg™ license permissions. Intraday history goes back up to 6 months, and historical open interest and custom data aren't available. For more information, see [Quant Bridge](https://www.quantconnect.com/docs/v2/lean-cli/datasets/quant-bridge.md).

## Orders

Quant Bridge enables you to create and manage Bloomberg™ orders.

### Order Types

The following table describes the available order types for each asset class that Quant Bridge supports:

| Order Type | Equity | Equity Options | Index Options | Futures |
| --- | --- | --- | --- | --- |
| [Market](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/market-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Market on open](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/market-on-open-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |  |  |  |
| [Limit](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/limit-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Stop market](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/stop-market-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |
| [Stop limit](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-types/stop-limit-orders.md) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |

### Order Properties

We model custom order properties from the Bloomberg EMSX API. The following table describes the members of the `QuantBridgeOrderProperties` object that you can set to customize order execution:

| Property | Data Type | Description | Default Value |
| --- | --- | --- | --- |
| `time_in_force` | `TimeInForce` | A [TimeInForce](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-properties.md#03-Time-In-Force) instruction to apply to the order. The following instructions are supported: `DAY` `GOOD_TIL_CANCELED` `good_til_date` | `TimeInForce.GOOD_TIL_CANCELED` |
| `notes` | `str` | The free form instructions that may be sent to the broker. |  |
| `handling_instruction` | `str` | The instructions for handling the order or route. The values can be preconfigured or a value customized by the broker. |  |
| `custom_notes_1` | `str` | Custom user order notes 1. For more information about custom order notes, see [Custom Notes & Free Text Fields](https://emsx-api-doc.readthedocs.io/en/latest/programmable/description.html?highlight=Notes#custom-notes-free-text-fields) in the EMSX API documentation |  |
| `custom_notes_2` | `str` | Custom user order notes 2. |  |
| `custom_notes_3` | `str` | Custom user order notes 3. |  |
| `custom_notes_4` | `str` | Custom user order notes 4. |  |
| `custom_notes_5` | `str` | Custom user order notes 5. |  |
| `account` | `str` | The EMSX account. |  |
| `broker` | `str` | The EMSX broker code. |  |
| `locate_broker` | `str` | The EMSX locate broker code that identifies the counterparty the shares are borrowed from for a short equity sale (for example, `"BMTB"`). Maps to the `LocBrkr` field on the EMSX trading ticket. Setting this property (or `locate_id`) on a short equity sale causes the brokerage to emit `EMSX_LOCATE_REQ = "Y"` alongside. |  |
| `locate_id` | `str` | The EMSX locate confirmation/ticket Id that the lending broker returns. Maps to the `LocId` field on the EMSX trading ticket. |  |
| `is_cfd_trade` | `bool` | A flag that books the order as a contract for differences (CFD) instead of a regular trade. Maps to the `CFD` option of the `Booking Type` drop-down on the EMSX trading ticket and sets the `EMSX_CFD_FLAG` element. EMSX applies this flag at the order level, not per security. A regular trade is the EMSX default, so the brokerage only sends the element when you set this property to `True`. | `False` |
| `strategy` | `StrategyParameters` | An object that represents the EMSX order strategy details. You must append strategy parameters in the order that the EMSX API expects. The following strategy names are supported: "DMA", "DESK", "VWAP", "TWAP", "FLOAT", "HIDDEN", "VOLUMEINLINE", "CUSTOM", "TAP", "CUSTOM2", "WORKSTRIKE", "TAPNOW", "TIMED", "LIMITTICK", "STRIKE" |  |
| `execution_instruction` | `str` | The execution instruction field. |  |
| `automatic_position_sides` | `bool` | A flag that determines whether to automatically include the position side in the order direction (buy-to-open, sell-to-close, etc.) instead of the default (buy, sell). |  |
| `position_side` | `OrderPosition/NoneType` | An `OrderPosition` object that specifies the position side in the order direction (buy-to-open, sell-to-close, etc.) instead of the default (buy, sell). This member has precedence over `automatic_position_sides`. |  |
| `exchange` | `Exchange` | Defines the exchange name for sending the order to. |  |
| `additional_properties` | `BaseExtendedDictionary[str, str]` | The custom EMSX elements to send with the order. The key is the EMSX element name and the value is the element value. The other order properties take precedence, so an entry that targets an element they already set has no effect. The brokerage skips entries that the EMSX schema doesn't define instead of rejecting the order. | An empty dictionary |

The `additional_properties` dictionary lets you set EMSX elements that the preceding properties don't cover, without waiting for a new LEAN release. `is_cfd_trade` reads and writes the `EMSX_CFD_FLAG` entry of this dictionary, so setting either of them is equivalent. The following example books the orders as CFD trades and adds the odd lot element, which no dedicated property covers:

The dictionary starts empty and you can't replace it with a plain Python dictionary. To add several elements at once, call the `update` method with a dictionary. To remove all the elements, call the `clear` method.

For more information about the format that the Bloomberg EMSX API expects, see [Create Order and Route Extended Request](https://emsx-api-doc.readthedocs.io/en/latest/programmable/requestResponse.html#create-order-and-route-extended-request) in the EMSX API documentation and the [createOrderAndRouteWithStrat documentation](https://www.mathworks.com/help/datafeed/emsx.createorderandroutewithstrat.html) on the MathWorks website.

### Get Open Orders

Quant Bridge lets you [access open orders](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-management/transaction-manager.md).

### Monitor Fills

Quant Bridge allows you to monitor orders as they fill through [order events](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-events.md).

### Updates

Quant Bridge doesn't support [order updates](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-management/order-tickets.md#04-Update-Orders), but you can cancel an existing order and then create a new order with the desired arguments. For more information about this workaround, see the [Workaround for Brokerages That Don’t Support Updates](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-management/order-tickets.md#workaround-for-brokerages-that-dont-support-updates).

### Cancellations

Quant Bridge enables you to [cancel open orders](https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/order-management/order-tickets.md#05-Cancel-Orders).

### Handling Splits

If you're using raw [data normalization](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/requesting-data.md#11-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](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/corporate-actions.md#02-Splits) occurs, the following properties of your orders automatically adjust to reflect the stock split:

- Quantity
- Limit price
- Stop price
- Trigger price

### Brokerage-Side Orders

By default, your algorithm doesn't record orders that you submit to your account by third-parties instead of through LEAN. To accept these orders, create a [custom brokerage message handler](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerage-message-handler.md).

## Fees

Orders filled with Quant Bridge are subject to the fees of the Bloomberg™ Execution Management System and your prime brokerage destination. To view how we model their fees, see [Fees](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md#06-Fees).

## Margin

Set your cash and holdings state in the wizard when you deploy to the Bloomberg™ EMSX environment. We use these states to model [buying power](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md#07-Buying-Power) and [margin calls](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/margin-calls.md) to ensure your algorithm stays within the margin requirements.

## Fills

In live trading, LEAN routes your orders to the exchange or prime brokerage you select. The order fills and then routes back to you.

To view how we model Bloomberg™ Execution Management System order fills, see [Fills](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md#04-Fills).

## Compliance

Bloomberg™ is not affiliated with QuantConnect, nor does it endorse Quant Bridge. You need Bloomberg™ EMSX and EMSX API Server permissions to use this brokerage connection, with a Trading Firm or Institutional subscription on QuantConnect.

The following rules apply:

- All users of the integration must hold a Bloomberg License to be defined as an "Entitled User".
- The Bloomberg™ EMSX API Server is for order routing only. It doesn't provide data and can't be used for black-box trading.

The following table shows the activities each of the Bloomberg technologies support:

| Technology | Research | Backtesting | Paper UAT Trading | Live Trading |
| --- | --- | --- | --- | --- |
| EMSX API Server | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) | ![green check](https://cdn.quantconnect.com/i/tu/check.png) |

## Set Up EMSX API Server

The following few sections explain how to download the Bloomberg™ EMSX API Server, install it on a cloud server, and add firewall rules so it can connect to QuantConnect Cloud.

### Download the EMSX API Server

Follow these steps to download the EMSX API Server:

1. [Install the Bloomberg™ Terminal](https://www.bloomberg.com/professional/support/software-updates/).
2. [Create a Bloomberg™ Terminal account](https://www.emich.edu/cob/programs/finance-programs/documents/bloomberg-lab/bloomberg-account.pdf).
3. In the Bloomberg™ Terminal, run `WAPI<GO>`.
4. On the API Developer's Help Site, click **EMSX API**.
   ![](https://cdn.quantconnect.com/i/tu/bbg-sapi-1.png)
5. On the EMSX API page, under the **Server API Process** section, click **Link**.
   ![](https://cdn.quantconnect.com/i/tu/bbg-sapi-2.png)
6. On the Server API Software Install page, click the correct **download** icons.
   ![](https://cdn.quantconnect.com/i/tu/bbg-sapi-3.png)
7. Click **System Requirements**.
   ![](https://cdn.quantconnect.com/i/tu/bbg-sapi-4.png)

### Install the EMSX API Server

Follow these steps to install the EMSX API Server:

1. Spin up an E12x9 AWS instance or higher that your organization controls.
2. Run the EMSX API Server installer on the cloud server.
   For more information about this step, see [How to install serverapi.exe](https://emsx-api-doc.readthedocs.io/en/latest/server/serverApiInstallation.html) in the EMSX API Programmers Guide. At the end of the installion, you get a registration key.
3. Ask Bloomberg™ Support to activate your registration key.
4. Start the serverapi program.
   On Windows, the default location is `C: \ BLP \ ServerApi \ bin \ serverapi.exe`.

### Set Up Your Account

Follow these steps to set up your EMSX API Server account:

1. [Contact Bloomberg Support](https://www.bloomberg.com/faq/question/how-can-i-contact-bloomberg-for-support/) and ask them to enable the Server Side EMSX API.
2. Ask Bloomberg Support for your unique user identifier (UUID).
   Save it somewhere safe. You will need it when you deploy live algorithms.
3. Contact the EMSX brokerage you plan to use and give them your UUID.

### Add Firewall Rules

Follow these steps to configure the firewall rules on the AWS instance so that the EMSX API Server can connect to QuantConnect Cloud:

1. Click **Start**.
2. Enter **Windows Defender Firewall with Advanced Security** and then press **Enter**.
3. In the left panel, click **Inbound Rules**.
4. In the right panel, click **New Rule...**.
5. Follow the prompts to create a program rule for the serverapi.
6. In the Windows Defender Firewall with Advanced Security window, double-click the serverapi row.
7. In the serverapi window, click the **Scope** tab.
8. In the **Remote IP address** section, add the QuantConnect Cloud IP address, 207.182.16.137.
9. Click **OK**.
10. Add the QuantConnect Cloud IP address to the other row in the table that has the serverapi name.

## Deploy Live Algorithms

You need to [set up the Bloomberg™ EMSX API Server](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/brokerages/bloomberg-emsx.md#11-Set-Up-EMSX-API-Server) before you can deploy cloud algorithms with Quant Bridge.

You must have an available [live trading node](https://www.quantconnect.com/docs/v2/cloud-platform/organizations/resources.md#04-Live-Trading-Nodes) for each live trading algorithm you deploy.

Follow these steps to deploy a live algorithm:

1. [Open the project](https://www.quantconnect.com/docs/v2/cloud-platform/projects/getting-started.md#02-View-All-Projects) you want to deploy.
2. Click the ![Lightning icon](https://cdn.quantconnect.com/i/tu/deploy-live-icon.png) **Deploy Live** icon.
3. On the Deploy Live page, click the **Brokerage** field and then click **Quant Bridge** from the drop-down menu.
4. Click the **Connection Type** field and then click **SAPI** from the drop-down menu.
5. In the **Server Auth Id** field, enter your unique user identifier (UUID).
   The UUID is a unique integer identifier that's assigned to each Bloomberg Anywhere user. If you don't know your UUID, contact Bloomberg.
6. In the **EMSX Broker** field, enter the EMSX broker to use.
7. In the **Server Port** field, enter the port where the EMSX API Server is listening.
   The default port is 8194.
8. In the **Server Host** field, enter the public IP address of the AWS instance that runs the EMSX API Server.
9. In the **EMSX Account** field, enter the account to which LEAN should route orders.
10. In the **EMSX Team** field, enter the team account to receive events of your team's orders.
   The default value is empty, which means LEAN disregards these notifications.
11. In the **OpenFIGI Api Key** field, enter your API key.
12. Click the **Environment** field and then click one of the options from the drop-down menu.
13. In the **Region** section, click the [region](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/getting-started.md#07-Redundancy) where you want to run the algorithm.
14. Click the **Node** field and then click the live trading node that you want to use from the drop-down menu.
15. (Optional) In the **Data Provider** section, click **Show** and change the data provider or add additional providers.
16. If your brokerage account has existing cash holdings, follow these steps ([see video](https://vimeo.com/703024505)):
   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.
17. If your brokerage account has existing position holdings, follow these steps ([see video](https://vimeo.com/703024505)):
   1. In the **Algorithm Holdings State** section, click **Show**.
   2. Click **Add Holding**.
   3. Enter the symbol ID, symbol, quantity, and average price.
18. (Optional) [Set up notifications](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/notifications.md).
19. Configure the **Automatically restart algorithm** setting.
   By enabling [automatic restarts](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/deployment.md#07-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.
20. Click **Deploy**.

The deployment process can take up to 5 minutes. When the algorithm deploys, the [live results page](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/results.md) 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.

Restarts, including automatic restarts and redeployments, don't save the state of your algorithm. To learn what a restart recovers and how to persist the rest, see [State Persistence](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/deployment.md#10-State-Persistence).

## Deployment Details

When you deploy a live algorithm with Quant Bridge, the brokerage shares some details of the deployment, like the account it trades. Use them to tell concurrent deployments apart or to check that the algorithm connected to the account you expect. The details never include credentials.

The following table describes the deployment details that Quant Bridge shares:

| Key | Description |
| --- | --- |
| `quant-bridge-server-auth-id` | The Server Auth Id, which is the unique user identifier (UUID) of the Bloomberg Anywhere user. |
| `quant-bridge-emsx-broker` | The EMSX broker that receives the orders. |
| `quant-bridge-emsx-account` | The EMSX account to which LEAN routes orders. |
| `quant-bridge-emsx-team` | The EMSX team account that receives events of your team's orders. It's empty if you didn't set one. |

The `deployment_details` property of your algorithm is a read-only dictionary of the details. LEAN populates it before it calls the `initialize` method, so you can read it anywhere in your algorithm.

```python
deployment_details = [f'{kvp.key}:{kvp.value}' for kvp in self.deployment_details]
self.log(f'deployment_details: {deployment_details}')
```

The [/live/read](https://www.quantconnect.com/docs/v2/cloud-platform/api-reference/live-management/read-live-algorithm/live-algorithm-statistics.md) API endpoint also returns the details in its `deploymentDetails` field, so you can read them outside of the algorithm.
