我在使用PyFIX连接ctrader和FIX44时遇到了一些问题。
当我将地址和端口添加到我的客户端时,它出现错误。代码:https://github.com/wannabegeek/PyFIX
我的代码:
class Client(FIXEngine):
def __init__(self):
FIXEngine.__init__(self, "h50.p.ctrader.com")
self.clOrdID = 0
self.msgGenerator = None
# create a FIX Client using the FIX 4.4 standard
self.client = FIXClient(self, "pyfix.FIX44", "TARGET", "SENDER")
# we register some listeners since we want to know when the connection goes up or down
self.client.addConnectionListener(self.onConnect, ConnectionState.CONNECTED)
self.client.addConnectionListener(self.onDisconnect, ConnectionState.DISCONNECTED)
# start our event listener indefinitely
self.client.start('178.62.43.199', int("5211"))
while True:
self.eventManager.waitForEventWithTimeout(10.0)
# some clean up before we shut down
self.client.removeConnectionListener(self.onConnect, ConnectionState.CONNECTED)
self.client.removeConnectionListener(self.onConnect, ConnectionState.DISCONNECTED)这就是错误:
2017-09-23 10:56:23,631 Client disconnected
2017-09-23 10:56:23,631 ('178.62.43.199', 5211) has disconnected
2017-09-23 10:56:23,631 Attempting Connection to 178.62.43.199:5211
2017-09-23 10:56:23,740 Connected to ('178.62.43.199', 5211)
2017-09-23 10:56:23,868 Established connection to ('178.62.43.199', 5211)
2017-09-23 10:56:23,869 Connection has been closed [Errno 104] Connection reset by peer
2017-09-23 10:56:23,869 Client disconnected
2017-09-23 10:56:23,869 ('178.62.43.199', 5211) has disconnected
2017-09-23 10:56:23,869 Attempting Connection to 178.62.43.199:5211
2017-09-23 10:56:23,980 Connected to ('178.62.43.199', 5211)
^CTraceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/pyfix/connection.py", line 150, in handle_read
msg = self.sock.recv(8192)
ConnectionResetError: [Errno 104] Connection reset by peer我来自埃及,客户来自新西兰,是不是因为埃及的IP而有问题?
发布于 2017-10-02 00:15:05
不,很可能是因为埃及的IP地址而没有被拒绝
确切的原因很难从有限的张贴细节中说出来。
尽管如此,大多数基于FIX协议的API服务提供商都不允许您的代码在全球互联网上进行裸体连接。
通常首先存在ssh应用网关加密的连接和用户访问授权,使得实际的交易交易和报价流事件都流经加密的ssh隧道,并且所有内容保持受保护以防止未经授权的{被动|主动}-activity或误用。
与基于FIX协议的应用编程接口服务提供商协调您的访问凭证、加密详细信息和适当的L3+连接详细信息,以便以完全符合服务提供商文档的方式为交易流和报价流接口配置访问平面的本地端和XTO/报价平面。
由于自然原因,没有其他方法可以向前发展。
https://stackoverflow.com/questions/46377988
复制相似问题