示例#1
0
 /// <summary>
 /// Places an order
 /// </summary>
 /// <param name="symbol">The symbol of the order</param>
 /// <param name="direction">The direction of the order</param>
 /// <param name="type">The type of order</param>
 /// <param name="quantity">The quantity of the order</param>
 /// <param name="timeInForce">The time in force of the order</param>
 /// <param name="limit">The limit price of the order (limit orders only)</param>
 /// <param name="ceiling">The ceiling price of the order (ceiling orders only)</param>
 /// <param name="clientOrderId">Id to track the order by</param>
 /// <returns>The order info</returns>
 public WebCallResult <BittrexOrderV3> PlaceOrder(string symbol, OrderSide direction, OrderTypeV3 type, decimal quantity, TimeInForce timeInForce, decimal?limit = null, decimal?ceiling = null, string clientOrderId = null) => PlaceOrderAsync(symbol, direction, type, quantity, timeInForce, limit, ceiling, clientOrderId).Result;
示例#2
0
        /// <summary>
        /// Places an order
        /// </summary>
        /// <param name="symbol">The symbol of the order</param>
        /// <param name="direction">The direction of the order</param>
        /// <param name="type">The type of order</param>
        /// <param name="quantity">The quantity of the order</param>
        /// <param name="timeInForce">The time in force of the order</param>
        /// <param name="limit">The limit price of the order (limit orders only)</param>
        /// <param name="ceiling">The ceiling price of the order (ceiling orders only)</param>
        /// <param name="clientOrderId">Id to track the order by</param>
        /// <returns>The order info</returns>
        public async Task <WebCallResult <BittrexOrderV3> > PlaceOrderAsync(string symbol, OrderSide direction, OrderTypeV3 type, decimal quantity, TimeInForce timeInForce, decimal?limit = null, decimal?ceiling = null, string clientOrderId = null)
        {
            var parameters = new Dictionary <string, object>()
            {
                { "marketSymbol", symbol },
                { "direction", JsonConvert.SerializeObject(direction, new OrderSideConverter(false)) },
                { "type", JsonConvert.SerializeObject(type, new OrderTypeConverter(false)) },
                { "quantity", quantity.ToString(CultureInfo.InvariantCulture) },
                { "timeInForce", JsonConvert.SerializeObject(timeInForce, new TimeInForceConverter(false)) }
            };

            parameters.AddOptionalParameter("limit", limit?.ToString(CultureInfo.InvariantCulture));
            parameters.AddOptionalParameter("clientOrderId", clientOrderId);
            parameters.AddOptionalParameter("ceiling", ceiling?.ToString(CultureInfo.InvariantCulture));

            return(await ExecuteRequest <BittrexOrderV3>(GetUrl("orders"), method : Constants.PostMethod, parameters : parameters, signed : true).ConfigureAwait(false));
        }
        /// <summary>
        /// Places an order
        /// </summary>
        /// <param name="symbol">The symbol of the order</param>
        /// <param name="direction">The direction of the order</param>
        /// <param name="type">The type of order</param>
        /// <param name="quantity">The quantity of the order</param>
        /// <param name="timeInForce">The time in force of the order</param>
        /// <param name="limit">The limit price of the order (limit orders only)</param>
        /// <param name="ceiling">The ceiling price of the order (ceiling orders only)</param>
        /// <param name="clientOrderId">Id to track the order by</param>
        /// <param name="ct">Cancellation token</param>
        /// <returns>The order info</returns>
        public async Task <WebCallResult <BittrexOrderV3> > PlaceOrderAsync(string symbol, OrderSide direction, OrderTypeV3 type, decimal quantity, TimeInForce timeInForce, decimal?limit = null, decimal?ceiling = null, string?clientOrderId = null, CancellationToken ct = default)
        {
            symbol.ValidateBittrexSymbol();
            var parameters = new Dictionary <string, object>()
            {
                { "marketSymbol", symbol },
                { "direction", JsonConvert.SerializeObject(direction, new OrderSideConverter(false)) },
                { "type", JsonConvert.SerializeObject(type, new OrderTypeConverter(false)) },
                { "quantity", quantity.ToString(CultureInfo.InvariantCulture) },
                { "timeInForce", JsonConvert.SerializeObject(timeInForce, new TimeInForceConverter(false)) }
            };

            parameters.AddOptionalParameter("limit", limit?.ToString(CultureInfo.InvariantCulture));
            parameters.AddOptionalParameter("clientOrderId", clientOrderId);
            parameters.AddOptionalParameter("ceiling", ceiling?.ToString(CultureInfo.InvariantCulture));

            return(await SendRequest <BittrexOrderV3>(GetUrl("orders"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false));
        }