/// <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)); }
/// <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)); }
/// <summary> /// Get deposit methods /// </summary> /// <param name="currency_id"></param> /// <returns></returns> private async Task <NameResult> getDepositMethod(string currency_id) { var _result = new NameResult(); if (depositMethods.ContainsKey(currency_id) == false) { var _params = new Dictionary <string, object>(); { _params.Add("asset", currency_id); } #if DEBUG if (XApiClient.TestXUnitMode != XUnitMode.UseExchangeServer) { _result.result = currency_id; depositMethods.Add(currency_id, _result.result); } else { #endif var _json_value = await privateClient.CallApiPost1Async("/0/private/DepositMethods", _params); #if DEBUG _result.rawJson = _json_value.Content; #endif var _json_result = privateClient.GetResponseMessage(_json_value.Response); if (_json_result.success == true) { var _json_data = privateClient.DeserializeObject <JToken>(_json_value.Content); { _result.result = _json_data["result"][0]["method"].Value <string>(); depositMethods.Add(currency_id, _result.result); } } _result.SetResult(_json_result); #if DEBUG } #endif } else { _result.result = depositMethods[currency_id]; _result.SetSuccess(); } return(_result); }