Live Trading

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.

Deploy Local Algorithms

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

  1. Open a terminal in your CLI root directory.
  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) FTX 
    Enter an option:
  3. Enter the number of the organization that has a subscription for the Terminal Link module.
    $ lean live "My Project"
    Select the organization with the Terminal Link module subscription:
    1) Organization 1
    2) Organization 2
    3) Organization 3
    Enter an option: 1
  4. Enter the environment to run in. This property must be either Production or Beta.
    $ lean live "My Project"
    Environment (Production, Beta): Production
  5. Enter the host and port of the Bloomberg server.
    $ lean live "My Project"
    Server host: 127.0.0.1
    Server port: 8194
  6. Enter the path to the symbol map file.
    $ lean live "My Project"
    Path to symbol map file: ~/Documents/symbol-map-file.json
    The symbol map file must be a JSON file (comments are supported) in which the keys are the Bloomberg symbol names and the values are the corresponding QuantConnect symbols. This content can be used as an example:
    /* This is a manually created file that contains mappings from Bloomberg's own naming to original symbols defined by respective exchanges. */
    {
        // Example:
        /*"SPY US Equity": {
            "Underlying": "SPY",
            "SecurityType": "Equity",
            "Market": "usa"
        }*/
    }
    
  7. Enter your EMSX configuration (properties followed by [] can be skipped by pressing enter).
    $ lean live "My Project"
    EMSX broker: someValue
    EMSX user timezone [UTC]:
    EMSX account []:
    EMSX strategy []:
    EMSX notes []:
    EMSX handling []:
  8. Enter whether modification must be allowed.
    $ lean live "My Project"
    Allow modification (yes/no): no
  9. If you are on a Windows computer, 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) Terminal Link
    2) IQFeed
    Enter an option:
  10. If you select IQFeed, see IQFeed for set up instructions.

  11. 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: