Esempio n. 1
0
        /// <summary>
        /// Create a CoinBuy from an ExchangeHub OrderResponse
        /// </summary>
        /// <param name="orderResponse">OrderResponse to convert</param>
        /// <param name="quantityApplied">Quantity to apply to this order</param>
        /// <returns>new CoinBuy object</returns>
        public CoinBuy GetCoinBuy(ExchangeHub.Contracts.OrderResponse orderResponse, decimal quantityApplied)
        {
            var coinBuy = new CoinBuy
            {
                BTCPrice   = orderResponse.Pair.EndsWith("BTC") ? orderResponse.Price : 0,
                Exchange   = StringToExchange(currentExchange),
                OrderId    = orderResponse.OrderId,
                Pair       = orderResponse.Pair,
                Price      = orderResponse.Price,
                Quantity   = quantityApplied,
                ClosedDate = orderResponse.TransactTime
            };

            return(coinBuy);
        }
Esempio n. 2
0
        /// <summary>
        /// Convert an OrderResponse to an ExchangeOrder
        /// </summary>
        /// <param name="orderResponse">OrderResponse to convert</param>
        /// <returns>new ExchangeOrder object</returns>
        public ExchangeOrder OrderResponseToExchangeOrder(ExchangeHub.Contracts.OrderResponse orderResponse)
        {
            var exchangeOrder = new ExchangeOrder
            {
                Exchange       = StringToExchange(currentExchange),
                FilledQuantity = orderResponse.FilledQuantity,
                OrderId        = orderResponse.OrderId,
                Pair           = orderResponse.Pair,
                PlaceDate      = orderResponse.TransactTime,
                Price          = orderResponse.Price,
                Quantity       = orderResponse.OrderQuantity,
                Side           = (Side)orderResponse.Side
            };

            return(exchangeOrder);
        }