Example #1
0
        private ExchangeOrderResult Buy(Coin baseCoin, Coin coin, decimal quantity, decimal?price, Enumerations.OrderTypeEnum type)
        {
            _logger.Info("");
            Log($"Placing BUY order for {baseCoin.Code}-{coin.Code}, quantity {quantity}, price {price}, type {type}");
            _logger.Info("");

            try
            {
                return(_exchangeApi.Simulated
                    ? SimulateOrderResult(baseCoin, coin, quantity, price, true, ExchangeAPIOrderResult.Pending)
                    : _exchangeApi.PlaceOrder(baseCoin, coin, quantity, price, true, type));
            }
            catch (Exception e)
            {
                _logger.Error(e);
                return(null);
            }
        }
Example #2
0
        public async Task <Order> PlaceOrder(User user, ClientOrder clientOrder, long recWindow = 0, CancellationToken cancellationToken = default(CancellationToken))
        {
            var result = await exchangeApi.PlaceOrder(user, clientOrder, recWindow, cancellationToken).ConfigureAwait(false);

            return(result);
        }