Brokerages

Prime Brokerages

Introduction

The Lean CLI supports local live trading with all brokerages supported by LEAN, which makes the transfer from backtesting to live trading as seamless as possible. The Lean CLI also supports starting live trading for a cloud project on any of the brokerages supported in the cloud. We recommend live trading your projects in our cloud because we provide a battle-tested, colocated infrastructure racked in Equinix, maintained by our engineers to ensure the best possible stability and uptime. This page contains instructions on how to start live trading with the Terminal Link brokerage.

Asset Classes

Terminal Link supports trading the following asset classes:

You may not be able to trade all assets with Terminal Link. For example, if you live in the EU, you can't trade US ETFs. Check with your local regulators to know which assets you are allowed to trade. You may need to adjust settings in your brokerage account to live trade some assets.

Data Feeds

Terminal Link lets you source a live data feed from the Bloomberg™ Terminal for live trading. You also can use the LEAN paper trading functionality to test your strategy on Bloomberg™’s live data feed.

Orders

Terminal Link enables you to create and manage Bloomberg™ orders.

Order Types

The following table describes the available order types for each asset class that Terminal Link supports:

Order TypeEquityEquity OptionsFutures
MarketOrdergreen checkgreen checkgreen check
LimitOrdergreen checkgreen checkgreen check
StopMarketOrdergreen checkgreen checkgreen check
StopLimitOrdergreen checkgreen checkgreen check

Time In Force

Terminal Link supports the following TimeInForce instructions:

  • Day
  • GoodTilCanceled
  • GoodTilDate

Get Open Orders

Terminal Link lets you access open orders.

Monitor Fills

Terminal Link allows you to monitor orders as they fill through order events.

Updates

Terminal Link doesn't support order updates.

Cancellations

Terminal Link enables you to cancel open orders.

Fees

Orders filled with Terminal Link are subject to the fees of the Bloomberg Execution Management System.

Historical Data

When LEAN taps into Bloomberg™ via Terminal Link, it can run backtests and research notebooks with rich historical data sourced from the Bloomberg™ Terminal. LEAN provides accurate slippage, spread, and transaction fee models for realistic backtesting. All models are customizable to adapt to your strategy requirements. Historical data is cached locally in an efficient format for quick backtesting in the LEAN engine. If you request intraday historical data, you can request data from within the last 6 months. Historical open interest and custom data isn't available.

Compliance

Bloomberg™ is not affiliated with QuantConnect, nor does it endorse Terminal Link. All users of the integration must hold a Bloomberg™ License to be defined as an “Entitled User.” All products must be used in accordance with established licensing terms set by Bloomberg™. All data accessed via the Bloomberg™ Desktop API must remain on the host computer. The Bloomberg™ Terminal and the LEAN instance must be on the same computer. The Bloomberg™ Server API cannot be used for black-box trading. Any Bloomberg™ Server API Data usage will require soliciting permission via the Bloomberg™ Permission System. QuantConnect requires installing the LEAN GUI along with any Terminal Link subscription.

The following rules apply:

  • All users of the integration must hold a Bloomberg License to be defined as an "Entitled User".
  • All data accessed via the Bloomberg Desktop API must remain on the host computer. The Bloomberg Terminal and the LEAN instance must be on the same computer.
  • The Bloomberg Server API cannot be used for black-box trading. Any Bloomberg Server API Data usage will require soliciting permission via the Bloomberg Permission System.

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

TechnologyResearchBacktestingPaper TradingLive Trading
Desktop APIgreen checkgreen checkgreen checkgreen check
B.PIPEgreen checkgreen checkgreen checkgreen check
Server APIgreen checkgreen checkgreen check-

CLI Commands

Execute the CLI commands in the following sections to interact with Terminal Link. If you need further assistance, see the CLI Reference.

Run Local Backtests

Launch local backtests with data from the Bloomberg Terminal desktop API. Lean automatically fetches the data required for your backtest.

$ lean backtest "<projectName>" --data-provider "Terminal Link"

Launch Research Notebooks

Start Jupyter Research Notebooks, tapping into the entire QuantConnect API with the data sourced from a Bloomberg Terminal.

$ lean research "<projectName>" --data-provider "Terminal Link"

Deploy Live Algorithms

Launch live trading algorithms to trade with any of the 1300+ routing destinations in the Bloomberg EMSX network.

$ lean live "<projectName>" --brokerage "Terminal Link" --data-feed "Terminal Link"

Deploy Local Algorithms

Follow these steps to start local live trading with the Terminal Link brokerage:

  1. Open a terminal in the organization workspace that contains the project.
  2. Run lean live "<projectName>" to start a live deployment wizard for the project in . / <projectName> and then enter the brokerage number.
    $ lean live "My Project"
    Select a brokerage:
    1) Paper Trading
    2) Interactive Brokers
    3) Tradier
    4) OANDA
    5) Bitfinex
    6) Coinbase Pro
    7) Binance
    8) Zerodha
    9) Samco
    10) Terminal Link
    11) Atreyu
    12) Trading Technologies
    13) Kraken
    14) TD Ameritrade
    Enter an option: 
  3. Enter the environment to use.
    $ lean live "My Project"
    Environment (Production, Beta): Production
  4. Enter the host and port of the Bloomberg server.
    $ lean live "My Project"
    Server host: 127.0.0.1
    Server port: 8194
  5. Enter your EMSX configuration
    $ lean live "My Project"
    EMSX broker: someValue
    EMSX account:
  6. Enter your Open FIGI API key.
    $ lean live "My Project"
    Open FIGI API key: 
  7. Enter the number of the data feed to use and then follow the steps required for the data connection.
    $ lean live "My Project"
    Select a data feed:
    1) Interactive Brokers
    2) Tradier
    3) Oanda
    4) Bitfinex
    5) Coinbase Pro
    6) Binance
    7) Zerodha
    8) Samco
    9) Terminal Link
    10) Kraken
    11) TD Ameritrade
    12) IQFeed
    13) Polygon Data Feed
    14) Custom data only
    To enter multiple options, separate them with comma.:
  8. If you select IQFeed, see IQFeed for set up instructions.

    If you select Polygon Data Feed, see Polygon for set up instructions.

  9. View the result in the <projectName> / live / <timestamp> directory. Results are stored in real-time in JSON format. You can save results to a different directory by providing the --output <path> option in step 2.

If you already have a live environment configured in your Lean configuration file, you can skip the interactive wizard by providing the --environment <value> option in step 2. The value of this option must be the name of an environment which has live-mode set to true.

Deploy Cloud Algorithms

The CLI doesn't currently support deploying cloud algorithms with Terminal Link.

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: