How to Get Bar data for today_only
I am trying to get the previous 13 5 minute candles (regular trading hours only). My code looks like this:
bars = md.bar.minute(start=-13, barsize=5, today_only=False, include_extended=False)
When I test this it does not reference yesterdays data, my first bar has 1 element, the next has 2 etc.
The print of the first few result sets looks like this:
BarView(symbol=u'SPY', length=60, timestamp=array([1470081300000000]), open=array([ 216.66000366]), high=array([ 216.91000366]), low=array([ 216.58999634]), close=array([ 216.88999939]), volume=array([ 3718135.]), vwap=array([ 216.7594277]), spread=array([ 0.00971429]), bidvol=array([ 1505816.]), askvol=array([ 1797574.]), count=array([ 12594.]), valid=array([ True], dtype=bool), close_primary=array([ 0.]), open_primary=array([ 0.]))
BarView(symbol=u'SPY', length=60, timestamp=array([1470144600000000]), open=array([ 216.6499939]), high=array([ 216.78999329]), low=array([ 216.41000366]), close=array([ 216.69000244]), volume=array([ 1697336.]), vwap=array([ 216.63019261]), spread=array([ 0.00970991]), bidvol=array([ 889699.]), askvol=array([ 710171.]), count=array([ 6909.]), valid=array([ True], dtype=bool), close_primary=array([ 0.]), open_primary=array([ 0.]))
BarView(symbol=u'SPY', length=60, timestamp=array([1470144600000000, 1470144900000000]), open=array([ 216.6499939 , 216.67999268]), high=array([ 216.78999329, 216.83000183]), low=array([ 216.41000366, 216.27999878]), close=array([ 216.69000244, 216.33999634]), volume=array([ 1697336., 1829392.]), vwap=array([ 216.63019261, 216.54319529]), spread=array([ 0.00970991, 0.00961207]), bidvol=array([ 889699., 888268.]), askvol=array([ 710171., 824432.]), count=array([ 6909., 7729.]), valid=array([ True, True], dtype=bool), close_primary=array([ 0., 0.]), open_primary=array([ 0., 0.]))
BarView(symbol=u'SPY', length=60, timestamp=array([1470144600000000, 1470144900000000, 1470145200000000]), open=array([ 216.6499939 , 216.67999268, 216.34500122]), high=array([ 216.78999329, 216.83000183, 216.46000671]), low=array([ 216.41000366, 216.27999878, 216.24000549]), close=array([ 216.69000244, 216.33999634, 216.38999939]), volume=array([ 1697336., 1829392., 1239897.]), vwap=array([ 216.63019261, 216.54319529, 216.34363488]), spread=array([ 0.00970991, 0.00961207, 0.00947814]), bidvol=array([ 889699., 888268., 650863.]), askvol=array([ 710171., 824432., 530952.]), count=array([ 6909., 7729., 5895.]), valid=array([ True, True, True], dtype=bool), close_primary=array([ 0., 0., 0.]), open_primary=array([ 0., 0., 0.]))
How do I get all of the 13 candles, regardless of today or yesterday?
Comments
with
bars = md.bar.minute(start=-13, barsize=5, today_only=False)
only returns the bar_size of 5 of the last 13 1-minute bars.start
is bars based on 1 minute barstry
bars = md.bar.minute(start=-13*5, barsize=5, today_only=False)