Lean
Lean copied to clipboard
Better Error Reporting from Custom Data Types
Expected Behavior
LEAN provides information about errors in Custom Data Types.
Actual Behavior
The Reader of Custom Data types doesn't always display the error to the user.
Potential Solution
TextSubscriptionDataSourceReader.ReaderError should not be null. OnReaderError will not log anywhere if it is.
Reproducing the Problem
Run CustomDataBitcoinAlgorithm
in live mode. There is a bug at
coin.EndTime = datetime.utcnow().astimezone(timezone(str(config.ExchangeTimeZone))).replace(tzinfo=None)
since the timezone
constructor doesn't accept a string argument. We should receive a message:
'timezone() argument 1 must be datetime.timedelta, not str'
we can fix that line with
coin.EndTime = Extensions.ConvertFromUtc(datetime.utcnow(), config.ExchangeTimeZone)
Checklist
- [x] I have completely filled out this template
- [x] I have confirmed that this issue exists on the current
master
branch - [x] I have confirmed that this is not a duplicate issue by searching issues
- [x] I have provided detailed steps to reproduce the issue
In addition to error non-reporting, the execution also doesn't stop at breakpoints placed in custom data class in debug mode which makes it even difficult to debug errors in it.
In addition to error non-reporting, the execution also doesn't stop at breakpoints placed in custom data class in debug mode which makes it even difficult to debug errors in it.
Hey @AmazingAbhi! Mind clarifying how are you running Lean and reproducing the issue your mentioning? I assume python? If you can share and algorithm to reproduce the issue even better, this helps us pin and solve the issues faster, thank you!
Issue is lean cli specific:
- Clone this bitstamp algo: https://www.quantconnect.com/terminal/clone/13895484/9619c8238a1f87f95f967d2db94f64bf/clone-of%3A-key-concepts-example-%5Bpy%5D
- Add a breakpoint anywhere in Reader function of custom data class
- Click on 'Debug using Lean CLI'
- Run in lean cli using 'lean backtest <project_name> --debug pycharm
Execution should stop at breakpoint but it doesn't.