Skip to content

Commit bcbeabb

Browse files
authored
Add files via upload
1 parent 6d00ecc commit bcbeabb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fmz.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ def toObj(self):
547547
obj[k] = v
548548
return dic2obj(obj)
549549

550+
class _INFO(_CSTRUCT):
551+
_fields_ = [("s_js", ctypes.c_char_p),
552+
("s_js_size", ctypes.c_uint)]
553+
550554
class _TICKER(_CSTRUCT):
551555
_fields_ = [("Time", ctypes.c_ulonglong),
552556
("Symbol", ctypes.c_char * 31),
@@ -558,9 +562,7 @@ class _TICKER(_CSTRUCT):
558562
("Last", ctypes.c_double),
559563
("Volume", ctypes.c_double),
560564
("OpenInterest", ctypes.c_double),
561-
("data", ctypes.c_char_p),
562-
("data_size", ctypes.c_uint),
563-
]
565+
("Info", _INFO)]
564566

565567
class _FUNDING(_CSTRUCT):
566568
_fields_ = [("Time", ctypes.c_ulonglong),
@@ -748,7 +750,7 @@ def GetData(self, name, timeout=60000, offset=0):
748750
r = _TICKER()
749751
ret = self.lib.api_Exchange_GetData(self.ctx, self.idx, ctypes.byref(r), safe_str(name), int(timeout), int(offset))
750752
if ret == API_ERR_SUCCESS:
751-
return dic2obj({'Time': r.Time, 'Data': json.loads(r.data[:r.data_size]) if r.data_size > 0 else None})
753+
return dic2obj({'Time': r.Time, 'Data': json.loads(r.Info.s_js[:r.Info.s_js_size]) if r.Info.s_js_size > 0 else None})
752754
elif ret == API_ERR_FAILED:
753755
return None
754756
EOF()

0 commit comments

Comments
 (0)