public void ToCryptoOrder_Should_Convert() { var bittrexOrder = new BittrexOpenOrdersOrder { Exchange = "BTC-XLM", OrderType = OrderSideExtended.LimitBuy, Price = 0.001M, Quantity = 100, PricePerUnit = 0.0001M, Limit = 0.0001M, CommissionPaid = 0.00001M, Closed = DateTime.MaxValue, Opened = DateTime.MaxValue, Uuid = Guid.NewGuid(), QuantityRemaining = 0.002M }; var order = bittrexOrder.ToCryptoOrder(); order.Market.Should().Be(bittrexOrder.Exchange); order.OrderType.Should().Be(CryptoOrderType.LimitBuy); order.Price.Should().Be(bittrexOrder.Price); order.Quantity.Should().Be(bittrexOrder.Quantity); order.QuantityRemaining.Should().Be(bittrexOrder.QuantityRemaining); order.PricePerUnit.Should().Be(bittrexOrder.PricePerUnit); order.Uuid.Should().Be(bittrexOrder.Uuid.GetValueOrDefault().ToString()); order.CommissionPaid.Should().Be(bittrexOrder.CommissionPaid); order.Limit.Should().Be(bittrexOrder.Limit); order.Opened.Should().Be(bittrexOrder.Opened); order.IsClosed.Should().BeFalse(); order.Closed.Should().Be(bittrexOrder.Closed.GetValueOrDefault()); }
public static CryptoOrder ToCryptoOrder(this BittrexOpenOrdersOrder openOrder) { return(new CryptoOrder { Market = openOrder.Exchange, OrderType = openOrder.OrderType == OrderSideExtended.LimitBuy ? CryptoOrderType.LimitBuy : CryptoOrderType.LimitSell, Price = openOrder.Price.RoundSatoshi(), Quantity = openOrder.Quantity.RoundSatoshi(), PricePerUnit = openOrder.Limit.RoundSatoshi(), CommissionPaid = openOrder.CommissionPaid.RoundSatoshi(), Canceled = openOrder.CancelInitiated, Uuid = openOrder.Uuid.GetValueOrDefault().ToString(), Opened = openOrder.Opened, Closed = openOrder.Closed.GetValueOrDefault(), Limit = openOrder.Limit.RoundSatoshi(), QuantityRemaining = openOrder.QuantityRemaining.RoundSatoshi() }); }