public static List<CoinInformation> GetCoinInformation(string userAgent = "", BaseCoin profitabilityBasis = BaseCoin.Bitcoin) { WebClient client = new WebClient(); if (!string.IsNullOrEmpty(userAgent)) client.Headers.Add("user-agent", userAgent); string apiUrl = GetApiUrl(profitabilityBasis); string jsonString = client.DownloadString(apiUrl); JArray jsonArray = JArray.Parse(jsonString); List<CoinInformation> result = new List<CoinInformation>(); foreach (JToken jToken in jsonArray) { CoinInformation coinInformation = new CoinInformation(); coinInformation.PopulateFromJson(jToken); if (coinInformation.Difficulty > 0) //only add coins with valid info since the user may be basing //strategies on Difficulty result.Add(coinInformation); } return result; }
public static string GetApiUrl(BaseCoin profitabilityBasis) { string apiUrl = "http://www.coinchoose.com/api.php"; if (profitabilityBasis == BaseCoin.Litecoin) apiUrl = apiUrl + "?base=LTC"; return apiUrl; }
public static List <CoinInformation> GetCoinInformation(string userAgent = "", BaseCoin profitabilityBasis = BaseCoin.Bitcoin) { WebClient client = new WebClient(); if (!string.IsNullOrEmpty(userAgent)) { client.Headers.Add("user-agent", userAgent); } string apiUrl = "http://www.coinchoose.com/api.php"; if (profitabilityBasis == BaseCoin.Litecoin) { apiUrl = apiUrl + "?base=LTC"; } string jsonString = client.DownloadString(apiUrl); JArray jsonArray = JArray.Parse(jsonString); List <CoinInformation> result = new List <CoinInformation>(); foreach (JToken jToken in jsonArray) { CoinInformation coinInformation = new CoinInformation(); coinInformation.PopulateFromJson(jToken); result.Add(coinInformation); } return(result); }
public IEnumerable<CoinInformation> GetCoinInformation(string userAgent = "", BaseCoin profitabilityBasis = BaseCoin.Bitcoin) { WebClient client = new ApiWebClient(); if (!string.IsNullOrEmpty(userAgent)) client.Headers.Add("user-agent", userAgent); string apiUrl = GetApiUrl(profitabilityBasis); string jsonString = client.DownloadString(apiUrl); JObject jsonObject = JObject.Parse(jsonString); if (!jsonObject.Value<bool>("Success")) { throw new CoinApiException(jsonObject.Value<string>("Message")); } JArray jsonArray = jsonObject.Value<JArray>("Data"); List<CoinInformation> result = new List<CoinInformation>(); foreach (JToken jToken in jsonArray) { CoinInformation coinInformation = new CoinInformation(); coinInformation.PopulateFromJson(jToken); if (coinInformation.Difficulty > 0) //only add coins with valid info since the user may be basing //strategies on Difficulty result.Add(coinInformation); } return result; }
public string GetInfoUrl(BaseCoin profitabilityBasis) { if (profitabilityBasis == BaseCoin.Litecoin) return "http://coinchoose.com/litecoin.php"; else return "http://coinchoose.com/index.php"; }
public IEnumerable <CoinInformation> GetCoinInformation(string userAgent = "", BaseCoin profitabilityBasis = BaseCoin.Bitcoin) { WebClient client = new ApiWebClient(); if (!string.IsNullOrEmpty(userAgent)) { client.Headers.Add("user-agent", userAgent); } string apiUrl = GetApiUrl(profitabilityBasis); string jsonString = client.DownloadString(apiUrl); JArray jsonArray = JArray.Parse(jsonString); List <CoinInformation> result = new List <CoinInformation>(); foreach (JToken jToken in jsonArray) { CoinInformation coinInformation = new CoinInformation(); coinInformation.PopulateFromJson(jToken); if (coinInformation.Difficulty > 0) { //only add coins with valid info since the user may be basing //strategies on Difficulty result.Add(coinInformation); } } return(result); }
public string GetApiUrl(BaseCoin profitabilityBasis) { string apiUrl = "http://www.coinchoose.com/api.php"; if (profitabilityBasis == BaseCoin.Litecoin) { apiUrl = apiUrl + "?base=LTC"; } return(apiUrl); }
public string GetInfoUrl(BaseCoin profitabilityBasis) { if (profitabilityBasis == BaseCoin.Litecoin) { return("http://coinchoose.com/litecoin.php"); } else { return("http://coinchoose.com/index.php"); } }
private void RefreshCoinStats() { //always load known coins from file //CoinChoose may not shown coins it once did if there are no orders LoadKnownCoinsFromFile(); try { coinInformation = coinApiContext.GetCoinInformation( UserAgent.AgentString, engineConfiguration.StrategyConfiguration.BaseCoin).ToList(); currentBaseCoin = applicationConfiguration.UseCoinWarzApi ? BaseCoin.Bitcoin : engineConfiguration.StrategyConfiguration.BaseCoin; } catch (Exception ex) { //don't crash if website cannot be resolved or JSON cannot be parsed if ((ex is WebException) || (ex is InvalidCastException) || (ex is FormatException) || (ex is Coin.Api.CoinApiException)) { if (applicationConfiguration.ShowApiErrors) ShowCoinApiErrorNotification(ex); return; } throw; } LoadListViewValuesFromCoinStats(); LoadKnownCoinsFromCoinStats(); RefreshCoinStatsLabel(); AutoSizeListViewColumns(); SuggestCoinsToMine(); }
public string GetInfoUrl(BaseCoin profitabilityBasis) { return(String.Format(@"http://www.coinwarz.com/cryptocurrency", apiKey)); }
public string GetApiUrl(BaseCoin profitabilityBasis) { return(String.Format(@"http://www.coinwarz.com/v1/api/profitability/?apikey={0}&algo=all", apiKey)); }
public string GetInfoUrl(BaseCoin profitabilityBasis) { return String.Format(@"http://www.coinwarz.com/cryptocurrency", apiKey); }
public string GetApiUrl(BaseCoin profitabilityBasis) { return String.Format(@"http://www.coinwarz.com/v1/api/profitability/?apikey={0}&algo=all", apiKey); }