Back

Am i developing my algorithm using the right environment?

presently i'm trying to learn python and write an algorithm in parallel and as a result i'm spending a lot of time chasing runtime errors that only appear in the backtest and not during the build, which is akin to looking for the right rake in a dark room and all the rakes are lying rake-side-up on the floor. should i be doing this in jupyter or something to shorten the cycle? thanks!

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.


Hi Joe, welcome to the forums!

You're on the right track here. With a bit of guidance from the example algorithms, it should be possible to avoid most runtime errors. Normally the syntax and API of the library is the hardest to get around - not the runtime errors. 95% of all the runtime errors I see on the forums come from trying to access data that doesn't exist (in arrays or rolling windows).

If you get stuck at a particular runtime error, you're more than welcome to attach your algorithm here and someone will surely take a look! 

0

hi douglas,

thanks for the advice! the biggest problem i'm having right now is that i can't figure out how to use the UncorrelatedUniverseSelectionModel available from the algorithm builder. i'd like to experiment with various technical indicators operating on the uncorrelated stocks to create some insights. i've located several example algorithms that show how to make a custom universe with the filter methods but haven't been able to find one that shows how you use a pre-built universe. are you aware of any?

best

joe

0

Just my 0.02: I've experienced a lot of frustration as well debugging in the IDE.

As the errors can be difficult to trace, what helped me the most was using self.Log("string here") as a sort of print statement, and comparing the output with the trades log to see what bits of code weren't functioning as I expected. I found a logic error first time around.

When debugging, I've found just backtesting for a few months is preferable since backtests are faster, and when logging keep the string size to a minimum because otherwise one runs out of log data allotment. Example: instead of "Stop loss price {}, Limit order price {}" use "S {}, L {}"

1

hi ian,

thanks, that's good advice. so far my list of things i wish i knew before i started debugging on QC, tho i expect it'll continue to grow.

a) self.Log()

b) using small backtests timeframes for quicker turnaround

c) using dynamically generated strings in marketorder tags

d) using try/except blocks to manage missing data exceptions

best

joe

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