public async void GetCoinList_returns_all_coins()
        {
            var client = new CoinGeckoClient();

            var coins = await client.GetCoinList();

            Assert.NotNull(coins);
            Assert.True(coins.Count > 1000);
        }
        public async void GetCoinPriceHistory_returns_price_history()
        {
            var client = new CoinGeckoClient();

            var priceHistory = await client.GetCoinPriceHistory("bitcoin");

            Assert.NotNull(priceHistory);
            Assert.True(priceHistory.Count > 2300);
        }
        public async void GetCoinDetail_returns_coin_details()
        {
            var client = new CoinGeckoClient();

            var coin = await client.GetCoinDetail("bitcoin");

            Assert.NotNull(coin);
            Assert.Equal("Bitcoin", coin.Name);
            Assert.Equal("btc", coin.Symbol);
        }
Ejemplo n.º 4
0
        public void GetCoinGeckoGetListTest()
        {
            CoinGeckoClient client = CoinGeckoClient.Instance;

            IReadOnlyList <CoinFullData> currencies = client.CoinsClient.GetAllCoinsData("id", 5000, 1, "en", false).GetAwaiter().GetResult();

            Output.WriteLine(
                string.Join(",\n", currencies.Select(c => string.Concat(c.Id, ":", c.Name, ":", c.Symbol, ":Slug=", c.Localization)).ToArray())
                );
            //var listingsResponse = await client.GetCryptocurrencyIdMapAsync(new IdMapParameters { Symbol = "LINK" }, CancellationToken.None);
        }
 /// <summary>
 /// The instance constructor.
 /// </summary>
 /// <param name="nodeSettings">The <see cref="NodeSettings"/>.</param>
 /// <param name="asyncProvider">The <see cref="IAsyncProvider"/>.</param>
 /// <param name="nodeLifetime">The <see cref="INodeLifetime"/>.</param>
 /// <param name="externalApiSettings">The <see cref="ExternalApiSettings"/>.</param>
 public ExternalApiPoller(NodeSettings nodeSettings,
                          IAsyncProvider asyncProvider,
                          INodeLifetime nodeLifetime,
                          ExternalApiSettings externalApiSettings)
 {
     this.asyncProvider       = asyncProvider;
     this.nodeLifetime        = nodeLifetime;
     this.logger              = nodeSettings.LoggerFactory.CreateLogger(this.GetType().FullName);
     this.externalApiSettings = externalApiSettings;
     this.etherscanClient     = new EtherscanClient(this.externalApiSettings);
     this.coinGeckoClient     = new CoinGeckoClient(this.externalApiSettings);
 }
Ejemplo n.º 6
0
        protected FeatureFixture()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile(System.IO.Directory.GetCurrentDirectory() + "\\appsettings.json")
                         .Build();

            var coinGeckoHttpClient = new HttpClient {
                BaseAddress = new Uri(config["coingecko:baseaddress"])
            };

            coinGeckoHttpClient
            .DefaultRequestHeaders
            .Add("x-rapidapi-key", config["coingecko:x-rapidapi-key"]);
            coinGeckoHttpClient
            .DefaultRequestHeaders.Add("x-rapidapi-host", config["coingecko:x-rapidapi-host"]);

            var coinGeckoClient = new CoinGeckoClient(coinGeckoHttpClient);

            ZigluService = new Service(coinGeckoClient);
        }
 public CoinDataGenerator(CoinGeckoClient coinGeckoClient)
 {
     _coinGeckoClient = coinGeckoClient;
 }