Skip to content

Commit

Permalink
[Bug] Incorrect conversion format due to culture info (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
dougdellolio authored Jan 15, 2018
1 parent ab55f41 commit ef41a62
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions GDAXClient/Services/Products/ProductsService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
Expand Down Expand Up @@ -94,24 +95,24 @@ private ProductsOrderBookResponse ConvertProductOrderBookResponse(
ProductsOrderBookJsonResponse productsOrderBookJsonResponse,
ProductLevel productLevel)
{
var askList = productsOrderBookJsonResponse.Asks.Select(product => product.ToArray()).Select(askArray => new Ask(Convert.ToDecimal(askArray[0]), Convert.ToDecimal(askArray[1]))
var askList = productsOrderBookJsonResponse.Asks.Select(product => product.ToArray()).Select(askArray => new Ask(Convert.ToDecimal(askArray[0], CultureInfo.InvariantCulture), Convert.ToDecimal(askArray[1], CultureInfo.InvariantCulture))
{
OrderId = productLevel == ProductLevel.Three
? new Guid(askArray[2])
: (Guid?)null,
NumberOfOrders = productLevel == ProductLevel.Three
? (decimal?)null
: Convert.ToDecimal(askArray[2])
: Convert.ToDecimal(askArray[2], CultureInfo.InvariantCulture)
}).ToArray();

var bidList = productsOrderBookJsonResponse.Bids.Select(product => product.ToArray()).Select(bidArray => new Bid(Convert.ToDecimal(bidArray[0]), Convert.ToDecimal(bidArray[1]))
var bidList = productsOrderBookJsonResponse.Bids.Select(product => product.ToArray()).Select(bidArray => new Bid(Convert.ToDecimal(bidArray[0], CultureInfo.InvariantCulture), Convert.ToDecimal(bidArray[1], CultureInfo.InvariantCulture))
{
OrderId = productLevel == ProductLevel.Three
? new Guid(bidArray[2])
: (Guid?)null,
NumberOfOrders = productLevel == ProductLevel.Three
? (decimal?)null
: Convert.ToDecimal(bidArray[2])
: Convert.ToDecimal(bidArray[2], CultureInfo.InvariantCulture)
});

var productOrderBookResponse = new ProductsOrderBookResponse(productsOrderBookJsonResponse.Sequence, bidList, askList);
Expand Down

0 comments on commit ef41a62

Please sign in to comment.