Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="currency_name">base coin or quote coin name</param>
        /// <param name="args">Add additional attributes for each exchange</param>
        /// <returns></returns>
        public virtual async ValueTask <NameResult> LoadCurrencyNickAsync(string currency_name, Dictionary <string, object> args = null)
        {
            var _result = new NameResult();

            var _markets = await this.LoadMarketsAsync();

            if (_markets.success == true)
            {
                if (publicClient.ExchangeInfo.CurrencyNicks.ContainsKey(currency_name) == true)
                {
                    _result.result = publicClient.ExchangeInfo.CurrencyNicks[currency_name];
                    _result.SetResult(_markets);
                }
                else
                {
                    _result.SetFailure(
                        $"not exist currency name '{currency_name}' in currencies",
                        ErrorCode.NotSupported
                        );
                }
            }
            else
            {
                _result.SetResult(_markets);
            }

            return(await Task.FromResult(_result));
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="currency_name">base coin or quote coin name</param>
        /// <param name="args">Add additional attributes for each exchange</param>
        /// <returns></returns>
        public virtual async Task <NameResult> LoadCurrencyId(string currency_name, Dictionary <string, object> args = null)
        {
            var _result = new NameResult();

            var _markets = await this.LoadMarkets();

            if (_markets.success == true)
            {
                if (_markets.CurrencyNames.ContainsValue(currency_name) == true)
                {
                    _result.result = _markets.GetCurrencyId(currency_name);

                    _result.SetResult(_markets);
                }
                else
                {
                    _result.SetFailure(
                        $"not exist currency name '{currency_name}' in currencies",
                        ErrorCode.NotSupported
                        );
                }
            }
            else
            {
                _result.SetResult(_markets);
            }

            return(await Task.FromResult(_result));
        }