Example #1
0
        // where symbol like "ETHUSDT"
        // where side is OrderSide.Buy/OrderSide.Sell
        // where price like 390.19M
        // where amount like 0.1M
        public static async Task <ExchangeOrderResult> PlaceOrderAsync(IExchangeAPI api, string symbol, OrderSide side, decimal price, decimal amount)
        {
            var order = new ExchangeOrderRequest();

            order.OrderType         = OrderType.Limit;
            order.Symbol            = symbol;
            order.Price             = price;
            order.Amount            = amount;
            order.IsBuy             = side == OrderSide.Buy;
            order.ShouldRoundAmount = true;
            //order.RoundAmount();
            //var parameters = order.ExtraParameters;
            //order.ExtraParameters["post_only"] = postOnly;

            return(await api.PlaceOrderAsync(order));
        }
Example #2
0
        public void SubmitStopMarginOrder()
        {
            IExchangeAPI         api   = ExchangeAPI.GetExchangeAPIAsync("Bitfinex").Result;
            ExchangeOrderRequest order = new ExchangeOrderRequest
            {
                MarketSymbol = "ADAUSD",
                Amount       = System.Convert.ToDecimal(0.0001),
                IsBuy        = true,
                IsMargin     = true,
                OrderType    = OrderType.Stop,
                StopPrice    = System.Convert.ToDecimal(100)
            };

            api.PrivateApiKey = _pvtKey;
            api.PublicApiKey  = _pubKey;
            ExchangeOrderResult result = api.PlaceOrderAsync(order).Result;
        }