Python中文
首页
教程
问答
标签
搜索
登录
注册
使用Python在QuickFIX中发送TradeCaptureReport,但无法接收任何TradeCaptureReportA
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我用pythonapi为quickfix1.13.3编写了一个启动器。在</p> <p>它只需将<code>TradeCaptureReport</code>(代码:<code>AE</code>)类型的消息发送给接受者。 我应该收到一个<code>TradeCaptureReportAck</code>(事实上,如果我使用另一个客户机,我就会收到它),但是没有返回任何内容。在</p> <p>使用Wireshark,我可以看到登录和注销都是正确执行的,心跳也保持得很好。在</p> <p>我写的<code>Application</code>定义如下:</p> <pre><code>import sys import time import thread import quickfix as fix import quickfix44 as fix44 from datetime import datetime class Application (fix.Application): orderID = 0 execID = 0 tradeID = 0 global settings def onCreate (self, sessionID): self.sessionID = sessionID print ("Application created - session: " + sessionID.toString ()) def onLogon (self, sessionID): print ("Logon") def onLogout (self, sessionID): print ("Logout") def onMessage (self, message, sessionID): print (message) def toAdmin (self, message, sessionID): msgType = fix.MsgType () message.getHeader ().getField (msgType) if (msgType.getValue () == fix.MsgType_Logon): message.setField (fix.Password (settings.get (self.sessionID).getString ("Password"))) message.setField (fix.ResetSeqNumFlag (True)) def fromAdmin (self, message, sessionID): pass def toApp (self, message, sessionID): pass def fromApp (self, message, sessionID): pass def genOrderID (self): self.orderID += 1 return repr (self.orderID) def genTradeReportID (self): self.tradeID += 1 return repr (self.tradeID) def genExecID (self): self.execID += 1 return repr (self.execID) def run (self): time.sleep (5) self.queryEnterOrder () time.sleep (5) def queryEnterOrder (self): print ("\nTradeCaptureReport (AE)\n") trade = fix.Message () trade.getHeader ().setField (fix.BeginString (fix.BeginString_FIX44)) trade.getHeader ().setField (fix.MsgType (fix.MsgType_TradeCaptureReport)) trade.setField (fix.TradeReportTransType (fix.TradeReportTransType_NEW)) # 487 trade.setField (fix.TradeReportID (self.genTradeReportID ())) # 571 trade.setField (fix.TrdSubType (4)) # 829 trade.setField (fix.SecondaryTrdType (2)) # 855 trade.setField (fix.Symbol ("MYSYMBOL")) # 55 trade.setField (fix.LastQty (22)) # 32 trade.setField (fix.LastPx (21.12)) # 31 trade.setField (fix.TradeDate ((datetime.now ().strftime ("%Y%m%d")))) # 75 trade.setField (fix.TransactTime ((datetime.now ().strftime ("%Y%m%d-%H:%M:%S.%f"))[:-3])) # 60 trade.setField (fix.PreviouslyReported (False)) # 570 group = fix44.TradeCaptureReport ().NoSides () group.setField (fix.Side (fix.Side_SELL)) # 54 group.setField (fix.OrderID (self.genOrderID ())) # 37 group.setField (fix.NoPartyIDs (1)) # 453 group.setField (fix.PartyIDSource (fix.PartyIDSource_PROPRIETARY_CUSTOM_CODE)) # 447 group.setField (fix.PartyID ("CLEARING")) # 448 group.setField (fix.PartyRole (fix.PartyRole_CLEARING_ACCOUNT)) # 452 trade.addGroup (group) group.setField (fix.Side (fix.Side_BUY)) # 54 group.setField (fix.OrderID (self.genOrderID ())) # 37 group.setField (fix.NoPartyIDs (1)) # 453 group.setField (fix.PartyIDSource (fix.PartyIDSource_PROPRIETARY_CUSTOM_CODE)) # 447 group.setField (fix.PartyID ("CLEARING")) # 448 group.setField (fix.PartyRole (fix.PartyRole_CLEARING_ACCOUNT)) # 452 trade.addGroup (group) fix.Session.sendToTarget (trade, self.sessionID) </code></pre> <p>这得益于以下代码片段:</p> ^{pr2}$ <p><strong>更新</strong></p> <p>消息交换如下(I=发起方,A=接受者):</p> <pre><code>1. I ---------- LOGON -----------> A 2. I <--------- LOGON ------------ A 3. I ---- TradeCaptureReport ----> A 4. I ---------- LOGOFF ----------> A 5. I <--------- LOGOFF ----------- A </code></pre> <p>如你所见,在3之间。和4。缺少TradeCaptureReportAck类型的消息。在</p> <p>任何暗示都是最受欢迎的!在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>尝试实现fromAdmin和fromApp方法,您应该会在这里看到返回修复消息。检查您的TradeCaptureReportAck是否到达此处,并确认它们遵循与登录、注销和心跳相同的调用。并实现onMessage方法,或检查是否在此处收到任何修复消息。这应该是您应该看到ACK返回消息的地方。在</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何添加虚拟方法
8 回答
如何添加表示整数的擦边字符串?
3 回答
如何添加要在Bokeh中使用的新font.ttf文件?
9 回答
如何添加要显示的矩阵XY轴编号和XY轴
7 回答
如何添加计数?
10 回答
如何添加计数器函数?
1 回答
如何添加计数器列来计算数据帧中另一列中的特定值?
5 回答
如何添加计数器来跟踪while循环中的月份和年份?
8 回答
如何添加计数并删除countplot的顶部和右侧脊椎?
1 回答
如何添加计时器wx.应用程序更新窗口对象的主循环?
8 回答
如何添加评论到帖子?PostDetailVew,Django 2.1.5
9 回答
如何添加评论拉梅尔亚姆
2 回答
如何添加诸如矩阵Python/Pandas之类的数据帧?
8 回答
如何添加谷歌地点自动完成到Flask?
6 回答
如何添加超时、python discord bot
3 回答
如何添加超过1dp的检查
10 回答
如何添加距离方法
3 回答
如何添加跟随游戏的敌人精灵
10 回答
如何添加路径以便python可以找到程序?
6 回答
如何添加身份验证/安全性以使用happybase访问HBase?
10 回答