JKorf / OKX.Net

A C# .netstandard client library for the OKX REST and Websocket Spot and Futures API focusing on clear usage and models
https://jkorf.github.io/OKX.Net/
MIT License
27 stars 16 forks source link

The JSON value could not be converted to System.Nullable`1[System.Int32] #48

Closed dante1989 closed 1 day ago

dante1989 commented 2 weeks ago

After i upgraded to version 2.0.0 I use this function clientOKX.UnifiedApi.Account.GetPositionsAsync i got error: The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $ | LineNumber: 0 | BytePositionInLine: 7. The old version (Version 1.11.1 - 25 Jun 2024) is ok

JKorf commented 2 weeks ago

Do you know what the response was? The Position model itself doesn't have any int properties, so I'm trying to check whhere that error is coming from

dante1989 commented 2 weeks ago

When the position is not opened, i got that error

dante1989 commented 2 weeks ago

i'm sorry, the error from this Function GetLeverageAsync, not GetPositionsAsync

dante1989 commented 2 weeks ago

try

Dim ItemFuturesDonBayOKX = Await clientOKX.UnifiedApi.Account.GetLeverageAsync(Symbol_USDFuture, OKX.Net.Enums.MarginMode.Cross)

Dim DonBayActive_Long = ItemFuturesDonBayOKX.Data(0).Leverage.Value Dim DonBayActive_Short = ItemFuturesDonBayOKX.Data(1).Leverage.Value

Catch ex As Exception

End Try

ex.Message get error: i got error: The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $ | LineNumber: 0 | BytePositionInLine: 7. The old version (Version 1.11.1 - 25 Jun 2024) is ok

JKorf commented 2 weeks ago

Yeah I found the issue, the error response parsing had a bug. I'll fix it and push a new version later today

JKorf commented 2 weeks ago

I can't push a new package at the moment unfortunately due to an issue with nuget, but will do so when I can.

dante1989 commented 2 weeks ago

thank you so much

dante1989 commented 2 days ago

After i upgraded to version 2.1.0 i got the new error ex.Message get error: Value cannot be null. Parameter name: source ItemFuturesDonBayOKX.Error.Message got the error: mgnMode cannot be empty

JKorf commented 1 day ago

Fixed in the latest version