我在使用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
我来自埃及,客户来自新西兰,这是因为埃及的知识产权问题吗?
答案 0 :(得分:0)
确切的原因很难通过有限的发布细节来说明。
尽管如此,大多数基于FIX协议的API服务提供商都不允许您的代码在全球互联网上裸露连接。
首先通常使用ssh-application-gateway加密连接和用户访问授权,以便实际的交易事务和报价流事件都流过加密的ssh-tunnel,所有内容都保护不受未授权的{被动|活跃的 - 活动的或滥用的。
与您的基于FIX协议的API服务提供商协调您的访问凭据,加密详细信息和正确的L3 +连接详细信息,以便配置访问平面的本地端和XTO / QUOTE平面进行交易-stream和quote-stream接口以完全符合服务提供商文档的方式接口。
出于自然原因,没有其他方式前进。