static async Task Main(string[] args) { var storage = new CandlesPersistentAzureStorage( () => _bidConnectionString, () => _askConnectionString); //await LoadInstrument("USDTUSD", "BUSDUSDT", storage, 4, true); //await LoadInstrument("testBTCUSD", "BTCBUSD", storage, 8); //await LoadInstrument("testETHUSD", "ETHBUSD", storage, 8); //await LoadInstrument("testXLMUSD", "XLMBUSD", storage, 8); /* * await LoadInstrument("ALGOBTC", "ALGOBTC", storage, 8); * await LoadInstrument("ALGOUSD", "ALGOBUSD", storage, 4); * * await LoadInstrument("BCHBTC", "BCHBTC", storage, 6); * await LoadInstrument("BCHUSD", "BCHBUSD", storage, 2); * * await LoadInstrument("BTCEUR", "BTCEUR", storage, 2); * await LoadInstrument("BTCUSD", "BTCBUSD", storage, 2); * * await LoadInstrument("DASHBTC", "DASHBTC", storage, 6); * await LoadInstrument("DASHUSD", "DASHBUSD", storage, 2); * * await LoadInstrument("EOSBTC", "EOSBTC", storage, 8); * await LoadInstrument("EOSUSD", "EOSBUSD", storage, 2); * * await LoadInstrument("ETHBTC", "ETHBTC", storage, 8); * await LoadInstrument("ETHEUR", "ETHEUR", storage, 2); * await LoadInstrument("ETHUSD", "ETHBUSD", storage, 2); * * await LoadInstrument("LTCBTC", "LTCBTC", storage, 8); * await LoadInstrument("LTCUSD", "LTCBUSD", storage, 4); * * await LoadInstrument("TRXBTC", "TRXBTC", storage, 8); * await LoadInstrument("TRXUSD", "TRXBUSD", storage, 6); * * await LoadInstrument("XLMBTC", "XLMBTC", storage, 8); * await LoadInstrument("XLMUSD", "XLMBUSD", storage, 5); * * await LoadInstrument("XRPBTC", "XRPBTC", storage, 8); * await LoadInstrument("XRPUSD", "XRPBUSD", storage, 6); * * await LoadInstrument("ZECBTC", "ZECBTC", storage, 8); * await LoadInstrument("ZECUSD", "ZECBUSD", storage, 2); */ Console.WriteLine(); Console.WriteLine("End of loading"); Console.ReadLine(); }
private static async Task LoadInterval(CandleType candle, string source, CandlesPersistentAzureStorage storage, string symbol, int digits, bool isRevert) { Console.WriteLine(); Console.WriteLine($"----- {candle.ToString()} --------"); var interval = ""; switch (candle) { case CandleType.Minute: interval = "1m"; break; case CandleType.Hour: interval = "1h"; break; case CandleType.Day: interval = "1d"; break; case CandleType.Month: interval = "1M"; break; } var data = await GetCandles(source, 1000, interval, 0, isRevert, digits); var count = 0; //while (data.Any() && count < 45000) while (data.Any() && count < 3000) { Console.Write($"Read {data.Count} items from Binance ... "); await storage.BulkSave(symbol, true, digits, candle, data); await storage.BulkSave(symbol, false, digits, candle, data); Console.WriteLine($"Save {data.Count} items"); var lastTime = data.Min(e => e.DateTime).UnixTime(); count += data.Count; data = await GetCandles(source, 1000, interval, lastTime - 1, isRevert, digits); } }
private static async Task LoadInstrument(string symbol, string source, CandlesPersistentAzureStorage storage, int digits, bool isRevert = false) { Console.WriteLine(); Console.WriteLine($"========= Load {symbol} from {source} ======="); var candle = CandleType.Minute; await LoadInterval(candle, source, storage, symbol, digits, isRevert); candle = CandleType.Hour; await LoadInterval(candle, source, storage, symbol, digits, isRevert); candle = CandleType.Day; await LoadInterval(candle, source, storage, symbol, digits, isRevert); candle = CandleType.Month; await LoadInterval(candle, source, storage, symbol, digits, isRevert); }