使用quickfix python找不到会话错误?

时间:2019-01-23 14:21:47

标签: python-3.x quickfix

我正在使用quickfix python并尝试将测试请求发送到交易对手。调用session_sendToTarget(req)函数时,出现错误“找不到会话”。有人可以告诉我其背后的原因吗?我做错了什么?

配置:

[DEFAULT]
ConnectionType=initiator
ReconnectInterval=60
FileStorePath=store
FileLogPath=client/log
StartTime=17:00:00
EndTime=17:02:00
UseDataDictionary=N
# DataDictionary=spec/FIX44.xml
# TransportDataDictionary=spec/FIX44.xml
# ValidateUserDefinedFields=N
SocketConnectHost=*****
SocketAcceptPort=****
ValidateUserDefinedFields=N
ResetOnLogout=N
ResetOnLogon=Y
DefaultApplVerID=FIX.5.0SP2

# standard config elements

[SESSION]
# inherit ConnectionType, ReconnectInterval and SenderCompID from default
BeginString=FIX.4.4
Symbol=APPL
SenderCompID=******
TargetCompID=******
SocketConnectHost=*****
SocketConnectPort=*****
HeartBtInt=30

Initiator.py

class Application(fix.Application):
    orderID = 0
    execID = 0

    def testrequest(self):
        req = fix44.TestRequest()
        req.setField(35, "A")
        req.setField(fix.RawData("data"))
        fix.Session_sendToTarget(req)

if __name__ == "__main__":
    file = path
    settings = fix.SessionSettings(file)
    application = Application()
    storeFactory = fix.FileStoreFactory(settings)
    logFactory = fix.ScreenLogFactory(settings)
    initiator = fix.SocketInitiator(application, storeFactory, 
    settings, logFactory)
    initiator.start()

    while 1:
      session = initiator.getSessions()
      application.testrequest()

1 个答案:

答案 0 :(得分:0)

您是否尝试过在[SESSION]配置文件中添加 SessionQualifier 属性?

在产品环境(用C#编写)中,我已经限定了配置文件中的每个会话。

如果您需要一些代码,请随时与我联系。

int y[10][2];

也请尝试阅读以下问题: Getting session not found error using quickfix python?