QuantConnect / lean-cli

CLI for running the LEAN engine locally and in the cloud
https://www.lean.io/cli
Apache License 2.0
189 stars 101 forks source link

Lean CLI not using sandbox server for tradier paper trading account #461

Open wlami opened 1 month ago

wlami commented 1 month ago

Expected Behavior

The cli parameter --tradier-environment paper should let lean access the paper trading environment at sandbox.tradier.com.

Actual Behavior

The log file shows the live endpoint and the application shuts down:

20240528 19:56:34.659 TRACE:: WebSocketClientWrapper connection task ended: wss://ws.tradier.com/v1/markets/events
20240528 19:56:34.660 TRACE:: WebSocketClientWrapper.OnClose(): Connection closed (IsOpen:False, State:Aborted): wss://ws.tradier.com/v1/markets/events

Potential Solution

I checked my lean.json and there is only an "live-tradier" environment, but no "paper-tradier" one. Maybe I am missing some config?

Reproducing the Problem

  1. Setup tradier paper trading account
  2. Start lean cli using the command given below

System Information

Register for tradier account, setup a paper trading account at and start lean live:

lean live deploy --brokerage Tradier \
    --data-provider-live Tradier \
    --tradier-account-id "xxxx" --tradier-access-token "xxxx" \
    --tradier-environment paper \
    ${projectname}

Checklist

Martin-Molinero commented 1 month ago

Hey @wlami! Tradier does not support data streaming in the paper/sandbox environment, this is probably causing the issue ur experiencing. Will keep this issue open so we update the lean CLI not to allow this invalid configuration setup.

wlami commented 1 month ago

Hey @Martin-Molinero, thanks for the explanation. Could you help me understand what --tradier-environment paper then is meant to do? Does it only work with other data providers?