From a4859a94eb612ef1947019f733cc977073c39ad6 Mon Sep 17 00:00:00 2001 From: nanoric Date: Thu, 11 Oct 2018 04:03:48 -0400 Subject: [PATCH] =?UTF-8?q?[Fix]=20OkexFutureApi:=E5=B0=86onFailed?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=8F=98=E4=B8=BA=E7=9C=9F=E7=9A=84=E5=8F=AF?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/api/okexfuture/OkexFutureApi.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/vnpy/api/okexfuture/OkexFutureApi.py b/vnpy/api/okexfuture/OkexFutureApi.py index fd12887e..4ac26f0d 100644 --- a/vnpy/api/okexfuture/OkexFutureApi.py +++ b/vnpy/api/okexfuture/OkexFutureApi.py @@ -246,7 +246,8 @@ class OkexFutureRestClient(OkexFutureRestBase): remoteId = data['order_id'] extra.onSuccess(remoteId, extra.extra) else: - extra.onFailed(extra.extra) + if extra.onFailed: + extra.onFailed(extra.extra) #---------------------------------------------------------------------- @staticmethod @@ -259,7 +260,8 @@ class OkexFutureRestClient(OkexFutureRestBase): if success: extra.onSuccess(extra.extra) else: - extra.onFailed(extra.extra) + if extra.onFailed: + extra.onFailed(extra.extra) #---------------------------------------------------------------------- @staticmethod @@ -285,7 +287,8 @@ class OkexFutureRestClient(OkexFutureRestBase): extra.onSuccess(okexOrder, extra.extra) else: - extra.onFailed(extra.extra) + if extra.onFailed: + extra.onFailed(extra.extra) #---------------------------------------------------------------------- @staticmethod @@ -305,7 +308,8 @@ class OkexFutureRestClient(OkexFutureRestBase): uis.append(ui) extra.onSuccess(uis, extra.extra) else: - extra.onFailed(extra.extra) + if extra.onFailed: + extra.onFailed(extra.extra) #---------------------------------------------------------------------- @staticmethod @@ -335,4 +339,5 @@ class OkexFutureRestClient(OkexFutureRestBase): pos.holding.append(posDetail) extra.onSuccess(pos, extra.extra) else: - extra.onFailed(extra.extra) + if extra.onFailed: + extra.onFailed(extra.extra)