532 浏览
0

【模拟】成功

print(‘模拟…’)
auth=TqAuth(“xxx”,”xxx”)
api0 = TqApi(TqSim(200000),auth=auth)
quote = api0.get_quote(‘KQ.m@SHFE.au’)
api0.wait_update()
print(quote)
api0.close()

模拟…
在使用天勤量化之前,默认您已经知晓并同意以下免责条款,如果不同意请立即停止使用:https://www.shinnytech.com/blog/disclaimer/
2023-02-28 13:40:39.847183 – 通知: 账户 2830923976288 与交易服务器的网络连接已建立.
2023-02-28 13:40:39.850901 – 通知: 与合约服务器的网络连接已建立.
{“datetime”:”2023-02-28 13:40:41.000001″,”ask_price1″:412.66,”ask_volume1″:14,”bid_price1″:412.64,”bid_volume1″:4,”ask_price2″:412.68,”ask_volume2″:19,”bid_price2″:412.62,”bid_volume2″:18,”ask_price3″:412.7,”ask_volume3″:35,”bid_price3″:412.6,”bid_volume3″:38,”ask_price4″:412.72,”ask_volume4″:9,”bid_price4″:412.58,”bid_volume4″:11,”ask_price5″:412.74,”ask_volume5″:22,”bid_price5″:412.56,”bid_volume5″:13,”last_price”:412.64,”highest”:413.4,”lowest”:412.04,”open”:412.04,”close”:”-“,”average”:412.6,”volume”:85461,”amount”:35261055820.0,”open_interest”:75769,”settlement”:”-“,”upper_limit”:445.5,”lower_limit”:379.5,”pre_open_interest”:107333,”pre_settlement”:412.5,”pre_close”:412.2,”price_tick”:0.02,”price_decs”:2,”volume_multiple”:1000.0,”max_limit_order_volume”:0,”max_market_order_volume”:0,”underlying_symbol”:”SHFE.au2304″,”strike_price”:0.0,”ins_class”:”CONT”,”instrument_id”:”m@SHFE.au”,”instrument_name”:”沪金主连”,”exchange_id”:”KQ”,”expired”:false,”expire_datetime”:0.0,”delivery_year”:2023,”delivery_month”:4,”last_exercise_datetime”:0.0,”product_id”:””,”margin”:”-“,”commission”:”-“}

【回测】失败

print(‘回测…’)
auth=TqAuth(“xxx”,”xxx”)
api = TqApi(TqSim(200000),auth=auth,
backtest=TqBacktest(start_dt=date(2021, 1, 30), end_dt=date(2021, 3, 30)))
quote = api.get_quote(‘KQ.m@SHFE.au’)
api.wait_update()
print(quote)
api.close()

回测…
在使用天勤量化之前,默认您已经知晓并同意以下免责条款,如果不同意请立即停止使用:https://www.shinnytech.com/blog/disclaimer/
2021-01-29 18:00:00.000000 – 通知: 账户 2086956448816 与交易服务器的网络连接已建立.
2021-01-29 18:00:00.000000 – 通知: 与合约服务器的网络连接已建立.
Traceback (most recent call last):
File “.\main.py”, line 209, in <module>
quote = api.get_quote(‘KQ.m@SHFE.au’)
ValueError: 合约代码 KQ.m@SHFE.au 不存在, 请检查合约代码是否填写正确.

李思恒 已回答的问题 2023年3月7日
0

参考上一个回答我回复你的哈,可以加我下看看

李思恒 已回答的问题 2023年3月7日