public static void WriteDividendsData(Dividends_DB_Model dividends) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute("insert into Dividends (DATE, DIVIDENDS, STOCK_TICKER) values (@DATE, @DIVIDENDS, @STOCK_TICKER)", dividends); } }
public override ValueInvestingCompanyDBModel WebClientAPICall(ValueInvestingCompanyDBModel company) { string Json = ""; WebClient client = new WebClient(); Json = client.DownloadString($"https://financialmodelingprep.com/api/v3/financials/cash-flow-statement/{ company.STOCK_TICKER}"); var OCJson = CashFlow_Top_Level.FromJson(Json); Console.WriteLine("Writting to Book Value DB"); foreach (var item in OCJson.Financials) { Dividends_DB_Model dividends = new Dividends_DB_Model { DATE = (item.Date), DIVIDENDS = (item.DividendPayments), STOCK_TICKER = company.STOCK_TICKER }; SQL.WriteDividendsData(dividends); } Random rnd = new Random(); company.DIVIDENDS = Convert.ToDouble(rnd.Next()); return(company); }