public void GetCurrency_Using300_Return300Entries() { ICoinmarketcapClient m_Sut = new CoinmarketcapClient(API_KEY); var retValue = m_Sut.GetCurrencies(300); retValue.Count().Should().Be(300); }
private async void AnalyzeCurrencies() { ICoinmarketcapClient client = new CoinmarketcapClient("ed57fadd-e7a7-4eb8-8fd5-ab510d358856"); IMailService mailService = new MailService(); while (true) { DateTime currentTime = DateTime.Now; IEnumerable <Currency> currencies = client.GetCurrencies(1500, "USD"); // Algorithm for identifying potential data List <Currency> currenciesToNotify = FindPotentialCoinsInBullishTrend(currencies); if (currenciesToNotify.Count > 0) { // Verify if any found coin has already been notified in the last 24h currenciesToNotify = await RemoveCoinsWithExistingNotification(currenciesToNotify); // If there are still coins to be notified if (currenciesToNotify.Count > 0) { string mailMessage = AssembleMailNotification(currenciesToNotify); mailService.Send("Irmãos ao Crypto - NEW Bullish coins", mailMessage); // Update database with this notification await UpdateNotificationsAtDB(currenciesToNotify); } } Thread.Sleep(4000000); } }
public void GetCurrency_Nothing_Return100() { ICoinmarketcapClient m_Sut = new CoinmarketcapClient(API_KEY); var retValue = m_Sut.GetCurrencies(); retValue.Count().Should().Be(100); }
public void GetCurrency_Nothing_ReturnAll() { ICoinmarketcapClient m_Sut = new CoinmarketcapClient(); var retValue = m_Sut.GetCurrencies(); retValue.Count().Should().BeGreaterThan(900); }
public static IList <Currency> GetCurrencyList() { if (ConfigHelper.DisplayUnitUSDValue || ConfigHelper.DisplayPercentage1h || ConfigHelper.DisplayPercentage24h || ConfigHelper.DisplayPercentage7d || ConfigHelper.DisplayRank || ConfigHelper.DisplayMarketCap ) { try { ICoinmarketcapClient client = new CoinmarketcapClient(); return(client.GetCurrencies(ConfigHelper.CoinMarketCapFetchCount).ToList()); } catch { ApiProblemDetected = true; ConfigHelper.DisplayUnitUSDValue = false; ConfigHelper.DisplayPercentage1h = false; ConfigHelper.DisplayPercentage24h = false; ConfigHelper.DisplayPercentage7d = false; ConfigHelper.DisplayRank = false; ConfigHelper.DisplayMarketCap = false; } } return(null); }
public void GetCoinCapListingsNoobsMucTest() { ICoinmarketcapClient client = new CoinmarketcapClient(Global.CoinmarketcapApiKey); IEnumerable <CmcCurrency> currencies = client.GetCurrencies(5000); Output.WriteLine( string.Join(",\n", currencies.Select(c => String.Concat(c.Id, ":", c.Name, ":", c.Symbol)).ToArray()) ); }
public void GetCurrency_UsingJPYAnd200_Return200Entries() { ICoinmarketcapClient m_Sut = new CoinmarketcapClient(API_KEY); IEnumerable <Currency> retValue = m_Sut.GetCurrencies(200, "JPY"); retValue.Count().Should().Be(200); retValue.First().Price.Should().NotBe(null); retValue.First().MarketCapConvert.Should().NotBe(null); retValue.First().ConvertCurrency.Should().Be("JPY"); retValue.Last().Price.Should().NotBe(null); retValue.Last().MarketCapConvert.Should().NotBe(null); retValue.Last().ConvertCurrency.Should().Be("JPY"); }
public void GetCurrency_UsingGBP_ReturnCurrencyWithConverted() { ICoinmarketcapClient m_Sut = new CoinmarketcapClient(API_KEY); var retValue = m_Sut.GetCurrencies("GBP"); retValue.Count().Should().Be(100); retValue.First().Price.Should().NotBe(null);; retValue.First().MarketCapConvert.Should().NotBe(null); retValue.First().ConvertCurrency.Should().Be("GBP"); retValue.Take(155).Last().Price.Should().NotBe(null); retValue.Take(155).Last().MarketCapConvert.Should().NotBe(null); retValue.Take(155).Last().ConvertCurrency.Should().Be("GBP"); }
public void GetCurrency_UsingJPYAnd200_Return200Entries() { ICoinmarketcapClient m_Sut = new CoinmarketcapClient(); var retValue = m_Sut.GetCurrencies(200, "JPY"); retValue.Count().Should().Be(200); retValue.First().PriceConvert.Should().NotBeNullOrEmpty(); retValue.First().MarketCapConvert.Should().NotBeNullOrEmpty(); retValue.First().Volume24Convert.Should().NotBeNullOrEmpty(); retValue.First().ConvertCurrency.Should().Be("JPY"); retValue.Last().PriceConvert.Should().NotBeNullOrEmpty(); retValue.Last().MarketCapConvert.Should().NotBeNullOrEmpty(); retValue.Last().Volume24Convert.Should().NotBeNullOrEmpty(); retValue.Last().ConvertCurrency.Should().Be("JPY"); }
public void GetCurrency_UsingGBP_ReturnAllCurrencyWithConverted() { ICoinmarketcapClient m_Sut = new CoinmarketcapClient(); var retValue = m_Sut.GetCurrencies("GBP"); retValue.Count().Should().BeGreaterThan(900); retValue.First().PriceConvert.Should().NotBeNullOrEmpty(); retValue.First().MarketCapConvert.Should().NotBeNullOrEmpty(); retValue.First().Volume24Convert.Should().NotBeNullOrEmpty(); retValue.First().ConvertCurrency.Should().Be("GBP"); retValue.Take(155).Last().PriceConvert.Should().NotBeNullOrEmpty(); retValue.Take(155).Last().MarketCapConvert.Should().NotBeNullOrEmpty(); retValue.Take(155).Last().Volume24Convert.Should().NotBeNullOrEmpty(); retValue.Take(155).Last().ConvertCurrency.Should().Be("GBP"); }
static void UpdateCurrencies() { int attempts = 0; TimeSpan attemptLength = default(TimeSpan); IEnumerable <Currency> currencies = null; do { attempts++; var task = new Task(() => { try { DateTime start = DateTime.Now; ICoinmarketcapClient cmcc = new CoinmarketcapClient(); currencies = cmcc.GetCurrencies(100000); DateTime end = DateTime.Now; attemptLength = end - start; } catch { } }); task.Start(); //TODO: This hangs on occasion task.Wait(1000); } while (currencies == null); Currencies = currencies; if (attempts > 1) { // This get annoying //new MessageBox.MessageBoxService().ShowMessage($"CoinMarket Took {attempts} attempts to get the data. Success took {attemptLength.TotalSeconds} seconds.", "Coinmarket took multiple attempts to retrieve data.", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Exclamation); } }
public static void Main() { ICoinmarketcapClient client = new CoinmarketcapClient(); var currencies = client.GetCurrencies(50); }