python – 使用stunnel建立与DUKASCOPY的连接
作者:互联网
寻找一些帮助建立与我的经纪人DUKASCOPY的连接使用stunnel和quickfix python而不是FIX4.4协议.
这是我的stunnel配置:
client = yes
cert = /etc/stunnel/stunnel.pem
[OKSERVER]
accept = 9443
connect = demo-api.dukascopy.com:10443
我的quickfix cfg文件:
[DEFAULT]
ConnectionType=initiator
LogonTimeout=30
ReconnectInterval=30
ResetOnLogon=Y
FileLogPath=./Logs/
[SESSION]
BeginString=FIX.4.4
SenderCompID=SENDER_ID # replaced with anonymous value for this post
TargetCompID=TARGET_ID # replaced with anonymous value for this post
StartTime=00:00:00
EndTime=00:00:00
HeartBtInt=30
CheckLatency=N
MaxLatency=240
SocketConnectPort=10443
SocketConnectHost=demo-api.dukascopy.com
UseDataDictionary=Y
DataDictionary=/home/jaspal/qfsample/quickfix/spec/FIX44.xml
FileStorePath=./Sessions/
当我尝试登录时,我得到:
20181002-22:26:23.972817000 : Created session
20181002-22:26:23.978505000 : Connecting to demo-api.dukascopy.com on port 10443 (Source :0)
20181002-22:26:24.023770000 : Initiated logon request
20181002-22:26:24.065703000 : Socket Error: Connection reset by peer.
20181002-22:26:24.065799000 : Disconnecting
我可以确认我正在收听传入端口:
~/qfsample/quickfix-python-sample$netstat -an | grep 9443
tcp 0 0 0.0.0.0:9443 0.0.0.0:* LISTEN
我还在我的路由器上配置了9443以将其转发到客户端计算机.
这是我从应用程序获得的消息:
onCreate(self=<__main__.Application; proxy of <Swig Object of type 'FIX::Application *' at 0x7f87db719030> >, sessionID=<quickfix.SessionID; proxy of <Swig Object of type 'FIX::SessionID *' at 0x7f87db6674e0> >)
toAdmin(self=<__main__.Application; proxy of <Swig Object of type 'FIX::Application *' at 0x7f87db719030> >, sessionID=<quickfix.Message; proxy of <Swig Object of type 'FIX::Message *' at 0x7f87db667e70> >, message=<quickfix.SessionID; proxy of <Swig Object of type 'FIX::SessionID *' at 0x7f87db667d20> >)
任何有关在这里找到问题的帮助都将非常受欢迎!
解决方法:
好.所以我想我不可避免地要从这个伟大的论坛得到一些帮助,或者自己搞清楚!在这种情况下是后者!
这是我出错的地方:
使用stunnel创建隧道时,必须在stunnel配置中为“accept”创建的端口设置目标到本地计算机,而不是代理的地址.现在很明显!这是我的cfg文件现在的样子:
SocketConnectPort=9443
SocketConnectHost=localhost
标签:python,quickfix,stunnel,fix-protocol 来源: https://codeday.me/bug/20190827/1746143.html