public BalanceSheetCollection ProjectBalanceSheets(string symbol, int fromYear, int yrsToProject, IncomeStatementCollection incs) { BalanceSheetCollection balProjections = BalanceSheetBL.Instance.GetBalanceSheets(symbol, fromYear - 2, fromYear); if (balProjections == null || balProjections.Count < 1) { throw new Exception("Not enough Balance Sheet Data"); } for (int i = fromYear + 1; i < fromYear + yrsToProject + 1; i++) { IncomeStatement thisInc = incs.Find(i); if (thisInc != null) { balProjections.Add(new BalanceSheet( incs[0].Symbol, i, thisInc.Revenue * GetAvgPercentOfSales("CurrentAssets", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("CurrentLiabilities", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("Ppe", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("Cash", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("Debt", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("ShareholdersEquity", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("TotalAssets", balProjections, incs) )); } } return(balProjections); }
public IncomeStatementCollection ProjectIncomeStatementsAvgRevenueGrowth(string symbol, int fromYear, int yrsToProject) { IncomeStatementCollection incProjections = IncomeStatementBL.Instance.GetIncomeStatements(symbol, fromYear - 2, fromYear); CheckEnoughIncomeStatements(incProjections); decimal avgGrowthRate = GetRevenueAverageGrowthRate(incProjections); for (int i = fromYear + 1; i < fromYear + yrsToProject + 1; i++) { IncomeStatement lastYrInc = incProjections.Find(i - 1); if (lastYrInc != null) { incProjections.Add(new IncomeStatement( incProjections[0].Symbol, i, lastYrInc.Revenue * (1 + avgGrowthRate), lastYrInc.Revenue * (1 + avgGrowthRate) * GetAvgPercentOfSales("Cogs", incProjections), lastYrInc.Revenue * (1 + avgGrowthRate) * GetAvgPercentOfSales("OperatingExpenses", incProjections), lastYrInc.Revenue * (1 + avgGrowthRate) * GetAvgPercentOfSales("Depreciation", incProjections), lastYrInc.Revenue * (1 + avgGrowthRate) * GetAvgPercentOfSales("NetIncome", incProjections), lastYrInc.Revenue * (1 + avgGrowthRate) * GetAvgPercentOfSales("CapitalExpenditures", incProjections) )); } } return(incProjections); }
public BalanceSheetCollection ProjectBalanceSheets(string symbol, int fromYear, int yrsToProject, IncomeStatementCollection incs) { BalanceSheetCollection balProjections = BalanceSheetBL.Instance.GetBalanceSheets(symbol, fromYear - 2, fromYear); if (balProjections == null || balProjections.Count < 1) { throw new Exception("Not enough Balance Sheet Data"); } for (int i = fromYear + 1; i < fromYear + yrsToProject + 1; i++) { IncomeStatement thisInc = incs.Find(i); if (thisInc != null) { balProjections.Add(new BalanceSheet( incs[0].Symbol, i, thisInc.Revenue * GetAvgPercentOfSales("CurrentAssets", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("CurrentLiabilities", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("Ppe", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("Cash", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("Debt", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("ShareholdersEquity", balProjections, incs), thisInc.Revenue * GetAvgPercentOfSales("TotalAssets", balProjections, incs) )); } } return balProjections; }
public IncomeStatementCollection ProjectIncomeStatementsDecayRevenueGrowth(string symbol, int fromYear, int yrsToProject, decimal endGrowth) { IncomeStatementCollection incProjections = IncomeStatementBL.Instance.GetIncomeStatements(symbol, fromYear - 2, fromYear); CheckEnoughIncomeStatements(incProjections); decimal[] yoyGrowth = GetDecayGrowthRates(yrsToProject, endGrowth, incProjections); int j = 0; for (int i = fromYear + 1; i < fromYear + yrsToProject + 1; i++) { IncomeStatement lastYrInc = incProjections.Find(i - 1); if (lastYrInc != null) { incProjections.Add(new IncomeStatement( incProjections[0].Symbol, i, lastYrInc.Revenue * (1 + yoyGrowth[j]), lastYrInc.Revenue * (1 + yoyGrowth[j]) * GetAvgPercentOfSales("Cogs", incProjections), lastYrInc.Revenue * (1 + yoyGrowth[j]) * GetAvgPercentOfSales("OperatingExpenses", incProjections), lastYrInc.Revenue * (1 + yoyGrowth[j]) * GetAvgPercentOfSales("Depreciation", incProjections), lastYrInc.Revenue * (1 + yoyGrowth[j]) * GetAvgPercentOfSales("NetIncome", incProjections), lastYrInc.Revenue * (1 + yoyGrowth[j]) * GetAvgPercentOfSales("CapitalExpenditures", incProjections) )); } j++; } return(incProjections); }
public void GetCashFlowStatementData(string symbol, int year, int yearsToLoad, IncomeStatementCollection incs) { Dictionary <int, Dictionary <string, decimal> > values = new Dictionary <int, Dictionary <string, decimal> >(); Dictionary <string, decimal> bs2012 = new Dictionary <string, decimal>(); Dictionary <string, decimal> bs2011 = new Dictionary <string, decimal>(); Dictionary <string, decimal> bs2010 = new Dictionary <string, decimal>(); string url = "http://finance.yahoo.com/q/cf?s=" + symbol + "+Cash+Flow&annual"; HtmlDocument doc = new HtmlWeb().Load(url); foreach (HtmlNode div in doc.DocumentNode.SelectNodes("//td[@colspan='2']")) { if (div.InnerHtml.Contains("Depreciation")) { bs2012.Add("Depreciation", GetValueFromInnerHtml(div.NextSibling.ChildNodes[0].InnerHtml)); bs2011.Add("Depreciation", GetValueFromInnerHtml(div.NextSibling.NextSibling.ChildNodes[0].InnerHtml)); bs2010.Add("Depreciation", GetValueFromInnerHtml(div.NextSibling.NextSibling.NextSibling.ChildNodes[0].InnerHtml)); } else if (div.InnerHtml.Contains("Capital Expenditures")) { bs2012.Add("Capital Expenditures", GetValueFromInnerHtml(div.NextSibling.ChildNodes[0].InnerHtml) * -1); bs2011.Add("Capital Expenditures", GetValueFromInnerHtml(div.NextSibling.NextSibling.ChildNodes[0].InnerHtml) * -1); bs2010.Add("Capital Expenditures", GetValueFromInnerHtml(div.NextSibling.NextSibling.NextSibling.ChildNodes[0].InnerHtml) * -1); } //else if (div.InnerHtml.Equals("Investments")) //{ // bs2012.Add("Investments", GetValueFromInnerHtml(div.NextSibling.ChildNodes[0].InnerHtml)); // bs2011.Add("Investments", GetValueFromInnerHtml(div.NextSibling.NextSibling.ChildNodes[0].InnerHtml)); // bs2010.Add("Investments", GetValueFromInnerHtml(div.NextSibling.NextSibling.NextSibling.ChildNodes[0].InnerHtml)); //} } values.Add(2010, bs2010); values.Add(2011, bs2011); values.Add(2012, bs2012); for (int y = year; y > year - yearsToLoad; y--) { if (values.ContainsKey(y)) { incs.Find(y).Depreciation = values[y]["Depreciation"]; incs.Find(y).CapitalExpenditures = values[y]["Capital Expenditures"]; } } }
private void EnterFinancialData(IncomeStatementCollection incs, BalanceSheetCollection bals, CompanyAnnualData cad, int year, int yearsToLoad) { CompanyAnnualDataBL.Instance.UpdateCompanyAnnual(cad); for (int y = year; y > year - yearsToLoad; y--) { IncomeStatementBL.Instance.UpdateIncomeStatement(incs.Find(y)); BalanceSheetBL.Instance.UpdateBalanceSheet(bals.Find(y)); } }
public FreeCashFlowCollection CalculateFreeCashFlow(string symbol, int year, int yrsToProject, IncomeStatementCollection incomeStatementProjection) { FreeCashFlowCollection fcfs = null; MarketParameters mktParms = MarketParametersBL.Instance.GetMarketParameters(); BalanceSheetProjectionBL bsProjectionBL = new BalanceSheetProjectionBL(); BalanceSheetCollection bsProjections = bsProjectionBL.ProjectBalanceSheets(symbol, year, yrsToProject, incomeStatementProjection); if (incomeStatementProjection != null && bsProjections != null) { fcfs = new FreeCashFlowCollection(); for (int i = year + 1; i < year + yrsToProject + 1; i++) { IncomeStatement inc = incomeStatementProjection.Find(i); BalanceSheet bs = bsProjections.Find(i); BalanceSheet lastYrBs = bsProjections.Find(i - 1); if (inc != null && bs != null) { fcfs.Add(new FreeCashFlow( symbol, i, inc.NOP(mktParms.TaxRate), inc.NetIncome, (bs.Ppe - lastYrBs.Ppe + inc.Depreciation), bs.WorkingCapital, bs.WorkingCapital - lastYrBs.WorkingCapital, inc.Depreciation, bs.InvestedCapital )); } } } return(fcfs); }
public FreeCashFlowCollection CalculateFreeCashFlow(string symbol, int year, int yrsToProject ,IncomeStatementCollection incomeStatementProjection) { FreeCashFlowCollection fcfs = null; MarketParameters mktParms = MarketParametersBL.Instance.GetMarketParameters(); BalanceSheetProjectionBL bsProjectionBL = new BalanceSheetProjectionBL(); BalanceSheetCollection bsProjections = bsProjectionBL.ProjectBalanceSheets(symbol, year, yrsToProject, incomeStatementProjection); if (incomeStatementProjection != null && bsProjections != null) { fcfs = new FreeCashFlowCollection(); for (int i = year + 1; i < year + yrsToProject + 1; i++) { IncomeStatement inc = incomeStatementProjection.Find(i); BalanceSheet bs = bsProjections.Find(i); BalanceSheet lastYrBs = bsProjections.Find(i - 1); if (inc != null && bs != null) { fcfs.Add(new FreeCashFlow( symbol, i, inc.NOP(mktParms.TaxRate), inc.NetIncome, (bs.Ppe - lastYrBs.Ppe + inc.Depreciation), bs.WorkingCapital, bs.WorkingCapital -lastYrBs.WorkingCapital, inc.Depreciation, bs.InvestedCapital )); } } } return fcfs; }
public void GetCashFlowStatementData(string symbol, int year, int yearsToLoad, IncomeStatementCollection incs) { Dictionary<int, Dictionary<string, decimal>> values = new Dictionary<int, Dictionary<string, decimal>>(); Dictionary<string, decimal> bs2012 = new Dictionary<string, decimal>(); Dictionary<string, decimal> bs2011 = new Dictionary<string, decimal>(); Dictionary<string, decimal> bs2010 = new Dictionary<string, decimal>(); string url = "http://finance.yahoo.com/q/cf?s=" + symbol + "+Cash+Flow&annual"; HtmlDocument doc = new HtmlWeb().Load(url); foreach (HtmlNode div in doc.DocumentNode.SelectNodes("//td[@colspan='2']")) { if (div.InnerHtml.Contains("Depreciation")) { bs2012.Add("Depreciation", GetValueFromInnerHtml(div.NextSibling.ChildNodes[0].InnerHtml)); bs2011.Add("Depreciation", GetValueFromInnerHtml(div.NextSibling.NextSibling.ChildNodes[0].InnerHtml)); bs2010.Add("Depreciation", GetValueFromInnerHtml(div.NextSibling.NextSibling.NextSibling.ChildNodes[0].InnerHtml)); } else if (div.InnerHtml.Contains("Capital Expenditures")) { bs2012.Add("Capital Expenditures", GetValueFromInnerHtml(div.NextSibling.ChildNodes[0].InnerHtml) * -1); bs2011.Add("Capital Expenditures", GetValueFromInnerHtml(div.NextSibling.NextSibling.ChildNodes[0].InnerHtml) * -1); bs2010.Add("Capital Expenditures", GetValueFromInnerHtml(div.NextSibling.NextSibling.NextSibling.ChildNodes[0].InnerHtml) * -1); } //else if (div.InnerHtml.Equals("Investments")) //{ // bs2012.Add("Investments", GetValueFromInnerHtml(div.NextSibling.ChildNodes[0].InnerHtml)); // bs2011.Add("Investments", GetValueFromInnerHtml(div.NextSibling.NextSibling.ChildNodes[0].InnerHtml)); // bs2010.Add("Investments", GetValueFromInnerHtml(div.NextSibling.NextSibling.NextSibling.ChildNodes[0].InnerHtml)); //} } values.Add(2010, bs2010); values.Add(2011, bs2011); values.Add(2012, bs2012); for (int y = year; y > year - yearsToLoad; y--) { if (values.ContainsKey(y)) { incs.Find(y).Depreciation = values[y]["Depreciation"]; incs.Find(y).CapitalExpenditures = values[y]["Capital Expenditures"]; } } }