quote_datetime,last 2020-03-02 09:45:00,276.76 2020-03-02 10:00:00,276.8 2020-03-02 10:15:00,276.62 2020-03-02 10:30:00,276.81 2020-03-02 10:45:00,277.09 2020-03-02 11:00:00,278.24 2020-03-02 11:15:00,278.98 2020-03-02 11:30:00,280.63 2020-03-02 11:45:00,282.24 2020-03-02 12:00:00,283.26
重采样至30分钟后形成ohlc。
quote_datetime,open,high,low,close 2020-03-02 09:30:00,276.76,276.76,276.76,276.76 2020-03-02 10:00:00,276.8,276.8,276.62,276.62 2020-03-02 10:30:00,276.81,277.09,276.81,277.09 2020-03-02 11:00:00,278.24,278.98,278.24,278.98 2020-03-02 11:30:00,280.63,282.24,280.63,282.24
30min OHLC条从重采样功能输出 11.00 bar 在这里,当前柱和下一个柱形成30min OHlc柱。
开盘价为278.24 =这是最新价格11.00
收盘价是278.98 =从11.00开始的下一个柱=> 11.15
高点和低点在最近的价格从11.00到11.15之间
预计30分钟的输出量:
open as 276.81, which is last price at 10.30 close as 278.24, which is last price at 11.00 high and low, which should be between 10.30, 10.45, 11.00
tempDf = underlyingDf['last'].resample('1H').ohlc()
通过重采样功能,这种不匹配也发生了1小时ohlc。 11.00 bar 在这里,1小时ohlc柱由当前柱和下一个3柱形成。
2020-03-02 11:00:00,278.24,282.24,278.24,282.24 2020-03-02 12:00:00,283.26,285.67,283.26,285.4
1小时的正常输出量
open 276.8, which is price at 10.00, this will become open price for 11.00 bar. close 278.24, which is price at 11.00, this will the become close price for 11.00 bar. high and low, between 10.00 to 11.00
有人可以通过将ohlc()与python resample一起使用来帮助我实现预期的输出是正确的。
谢谢。