简体   繁体   English

FIX QuoteRequest标头字段混乱(或不支持的消息)

[英]FIX QuoteRequest Header fields out of order (or Unsupported Message)

I'm trying to send QuoteRequest to get quote before deciding to whether to place an order, but the Fix server is unhappy. 我正在尝试发送QuoteRequest以获取报价,然后再决定是否下订单,但是Fix服务器不满意。 It seems to me that I follow the documentation here and here , but obviously I'm missing something obvious. 在我看来,我在这里这里都遵循文档,但是显然我缺少明显的东西。

Although, I send same message to two identical installations if FIXimulate (Windows and Mac) and receive two different resonses. 虽然,如果FIXimulate(Windows和Mac),我会向两个相同的安装发送相同的消息,并收到两个不同的响应。

here is config.ini 这是config.ini

# default settings for sessions
[DEFAULT]
ConnectionType=initiator
ReconnectInterval=60
SenderCompID=BANZAI

[SESSION]
BeginString=FIX.4.2
TargetCompID=FIXIMULATOR
StartTime=00:00:00
EndTime=00:00:00
# overide default setting for RecconnectInterval
ReconnectInterval=30
HeartBtInt=30
SocketConnectPort=9878
# SocketConnectHost=127.0.0.1
SocketConnectHost=192.168.1.67
DataDictionary=FIX42.xml
FileStorePath=.

Message I send: 8=FIX.4.2|9=90|35=R|34=2|49=BANZAI|52=20170322-11:48:49.000|56=FIXIMULATOR|131=0004|146=1|55=AMZN|38=100|10=180 我发送的消息: 8=FIX.4.2|9=90|35=R|34=2|49=BANZAI|52=20170322-11:48:49.000|56=FIXIMULATOR|131=0004|146=1|55=AMZN|38=100|10=180

using updated code to avoid fiddling manually with Header: 使用更新的代码来避免手动摆弄Header:

def sendQuoteRequest(self):
    message = quickfix.Message()
    message.getHeader().setField(quickfix.BeginString(quickfix.BeginString_FIX42))
    message.getHeader().setField(quickfix.MsgType(quickfix.MsgType_QuoteRequest))
    message.setField(quickfix.QuoteReqID("0004"))  # 131

    group = quickfix43.QuoteRequest().NoRelatedSym()
    group.setField(quickfix.Symbol('AMZN'))
    group.setField(quickfix.OrderQty(100))
    message.addGroup(group)

    print "QuoteRequest: " + str(message)
    quickfix.Session.sendToTarget(message, self.sessionID)

But still I have the same error back 58=Unsupported Message Type|372=R|380=3: 但是仍然有相同的错误返回58 =不支持的消息类型| 372 = R | 380 = 3:

  8=FIX.4.2|9=105|35=j|34=2|49=FIXIMULATOR|52=20170322-11:48:49.689|56=BANZAI|45=2|58=Unsupported Message Type|372=R|380=3|10=099

I'm totaly confused and would really appriciate help! 我很困惑,真的会寻求帮助!

I have used QF with Python extensively and always set the header fields as in the documentation and as you have done. 我已经在Python中广泛使用了QF,并且总是按照文档中和您所做的那样设置标头字段。 I think the problem is actually in your last line. 我认为问题实际上出在您的最后一行。 Try only passing the message itself, as opposed to the message and your sessionID, like: 尝试仅传递消息本身,而不是传递消息和您的sessionID,例如:

quickfix.Session.sendToTarget(message)

Also, when I call this, for some reason I have to write 另外,当我打电话给我时,由于某种原因我必须写

quickfix.Session_sendToTarget(message)

which is very different. 这是非常不同的。 We may be operating with different versions of QF. 我们可能正在使用不同版本的QF。 In any case it looks like your message is going out but if you get desperate you might try the underscore. 在任何情况下,您的消息似乎都在发出,但如果您感到绝望,则可以尝试使用下划线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM