Esempio n. 1
0
        internal async Task <ExchangeOrder> BuyLimitOrderAsync(TradeSession tradeSession, decimal amount, decimal price)
        {
            var executedOrder = await _exchange.BuyLimitOrderAsync(tradeSession.PairCode, amount, price);

            if (executedOrder.Id == 0)
            {
                throw new Exception("Buy order not executed (order id = 0)");
            }

            BuyLimitOrderPlaced?.Invoke(this, new BitstampOrderEventArgs(executedOrder));
            tradeSession.LastBuyTimestamp = DateTime.Now;

            return(executedOrder);
        }