From 88ea19d9db6063dfc2baec8b61df5bb8ae7e2b78 Mon Sep 17 00:00:00 2001 From: xldistance <819873074@qq.com> Date: Sun, 30 Jun 2019 13:56:34 +0800 Subject: [PATCH] Update onetoken_gateway.py --- vnpy/gateway/onetoken/onetoken_gateway.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vnpy/gateway/onetoken/onetoken_gateway.py b/vnpy/gateway/onetoken/onetoken_gateway.py index f6834e9f..e140c37f 100644 --- a/vnpy/gateway/onetoken/onetoken_gateway.py +++ b/vnpy/gateway/onetoken/onetoken_gateway.py @@ -618,23 +618,23 @@ class OnetokenTradeWebsocketApi(WebsocketClient): # Futures elif _type == "future": long_position = PositionData( - symbol=X["contract"], + symbol=account_data["contract"], exchange=Exchange(self.exchange.upper()), direction=Direction.LONG, - price=X["average_open_price_long"], - volume=X["total_amount_long"], - pnl=X["unrealized_long"], - frozen=X["frozen_position_long"], + price=account_data["average_open_price_long"], + volume=account_data["total_amount_long"], + pnl=account_data["unrealized_long"], + frozen=account_data["frozen_position_long"], gateway_name=self.gateway_name, ) short_position = PositionData( - symbol=X["contract"], + symbol=account_data["contract"], exchange=Exchange(self.exchange.upper()), direction=Direction.SHORT, - price=X["average_open_price_short"], - volume=X["total_amount_short"], - pnl=X["unrealized_short"], - frozen=X["frozen_position_short"], + price=account_data["average_open_price_short"], + volume=account_data["total_amount_short"], + pnl=account_data["unrealized_short"], + frozen=account_data["frozen_position_short"], gateway_name=self.gateway_name, ) self.gateway.on_position(long_position)