From 41f80de940d74b660229964d863b10835fb6ef59 Mon Sep 17 00:00:00 2001 From: Archer Date: Mon, 15 Apr 2019 17:59:55 +0800 Subject: [PATCH 1/7] add gateway onetoken --- vnpy/gateway/onetoken/__init__.py | 1 + vnpy/gateway/onetoken/onetoken_gateway.py | 265 ++++++++++++++++++++++ 2 files changed, 266 insertions(+) create mode 100644 vnpy/gateway/onetoken/__init__.py create mode 100644 vnpy/gateway/onetoken/onetoken_gateway.py diff --git a/vnpy/gateway/onetoken/__init__.py b/vnpy/gateway/onetoken/__init__.py new file mode 100644 index 00000000..ace37fbe --- /dev/null +++ b/vnpy/gateway/onetoken/__init__.py @@ -0,0 +1 @@ +from .onetoken_gateway import OnetokenGateway diff --git a/vnpy/gateway/onetoken/onetoken_gateway.py b/vnpy/gateway/onetoken/onetoken_gateway.py new file mode 100644 index 00000000..653ffe7f --- /dev/null +++ b/vnpy/gateway/onetoken/onetoken_gateway.py @@ -0,0 +1,265 @@ +# encoding: UTF-8 +""" +""" + +import hashlib +import hmac +import sys +import time +import json +from copy import copy +from datetime import datetime +from threading import Lock +from urllib.parse import urlencode + +from requests import ConnectionError + +from vnpy.api.rest import Request, RestClient +from vnpy.api.websocket import WebsocketClient +from vnpy.trader.constant import ( + Direction, + Exchange, + OrderType, + Product, + Status, + Offset +) +from vnpy.trader.gateway import BaseGateway +from vnpy.trader.object import ( + TickData, + OrderData, + TradeData, + PositionData, + AccountData, + ContractData, + OrderRequest, + CancelRequest, + SubscribeRequest, +) +from urllib.parse import urlparse + + +REST_HOST = 'https://1token.trade/api' + +DIRECTION_VT2ONETOKEN = {Direction.LONG: "b", Direction.SHORT: "s"} +DIRECTION_ONETOKEN2VT = {v: k for k, v in DIRECTION_VT2ONETOKEN.items()} + + +class OnetokenGateway(BaseGateway): + """ + VN Trader Gateway for 1Token connection + """ + + default_setting = { + "OT Key": "", + "OT Secret": "", + "会话数": 3, + "服务器": ["REAL", "TESTNET"], + "代理地址": "127.0.0.1", + "代理端口": 1080, + } + + def __init__(self, event_engine): + """Constructor""" + super(OnetokenGateway, self).__init__(event_engine, "1Token") + + self.rest_api = OnetokenRestApi(self) + + def connect(self, setting: dict): + """""" + key = setting["OT Key"] + secret = setting["OT Secret"] + session_number = setting["会话数"] # todo + server = setting["服务器"] + proxy_host = setting["代理地址"] + proxy_port = setting["代理端口"] + self.rest_api.connect(key, secret, session_number, + server, proxy_host, proxy_port) + + def subscribe(self, req: SubscribeRequest): + """""" + pass + # self.ws_api.subscribe(req) + + def send_order(self, req: OrderRequest): + """""" + return self.rest_api.send_order(req) + + def cancel_order(self, req: CancelRequest): + """""" + pass + # self.rest_api.cancel_order(req) + + def query_account(self): + """""" + self.rest_api.get_account() + + def query_position(self): + """""" + pass + + def close(self): + """""" + self.rest_api.stop() + + +class OnetokenRestApi(RestClient): + """ + 1Token REST API + """ + + def __init__(self, gateway: BaseGateway): + """""" + super(OnetokenRestApi, self).__init__() + + self.gateway = gateway + self.gateway_name = gateway.gateway_name + + self.key = "" + self.secret = "" + + self.order_count = 1_000_000 + self.order_count_lock = Lock() + + self.connect_time = 0 + self.account = "okex/mock-archer" # todo + + def sign(self, request): + """ + Generate 1Token signature. + """ + timeout = 15 + method = request.method + + endpoint = request.path + parsed_url = urlparse(endpoint) + path = parsed_url.path + + nonce = str(int(time.time() * 1000000)) + + data = request.data + json_str = json.dumps(data) if data else '' + + message = method + path + nonce + json_str + + signature = hmac.new(bytes(self.secret, 'utf8'), bytes(message, 'utf8'), digestmod=hashlib.sha256).hexdigest() + + headers = {'Api-Nonce': nonce, + 'Api-Key': self.key, + 'Api-Signature': signature, + 'Content-Type': 'application/json'} + request.headers = headers + return request + + def connect( + self, + key: str, + secret: str, + session_number: int, + server: str, + proxy_host: str, + proxy_port: int, + ): + """ + Initialize connection to REST server. + """ + self.key = key + self.secret = secret + + self.connect_time = ( + int(datetime.now().strftime("%y%m%d%H%M%S")) * self.order_count + ) + + self.init(REST_HOST, proxy_host, proxy_port) + + self.start(session_number) + + self.gateway.write_log("REST API启动成功") + + self.query_account() + + def _new_order_id(self): + with self.order_count_lock: + self.order_count += 1 + return self.order_count + + def query_account(self): + """""" + self.add_request( + "GET", + "/v1/trade/{}/info".format(self.account), + callback=self.on_query_account + ) + + def on_query_account(self, data, request): + """""" + for account_data in data["position"]: + account = AccountData( + accountid=account_data["contract"], + balance=float(account_data["total_amount"]), + frozen=float(account_data["frozen"]), + gateway_name=self.gateway_name + ) + self.gateway.on_account(account) + + self.gateway.write_log("账户资金查询成功") + + def send_order(self, req: OrderRequest): + """""" + orderid = str(self.connect_time + self._new_order_id()) + + data = { + "contract": req.symbol, + 'price': float(req.price), + "side": DIRECTION_VT2ONETOKEN[req.direction], + 'amount': float(req.volume) + } + + if req.offset == Offset.CLOSE: + data['options'] = {'close': True} + + order = req.create_order_data(orderid, self.gateway_name) + + self.add_request( + method="POST", + path="/v1/trade/{}/info".format(self.account), + callback=self.on_send_order, + data=data, + extra=order, + on_failed=self.on_send_order_failed, + on_error=self.on_send_order_error + ) + + self.gateway.on_order(order) + return order.vt_orderid + + def on_send_order(self, data, request): + msg = request.response.text + self.gateway.write_log(msg) + + #todo + def on_send_order_failed(self, status_code: str, request: Request): + """ + Callback when sending order failed on server. + """ + order = request.extra + order.status = Status.REJECTED + self.gateway.on_order(order) + + msg = f"委托失败,状态码:{status_code},信息:{request.response.text}" + self.gateway.write_log(msg) + + #todo + def on_send_order_error( + self, exception_type: type, exception_value: Exception, tb, request: Request + ): + """ + Callback when sending order caused exception. + """ + order = request.extra + order.status = Status.REJECTED + self.gateway.on_order(order) + + # Record exception if not ConnectionError + if not issubclass(exception_type, ConnectionError): + self.on_error(exception_type, exception_value, tb, request) \ No newline at end of file From 3da8d4426c4f1825c89af90fa011b7af26c79356 Mon Sep 17 00:00:00 2001 From: Archer Date: Mon, 15 Apr 2019 20:28:47 +0800 Subject: [PATCH 2/7] debug: signature --- vnpy/gateway/onetoken/onetoken_gateway.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/vnpy/gateway/onetoken/onetoken_gateway.py b/vnpy/gateway/onetoken/onetoken_gateway.py index 653ffe7f..592d78e1 100644 --- a/vnpy/gateway/onetoken/onetoken_gateway.py +++ b/vnpy/gateway/onetoken/onetoken_gateway.py @@ -39,7 +39,7 @@ from vnpy.trader.object import ( from urllib.parse import urlparse -REST_HOST = 'https://1token.trade/api' +REST_HOST = 'https://1token.trade/api/v1/trade' DIRECTION_VT2ONETOKEN = {Direction.LONG: "b", Direction.SHORT: "s"} DIRECTION_ONETOKEN2VT = {v: k for k, v in DIRECTION_VT2ONETOKEN.items()} @@ -136,14 +136,14 @@ class OnetokenRestApi(RestClient): path = parsed_url.path nonce = str(int(time.time() * 1000000)) - data = request.data json_str = json.dumps(data) if data else '' message = method + path + nonce + json_str signature = hmac.new(bytes(self.secret, 'utf8'), bytes(message, 'utf8'), digestmod=hashlib.sha256).hexdigest() - + print('message:>>>', message) + print('signature:>>>>>', signature) headers = {'Api-Nonce': nonce, 'Api-Key': self.key, 'Api-Signature': signature, @@ -187,12 +187,13 @@ class OnetokenRestApi(RestClient): """""" self.add_request( "GET", - "/v1/trade/{}/info".format(self.account), + "/{}/info".format(self.account), callback=self.on_query_account ) def on_query_account(self, data, request): """""" + print('on response>>>>>>>>>>>>>>>>>>>>', data, request) for account_data in data["position"]: account = AccountData( accountid=account_data["contract"], @@ -209,10 +210,10 @@ class OnetokenRestApi(RestClient): orderid = str(self.connect_time + self._new_order_id()) data = { - "contract": req.symbol, - 'price': float(req.price), - "side": DIRECTION_VT2ONETOKEN[req.direction], - 'amount': float(req.volume) + 'contract': req.symbol, + 'price': int(req.price), + "bs": DIRECTION_VT2ONETOKEN[req.direction], + 'amount': int(req.volume) } if req.offset == Offset.CLOSE: @@ -222,7 +223,7 @@ class OnetokenRestApi(RestClient): self.add_request( method="POST", - path="/v1/trade/{}/info".format(self.account), + path="/{}/orders".format(self.account), callback=self.on_send_order, data=data, extra=order, From 64e314a547ac3bf62bf4f3631ba53f6ea5683d3a Mon Sep 17 00:00:00 2001 From: Archer Date: Tue, 16 Apr 2019 15:24:25 +0800 Subject: [PATCH 3/7] update: OnetokenRestApi --- vnpy/gateway/onetoken/onetoken_gateway.py | 128 ++++++++++++++++------ 1 file changed, 92 insertions(+), 36 deletions(-) diff --git a/vnpy/gateway/onetoken/onetoken_gateway.py b/vnpy/gateway/onetoken/onetoken_gateway.py index 592d78e1..360c3c39 100644 --- a/vnpy/gateway/onetoken/onetoken_gateway.py +++ b/vnpy/gateway/onetoken/onetoken_gateway.py @@ -53,8 +53,9 @@ class OnetokenGateway(BaseGateway): default_setting = { "OT Key": "", "OT Secret": "", + "交易所": "", + "账户": "", "会话数": 3, - "服务器": ["REAL", "TESTNET"], "代理地址": "127.0.0.1", "代理端口": 1080, } @@ -69,12 +70,13 @@ class OnetokenGateway(BaseGateway): """""" key = setting["OT Key"] secret = setting["OT Secret"] - session_number = setting["会话数"] # todo - server = setting["服务器"] + session_number = setting["会话数"] + exchange = setting["交易所"].lower() + account = setting["账户"] proxy_host = setting["代理地址"] proxy_port = setting["代理端口"] self.rest_api.connect(key, secret, session_number, - server, proxy_host, proxy_port) + exchange, account, proxy_host, proxy_port) def subscribe(self, req: SubscribeRequest): """""" @@ -87,12 +89,11 @@ class OnetokenGateway(BaseGateway): def cancel_order(self, req: CancelRequest): """""" - pass - # self.rest_api.cancel_order(req) + self.rest_api.cancel_order(req) def query_account(self): """""" - self.rest_api.get_account() + pass def query_position(self): """""" @@ -117,38 +118,38 @@ class OnetokenRestApi(RestClient): self.key = "" self.secret = "" + self.exchange = "" self.order_count = 1_000_000 self.order_count_lock = Lock() self.connect_time = 0 - self.account = "okex/mock-archer" # todo + self.account = "" def sign(self, request): """ Generate 1Token signature. """ - timeout = 15 method = request.method endpoint = request.path parsed_url = urlparse(endpoint) path = parsed_url.path - nonce = str(int(time.time() * 1000000)) + nonce = str(int(time.time() * 1e6)) data = request.data - json_str = json.dumps(data) if data else '' + json_str = data if data else '' message = method + path + nonce + json_str signature = hmac.new(bytes(self.secret, 'utf8'), bytes(message, 'utf8'), digestmod=hashlib.sha256).hexdigest() - print('message:>>>', message) - print('signature:>>>>>', signature) + headers = {'Api-Nonce': nonce, 'Api-Key': self.key, 'Api-Signature': signature, 'Content-Type': 'application/json'} request.headers = headers + return request def connect( @@ -156,7 +157,8 @@ class OnetokenRestApi(RestClient): key: str, secret: str, session_number: int, - server: str, + exchange: str, + account: str, proxy_host: str, proxy_port: int, ): @@ -165,6 +167,8 @@ class OnetokenRestApi(RestClient): """ self.key = key self.secret = secret + self.exchange = exchange + self.account = account self.connect_time = ( int(datetime.now().strftime("%y%m%d%H%M%S")) * self.order_count @@ -183,49 +187,74 @@ class OnetokenRestApi(RestClient): self.order_count += 1 return self.order_count - def query_account(self): + def query_account(self): # get balance and positions at the same time """""" self.add_request( "GET", - "/{}/info".format(self.account), + "/{}/{}/info".format(self.exchange, self.account), callback=self.on_query_account ) def on_query_account(self, data, request): - """""" - print('on response>>>>>>>>>>>>>>>>>>>>', data, request) + """This is for WS Example""" for account_data in data["position"]: - account = AccountData( - accountid=account_data["contract"], - balance=float(account_data["total_amount"]), - frozen=float(account_data["frozen"]), - gateway_name=self.gateway_name - ) - self.gateway.on_account(account) + _type = account_data['type'] + if 'spot' in _type: #统计balance + account = AccountData( + accountid=account_data["contract"], + balance=float(account_data["total_amount"]), + frozen=float(account_data["frozen"]), + gateway_name=self.gateway_name + ) + self.gateway.on_account(account) + elif _type == 'future': #期货合约 + long_position = PositionData( + symbol=account_data["contract"], + exchange=Exchange.OKEX, # todo add Exchange + direction=Direction.LONG, + volume=account_data['total_amount_long'], + frozen=account_data['total_amount_long'] - account_data['available_long'], + gateway_name=self.gateway_name, + # yd_volume=? + ) + short_position = PositionData( + symbol=account_data["contract"], + exchange=Exchange.OKEX, # todo add Exchange + direction=Direction.SHORT, + volume=account_data['total_amount_short'], + frozen=account_data['total_amount_short'] - account_data['available_short'], + gateway_name=self.gateway_name, + # yd_volume=? + ) + self.gateway.on_position(long_position) + self.gateway.on_position(short_position) self.gateway.write_log("账户资金查询成功") + self.gateway.write_log("账户持仓查询成功") def send_order(self, req: OrderRequest): """""" orderid = str(self.connect_time + self._new_order_id()) data = { - 'contract': req.symbol, - 'price': int(req.price), + 'contract': self.exchange + '/' + req.symbol, + 'price': float(req.price), "bs": DIRECTION_VT2ONETOKEN[req.direction], - 'amount': int(req.volume) + 'amount': float(req.volume), + 'client_oid': orderid } if req.offset == Offset.CLOSE: data['options'] = {'close': True} - + data = json.dumps(data) order = req.create_order_data(orderid, self.gateway_name) self.add_request( method="POST", - path="/{}/orders".format(self.account), + path="/{}/{}/orders".format(self.exchange, self.account), callback=self.on_send_order, data=data, + params={}, extra=order, on_failed=self.on_send_order_failed, on_error=self.on_send_order_error @@ -234,11 +263,25 @@ class OnetokenRestApi(RestClient): self.gateway.on_order(order) return order.vt_orderid - def on_send_order(self, data, request): - msg = request.response.text - self.gateway.write_log(msg) + def cancel_order(self, req: CancelRequest): + """""" + params = { + 'client_oid': req.orderid + } + + self.add_request( + method="DELETE", + path="/{}/{}/orders".format(self.exchange, self.account), + callback=self.on_cancel_order, + params=params, + on_error=self.on_cancel_order_error, + extra=req + ) + + def on_send_order(self, data, request): + """Websocket will push a new order status""" + pass - #todo def on_send_order_failed(self, status_code: str, request: Request): """ Callback when sending order failed on server. @@ -250,7 +293,6 @@ class OnetokenRestApi(RestClient): msg = f"委托失败,状态码:{status_code},信息:{request.response.text}" self.gateway.write_log(msg) - #todo def on_send_order_error( self, exception_type: type, exception_value: Exception, tb, request: Request ): @@ -263,4 +305,18 @@ class OnetokenRestApi(RestClient): # Record exception if not ConnectionError if not issubclass(exception_type, ConnectionError): - self.on_error(exception_type, exception_value, tb, request) \ No newline at end of file + self.on_error(exception_type, exception_value, tb, request) + + def on_cancel_order(self, data, request): + """Websocket will push a new order status""" + pass + + def on_cancel_order_error( + self, exception_type: type, exception_value: Exception, tb, request: Request + ): + """ + Callback when cancelling order failed on server. + """ + # Record exception if not ConnectionError + if not issubclass(exception_type, ConnectionError): + self.on_error(exception_type, exception_value, tb, request) From 7ee538125e5831cc2d15f1f37e736f9e31871df8 Mon Sep 17 00:00:00 2001 From: Archer Date: Tue, 16 Apr 2019 15:34:06 +0800 Subject: [PATCH 4/7] update: flake8 --- vnpy/gateway/onetoken/onetoken_gateway.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vnpy/gateway/onetoken/onetoken_gateway.py b/vnpy/gateway/onetoken/onetoken_gateway.py index 360c3c39..a0ada054 100644 --- a/vnpy/gateway/onetoken/onetoken_gateway.py +++ b/vnpy/gateway/onetoken/onetoken_gateway.py @@ -171,7 +171,7 @@ class OnetokenRestApi(RestClient): self.account = account self.connect_time = ( - int(datetime.now().strftime("%y%m%d%H%M%S")) * self.order_count + int(datetime.now().strftime("%y%m%d%H%M%S")) * self.order_count ) self.init(REST_HOST, proxy_host, proxy_port) @@ -199,7 +199,7 @@ class OnetokenRestApi(RestClient): """This is for WS Example""" for account_data in data["position"]: _type = account_data['type'] - if 'spot' in _type: #统计balance + if 'spot' in _type: # 统计balance account = AccountData( accountid=account_data["contract"], balance=float(account_data["total_amount"]), @@ -207,7 +207,7 @@ class OnetokenRestApi(RestClient): gateway_name=self.gateway_name ) self.gateway.on_account(account) - elif _type == 'future': #期货合约 + elif _type == 'future': # 期货合约 long_position = PositionData( symbol=account_data["contract"], exchange=Exchange.OKEX, # todo add Exchange From e4f4ed4f624e90128239b0b3c471a81bb6ac9a95 Mon Sep 17 00:00:00 2001 From: Archer Date: Tue, 16 Apr 2019 16:12:17 +0800 Subject: [PATCH 5/7] update: removed unused import --- vnpy/gateway/onetoken/onetoken_gateway.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/vnpy/gateway/onetoken/onetoken_gateway.py b/vnpy/gateway/onetoken/onetoken_gateway.py index a0ada054..03e1c4a5 100644 --- a/vnpy/gateway/onetoken/onetoken_gateway.py +++ b/vnpy/gateway/onetoken/onetoken_gateway.py @@ -4,40 +4,29 @@ import hashlib import hmac -import sys -import time import json -from copy import copy +import time from datetime import datetime from threading import Lock -from urllib.parse import urlencode +from urllib.parse import urlparse from requests import ConnectionError from vnpy.api.rest import Request, RestClient -from vnpy.api.websocket import WebsocketClient from vnpy.trader.constant import ( Direction, Exchange, - OrderType, - Product, Status, Offset ) from vnpy.trader.gateway import BaseGateway from vnpy.trader.object import ( - TickData, - OrderData, - TradeData, PositionData, AccountData, - ContractData, OrderRequest, CancelRequest, SubscribeRequest, ) -from urllib.parse import urlparse - REST_HOST = 'https://1token.trade/api/v1/trade' From d201c5b65a1ef463e8ba6bec8d21feaeeb2e7818 Mon Sep 17 00:00:00 2001 From: Archer Date: Tue, 16 Apr 2019 19:40:11 +0800 Subject: [PATCH 6/7] add: query_time query_contract --- vnpy/gateway/onetoken/onetoken_gateway.py | 62 ++++++++++++++++++++--- 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/vnpy/gateway/onetoken/onetoken_gateway.py b/vnpy/gateway/onetoken/onetoken_gateway.py index 03e1c4a5..4f63be89 100644 --- a/vnpy/gateway/onetoken/onetoken_gateway.py +++ b/vnpy/gateway/onetoken/onetoken_gateway.py @@ -17,7 +17,8 @@ from vnpy.trader.constant import ( Direction, Exchange, Status, - Offset + Offset, + Product ) from vnpy.trader.gateway import BaseGateway from vnpy.trader.object import ( @@ -26,9 +27,10 @@ from vnpy.trader.object import ( OrderRequest, CancelRequest, SubscribeRequest, + ContractData ) -REST_HOST = 'https://1token.trade/api/v1/trade' +REST_HOST = 'https://1token.trade/api' DIRECTION_VT2ONETOKEN = {Direction.LONG: "b", Direction.SHORT: "s"} DIRECTION_ONETOKEN2VT = {v: k for k, v in DIRECTION_VT2ONETOKEN.items()} @@ -121,7 +123,9 @@ class OnetokenRestApi(RestClient): """ method = request.method - endpoint = request.path + endpoint = '/' + request.path.split('/', 3)[3] + # v1/trade/okex/mock-example/info -> okex/mock-example/info + print('endpoint>>>>', endpoint) parsed_url = urlparse(endpoint) path = parsed_url.path @@ -169,6 +173,8 @@ class OnetokenRestApi(RestClient): self.gateway.write_log("REST API启动成功") + self.query_time() + self.query_contract() self.query_account() def _new_order_id(self): @@ -180,7 +186,7 @@ class OnetokenRestApi(RestClient): """""" self.add_request( "GET", - "/{}/{}/info".format(self.exchange, self.account), + "/v1/trade/{}/{}/info".format(self.exchange, self.account), callback=self.on_query_account ) @@ -221,6 +227,50 @@ class OnetokenRestApi(RestClient): self.gateway.write_log("账户资金查询成功") self.gateway.write_log("账户持仓查询成功") + def query_time(self): + """""" + self.add_request( + "GET", + "/v1/basic/time", + callback=self.on_query_time + ) + + def on_query_time(self, data, request): + """""" + server_timestamp = data["server_time"] + dt = datetime.utcfromtimestamp(server_timestamp) + server_time = dt.isoformat() + 'Z' + local_time = datetime.utcnow().isoformat() + msg = f"服务器时间:{server_time},本机时间:{local_time}" + self.gateway.write_log(msg) + + def query_contract(self): + """""" + self.add_request( + "GET", + "/v1/basic/contracts?exchange={}".format(self.exchange), + callback=self.on_query_contract + ) + + def on_query_contract(self, data, request): + """""" + for instrument_data in data: + symbol = instrument_data["name"] + contract = ContractData( + symbol=symbol, + exchange=Exchange.OKEX, # todo + name=symbol, + product=Product.SPOT, # todo + size=float(instrument_data['min_amount']), + pricetick=float(instrument_data['unit_amount']), + gateway_name=self.gateway_name + ) + self.gateway.on_contract(contract) + self.gateway.write_log("合约信息查询成功") + + # Start websocket api after instruments data collected + # self.gateway.ws_api.start() + def send_order(self, req: OrderRequest): """""" orderid = str(self.connect_time + self._new_order_id()) @@ -240,7 +290,7 @@ class OnetokenRestApi(RestClient): self.add_request( method="POST", - path="/{}/{}/orders".format(self.exchange, self.account), + path="/v1/trade/{}/{}/orders".format(self.exchange, self.account), callback=self.on_send_order, data=data, params={}, @@ -260,7 +310,7 @@ class OnetokenRestApi(RestClient): self.add_request( method="DELETE", - path="/{}/{}/orders".format(self.exchange, self.account), + path="/v1/trade/{}/{}/orders".format(self.exchange, self.account), callback=self.on_cancel_order, params=params, on_error=self.on_cancel_order_error, From 76a8c5752c57102bad20277a777a5279d29f0c1d Mon Sep 17 00:00:00 2001 From: Archer Date: Tue, 16 Apr 2019 19:41:12 +0800 Subject: [PATCH 7/7] update --- vnpy/gateway/onetoken/onetoken_gateway.py | 1 - 1 file changed, 1 deletion(-) diff --git a/vnpy/gateway/onetoken/onetoken_gateway.py b/vnpy/gateway/onetoken/onetoken_gateway.py index 4f63be89..772a5913 100644 --- a/vnpy/gateway/onetoken/onetoken_gateway.py +++ b/vnpy/gateway/onetoken/onetoken_gateway.py @@ -125,7 +125,6 @@ class OnetokenRestApi(RestClient): endpoint = '/' + request.path.split('/', 3)[3] # v1/trade/okex/mock-example/info -> okex/mock-example/info - print('endpoint>>>>', endpoint) parsed_url = urlparse(endpoint) path = parsed_url.path