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 Atreyu Trading brokerage.

Deploy Local Algorithms

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

  1. Open a terminal in the 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 Atreyu Trading server configuration.
    $ lean live "My Project"
    Request port:
    Subscribe port:
  4. Enter your Atreyu Trading credentials.
    $ lean live "My Project"
    Client id:
  5. Enter the broker MPID to use.
    $ lean live "My Project"
    Broker MPID:
  6. Enter the locate rqd to use.
    $ lean live "My Project"
    Locate rqd:
  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. Set your initial cash balance.
    $ lean live "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. Set your initial portfolio holdings.
    $ lean live "My Project"
    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
    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
  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 Atreyu Trading.

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: