Beispiel #1
0
        /// <summary>
        /// Submit a new order
        /// </summary>
        /// <param name="pair">A valid pair</param>
        /// <param name="amount">Amount of coin to buy or sell</param>
        /// <param name="side">BUY or SELL</param>
        /// <param name="type">Type of order (LIMIT, MARKET, STOP OR STOP LIMIT)</param>
        /// <param name="limitPrice">Price of per coin that you buy or sell</param>
        /// <param name="stopPrice">[Optinal] Stop price for stop and stop limit orders</param>
        /// <param name="ct">Cancellation Token</param>
        /// <returns></returns>
        public virtual async Task <WebCallResult <CoinzoOrderId> > PlaceOrderAsync(string pair, decimal amount, CoinzoOrderSide side, CoinzoOrderType type, decimal?limitPrice = null, decimal?stopPrice = null, CancellationToken ct = default)
        {
            var parameters = new Dictionary <string, object>
            {
                { "pair", pair },
                { "side", JsonConvert.SerializeObject(side, new OrderSideConverter(false)) },
                { "type", JsonConvert.SerializeObject(type, new OrderTypeConverter(false)) },
                { "amount", amount.ToString(CultureInfo.InvariantCulture) },
            };

            parameters.AddOptionalParameter("limitPrice", limitPrice?.ToString(CultureInfo.InvariantCulture));
            parameters.AddOptionalParameter("stopPrice", stopPrice?.ToString(CultureInfo.InvariantCulture));

            return(await SendRequestAsync <CoinzoOrderId>(GetUrl(Endpoints_Private_PlaceOrder), method : HttpMethod.Post, cancellationToken : ct, parameters : parameters, checkResult : false, signed : true).ConfigureAwait(false));
        }
Beispiel #2
0
 /// <summary>
 /// Submit a new order
 /// </summary>
 /// <param name="pair">A valid pair</param>
 /// <param name="amount">Amount of coin to buy or sell</param>
 /// <param name="side">BUY or SELL</param>
 /// <param name="type">Type of order (LIMIT, MARKET, STOP OR STOP LIMIT)</param>
 /// <param name="limitPrice">Price of per coin that you buy or sell</param>
 /// <param name="stopPrice">[Optinal] Stop price for stop and stop limit orders</param>
 /// <param name="ct">Cancellation Token</param>
 /// <returns></returns>
 public virtual WebCallResult <CoinzoOrderId> PlaceOrder(string pair, decimal amount, CoinzoOrderSide side, CoinzoOrderType type, decimal?limitPrice = null, decimal?stopPrice = null, CancellationToken ct = default) => PlaceOrderAsync(pair, amount, side, type, limitPrice, stopPrice, ct).Result;