行情订阅输出不稳定,应该从那些方面排查原因?
发布于 1 个月前 作者 vensentzhou 95 次浏览 来自 问答

订阅了realtime_5min_rb1912的数据 运行

from QAStrategy import QAStrategyCTABase 
from QIFIAccount import QIFI_Account 
import QUANTAXIS as QA
from qaenv import (eventmq_amqp, eventmq_ip, eventmq_password, eventmq_port,eventmq_username, mongo_ip, mongo_uri) 
import pandas as pd

示例策略 
class macd(QAStrategyCTABase):   
    def on_bar(self, bar):
        
        print(bar)        
        if len(self.market_data)> 26:            
            res = self.calc_macd()
            print(res)
            ex = QA.CROSS(res['MACD'], 0)            
            ec = QA.CROSS(0, res['MACD'])           
            if ex.iloc[-1]> 0:                
                print('sendorder')                
                self.send_order('BUY', 'OPEN', price=bar['close'], volume= 1)            
            elif ec.iloc[-1]>0:                
                print('sendorder')                
                self.send_order('SELL', 'CLOSE', price=bar['close'], volume= 1)        
    def calc_macd(self):
        macd = QA.QA_indicator_MACD(self.market_data)        
        return macd.tail()
		strategy = macd(code='rb1912', frequence='5min', strategy_id='rb_test', start='2019-10-01') 
		strategy.run_sim()

image.png 行情数据时有时无。这种情况应该从哪些方面排查问题呢?

2 回复

rb1912本来就是很不活跃的合约 确实没啥tick的

现在的rb主力合约是rb2001

回到顶部