/// <summary> /// Places a conditional order. The order will be executed when the condition that is set becomes true. /// </summary> /// <param name="side">Buy or sell</param> /// <param name="timeInEffect">The time the order stays active</param> /// <param name="market">Market the order is for</param> /// <param name="quantity">The quantity of the order</param> /// <param name="rate">The rate of the order</param> /// <param name="conditionType">The type of condition</param> /// <param name="target">The target of the condition type</param> /// <returns></returns> public async Task <CallResult <BittrexOrderResult> > PlaceConditionalOrderAsync(OrderSide side, TimeInEffect timeInEffect, string market, decimal quantity, decimal rate, ConditionType conditionType, decimal target) { var parameters = new Dictionary <string, object> { { "ordertype", OrderType.Limit.ToString() }, { "timeineffect", JsonConvert.SerializeObject(timeInEffect, new TimeInEffectConverter(false)) }, { "marketname", market }, { "quantity", quantity.ToString(CultureInfo.InvariantCulture) }, { "rate", rate.ToString(CultureInfo.InvariantCulture) }, { "conditiontype", JsonConvert.SerializeObject(conditionType, new ConditionTypeConverter(false)) }, { "target", target.ToString(CultureInfo.InvariantCulture) } }; var uri = GetUrl(side == OrderSide.Buy ? BuyV2Endpoint : SellV2Endpoint, Api, ApiVersion2); return(await Execute <BittrexOrderResult>(uri, true, parameters).ConfigureAwait(false)); }
/// <summary> /// Synchronized version of the <see cref="PlaceConditionalOrderAsync"/> method /// </summary> /// <returns></returns> public CallResult <BittrexOrderResult> PlaceConditionalOrder(OrderSide side, TimeInEffect timeInEffect, string market, decimal quantity, decimal rate, ConditionType conditionType, decimal target) => PlaceConditionalOrderAsync(side, timeInEffect, market, quantity, rate, conditionType, target).Result;