burakoner / OKEx.Net

Open source .Net API wrapper for the @OKEx V5 Rest API and V5 Websocket API
MIT License
86 stars 48 forks source link

Incorrect deserialisation of perpetual swap positions #18

Closed tekr closed 3 years ago

tekr commented 3 years ago

As detailed here, the side of a position is returned as either 'long' or short'.

However OkexSwapPosition.Side is currently of type OkexSwapOrderSide, which is deserialised from the string values 'buy' and 'sell'. As such the values are not deserialised correctly (for short positions), leading to incorrect position results.

Following the pattern of OkexSwapTransaction.Direction, I believe that OkexSwapPosition.Side should be renamed to OkexSwapPosition.Direction and changed to be of type OkexSwapDirection.