Back

Schedualing Events On First Trading Day Of The Week

Hi

I have been porting my algos across from Quantopian. The schedule functions used at quantopian allow you to action a function on the first or subsequent trading day of the week. Quantconnect only seems to allow for a function to be scheduled on a specific day (e.g. Tuesday).

Q1. If a function is schedualed on a monday but monday is a holiday, will the function be actioned on the next trading day?

Q2. What is the easiest way to scheduale a function to be actioned on a specific trading day in the week (e.g. the first trading day or the second)?

I am coding in python. I believe the TradingCalander may be useful; however I am not familiar with how it works. I appreciate any help!

Update Backtest








I am only a c# developer but i would take a look at the info provided by tradingcalender.

https://github.com/QuantConnect/Lean/blob/5f64665598b5e6119b42d11d84eb1062f12542a6/Common/TradingCalendar.cs

like GetTradingDays(DateTime start, DateTime end)

https://github.com/QuantConnect/Lean/blob/e7ebddf8b639649ed2f57ed2d593ae88f9b5e6e2/Common/TradingDay.cs

TradingDayType: BusinessDay | PublicHoliday

0

Thank you - I will try to think of a way to utilise the feature

0

1 )when you go in the "Algorithm Lab" on the left there is the "API" - tab

2) expand QCAlgorithm then expand TradingCalendar

3) click on the return value to see the propierties

TradingDays

 

gl

0

Jared Broad

DONT CLICK ON "Quantconnect.Tradingday" link because you will not see the properites!!

BECAUSE ITS THE "SYMBOL"  !!! CLASS hehe :) thats the wrong class

0

@Jared

GetDaysBuyType also shows symbol class information :)

if you click on the first two decriptions links

0

Recently DateRules for WeekStart WeekEnd and MonthStart MonthEnd were added to Lean, Not in the docs yet but they exist around the codebase:
 

https://github.com/QuantConnect/Lean/blob/master/Tests/Common/Scheduling/DateRulesTests.cs
0

Perfect - thank you both for your help. Do you know if the new DateRules allow to offset days?

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