dougdellolio / coinbasepro-csharp

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

StablecoinConversionsService.CreateConversion fails "from currency is required" #283

Closed yellowwidget closed 3 years ago

yellowwidget commented 3 years ago

StablecoinConversionsService.CreateConversion("USD", "USDC", 10000.00);

fails with an exception of "from currency is required".

From CoinBase API documentation it looks like this should work { "from": "USD", "to": "USDC", "amount": "10000.00" }

So not sure why this is saying it doesn't recognize "USD".

yellowwidget commented 3 years ago

This will fix it.

namespace CoinbasePro.Services.StablecoinConversions
{
    public class StablecoinConversion
    {
        [JsonProperty("from", NullValueHandling = NullValueHandling.Ignore)]
        public string FromCurrency { get; set; }

        [JsonProperty("to", NullValueHandling = NullValueHandling.Ignore)]
        public string ToCurrency { get; set; }

        [JsonProperty("amount", NullValueHandling = NullValueHandling.Ignore)]
        public decimal Amount { get; set; }
    }
}
dougdellolio commented 3 years ago

hey @yellowwidget thanks for reporting. This is fixed with the latest version, you can update through NuGet. let me know if you run into any other issues. https://github.com/dougdellolio/coinbasepro-csharp/commit/1f6e13b393af8994a2251af024121ba8222bc04b