def unwind(context, data):
    """ turn trading off. """
    context.state = None
    square_off(context)
    daily_reset(context)
def daily_square_off(context, data):
    """ square off all positions at the end of day."""
    context.trading_hours = False
    square_off(context)
def daily_square_off(context, data):
    """ square off all positions at the end of day."""
    context.trading_hours = False # already done in `stop_trading`
    square_off(context)