def _normalize_dates(self, context):
        '''
        Build a timeline from given (or not) start and end dates
        '''
        if 'start' in context:
            if isinstance(context['start'], dt.date):
                context['start'] = dt.date.strftime(
                    context['start'], format='%Y-%m-%d')
        if 'end' in context:
            if isinstance(context['end'], dt.date):
                context['end'] = dt.date.strftime(
                    context['end'], format='%Y-%m-%d')

        trading_dates = intuition.utils.build_trading_timeline(
            context.pop('start', None), context.pop('end', None))

        context['index'] = trading_dates
        context['live'] = (dt.datetime.now(tz=pytz.utc) < trading_dates[-1])
def _normalize_dates ( self , context ) : if 'start' in context : if isinstance ( context [ 'start' ] , dt . date ) : context [ 'start' ] = dt . date . strftime ( context [ 'start' ] , format = '%Y-%m-%d' ) if 'end' in context : if isinstance ( context [ 'end' ] , dt . date ) : context [ 'end' ] = dt . date . strftime ( context [ 'end' ] , format = '%Y-%m-%d' ) trading_dates = intuition . utils . build_trading_timeline ( context . pop ( 'start' , None ) , context . pop ( 'end' , None ) ) context [ 'index' ] = trading_dates context [ 'live' ] = ( dt . datetime . now ( tz = pytz . utc ) < trading_dates [ - 1 ] )
Build a timeline from given (or not) start and end dates