Hello all,
I've been writing an algorithm involving dividends and I'm attempting to configure the algo to purchase the stock on the ex-day. To do this I am currently using
present = datetime.now()
present.strftime("%m/%d/%y")
date_tx = datetime.strptime("5/6/16", "%m/%d/%y")
if present == date_tx:
order_percent(symbol('TX'), 0.2)
However, while the program backtests, datetime.now returns the actual date not the one the simulation is currently on. Clearly, this is a problem for backtesting with dividends so any advice on how to fix it would be appreciated.