Back

Weird behavior on exceptions in scheduled event handler

1. Yesterday, I had a huge headache trying to figure out where an exception throwing bug happened, since line numbers aren't shown on callstack in Mono, and (this appears like a bug on LeanEngine's side) Log/Debug output in the event handling method prior to the exception did not appear. I.e. Log("this"); would simply not print anything, if there was an exception happening after it. In this case, exception was thrown inside a constructor (higher up on the call stack). I speculate that the log streams get killed by the exception propagating out of my event handler and do not flush, but I haven't read LE's code yet.

2. Currently having a scheduled event being triggered multiple times (about once per minute), after being scheduled with the following:

Schedule.On(DateRules.EveryDay("SPY"), TimeRules.AfterMarketOpen("SPY", 5), UpdatePortfolio);

Maybe this means "trigger every minute, starting 5 minutes after market open"? Either that, or the particular fact the called method throws an exception in live mode (due to another bug) makes the system retry the event call. Of course this is a less significant error that I can fix on my own, but I figured I might as well ask since I'm posting the above issue anyway.

Update Backtest








Forgot to state so; I'm desiring the scheduled event to only trigger once per day if it wasn't clear from context.

1

Schedule.On(DateRules.EveryDay("SPY"), TimeRules.AfterMarketOpen("SPY", 5), UpdatePortfolio);

Will trigger once per market trading day for SPY 5 minutes after open - if its not doing that please share the algorithm and we can assist further. 

2

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Alright, I'll be attempting to repro both issues in isolated test algos tomorrow.

While at it, thank you for being so quick in answering my questions. :) It makes QC look good!

0

I shared Exception Test with you, let me know if you can't find it.

1

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed