Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
The Awesome Algorithm - Trade at the end of the day
1 response

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 the price of the security is .5% less than the 3-day volume weighted average

price AND has not reached the maximum short, then the order is to sell

Similarly, if the stock is .5% higher than the 3-day average AND has not

reached the maximum long, then the order is to buy

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

With the name of the security, dates of early closure, the

timezone within the United States, when to place the order,

and order amount, the user can sit back and relax at the

end of the day while orders are still going on.

charlie_order(context.aapl, context.early_closes, u_timezone, u_minutes, s_amount)