From c5e600ce2558c8b29c14ad46838557388b9c67ee Mon Sep 17 00:00:00 2001 From: msincenselee Date: Wed, 6 May 2020 16:21:07 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=B4=A7=E6=80=A5=E8=A1=A5=E4=B8=81]=20?= =?UTF-8?q?=E5=B8=81=E5=AE=89=E6=8C=81=E4=BB=93=E4=BF=A1=E6=81=AF=E5=8F=98?= =?UTF-8?q?=E6=88=90=E5=A4=9A=E6=9D=A1=EF=BC=8C=E5=87=80=E4=BB=93=EF=BC=8C?= =?UTF-8?q?=E5=A4=9A=EF=BC=8C=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/gateway/binancef/binancef_gateway.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vnpy/gateway/binancef/binancef_gateway.py b/vnpy/gateway/binancef/binancef_gateway.py index 1b75429b..21f1d7b2 100644 --- a/vnpy/gateway/binancef/binancef_gateway.py +++ b/vnpy/gateway/binancef/binancef_gateway.py @@ -548,6 +548,8 @@ class BinancefRestApi(RestClient): for d in data: # self.gateway.write_log(d) volume = float(d["positionAmt"]) + if d.get('positionSide') != 'BOTH': + continue position = PositionData( accountid=self.accountid, symbol=d["symbol"], @@ -560,7 +562,8 @@ class BinancefRestApi(RestClient): gateway_name=self.gateway_name, ) self.gateway.on_position(position) - + if position.symbol == 'BTCUSDT': + self.gateway.write_log(f'{position.__dict__}\n {d}') # self.gateway.write_log("持仓信息查询成功") def on_query_order(self, data: dict, request: Request) -> None: @@ -879,7 +882,7 @@ class BinancefTradeWebsocketApi(WebsocketClient): gateway_name=self.gateway_name, ) holding_pnl += float(pos_data['up']) - self.gateway.on_position(position) + # self.gateway.on_position(position) for acc_data in packet["a"]["B"]: if acc_data['a'] != 'USDT':