JKorf / Binance.Net

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

Get exchange info method not working #1297

Closed Matasx closed 10 months ago

Matasx commented 10 months ago

Describe the bug Every time I call this method UsdFuturesApi.ExchangeData.GetExchangeInfoAsync I get success = false. This is the error as presented in the error response:

{Deserialize Unknown Exception: ArgumentNullException - Value cannot be null. (Parameter 'item')
   at System.Collections.Generic.List`1.System.Collections.IList.Add(Object item)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at CryptoExchange.Net.BaseApiClient.DeserializeAsync[T](Stream stream, JsonSerializer serializer, Nullable`1 requestId, Nullable`1 elapsedMilliseconds)
 [Data only available in Trace LogLevel]}

To Reproduce Call await client.UsdFuturesApi.ExchangeData.GetExchangeInfoAsync()

Expected behavior Success is true and data are returned.

Debug logging This is error that get's logged to debug console 2023/09/06 09:04:58:368 | Warning | Cannot map enum value. EnumType: Binance.Net.Enums.TimeInForce, Value: GTD, Known values: GTC, IOC, FOK, GTX, GTE_GTC. If you think GTD should added please open an issue on the Github repo. - Not sure if this is the cause of the issue, but it is the only one logged.

Though as per Binance changelog the GTD was added yesterday. (https://binance-docs.github.io/apidocs/futures/en/#change-log) Price Match/ Good Till Date TIF/ Breakeven Price(detail in 2023-08-29 changelog) are released at 2023-09-05.

This is example payload from the symbols collection in the json as returned by the Binance server.

    {
      "symbol": "MASKUSDT",
      "pair": "MASKUSDT",
      "contractType": "PERPETUAL",
      "deliveryDate": 4133404800000,
      "onboardDate": 1626418800000,
      "status": "TRADING",
      "maintMarginPercent": "2.5000",
      "requiredMarginPercent": "5.0000",
      "baseAsset": "MASK",
      "quoteAsset": "USDT",
      "marginAsset": "USDT",
      "pricePrecision": 4,
      "quantityPrecision": 0,
      "baseAssetPrecision": 8,
      "quotePrecision": 8,
      "underlyingType": "COIN",
      "underlyingSubType": [
        "Privacy"
      ],
      "settlePlan": 0,
      "triggerProtect": "0.1000",
      "liquidationFee": "0.020000",
      "marketTakeBound": "0.10",
      "maxMoveOrderLimit": 10000,
      "filters": [
        {
          "filterType": "PRICE_FILTER",
          "maxPrice": "100000.0000",
          "tickSize": "0.0010",
          "minPrice": "0.0040"
        },
        {
          "stepSize": "1",
          "minQty": "1",
          "maxQty": "5000000",
          "filterType": "LOT_SIZE"
        },
        {
          "filterType": "MARKET_LOT_SIZE",
          "minQty": "1",
          "stepSize": "1",
          "maxQty": "40000"
        },
        {
          "filterType": "MAX_NUM_ORDERS",
          "limit": 200
        },
        {
          "filterType": "MAX_NUM_ALGO_ORDERS",
          "limit": 10
        },
        {
          "notional": "5",
          "filterType": "MIN_NOTIONAL"
        },
        {
          "multiplierUp": "1.1000",
          "multiplierDecimal": "4",
          "filterType": "PERCENT_PRICE",
          "multiplierDown": "0.9000"
        }
      ],
      "orderTypes": [
        "LIMIT",
        "MARKET",
        "STOP",
        "STOP_MARKET",
        "TAKE_PROFIT",
        "TAKE_PROFIT_MARKET",
        "TRAILING_STOP_MARKET"
      ],
      "timeInForce": [
        "GTC",
        "IOC",
        "FOK",
        "GTX",
        "GTD"
      ]
    },
Br1ck-Top commented 10 months ago

Not only you have this problem, Binance changed futures accounts

JKorf commented 10 months ago

Thanks for the report, I've fixed this in version 9.1.2 which should be available in a few minutes

Matasx commented 10 months ago

Thanks for the report, I've fixed this in version 9.1.2 which should be available in a few minutes

Thanks a ton. The issue is fixed!