Brokerages

Trading Technologies

Introduction

The Lean CLI supports live trading on your local machine or in QuantConnect Cloud, which makes the transfer from backtesting to live trading as seamless as possible. You must log in using your QuantConnect account to deply your algorithm on your local machine or in QuantConnect Cloud. This page contains instructions on how to start live trading with the Trading Technologies brokerage. If the Lean Configuration file in your organization workspace contains values for some of the command options, the CLI skips some of the prompts.

To view the implementation of the Trading Technologies integration, see the Lean.Brokerages.TradingTechnologies repository.

Deploy Local Algorithms

Follow these steps to start local live trading with the Trading Technologies brokerage:

  1. Log in to the CLI if you haven't done so already.
  2. Open a terminal in the organization workspace that contains the project.
  3. Run lean live deploy "<projectName>" to start a live deployment wizard for the project in . / <projectName> and then enter the brokerage number, 11.
    $ lean live deploy "My Project"
    Select a brokerage:
    1) Paper Trading
    2) Interactive Brokers
    3) Tradier
    4) OANDA
    5) Bitfinex
    6) Coinbase Advanced Trade
    7) Binance
    8) Zerodha
    9) Samco
    10) Terminal Link
    11) Trading Technologies
    12) Kraken
    13) Charles Schwab
    14) Bybit
    15) TradeStation
    16) Alpaca
    Enter an option: 11
  4. Enter your Trading Technologies credentials.
    $ lean live "My Project"
    User name: john
    Session password: ****************       
    Account name: jane
  5. Enter the REST configuration.
    $ lean live "My Project"
    REST app key: my-rest-app-key
    REST app secret: ******************
    REST environment: my-environment
  6. Enter the market data configuration.
    $ lean live "My Project"
    Market data sender comp id:
    Market data target comp id:
    Market data host:
    Market data port:
  7. Enter the order routing configuration.
    $ lean live "My Project"
    Order routing sender comp id:
    Order routing target comp id:
    Order routing host:
    Order routing port:
  8. Enter whether FIX messages must be logged.
    $ lean live "My Project"
    Log FIX messages (yes/no): yes
  9. Set your initial cash balance.
    $ lean live deploy "My Project"
    Previous cash balance: [{'currency': 'USD', 'amount': 100000.0}]
    Do you want to set a different initial cash balance? [y/N]: y 
    Setting initial cash balance...
    Currency: USD
    Amount: 95800
    Cash balance: [{'currency': 'USD', 'amount': 95800.0}]
    Do you want to add more currency? [y/N]: n
  10. Enter the number of the live data provider(s) to use and then follow the steps required for the data connection.
    $ lean live deploy "My Project"
    Select a live data provider:
    1) Interactive Brokers
    2) Tradier
    3) Oanda
    4) Bitfinex
    5) Coinbase Advanced Trade
    6) Binance
    7) Zerodha
    8) Samco
    9) Terminal Link
    10) Trading Technologies
    11) Kraken
    12) Charles Schwab
    13) IQFeed
    14) Polygon
    15) IEX
    16) CoinApi
    17) ThetaData
    18) Custom data only
    19) Bybit
    20) TradeStation
    21) Alpaca
    To enter multiple options, separate them with comma:
  11. If you select one of the following data providers, see the respective page for more instructions:

  12. 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

Follow these steps to start live trading a project in the cloud with the Trading Technologies brokerage and the Trading Technologies data provider:

  1. Log in to the CLI if you haven't done so already.
  2. Open a terminal in the organization workspace that contains the project.
  3. Run lean cloud live deploy "<projectName>" --push --open to push . / <projectName>. to the cloud, start a live deployment wizard, and open the results in the browser once the deployment starts.
  4. $ lean cloud live deploy "My Project" --push --open
    [1/1] Pushing 'My Project'
    Successfully updated cloud file 'My Project/main.py'
    Started compiling project 'My Project'
    Successfully compiled project 'My Project'
  5. Enter 11 to select the Trading Technologies brokerage.
  6. $ lean cloud live deploy "My Project" --push --open
    Select a brokerage:
    1) Paper Trading
    2) Interactive Brokers
    3) Tradier
    4) Oanda
    5) Bitfinex
    6) Coinbase Advanced Trade
    7) Binance
    8) Zerodha
    9) Samco
    10) Terminal Link
    11) Trading Technologies
    12) Kraken
    13) Charles Schwab
    14) Bybit
    15) TradeStation
    16) Alpaca
    Enter an option: 11
  7. Enter your Trading Technologies credentials.
  8. $ lean cloud live "My Project" --push --open
    User name: john
    Session password: ****************
    Account name: jane
  9. Enter the REST configuration.
  10. $ lean cloud live "My Project" --push --open
    REST app key: my-rest-app-key
    REST app secret: ******************
    REST environment: my-environment
  11. Enter the order routing configuration.
  12. $ lean cloud live "My Project" --push --open
    Order routing sender comp id: 

    Our TT integration routes orders via the TT FIX 4.4 Connection. Contact your TT representative to set the exchange where you would like your orders sent. Your account details are not saved on QuantConnect.

  13. Configure your notification settings.
  14. You can configure any combination of email, webhook, SMS, and Telegram notifications for order events and emitted insights. To view the number of notification you can send for free, see the Live Trading Notification Quotas.

    $ lean cloud live deploy "My Project" --push --open
    Do you want to send notifications on order events? [y/N]: y
    Do you want to send notifications on insights? [y/N]: y
    Email notifications: None
    Webhook notifications: None
    SMS notifications: None
    Select a notification method:
    1) Email
    2) Webhook
    3) SMS
    4) Telegram
    Enter an option: 1
    Email address: john.doe@example.com
    Subject: Algorithm notification
    Email notifications: john.doe@example.com
    Webhook notifications: None
    SMS notifications: None
    Telegram notifications: None
    Do you want to add another notification method? [y/N]: n
  15. Enable or disable automatic algorithm restarting.
  16. This feature attempts to restart your algorithm if it fails due to a runtime error, like a brokerage API disconnection.

    $ lean cloud live deploy "My Project" --push --open
    Do you want to enable automatic algorithm restarting? [Y/n]: y
  17. Set your initial portfolio holdings.
  18. $ lean cloud live deploy "My Project" --push --open
    Do you want to set the initial portfolio holdings? [y/N]: y
    Do you want to use the last portfolio holdings? [] [y/N]: n
    Setting custom initial portfolio holdings...
    Symbol: GOOG
    Symbol ID: GOOCV VP83T1ZUHROL
    Quantity: 10
    Average Price: 50
    Portfolio Holdings: [{'symbol': 'GOOG', 'symbolId': 'GOOCV VP83T1ZUHROL', 'quantity': 10, 'averagePrice': 50.0}]
    Do you want to add more holdings? [y/N]: n
  19. Select the live node that you want to use.
  20. If you only have one idle live trading node, it is selected automatically and this step is skipped.

    $ lean cloud live deploy "My Project" --push --open
    Select a node:
    1) L-MICRO node 89c90172 - 1 CPU @ 2.4GHz, 0.5GB Ram
    2) L-MICRO node 85a52135 - 1 CPU @ 2.4GHz, 0.5GB Ram
    Enter an option: 1
  21. Enter 11 to select the Trading Technologies data provider.
  22. $ lean live "My Project"
    Select a live data feed:
    1) QuantConnect
    2) Interactive Brokers
    3) Tradier
    4) Oanda
    5) Bitfinex
    6) Coinbase Advanced Trade
    7) Binance
    8) Zerodha
    9) Samco
    10) Terminal Link
    11) Trading Technologies
    12) Kraken
    13) Charles Schwab
    14) Polygon
    15) IEX
    16) CoinApi
    17) Bybit
    18) TradeStation
    19) Alpaca
    To enter multiple options, separate them with comma: 11

    If you select one of the following data providers, see the respective page for more instructions:

  23. Verify the configured settings and confirm them to start the live deployment in the cloud.
  24. $ lean cloud live deploy "My Project" --push --open
    Brokerage: Trading Technologies
    Project id: 1234567
    Environment: Live
    Server name: L-MICRO node 89c90172
    Server type: L-MICRO
    Live Data providers: Trading Technologies
    LEAN version: 11157
    Order event notifications: Yes
    Insight notifications: Yes
    Email notifications: john.doe@example.com
    Webhook notifications: None
    SMS notifications: None
    Telegram notifications: None
    Initial live portfolio holdings: [{'symbol': 'GOOG', 'symbolId': 'GOOCV VP83T1ZUHROL', 'quantity': 10, 'averagePrice': 50.0}]
    Automatic algorithm restarting: Yes
    Are you sure you want to start live trading for project 'My Project'? [y/N]: y
  25. Inspect the result in the browser, which opens automatically after the deployment starts.

Follow these steps to see the live status of a project:

  1. Log in to the CLI if you haven't done so already.
  2. Open a terminal in the organization workspace that contains the project.
  3. Run lean cloud status "<projectName>" to show the status of the cloud project named "<projectName>".
  4. $ lean cloud status "My Project"
    Project id: 1234567
    Project name: My Project
    Project url: https://www.quantconnect.com/project/1234567
    Live status: Running
    Live id: L-1234567a8901d234e5e678ddd9b0123c
    Live url: https://www.quantconnect.com/project/1234567/live
    Brokerage: Trading Technologies
    Launched: 2021-06-09 15:10:12 UTC

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: