864 浏览
0

模拟没问题的,但实盘不行。在文华、国贸金服等软件中,连委托单都看不见。

import pandas as pd
from tqsdk import TqApi, TqAuth, TqAccount, TqKq, TqSim
import os
 attempts = 0
success = False
while attempts < 30 and not success:
    try:
        api = TqApi(account=TqAccount(),auth=TqAuth())
        success = True
    except:
        attempts += 1
 df_期货得分 = pd.read_csv('选股.csv')
new_symbol = list(df_期货得分['future'])[0]
new_direction = list(df_期货得分['direction'])[0]
 q = api.get_quote(new_symbol)
字典 = {'BUY':q.upper_limit,'SELL':q.lower_limit}
price = 字典[new_direction]
api.insert_order(new_symbol,new_direction,'OPEN',1,price)
api.wait_update()
 os._exit(0)

李思恒 已回答的问题 2022年9月5日
0

失败的原因是啥?最好发下报错截图。有一个可能是,模拟是即时成交的,但是实盘不是,需要报单到交易所进行撮合,所以看起来模拟是马上成交,但是实盘没有

李思恒 已回答的问题 2022年9月5日