返回列表 发布新帖

Tick周期为什么只有最近一个交易日有数据

310 1
发表于 2025-8-17 11:58:59 | 显示全部楼层 阅读模式

Tick周期为什么只有最近一个交易日有数据,数据补充过了,也显示下载完成。

#encoding:gbk
from datetime import datetime, timedelta

class GlobalVariable:pass

g = GlobalVariable()
g.accountID = 'test'
g.accountType = 'STOCK'
g.stock_list = ['518660.SH']


def init(c):

    c.set_account(g.accountID,g.accountType)
    c.capital = et.prepare_invest
    c.start = '2021-01-01 00:00:00'
    c.end = datetime.today().strftime('%Y-%m-%d %M:%H:%S')

def handlebar(c):

    # print({datetime.fromtimestamp(c.get_bar_timetag(c.barpos)/1000)})
    current_bar_date = datetime.fromtimestamp(c.get_bar_timetag(c.barpos)/1000)
    start_time = (current_bar_date - timedelta(minutes=5)).strftime('%Y%m%d%H%M%S')
    end_time = current_bar_date.replace(hour=23, minute=59, second=59).strftime('%Y%m%d%H%M%S')

    print(f's{start_time}e{end_time}')

    data = c.get_market_data_ex([],g.stock_list,'tick',start_time,end_time=end_time)

    for stock_code, d in data.items():
        print(f'stock_code:{stock_code}:{d["lastPrice"]}')




评论1

*******1676_H5n05
发表于 2025-9-4 09:34:56 | 显示全部楼层
我看了下xtdata.py:

你的get_market_data_ex函数
-》调用 get_market_data_ex_ori
-》调用 client.get_market_data3
-》调用 get_market_data3 = _get_market_data_ex_221207
-》_get_market_data_ex_221207 调用 get_market_data_ex_ori

又回到第二步去了,什么也没真正地执行!不知道咋回事。。。要不你换个取数据的函数?get_local_data?不懂。。。
   

回复

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

客服专线

400-080-8112

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