Skip to content

Commit 3b00509

Browse files
authored
Add files via upload
1 parent 984b6b2 commit 3b00509

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

fmz.py

+25-1
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,12 @@ class _TICKER(_CSTRUCT):
562562
("data_size", ctypes.c_uint),
563563
]
564564

565+
class _FUNDING(_CSTRUCT):
566+
_fields_ = [("Time", ctypes.c_ulonglong),
567+
("Rate", ctypes.c_double),
568+
("Period", ctypes.c_uint),
569+
("Symbol", ctypes.c_char * 31)]
570+
565571
class _RECORD(_CSTRUCT):
566572
_fields_ = [("Time", ctypes.c_ulonglong),
567573
("Open", ctypes.c_double),
@@ -782,6 +788,24 @@ def GetTicker(self, symbol=''):
782788
return None
783789
EOF()
784790

791+
def GetFundings(self, symbol=''):
792+
r_len = ctypes.c_uint(0)
793+
buf_ptr = ctypes.c_void_p()
794+
ret = self.lib.api_Exchange_GetFundings(self.ctx, self.idx, safe_str(symbol), ctypes.byref(r_len), ctypes.byref(buf_ptr))
795+
796+
if ret == API_ERR_SUCCESS:
797+
n = r_len.value
798+
eles = []
799+
if n > 0:
800+
group_array = (_FUNDING * n).from_address(buf_ptr.value)
801+
for i in range(0, n):
802+
eles.append(group_array[i].toObj())
803+
self.lib.api_free(buf_ptr)
804+
return eles
805+
elif ret == API_ERR_FAILED:
806+
return None
807+
EOF()
808+
785809
def IO(self, k, v = 0):
786810
if k == 'currency':
787811
return self.SetCurrency(v)
@@ -1427,7 +1451,7 @@ def __init__(self, task = None, autoRun=False, gApis = None, progressCallback=No
14271451
js = os.path.join(tmpCache, crcFile)
14281452
if os.path.exists(js):
14291453
b = open(js, 'rb').read()
1430-
if os.getenv("BOTVS_TASK_UUID") is None or "4968fee289f3e793110db9f76d6abc0c" in str(b):
1454+
if os.getenv("BOTVS_TASK_UUID") is None or "9d352eb2a1590a560bcb54111e5c9c9e" in str(b):
14311455
hdic = json_loads(b)
14321456
loader = os.path.join(tmpCache, soName)
14331457
update = False

0 commit comments

Comments
 (0)