tbpy如何查询历史数据
# encoding utf-8
import tbpy
import sys
from datetime import datetime
import numpy as np
import pandas as pd


if __name__ == '__main__':
    init = tbpy.init('tbquant3')
    if init is False:
        print('init fail.')
        sys.exit()

    print('init success.')
    # get quote test
    # get history kline by count
    # get_history_n(symbol, frequency, count, fields: list=None, timeout='30s')
    history1 = tbpy.get_history_n(symbol='rb000.SHFE', frequency='1d', count=5)
    print(1)
    print(history1)
    history2 = tbpy.get_history_n(symbol=['rb000.SHFE', 'a9000.DCE'], frequency='1m', count=10, fields=['open', 'high', 'time'], timeout='10s')
    print(2)
    print(history2)

    # get history kline by begin/end time
    # get_history(symbol, frequency, begin_time: datetime, end_time: datetime, fields: list=None, timeout='30s')
    history3 = tbpy.get_history(symbol='rb000.SHFE', frequency='1d', begin_time=datetime(2025, 11, 7), end_time=datetime(2025, 11, 11), flag=tbpy.QuoteFlag.RolloverBackWard)
    print(3)
    print(history3)

    # get_quote(symbol)
    tick4 = tbpy.get_current_tick(symbol='IF000.CFFEX')
    print(4)
    print(tick4)
    tick5 = tbpy.get_current_tick(symbol=['IF000.CFFEX', 'a9000.DCE', 'CF000.CZCE'])
    print(5)
    print(tick5)

df = pd.DataFrame(history1)
df.set_index('time', inplace=True)

请问为什么查询不到数据,tbquant3正常打开。

TBPY怎么查询主力连续合约信息?
tbpy读取历史数据最大是多少?
TBPY PTYHON功能
TBPY,不支持获取不同周期的历史数据吗?
没有专门的tbpy板块啊!建议增加查询资金和保证金的功能
tbpy get历史数据,设置获取日数据,怎么最大就只有120个呢?
tbpy如何开通权限
简语言版如何补充历史数据
超过5万条,之前的历史数据如何获取
如何用tbpy做多品种交易?

帮助文档范例试过了吗

软件版本保持最新,tbpy版本呢同步最新