返回列表 发布新帖

【请教问题】get_market_data_ex获取数据不正确

277 2
发表于 2024-4-18 09:06:35 | 显示全部楼层 阅读模式
请帮忙看一下,我想获取前一个交易日的收盘价,本来是获取最近两根日K线,拿前一根的收盘价,结果昨天反复调试都只返回1根K线的数据,后来就改为获取最近一根的preclose字段,结果今天早上preclose又返回0.00(如下日志中红色数字),不知道该如何稳定的获取前一根日K线的收盘价了,请帮忙看看,感谢。



mKDataInfoLastdayClose:{'002444.SZ':                 amount  close  high    low   open  openInterest  preClose  \
stime                                                                       
20240417  4.456874e+08   26.9  26.9  25.97  26.69            15     26.72   
20240418  0.000000e+00   26.9  26.9  26.90  26.90            15      0.00   

          settelementPrice     stime  suspendFlag           time  volume  
stime                                                                     
20240417               0.0  20240417            0  1713283200000  169395  
20240418               0.0  20240418            0  1713369600000       0  }



        mKDataInfoLastdayClose = ContextInfo.get_market_data_ex([],
                                                                 [stock],
                                                                 period='1d',
                                                                 start_time='',
                                                                 end_time='',
                                                                 count=2,
                                                                 subscribe=True)
       
        newKDataList = json.loads(mKDataInfoLastdayClose[stock].to_json(orient="records"))
        LastdayClose=newKDataList[-1]['preClose']
        signalInfo.lastClosePrice=LastdayClose
       
        print(f'mKDataInfoLastdayClose:{mKDataInfoLastdayClose}')

评论2

迅投kiki
发表于 2024-4-18 15:29:42 | 显示全部楼层
咱们用的什么地址环境呢?可以直接查前一个交易日的收盘价~
*******8532楼主
发表于 2024-4-18 20:56:10 | 显示全部楼层
我用的是券商版,您说的是哪个接口呢?谢谢

回复

您需要登录后才可以回帖 登录 | 立即注册

主题

1

回帖

1

积分

0

客服专线

400-080-8112

用思考的速度交易,用真诚的态度合作,我们是认真的!
  • 关注公众号
  • 添加微信客服
Copyright © 2001-2024 迅投QMT社区 版权所有 All Rights Reserved. 蜀ICP备19002686号-2
关灯 快速发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表