diff --git a/src/ExchangeSharp/API/Exchanges/Poloniex/ExchangePoloniexAPI.cs b/src/ExchangeSharp/API/Exchanges/Poloniex/ExchangePoloniexAPI.cs index 75ab8281..a7e1178b 100644 --- a/src/ExchangeSharp/API/Exchanges/Poloniex/ExchangePoloniexAPI.cs +++ b/src/ExchangeSharp/API/Exchanges/Poloniex/ExchangePoloniexAPI.cs @@ -166,7 +166,7 @@ public void ParseOrderTrades(IEnumerable trades, ExchangeOrderResult ord decimal tradeAmt = trade["amount"].ConvertInvariant(); decimal tradeRate = trade["rate"].ConvertInvariant(); - order.AveragePrice = (order.AveragePrice * order.AmountFilled + tradeAmt * tradeRate) / (order.AmountFilled + tradeAmt); + order.AveragePrice = (order.AveragePrice.GetValueOrDefault(decimal.Zero) * order.AmountFilled + tradeAmt * tradeRate) / (order.AmountFilled + tradeAmt); if (order.Amount == 0m) { order.Amount += tradeAmt;