private static IFinanceDataProvider[] GetFinanceDataProviders(IOutput output, Models.Config config) { var finscreenerDb = config.Finscreener.DbConnection; var finscreenerDelay = config.Finscreener.Delay; if (finscreenerDb == null || finscreenerDelay == null) { throw new ArgumentNullException(); } var finscreener = new Core.FinanceDataProvider.Finscreener.FinanceDataProvider(output, finscreenerDb, finscreenerDelay.Value); var finnhubToken = config.Finnhub.Tokens?.FirstOrDefault(); var finnhubDelay = config.Finnhub.Delay; if (finnhubToken == null || finnhubDelay == null) { throw new ArgumentNullException(); } var finnhub = new Core.FinanceDataProvider.Finnhub.FinanceDataProvider(finnhubToken, finnhubDelay.Value); var yahooFinanceDelay = config.YahooFinance.Delay; if (yahooFinanceDelay == null) { throw new ArgumentNullException(); } var yahooFinance = new Core.FinanceDataProvider.YahooFinance.FinanceDataProvider(yahooFinanceDelay.Value); return(new IFinanceDataProvider[] { finscreener, finnhub, yahooFinance, }); }
private static IStorage GetDbStorage(Models.Config config) { var postgres = config.Postgres; return(new Core.Storage.Postgres.Storage(postgres.DbConnection)); }