重新采样到形成的OHLC与基础数据不匹配

问题描述

    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.8,276.62,276.81,277.09,278.24,278.98,280.63,282.24,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条

通过重采样功能,这种不匹配也发生了1小时ohlc。 11.00 bar 在这里,1小时ohlc柱由当前柱和下一个3柱形成。

   2020-03-02 11:00:00,282.24
   2020-03-02 12:00:00,283.26,285.67,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一起使用来帮助我实现预期的输出是正确的。

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...