From db905149d6850b25f91267c106db4edb552165f8 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Sat, 4 Aug 2018 22:08:21 +0800 Subject: [PATCH] [Fix]Close #1004 --- vnpy/api/coinbase/vncoinbase.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/vnpy/api/coinbase/vncoinbase.py b/vnpy/api/coinbase/vncoinbase.py index 7efad269..04b3b4d2 100644 --- a/vnpy/api/coinbase/vncoinbase.py +++ b/vnpy/api/coinbase/vncoinbase.py @@ -199,18 +199,14 @@ class CoinbaseWebsocketApi(object): def run(self): """运行""" while self.active: - stream = self.ws.recv() - data = json.loads(stream) - self.onData(data) - - #try: - #stream = self.ws.recv() - #data = json.loads(stream) - #self.onData(data) - #except: - #msg = traceback.format_exc() - #self.onError(msg) - #self.reconnect() + try: + stream = self.ws.recv() + data = json.loads(stream) + self.onData(data) + except: + msg = traceback.format_exc() + self.onError(msg) + self.reconnect() #---------------------------------------------------------------------- def close(self):