[Add]BitfinexApi新增close函数

This commit is contained in:
vn.py 2018-06-10 14:59:33 +08:00
parent c42ecb6ec8
commit bbabd742ff

View File

@ -32,7 +32,7 @@ class BitfinexApi(object):
""""""
self.ws = websocket.create_connection(WEBSOCKET_V2_URL)
self.active =True
self.active = True
self.thread = Thread(target=self.run)
self.thread.start()
@ -61,11 +61,21 @@ class BitfinexApi(object):
self.onError(msg)
self.reconnect()
#----------------------------------------------------------------------
def close(self):
""""""
self.active = False
if self.thread:
self.thread.join()
if self.restThread:
self.thread.join()
#----------------------------------------------------------------------
def onConnect(self):
""""""
print 'connected'
#----------------------------------------------------------------------
def onData(self, data):