protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync() { Dictionary <string, ExchangeCurrency> currencies = new Dictionary <string, ExchangeCurrency>(); //[{"Id":1, "Name":"Bitcoin", "Symbol":"BTC", "Algorithm":"sha256" "WithdrawFee":0.00010000, "MinWithdraw":0.00040000, "MinBaseTrade":0.0, "IsTipEnabled":false, "MinTip":0.0, "DepositConfirmations":6, "Status":"Maintenance","StatusMessage":"Unable to sync network","ListingStatus": "Active" }, ... ] JToken result = await MakeJsonRequestAsync <JToken>("/GetCurrencies"); foreach (JToken token in result) { ExchangeCurrency currency = new ExchangeCurrency() { Name = token["Symbol"].ToStringInvariant(), FullName = token["Name"].ToStringInvariant(), MinConfirmations = token["DepositConfirmations"].ConvertInvariant <int>(), Notes = token["StatusMessage"].ToStringInvariant(), TxFee = token["WithdrawFee"].ConvertInvariant <decimal>() }; if (token["ListingStatus"].ToStringInvariant().Equals("Active")) { currency.IsEnabled = !token["Status"].ToStringInvariant().Equals("Maintenance"); } else { currency.IsEnabled = false; } currencies[token["Symbol"].ToStringInvariant()] = currency; } return(currencies); }
protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync() { /* * {"1CR":{"id":1,"name":"1CRedit","txFee":"0.01000000","minConf":3,"depositAddress":null,"disabled":0,"delisted":1,"frozen":0}, * "XC":{"id":230,"name":"XCurrency","txFee":"0.01000000","minConf":12,"depositAddress":null,"disabled":1,"delisted":1,"frozen":0}, * ... } */ var currencies = new Dictionary <string, ExchangeCurrency>(); Dictionary <string, JToken> currencyMap = await MakeJsonRequestAsync <Dictionary <string, JToken> >("/public?command=returnCurrencies"); foreach (var kvp in currencyMap) { var currency = new ExchangeCurrency { BaseAddress = kvp.Value["depositAddress"].ToStringInvariant(), FullName = kvp.Value["name"].ToStringInvariant(), IsEnabled = true, MinConfirmations = kvp.Value["minConf"].ConvertInvariant <int>(), Name = kvp.Key, TxFee = kvp.Value["txFee"].ConvertInvariant <decimal>(), }; string disabled = kvp.Value["disabled"].ToStringInvariant(); string delisted = kvp.Value["delisted"].ToStringInvariant(); string frozen = kvp.Value["frozen"].ToStringInvariant(); if (string.Equals(disabled, "1") || string.Equals(delisted, "1") || string.Equals(frozen, "1")) { currency.IsEnabled = false; } currencies[currency.Name] = currency; } return(currencies); }
protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync() { var currencies = new Dictionary <string, ExchangeCurrency>(); JToken products = await MakeJsonRequestAsync <JToken>("/currencies"); foreach (JToken product in products) { var currency = new ExchangeCurrency { Name = product["id"].ToStringUpperInvariant(), FullName = product["name"].ToStringInvariant(), IsEnabled = true }; currencies[currency.Name] = currency; } return(currencies); }
protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync() { var currencies = new Dictionary <string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase); //{ "success" : true,"message" : "", "result" : [{"Currency" : "BTC","CurrencyLong" : "Bitcoin","MinConfirmation" : 2,"TxFee" : 0.00080000,"IsActive" : true, "CoinType" : "BITCOIN","MaintenanceMode" : false}, ... JToken result = await MakeJsonRequestAsync <JToken>("/public/getcurrencies", null, null); foreach (JToken token in result) { var coin = new ExchangeCurrency { CoinType = token["CoinType"].ToStringInvariant(), FullName = token["CurrencyLong"].ToStringInvariant(), IsEnabled = token["MaintenanceMode"].ConvertInvariant <bool>().Equals(false), MinConfirmations = token["MinConfirmation"].ConvertInvariant <int>(), Name = token["Currency"].ToStringUpperInvariant(), Notes = token["Notice"].ToStringInvariant(), TxFee = token["TxFee"].ConvertInvariant <decimal>(), }; currencies[coin.Name] = coin; } return(currencies); }
protected override async Task <IReadOnlyDictionary <string, ExchangeCurrency> > OnGetCurrenciesAsync() { var currencies = new Dictionary <string, ExchangeCurrency>(StringComparer.OrdinalIgnoreCase); JToken array = await MakeJsonRequestAsync <JToken>("/public/getcurrencies"); foreach (JToken token in array) { var coin = new ExchangeCurrency { BaseAddress = token["BaseAddress"].ToStringInvariant(), CoinType = token["CoinType"].ToStringInvariant(), FullName = token["CurrencyLong"].ToStringInvariant(), IsEnabled = token["IsActive"].ConvertInvariant <bool>(), MinConfirmations = token["MinConfirmation"].ConvertInvariant <int>(), Name = token["Currency"].ToStringUpperInvariant(), Notes = token["Notice"].ToStringInvariant(), TxFee = token["TxFee"].ConvertInvariant <decimal>(), }; currencies[coin.Name] = coin; } return(currencies); }