[Add]BitfinexApi新增close函数
This commit is contained in:
parent
c42ecb6ec8
commit
bbabd742ff
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user