[Fix]Close #906,Bitfinex接口新增onConnect回调函数
This commit is contained in:
parent
dfe0304f74
commit
70ed2dfd66
@ -39,11 +39,15 @@ class BitfinexApi(object):
|
||||
self.restThread = Thread(target=self.runRest)
|
||||
self.restThread.start()
|
||||
|
||||
self.onConnect()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def reconnect(self):
|
||||
""""""
|
||||
self.ws = websocket.create_connection(WEBSOCKET_V2_URL)
|
||||
|
||||
self.onConnect()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def run(self):
|
||||
""""""
|
||||
@ -57,6 +61,12 @@ class BitfinexApi(object):
|
||||
self.onError(msg)
|
||||
self.reconnect()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onConnect(self):
|
||||
""""""
|
||||
print 'connected'
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onData(self, data):
|
||||
""""""
|
||||
|
@ -182,7 +182,10 @@ class GatewayApi(BitfinexApi):
|
||||
self.start()
|
||||
self.writeLog(u'交易API启动成功')
|
||||
|
||||
for symbol in symbols:
|
||||
#----------------------------------------------------------------------
|
||||
def onConnect(self):
|
||||
""""""
|
||||
for symbol in self.symbols:
|
||||
self.subscribe(symbol, 'ticker')
|
||||
self.subscribe(symbol, 'book')
|
||||
self.writeLog(u'行情推送订阅成功')
|
||||
|
Loading…
Reference in New Issue
Block a user