Skip to content

Commit

Permalink
[Fix]Close vnpy#1239
Browse files Browse the repository at this point in the history
  • Loading branch information
vnpy-dev-01 committed Nov 17, 2018
1 parent 2728577 commit 4229f6e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion vnpy/api/okex/vnokex.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import hashlib
import json
import traceback
import zlib
from threading import Thread
from time import sleep

Expand Down Expand Up @@ -145,7 +146,13 @@ def initWebsocket(self):
#----------------------------------------------------------------------
def readData(self, evt):
"""解码推送收到的数据"""
data = json.loads(evt)
# 先解压
decompress = zlib.decompressobj(-zlib.MAX_WBITS)
inflated = decompress.decompress(evt)
inflated += decompress.flush()

# 再转换为json
data = json.loads(inflated)
return data

#----------------------------------------------------------------------
Expand Down

0 comments on commit 4229f6e

Please sign in to comment.