In different trade date, why I can't get the same price data which bind with a specified date?
Here is my simple code:
def initialize(context):
context.rs_ref_stock = sid(19656)
def before_trading_start(context, data):
#get XLF close price
xlf_price_history = data.history(sid(19656), ['close'], 3, '1d')
log.info("\n" + str(xlf_price_history))
Output:
2017-06-15 20:45 before_trading_start:10 INFO
close
2017-06-12 00:00:00+00:00 24.345
2017-06-13 00:00:00+00:00 24.455
2017-06-14 00:00:00+00:00 24.500
2017-06-16 20:45 before_trading_start:10 INFO
close
2017-06-13 00:00:00+00:00 24.361690
2017-06-14 00:00:00+00:00 24.406518
2017-06-15 00:00:00+00:00 24.306900
End of logs.