Esempio n. 1
0
 public static void WriteOperatingCashData(Operating_Cash_DB_Model OperatingCash)
 {
     using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
     {
         cnn.Execute("insert into Operating_cash (DATE, OPERATING_CASH_FLOW, STOCK_TICKER) values (@DATE, @OPERATING_CASH_FLOW, @STOCK_TICKER)", OperatingCash);
     }
 }
        //making a webclient call syncly
        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}");

            //StockPriceModel Sp_json = JsonConvert.DeserializeObject<StockPriceModel>(Json);

            var OCJson = CashFlow_Top_Level.FromJson(Json);

            Console.WriteLine("Writting to Operating_Cash DB");
            foreach (var item in OCJson.Financials)
            {
                Operating_Cash_DB_Model OperatingCash = new Operating_Cash_DB_Model {
                    DATE = (item.Date), OPERATING_CASH_FLOW = (item.OperatingCashFlow), STOCK_TICKER = company.STOCK_TICKER
                };
                SQL.WriteOperatingCashData(OperatingCash);
            }



            //Operating_Cash_DB_Model OperatingCash = new Operating_Cash_DB_Model { DATE = (OCJson.Symbol[0]), OPERATING_CASH_FLOW = OCJson.  , STOCK_TICKER = company.STOCK_TICKER };

            //SQL.WriteCurrentFinancialsData(StockPrice);



            Random rnd = new Random();

            company.OPERATING_CASH = Convert.ToDouble(rnd.Next());

            return(company);
        }