Issue deserializing Price_Filter on GetExchangeInfo()
xucito opened this issue · comments
Issue Overview
A short description of the issue
Package Version: ?.?.?
Package v4.9.0
Repro Steps
Run GetExchangeInfo function.
Example:
var exchangeInfo = SendRequest(() => _client.GetExchangeInfo().GetAwaiter().GetResult());
Other Information
Stacktrace. Seems to be a issue with deserializing the filter. Will work on a solution.
Message: System.AggregateException : One or more errors occurred. (Unable to deserialize message from: https://api.binance.com/api/v1/exchangeInfo. Exception: Error converting value "PRICE_FILTER" to type 'BinanceExchange.API.Enums.ExchangeInfoSymbolFilterType'. Path 'filterType', line 1, position 646.) (The following constructor parameters did not have matching fixture data: ExchangeBaseFixture fixture)
---- BinanceExchange.API.Models.Response.Error.BinanceException : Unable to deserialize message from: https://api.binance.com/api/v1/exchangeInfo. Exception: Error converting value "PRICE_FILTER" to type 'BinanceExchange.API.Enums.ExchangeInfoSymbolFilterType'. Path 'filterType', line 1, position 646.
---- The following constructor parameters did not have matching fixture data: ExchangeBaseFixture fixture
Ok found issue,
The data object for filters is now:
{
"filterType": "PRICE_FILTER",
"minPrice": "0.00000000",
"maxPrice": "0.00000000",
"tickSize": "0.00000100"
}
Note how the filtertype is the first item in the json object (I think this has now been changed).
You can see in the ExchangeInfoSymbolFilter that the datamember is set always to position 1 which is causing the error.
using System.Runtime.Serialization;
using Newtonsoft.Json;
using BinanceExchange.API.Enums;
using Newtonsoft.Json.Converters;
namespace BinanceExchange.API.Models.Response
{
[DataContract]
public class ExchangeInfoSymbolFilter
{
[DataMember(Order = 1)]
[JsonConverter(typeof(StringEnumConverter))]
public ExchangeInfoSymbolFilterType FilterType { get; set; }
}
}
I don't think there should be a assumed order for the data-fields in Json objects.
I have created PR #139 to resolve this issue.
👍 Thanks I will take a look at this this afternoon