修复交易对手的连接问题

2024-05-03 10:48:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试连接到我的交易对手的补丁

对于修复连接,我将使用quickfixpython。这是我的quickfix的settings.configSenderCompIdTargetCompId端口主机从对方收到):

[DEFAULT]
ConnectionType=initiator
FileStorePath=C:\Users\me\Desktop\fix\store
FileLogPath=C:\Users\me\Desktop\fix\log
SenderCompID=sendid
[SESSION]
BeginString=FIX.4.4
ResetOnLogon=Y
StartTime=21:05:00
EndTime=21:03:00
TargetCompID=targid
HeartBtInt=30
SocketConnectPort=port
SocketConectHost=ip
DataDictionary=C:\Users\me\Desktop\fix\FIX44.xml

下面是我的简单应用程序的代码。我首先尝试向我的交易对手发送登录消息(密码也从交易对手收到):

class App(fix.Application):
    def onCreate(self, sessionID):
        print('on create')
        return
    def onLogon(self, sessionID):
        self.sessionID = sessionID
        print("Success Logon to session '%s'.", sessionID.toString())
        return
    def onLogout(self, sessionID):
        print('on logout')
        return
    def toAdmin(self, message, sessionID):
        print('to admin')
        if message.getHeader().getField(35) == 'A':
            message.setField(554, 'password')
        print(message.toString())
        return
    def toApp(self, message, sessionID):
        print("Receive message \n", message.toString())
        return
    def fromAdmin(self, message, sessionID):
        print('from admin')
        return
    def fromApp(self, message, sessionID):
        print('from app')
        return

settings = fix.SessionSettings('settings.config')
storeFactory = fix.SocketInitiator(application, storeFactory, settings, logFactory)
initiator.start()
print('initiator start')

我的应用程序的输出如下(复制时修复消息分隔符的问题):

on create
initiator start

在我的日志路径中initiator.start()之后创建四个.txt文件。他们的名字是:

FIX.4.4-sendid-targid.event.current.log
FIX.4.4-sendid-targid.messages.current.log
GLOBAL.event.current.log
GLOBAL.messages.current.log

FIX.4.4-sendid-targid.event.current.log中创建一条消息: date-time: Created session ,其他的都是空的

如您所见,我正在尝试向我的交易对手发送登录消息。但是,我没有收到任何关于成功登录的输出。交易对手也不认为我方有任何关联

有什么问题吗?我似乎每件事都是按规定做的。 请帮忙


Tags: selflog消息messagereturnsettingsdef交易