Modifying risk constraints based on time of the year

And implemented some code to change your optimal_portfolio risk constraints depending on the time of the year. So far it has given me inconsistent results. I'd be interested in hearing what sorts of results other people got when they used it in their algorithms.

I've also thought of adding some stuff about style/sector risks to it in the future. The numbers could be tweaked - they're just based on maintaining an amount of risk acceptable to quantopians algorithm but you might get some risk failures.

def constraints(context):
constraints = []
RISK_PARAMS = {}
RISK_PARAMS['MAX_GROSS_LEVERAGE'] = 1.05
RISK_PARAMS['MAX_SHORT'] = 0.04
RISK_PARAMS['MAX_LONG'] = 0.04
RISK_PARAMS['BETA'] = 0.25
RISK_PARAMS['DOLLAR_TOLERANCE'] = 0
if algo.get_datetime(tz=None).strftime("%B") == 'January':
increaseSell(RISK_PARAMS)
elif algo.get_datetime(tz=None).strftime("%B") == 'May':
increaseSell(RISK_PARAMS)
elif algo.get_datetime(tz=None).strftime("%B") == 'November':
elif algo.get_datetime(tz=None).strftime("%B") == 'December':
if algo.get_datetime(tz=None).strftime("%A") == 'Monday':
elif algo.get_datetime(tz=None).strftime("%A") == 'Friday':
minorincreaseSell(RISK_PARAMS)
pipe_beta_data = context.pipeline_beta_data.dropna()
beta_neutral = opt.FactorExposure(pipe_beta_data[['beta']],min_exposures={'beta': -RISK_PARAMS['BETA']},max_exposures={'beta': RISK_PARAMS['BETA']})
constraints.append(beta_neutral)

constrain_gross_leverage = opt.MaxGrossExposure(RISK_PARAMS['MAX_GROSS_LEVERAGE'])
constraints.append(constrain_gross_leverage)
dollar_neutral = opt.DollarNeutral(RISK_PARAMS['DOLLAR_TOLERANCE'])
constraints.append(dollar_neutral)
constrain_pos_size = opt.PositionConcentration.with_equal_bounds(
-RISK_PARAMS['MAX_SHORT'],RISK_PARAMS['MAX_LONG'])
constraints.append(constrain_pos_size)
constraints.append(constrain_sector_style_risk)
return constraints

RISK_PARAMS['MAX_GROSS_LEVERAGE'] += 0.02
RISK_PARAMS['BETA'] += 0.1
RISK_PARAMS['DOLLAR_TOLERANCE'] += 0.05
def increaseSell(RISK_PARAMS):
RISK_PARAMS['MAX_GROSS_LEVERAGE'] -= 0.025
RISK_PARAMS['BETA'] -= 0.1