Closed danielhw2 closed 1 year ago
@JKorf I'm not sure where it should be fixed: here or in CryptoExchange lib.
The main problem is that we used int to return:
public async Task<WebCallResult<int?>> SetLeverageAsync
which is correct according to the API docs. However, if the exchange returns error, like:
;ret_msg": "leverage not modified
we got here deserialization error:
"[11] Deserialize JsonReaderException: Error reading integer. Unexpected token: StartObject. Path 'result', line 1, position 62. Path: result, "
We still can get the initial exchange info using Trace flag, however it's not obvious and correct. I believe it should be solved somehow in the CryptoExchange library. What do you think about it?
Although I'm not sure what the cause of the server error was, you should be able to get the error info correctly in the response model with the latest version
All good. Thanks!!
Hello...
I'm trying to set the Leverage on Bybit but I'm getting an error.
Bybit.Net ver 1.4.0 CryptoExchange.Net ver 5.3.1
The code:
var resultado = ClienteRest.InverseFuturesApi.Account.SetLeverageAsync("BTCUSDH23", 5, 5, 10000, CancellationToken.None).Result;
The exeption:
Deserialize JsonReaderException: Unexpected character encountered while parsing value: {. Path 'result', line 1, position 62., Path: result, LineNumber: 1, LinePosition: 62
The Log:
| Error | Bybit | [140] Deserialize JsonReaderException: Unexpected character encountered while parsing value: {. Path 'result', line 1, position 62., Path: result, LineNumber: 1, LinePosition: 62, data: [Data only available in Trace LogLevel]