Lean CLI not using sandbox server for tradier paper trading account
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
- Setup tradier paper trading account
- 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
- [x] I have completely filled out this template
- [ ] I have confirmed that this issue exists on the current
masterbranch (No, could make the dotnet build work in my ubuntu environment) - [x] I have confirmed that this is not a duplicate issue by searching issues
- [x] I have provided detailed steps to reproduce the issue
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.
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?
Tradier brokerage internally is already not allowing paper trading being used as a data provider see https://github.com/QuantConnect/Lean.Brokerages.Tradier/blob/master/QuantConnect.TradierBrokerage/TradierBrokerage.DataQueueHandler.cs#L89.
update the lean CLI not to allow this invalid configuration
Lean cli currently can not enforce this, will skip for now, until further requirements