Back

Saving state or using scheduled events?

Hi,

Id like to write a python algorithm that uses a outside data source (csv from dropbox) to tell the algorithm that an event has occurred. When the event has occurred I want to buy some securities and then sell 7 days later.

What's the best way to get my algorithm to sell? One way seems to be the scheduled event stuff. I can read the csv, and if now is greater than the event date, then buy and and set an event to sell 7 days later.

Is there a better way? Without events I would just set some property of the self object but I'm not sure if that will survive different calls to onData.

Thanks!

Update Backtest








Hi Brett. Saving state is a feature we're aware of and have added to the todo list.

https://github.com/QuantConnect/Lean/issues/1040

But regarding your direct need about acting 7 days later; yes working with a dropbox CSV file would be an easy way.

The property will survive as long as the algorithm is running.

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.


Thanks Jared. Will the event based schedule work too or should I use

another mechanism?
0

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