Date and Time

date_rules.month_start(days_offset=2)

plz, explain the syntex.

what is mean by days_offset

days_offset is the parameter to choose the trigger date. For month_start, an offset=n means the trigger date is n-days after the start (first business day) of the month. For month_end, offset parameter n means n days before start of the month. Default offset is 0, which means trigger dates coincide with the start (for month_start) or end (month_end) of the months. For more see here.

if i would like to view every 2 month means how to denote?

Coarser frequency than a month has no direct support. You have to track it yourself. One way is to schedule at monthly frequency (start/end/offset depending on your choice) and in the function that you schedule add below at the very beginning.



form zipline.api import get_datetime

#form blueshift.api import get_datetime



def my_func(context, data):

    """ your scheduling function. """"

    today = get_datetime()           # <- returns the current simulation date-time

    if today.month%2==1:return   # <- do nothing if an odd month



    # <— rest of the code goes here –>