[Mod] complete test of okexs gateway
This commit is contained in:
parent
b9738f41f1
commit
d4f9c7ca05
@ -21,6 +21,7 @@ from vnpy.gateway.okex import OkexGateway
|
|||||||
from vnpy.gateway.bitfinex import BitfinexGateway
|
from vnpy.gateway.bitfinex import BitfinexGateway
|
||||||
# from vnpy.gateway.onetoken import OnetokenGateway
|
# from vnpy.gateway.onetoken import OnetokenGateway
|
||||||
from vnpy.gateway.okexf import OkexfGateway
|
from vnpy.gateway.okexf import OkexfGateway
|
||||||
|
from vnpy.gateway.okexs import OkexsGateway
|
||||||
# from vnpy.gateway.xtp import XtpGateway
|
# from vnpy.gateway.xtp import XtpGateway
|
||||||
# from vnpy.gateway.hbdm import HbdmGateway
|
# from vnpy.gateway.hbdm import HbdmGateway
|
||||||
# from vnpy.gateway.tap import TapGateway
|
# from vnpy.gateway.tap import TapGateway
|
||||||
@ -49,7 +50,7 @@ def main():
|
|||||||
# main_engine.add_gateway(CtpGateway)
|
# main_engine.add_gateway(CtpGateway)
|
||||||
# main_engine.add_gateway(CtptestGateway)
|
# main_engine.add_gateway(CtptestGateway)
|
||||||
# main_engine.add_gateway(MiniGateway)
|
# main_engine.add_gateway(MiniGateway)
|
||||||
main_engine.add_gateway(SoptGateway)
|
# main_engine.add_gateway(SoptGateway)
|
||||||
# main_engine.add_gateway(MinitestGateway)
|
# main_engine.add_gateway(MinitestGateway)
|
||||||
# main_engine.add_gateway(FemasGateway)
|
# main_engine.add_gateway(FemasGateway)
|
||||||
# main_engine.add_gateway(IbGateway)
|
# main_engine.add_gateway(IbGateway)
|
||||||
@ -67,6 +68,7 @@ def main():
|
|||||||
# main_engine.add_gateway(TapGateway)
|
# main_engine.add_gateway(TapGateway)
|
||||||
# main_engine.add_gateway(ToraGateway)
|
# main_engine.add_gateway(ToraGateway)
|
||||||
# main_engine.add_gateway(AlpacaGateway)
|
# main_engine.add_gateway(AlpacaGateway)
|
||||||
|
main_engine.add_gateway(OkexsGateway)
|
||||||
|
|
||||||
main_engine.add_app(CtaStrategyApp)
|
main_engine.add_app(CtaStrategyApp)
|
||||||
main_engine.add_app(CtaBacktesterApp)
|
main_engine.add_app(CtaBacktesterApp)
|
||||||
|
@ -281,10 +281,7 @@ class OkexsRestApi(RestClient):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def query_accounts(self):
|
def query_accounts(self):
|
||||||
"""
|
""""""
|
||||||
:note: This API not functioning well currently. Due to API replies empty data.
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
self.add_request(
|
self.add_request(
|
||||||
"GET",
|
"GET",
|
||||||
"/api/swap/v3/accounts",
|
"/api/swap/v3/accounts",
|
||||||
@ -355,13 +352,14 @@ class OkexsRestApi(RestClient):
|
|||||||
for info in data['info']:
|
for info in data['info']:
|
||||||
account = _parse_account_info(info, gateway_name=self.gateway_name)
|
account = _parse_account_info(info, gateway_name=self.gateway_name)
|
||||||
self.gateway.on_account(account)
|
self.gateway.on_account(account)
|
||||||
|
|
||||||
self.gateway.write_log("账户资金查询成功")
|
self.gateway.write_log("账户资金查询成功")
|
||||||
|
|
||||||
def on_query_position(self, datas, request):
|
def on_query_position(self, datas, request):
|
||||||
""""""
|
""""""
|
||||||
for data in datas:
|
for data in datas:
|
||||||
holdings = data['holding']
|
holdings = data['holding']
|
||||||
assert 'crossed' == data['margin_mode'], _("只支持全仓模式")
|
|
||||||
for holding in holdings:
|
for holding in holdings:
|
||||||
symbol = holding["instrument_id"].upper()
|
symbol = holding["instrument_id"].upper()
|
||||||
pos = _parse_position_holding(holding, symbol=symbol,
|
pos = _parse_position_holding(holding, symbol=symbol,
|
||||||
|
Loading…
Reference in New Issue
Block a user