I am not sure the description is exactly correct, reading the code:
- charlie_order will be called no matter what
- the amount will be 50 UNLESS price < vwap * 0.995 and notional > context.min_notional, that is because of the initialization of u_amount to a non zero value
Code that matches the description and does nothing when none of the two conditions would be
u_amount = 50
s_amount = 0
if price < vwap * 0.995 and notional > context.min_notional:
s_amount = -u_amount
elif price > vwap * 1.005 and notional < context.max_notional:
s_amount = +u_amount
charlie_order(context.aapl, context.early_closes, u_timezone, u_minutes, s_amount)