dougdellolio / coinbasepro-csharp

The unofficial .NET/C# client library for the Coinbase Pro/GDAX API
MIT License
193 stars 90 forks source link

Conversion when retrieving asset info #175

Closed LeonardoX77 closed 5 years ago

LeonardoX77 commented 5 years ago

Hi Doug I got this error sometimes when executing ProductsService.GetAllProductsAsync() It's strange but I couldn't reproduce it on my local environment. System format is English (U.K.), I'm not sure if it's something related to decimal separator or not.

Newtonsoft.Json.JsonReaderException: Could not convert string to decimal: 1e-8. Path '[21].quote_increment', line 1, position 7056. en Newtonsoft.Json.JsonReader.ReadDecimalString(String s) en Newtonsoft.Json.JsonTextReader.FinishReadQuotedNumber(ReadType readType) en Newtonsoft.Json.JsonTextReader.ReadNumberValue(ReadType readType) en Newtonsoft.Json.JsonTextReader.ReadAsDecimal() en Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) en Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) en Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) en Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) en Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id) en Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) en Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) en Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) en Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) en Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) en Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) en CoinbasePro.Shared.Utilities.JsonConfig.DeserializeObject[T](String contentBody) en CoinbasePro.Services.AbstractService.d6`1.MoveNext() --- Fin del seguimiento de la pila de la ubicaci󮠡nterior donde se produjo la excepci󮠭-- en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) en CoinbasePro.Services.Products.ProductsService.d2.MoveNext() --- Fin del seguimiento de la pila de la ubicaci󮠡nterior donde se produjo la excepci󮠭-- en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) en System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() en CryptoTrader.Business.Logic.UpdateData.AssetPairs.AssetsCoinbasePro.d__2.MoveNext() en

dougdellolio commented 5 years ago

hi @LeonardoX77. this looks related to https://github.com/dougdellolio/coinbasepro-csharp/issues/160. I have a fix that I will release shortly for it. The api is returning scientific notation in some cases and it doesnt know how to be deserialized

dougdellolio commented 5 years ago

closing. this is fixed with v1.0.25. let me know if you see any other issues