Пример #1
0
        public void TimrTradeVolume()
        {
            if (AssetPairsNames.IsNullOrEmpty() || !TimeoutTradeVolume.IsTriggered)
            {
                return;
            }

            TimeoutTradeVolume.Forced = true;

            TradeVolume tradevolume = this.GetTradeVolume(this.AssetPairsNames.ToList(), true);

            if (tradevolume == null)
            {
                return;
            }

            this.TradeVolume = tradevolume;

            TimeoutTradeVolume.Reset();
        }
Пример #2
0
        public TradeVolume GetTradeVolume(List <string> pairs = null, bool feeinfo = false)
        {
            string props = "";

            if (pairs != null)
            {
                props = string.Format("&pair={0}", pairs[0]);


                for (int i = 1; i < pairs.Count; i++)
                {
                    props += "," + pairs[i];
                }
            }

            if (feeinfo)
            {
                props += string.Format("&fee-info={0}", feeinfo);
            }


            string response = this.QueryPrivate("TradeVolume", props);

            if (response == null)
            {
                return(null);
            }

            ObjResult result = JsonConvert.DeserializeObject <ObjResult>(response);

            if (result.Error == null || result.Error.Count > 0)
            {
                return(null);
            }



            TradeVolume volume = JsonConvert.DeserializeObject <TradeVolume>(result.Result.ToString());

            List <TradeFees> tradefees = new List <TradeFees>();

            foreach (JProperty property in volume.fees.Children())
            {
                if (property == null || property.Value == null)
                {
                    continue;
                }
                try
                {
                    TradeFees tradefee = JsonConvert.DeserializeObject <TradeFees>(property.Value.ToString());
                    tradefee.PairName = property.Name;
                    tradefees.Add(tradefee);
                }
                catch
                {
                    continue;
                }
            }

            volume.Fees = tradefees.ToArray();


            List <TradeFees> tradefees_maker = new List <TradeFees>();

            foreach (JProperty property in volume.fees_maker.Children())
            {
                if (property == null || property.Value == null)
                {
                    continue;
                }

                try
                {
                    TradeFees tradefee = JsonConvert.DeserializeObject <TradeFees>(property.Value.ToString());
                    tradefee.PairName = property.Name;
                    tradefees_maker.Add(tradefee);
                }
                catch
                {
                    continue;
                }
            }


            volume.FeesMaker = tradefees_maker.ToArray();

            return(volume);
        }