Esempio n. 1
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. 2
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;