Esempio n. 1
0
        /// <summary>
        /// Get XML, JSON, PLAIN List conctact from section into Stats
        /// </summary>
        public string GetContactsStatSection(int id, StatSection section, OutputMode mode = OutputMode.XML)
        {
            Dictionary <string, string> Params = new Dictionary <string, string>();

            Params.Add("action", "get_contacts_stat_section");
            Params.Add("plan", this.plan);
            Params.Add("user", this.user);
            Params.Add("pass", this.pass);
            Params.Add("mode", mode.ToString().ToLower());              //CSV, XML or JSON
            Params.Add("eid", id.ToString());
            Params.Add("section", section.ToString().ToLower());

            string bruto = GetResponse(this.urlBase, Params, this.apiMethod);

            if (bruto.Substring(0, 2) == "KO")
            {
                throw new TeenvioException(bruto);
            }
            return(bruto);
        }
Esempio n. 2
0
        /// <summary>
        /// Get various stats for the symbol
        /// </summary>
        /// <param name="symbol">The symbol to request stats for</param>
        /// <param name="key">The type of stats</param>
        /// <param name="side">Side of the stats</param>
        /// <param name="section">Section of the stats</param>
        /// <param name="sorting">The way the result should be sorted</param>
        /// <returns></returns>
        public async Task <CallResult <BitfinexStats> > GetStatsAsync(string symbol, StatKey key, StatSide side, StatSection section, Sorting?sorting)
        {
            var parameters = new Dictionary <string, object>();

            parameters.AddOptionalParameter("sort", sorting != null ? JsonConvert.SerializeObject(sorting, new SortingConverter(false)) : null);

            var endpoint = FillPathParameter(StatsEndpoint,
                                             JsonConvert.SerializeObject(key, new StatKeyConverter(false)),
                                             symbol,
                                             JsonConvert.SerializeObject(side, new StatSideConverter(false)),
                                             JsonConvert.SerializeObject(section, new StatSectionConverter(false)));

            return(await ExecuteRequest <BitfinexStats>(GetUrl(endpoint, ApiVersion2), GetMethod, parameters));
        }
Esempio n. 3
0
 /// <summary>
 /// Synchronized version of the <see cref="GetStatsAsync"/> method
 /// </summary>
 /// <returns></returns>
 public CallResult <BitfinexStats> GetStats(string symbol, StatKey key, StatSide side, StatSection section, Sorting?sorting = null) => GetStatsAsync(symbol, key, side, section, sorting).Result;
Esempio n. 4
0
        /// <summary>
        /// Get XML, JSON, PLAIN List conctact from section into Stats
        /// </summary>
        public string GetContactsStatSection(int id, StatSection section, OutputMode mode=OutputMode.XML)
        {
            Dictionary<string, string> Params = new Dictionary<string, string>();
            Params.Add ("action", "get_contacts_stat_section");
            Params.Add ("plan", this.plan);
            Params.Add ("user", this.user);
            Params.Add ("pass", this.pass);
            Params.Add ("mode", mode.ToString().ToLower()); //CSV, XML or JSON
            Params.Add ("eid", id.ToString());
            Params.Add ("section", section.ToString().ToLower());

            string bruto= GetResponse(this.urlBase, Params, this.apiMethod);
            if (bruto.Substring (0, 2) == "KO") {
                throw new TeenvioException (bruto);
            }
            return bruto;
        }