在使用ib接口时,获取外汇数据是正常的。
但在NYMEX交易所的原油品种上,不能获得当天的一分钟历史数据。下载的历史数据是昨天的最后一分钟截止的。
数据如下:
Date: 20210312 05:53:00, Open: 65.960000, High: 65.970000, Low: 65.930000, Close: 65.930000, Volume: 87, Average: 65.950000, BarCount: 69
Date: 20210312 05:54:00, Open: 65.940000, High: 65.940000, Low: 65.930000, Close: 65.940000, Volume: 27, Average: 65.938000, BarCount: 19
Date: 20210312 05:55:00, Open: 65.940000, High: 65.950000, Low: 65.880000, Close: 65.890000, Volume: 237, Average: 65.913000, BarCount: 126
Date: 20210312 05:56:00, Open: 65.890000, High: 65.910000, Low: 65.880000, Close: 65.890000, Volume: 37, Average: 65.897000, BarCount: 17
Date: 20210312 05:57:00, Open: 65.880000, High: 65.920000, Low: 65.880000, Close: 65.900000, Volume: 20, Average: 65.899000, BarCount: 15
Date: 20210312 05:58:00, Open: 65.890000, High: 65.900000, Low: 65.880000, Close: 65.880000, Volume: 54, Average: 65.895000, BarCount: 24
Date: 20210312 05:59:00, Open: 65.880000, High: 65.920000, Low: 65.880000, Close: 65.910000, Volume: 96, Average: 65.905000, BarCount: 41
[BarData(gateway_name='IB', symbol='CL-20210322-USD-FUT', exchange=<Exchange.NYMEX: 'NYMEX'>, datetime=datetime.datetime(2021, 3, 10, 22, 30, tzinfo=<DstTzInfo 'Asia/Shanghai' CST+8:00:00 STD>), interval=<Interval.MINUTE: '1m'>, volume=4672, open_interest=0, open_price=64.09, high_price=64.09, low_price=63.72, close_price=63.85), BarData(gateway_name='IB', symbol='CL-20210322-USD-FUT', exchange=<Exchange.NYMEX: 'NYMEX'>, datetime=datetime.datetime(2021, 3, 10, 22, 31, tzinfo=<DstTzInfo 'Asia/Shanghai' CST+8:00:00 STD>), interval=<Interval.MINUTE: '1m'>, volume=3798, open_interest=0, open_price=63.85, high_price=63.9, low_price=63.56, close_price=63.6), BarData(gateway_name='IB', symbol='CL-20210322-USD-FUT', exchange=<Exchange.NYMEX: 'NYMEX'>, datetime=datetime.datetime(2021, 3, 10, 22, 32, tzinfo=<DstTzInfo 'Asia/Shanghai' CST+8:00:00 STD>), interval=<Interval.MINUTE: '1m'>, volume=3478, open_interest=0, open_price=63.59, high_price=63.87,
交易所早上6点收盘,然后数据就截止到5点59。
NYMEX交易所我已经购买了付费行情。
如果交易所不提供当天的1分钟历史数据,那就只能依靠tick来合成。麻烦大了。