diff --git a/vnpy/gateway/okexf/okexf_gateway.py b/vnpy/gateway/okexf/okexf_gateway.py index 7a3eca7d..28138c41 100644 --- a/vnpy/gateway/okexf/okexf_gateway.py +++ b/vnpy/gateway/okexf/okexf_gateway.py @@ -387,28 +387,28 @@ class OkexfRestApi(RestClient): return for pos_data in data["holding"][0]: - if float(pos_data["long_qty"]) > 0: + if int(pos_data["long_qty"]) > 0: pos = PositionData( symbol=pos_data["instrument_id"].upper(), exchange=Exchange.OKEX, direction=Direction.LONG, - volume=pos_data["long_qty"], + volume=int(pos_data["long_qty"]), frozen=float(pos_data["long_qty"]) - float(pos_data["long_avail_qty"]), - price=pos_data["long_avg_cost"], - pnl=pos_data["realised_pnl"], + price=float(pos_data["long_avg_cost"]), + pnl=float(pos_data["realised_pnl"]), gateway_name=self.gateway_name, ) self.gateway.on_position(pos) - if float(pos_data["short_qty"]) > 0: + if int(pos_data["short_qty"]) > 0: pos = PositionData( symbol=pos_data["instrument_id"], exchange=Exchange.OKEX, direction=Direction.SHORT, - volume=pos_data["short_qty"], + volume=int(pos_data["short_qty"]), frozen=float(pos_data["short_qty"]) - float(pos_data["short_avail_qty"]), - price=pos_data["short_avg_cost"], - pnl=pos_data["realised_pnl"], + price=float(["short_avg_cost"]), + pnl=float(["realised_pnl"]), gateway_name=self.gateway_name, ) self.gateway.on_position(pos)