在使用stunnel和quickfixpythonoverfix4.4协议与我的经纪人dukasscopy建立连接方面寻求帮助。
这是我的特技配置:
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