[Mod] complete test of okexs gateway

This commit is contained in:
vn.py 2019-09-03 09:45:40 +08:00
parent b9738f41f1
commit d4f9c7ca05
2 changed files with 6 additions and 6 deletions

View File

@ -21,6 +21,7 @@ from vnpy.gateway.okex import OkexGateway
from vnpy.gateway.bitfinex import BitfinexGateway
# from vnpy.gateway.onetoken import OnetokenGateway
from vnpy.gateway.okexf import OkexfGateway
from vnpy.gateway.okexs import OkexsGateway
# from vnpy.gateway.xtp import XtpGateway
# from vnpy.gateway.hbdm import HbdmGateway
# from vnpy.gateway.tap import TapGateway
@ -49,7 +50,7 @@ def main():
# main_engine.add_gateway(CtpGateway)
# main_engine.add_gateway(CtptestGateway)
# main_engine.add_gateway(MiniGateway)
main_engine.add_gateway(SoptGateway)
# main_engine.add_gateway(SoptGateway)
# main_engine.add_gateway(MinitestGateway)
# main_engine.add_gateway(FemasGateway)
# main_engine.add_gateway(IbGateway)
@ -67,6 +68,7 @@ def main():
# main_engine.add_gateway(TapGateway)
# main_engine.add_gateway(ToraGateway)
# main_engine.add_gateway(AlpacaGateway)
main_engine.add_gateway(OkexsGateway)
main_engine.add_app(CtaStrategyApp)
main_engine.add_app(CtaBacktesterApp)

View File

@ -281,10 +281,7 @@ class OkexsRestApi(RestClient):
)
def query_accounts(self):
"""
:note: This API not functioning well currently. Due to API replies empty data.
:return:
"""
""""""
self.add_request(
"GET",
"/api/swap/v3/accounts",
@ -355,13 +352,14 @@ class OkexsRestApi(RestClient):
for info in data['info']:
account = _parse_account_info(info, gateway_name=self.gateway_name)
self.gateway.on_account(account)
self.gateway.write_log("账户资金查询成功")
def on_query_position(self, datas, request):
""""""
for data in datas:
holdings = data['holding']
assert 'crossed' == data['margin_mode'], _("只支持全仓模式")
for holding in holdings:
symbol = holding["instrument_id"].upper()
pos = _parse_position_holding(holding, symbol=symbol,