Back

Economic news event trading - Run algo based on a set of dates

Hi,

I am a newbie here. I am working an trading algo based on major economic news release. The algo will trade based on a set of dates.

I have the following codes. Justto proof that it can execute job() at designated date/time. How do i intergrate this into quantconnect code, which section? under Initialize()?

thanks alot

##########################
    import sched, time
    import datetime
    s = sched.scheduler(time.time, time.sleep)

    time_sample = ["11 01 2017 12 03 00","11 01 2017 12 03 10"]

    def job():
        a = time.asctime(time.localtime())
        print(a)

    for x in time_sample:
        time_conv = time.strptime(x, "%m %d %Y %H %M %S")
        temp1 = time.mktime(time_conv)
        s.enterabs(temp1,1,job)
        s.run()
##########################

Update Backtest








It looks like you are using a scheduler. For that, we have the Scheduled Events feature that is set in Initialize.
 

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.


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