Esempio n. 1
0
        public override OrderResponse PlaceOrder(double price, double amount, CurrencyName currency, OrderSide side, TradeOrderType type = TradeOrderType.Limit)
        {
            QuadrigaOrderResponse response = null;
            string path = side == OrderSide.BID ? "buy" : "sell";
            string book = currency.ToString().ToLower() + "_cad";

            if (type == TradeOrderType.Limit)
            {
                response = _client.PlaceLimitOrder(path, amount, book, price);
            }
            else if (type == TradeOrderType.Market)
            {
                response = _client.PlaceMarketOrder(path, amount, book, price);
            }
            else
            {
                throw new ArgumentException("Invalid order type");
            }

            return(response.Error == null
                ? new OrderResponse(response.Datetime, response.OrderId)
                : new OrderResponse()
            {
                ErrorReason = response.Error.Message
            });
        }
Esempio n. 2
0
 public OrderResponse(QuadrigaOrderResponse order) : this(order.OrderId)
 {
     CreatedAt = order.Datetime;
     Price     = order.Price;
     Amount    = order.Amount;
 }