public async Task <ActiveTradeOrdersAPIResult> GetActiveTradeOrdersAsync(string AccountId, string SellToken, string BuyToken, TradeOrderListTypes OrderType, string Signature)
        {
            var args = new Dictionary <string, string>
            {
                { "AccountId", AccountId },
                { "SellToken", SellToken },
                { "BuyToken", BuyToken },
                { "OrderType", OrderType.ToString() },
                { "Signature", Signature }
            };

            return(await GetAsync <ActiveTradeOrdersAPIResult>("GetActiveTradeOrders", args));
        }
Exemplo n.º 2
0
 Task <ActiveTradeOrdersAPIResult> INodeAPI.GetActiveTradeOrders(string AccountId, string SellToken, string BuyToken, TradeOrderListTypes OrderType, string Signature)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// <param name="SellTokenCode">
        /// If SellToken is not specified (null or empty or *), orders for all sell tokens will be included.
        /// </param>
        /// <param name="BuyTokenCode">
        /// If BuyToken is not specified (null or empty or *), orders for all buy tokens will be included.
        /// </param>
        /// <param name="OrderType">
        /// All, Sell Only, or Buy Only
        /// </param>
        /// <returns>
        // Returns the current list of active trade orders (not cancelled or not executed).
        // If neither SellToken nor BuyToken is specified, and OrderType is "All", it will return the  list of all active orders in the network.
        /// </returns>
        /// </summary>
        public List <TradeOrderBlock> GetActiveTradeOrders(string SellTokenCode, string BuyTokenCode, TradeOrderListTypes OrderType)
        {
            var result_list = new List <TradeOrderBlock>();

            if (BuyTokenCode == "*")
            {
                BuyTokenCode = null;
            }

            if (SellTokenCode == "*")
            {
                SellTokenCode = null;
            }

            if (OrderType == TradeOrderListTypes.All || OrderType == TradeOrderListTypes.SellOnly)
            {
                foreach (var order in ActiveSellOrders.Values)
                {
                    if ((string.IsNullOrEmpty(SellTokenCode) || order.SellTokenCode == SellTokenCode) && (string.IsNullOrEmpty(BuyTokenCode) || order.BuyTokenCode == BuyTokenCode))
                    {
                        result_list.Add(order);
                    }
                }
            }

            if (OrderType == TradeOrderListTypes.All || OrderType == TradeOrderListTypes.BuyOnly)
            {
                foreach (var order in ActiveBuyOrders.Values)
                {
                    if ((string.IsNullOrEmpty(SellTokenCode) || order.SellTokenCode == SellTokenCode) && (string.IsNullOrEmpty(BuyTokenCode) || order.BuyTokenCode == BuyTokenCode))
                    {
                        result_list.Add(order);
                    }
                }
            }
            return(result_list);
        }