Exemplo n.º 1
0
        /// <summary>
        /// Download all assets to SQL database
        /// </summary>
        internal async Task DownloadAssets()
        {
            CryptoWatch cryptoWatch          = new CryptoWatch(new HttpClient());
            IEnumerable <CryptoAsset> assets = await cryptoWatch.GetAssets();

            ICryptoTickerRepository cryptoTickerRepository = new CryptoTickerRepository(this.DataContext);

            assets = this.FilterNotSavedAssets(assets);

            foreach (CryptoAsset asset in assets)
            {
                this.CreateTickerEntity(asset, cryptoTickerRepository);
            }

            cryptoTickerRepository.Save();
        }
        private async Task <List <CandleModel> > DownloadData(CryptoTicker cryptoTicker, DateTime from)
        {
            CryptoWatch cryptoCandleDataApi = new CryptoWatch(new HttpClient());

            return(await cryptoCandleDataApi.GetCandlesDataFrom(cryptoTicker.ToString(), from).ConfigureAwait(false));
        }