finmodeling 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +0 -0
- data/Gemfile +2 -0
- data/README.md +289 -269
- data/Rakefile +12 -0
- data/TODO.txt +113 -20
- data/examples/{dump_report.rb → dump_latest_10k.rb} +1 -1
- data/examples/list_disclosures.rb +50 -0
- data/examples/lists/nasdaq-mid-to-mega-tech-symbols.txt +0 -0
- data/examples/show_report.rb +112 -32
- data/examples/show_reports.rb +162 -33
- data/finmodeling.gemspec +4 -1
- data/lib/finmodeling/annual_report_filing.rb +97 -18
- data/lib/finmodeling/array_with_stats.rb +0 -0
- data/lib/finmodeling/assets_calculation.rb +12 -3
- data/lib/finmodeling/assets_item.rb +0 -0
- data/lib/finmodeling/assets_item_vectors.rb +0 -0
- data/lib/finmodeling/balance_sheet_analyses.rb +19 -4
- data/lib/finmodeling/balance_sheet_calculation.rb +52 -37
- data/lib/finmodeling/calculation_summary.rb +119 -14
- data/lib/finmodeling/can_cache_classifications.rb +0 -0
- data/lib/finmodeling/can_cache_summaries.rb +0 -0
- data/lib/finmodeling/can_choose_successive_periods.rb +15 -0
- data/lib/finmodeling/can_classify_rows.rb +0 -0
- data/lib/finmodeling/capm.rb +80 -0
- data/lib/finmodeling/cash_change_calculation.rb +3 -3
- data/lib/finmodeling/cash_change_item.rb +0 -0
- data/lib/finmodeling/cash_change_item_vectors.rb +0 -0
- data/lib/finmodeling/cash_change_summary_from_differences.rb +36 -0
- data/lib/finmodeling/cash_flow_statement_analyses.rb +36 -0
- data/lib/finmodeling/cash_flow_statement_calculation.rb +28 -52
- data/lib/finmodeling/classifiers.rb +2 -0
- data/lib/finmodeling/company.rb +0 -0
- data/lib/finmodeling/company_filing.rb +30 -7
- data/lib/finmodeling/company_filing_calculation.rb +16 -6
- data/lib/finmodeling/company_filings.rb +112 -46
- data/lib/finmodeling/comprehensive_income_calculation.rb +60 -0
- data/lib/finmodeling/comprehensive_income_statement_calculation.rb +74 -0
- data/lib/finmodeling/comprehensive_income_statement_item.rb +20 -0
- data/lib/finmodeling/comprehensive_income_statement_item_vectors.rb +235 -0
- data/lib/finmodeling/config.rb +0 -0
- data/lib/finmodeling/debt_cost_of_capital.rb +14 -0
- data/lib/finmodeling/equity_change_calculation.rb +43 -0
- data/lib/finmodeling/equity_change_item.rb +25 -0
- data/lib/finmodeling/equity_change_item_vectors.rb +156 -0
- data/lib/finmodeling/factory.rb +0 -0
- data/lib/finmodeling/fama_french_cost_of_equity.rb +119 -0
- data/lib/finmodeling/float_helpers.rb +14 -8
- data/lib/finmodeling/forecasted_reformulated_balance_sheet.rb +55 -0
- data/lib/finmodeling/forecasted_reformulated_income_statement.rb +110 -0
- data/lib/finmodeling/forecasts.rb +4 -4
- data/lib/finmodeling/has_string_classifer.rb +0 -0
- data/lib/finmodeling/income_statement_analyses.rb +23 -17
- data/lib/finmodeling/income_statement_calculation.rb +46 -43
- data/lib/finmodeling/income_statement_item.rb +1 -1
- data/lib/finmodeling/income_statement_item_vectors.rb +24 -13
- data/lib/finmodeling/invalid_filing_error.rb +4 -0
- data/lib/finmodeling/liabs_and_equity_calculation.rb +18 -8
- data/lib/finmodeling/liabs_and_equity_item.rb +1 -1
- data/lib/finmodeling/liabs_and_equity_item_vectors.rb +24 -24
- data/lib/finmodeling/linear_trend_forecasting_policy.rb +23 -0
- data/lib/finmodeling/net_income_calculation.rb +23 -10
- data/lib/finmodeling/net_income_summary_from_differences.rb +51 -0
- data/lib/finmodeling/paths.rb +0 -0
- data/lib/finmodeling/period_array.rb +8 -4
- data/lib/finmodeling/quarterly_report_filing.rb +9 -4
- data/lib/finmodeling/rate.rb +8 -0
- data/lib/finmodeling/ratio.rb +0 -0
- data/lib/finmodeling/reformulated_balance_sheet.rb +47 -88
- data/lib/finmodeling/reformulated_cash_flow_statement.rb +18 -41
- data/lib/finmodeling/reformulated_income_statement.rb +44 -206
- data/lib/finmodeling/reformulated_shareholder_equity_statement.rb +50 -0
- data/lib/finmodeling/reoi_valuation.rb +104 -0
- data/lib/finmodeling/shareholder_equity_statement_calculation.rb +34 -0
- data/lib/finmodeling/string_helpers.rb +18 -1
- data/lib/finmodeling/time_series_estimator.rb +25 -0
- data/lib/finmodeling/trailing_avg_forecasting_policy.rb +23 -0
- data/lib/finmodeling/version.rb +1 -1
- data/lib/finmodeling/weighted_avg_cost_of_capital.rb +35 -0
- data/lib/finmodeling/yahoo_finance_helpers.rb +20 -0
- data/lib/finmodeling.rb +33 -2
- data/spec/annual_report_filing_spec.rb +81 -45
- data/spec/assets_calculation_spec.rb +7 -4
- data/spec/assets_item_spec.rb +9 -14
- data/spec/balance_sheet_analyses_spec.rb +13 -13
- data/spec/balance_sheet_calculation_spec.rb +45 -51
- data/spec/calculation_summary_spec.rb +113 -21
- data/spec/can_classify_rows_spec.rb +0 -0
- data/spec/cash_change_calculation_spec.rb +1 -10
- data/spec/cash_change_item_spec.rb +10 -18
- data/spec/cash_flow_statement_calculation_spec.rb +10 -24
- data/spec/company_beta_spec.rb +53 -0
- data/spec/company_filing_calculation_spec.rb +39 -49
- data/spec/company_filing_spec.rb +0 -0
- data/spec/company_filings_spec.rb +75 -25
- data/spec/company_spec.rb +37 -47
- data/spec/comprehensive_income_statement_calculation_spec.rb +54 -0
- data/spec/comprehensive_income_statement_item_spec.rb +56 -0
- data/spec/debt_cost_of_capital_spec.rb +19 -0
- data/spec/equity_change_calculation_spec.rb +33 -0
- data/spec/equity_change_item_spec.rb +58 -0
- data/spec/factory_spec.rb +2 -2
- data/spec/forecasts_spec.rb +2 -2
- data/spec/income_statement_analyses_spec.rb +23 -21
- data/spec/income_statement_calculation_spec.rb +17 -49
- data/spec/income_statement_item_spec.rb +17 -29
- data/spec/liabs_and_equity_calculation_spec.rb +6 -3
- data/spec/liabs_and_equity_item_spec.rb +14 -22
- data/spec/linear_trend_forecasting_policy_spec.rb +37 -0
- data/spec/matchers/custom_matchers.rb +79 -0
- data/spec/mocks/calculation.rb +0 -0
- data/spec/mocks/income_statement_analyses.rb +0 -0
- data/spec/mocks/sec_query.rb +0 -0
- data/spec/net_income_calculation_spec.rb +16 -10
- data/spec/period_array.rb +0 -0
- data/spec/quarterly_report_filing_spec.rb +21 -38
- data/spec/rate_spec.rb +0 -0
- data/spec/ratio_spec.rb +0 -0
- data/spec/reformulated_balance_sheet_spec.rb +56 -33
- data/spec/reformulated_cash_flow_statement_spec.rb +18 -10
- data/spec/reformulated_income_statement_spec.rb +16 -15
- data/spec/reformulated_shareholder_equity_statement_spec.rb +43 -0
- data/spec/reoi_valuation_spec.rb +146 -0
- data/spec/shareholder_equity_statement_calculation_spec.rb +59 -0
- data/spec/spec_helper.rb +4 -1
- data/spec/string_helpers_spec.rb +15 -13
- data/spec/time_series_estimator_spec.rb +61 -0
- data/spec/trailing_avg_forecasting_policy_spec.rb +37 -0
- data/spec/weighted_avg_cost_of_capital_spec.rb +32 -0
- data/tools/create_equity_change_training_vectors.rb +49 -0
- data/tools/time_specs.sh +7 -0
- metadata +182 -36
- data/lib/finmodeling/constant_forecasting_policy.rb +0 -23
- data/lib/finmodeling/generic_forecasting_policy.rb +0 -19
- data/spec/constant_forecasting_policy_spec.rb +0 -37
- data/spec/generic_forecasting_policy_spec.rb +0 -33
|
@@ -13,7 +13,7 @@ module FinModeling
|
|
|
13
13
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
14
14
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
15
15
|
{:klass=>:cse, :item_string=>"Treasury Stock Value"},
|
|
16
|
-
{:klass=>:
|
|
16
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
17
17
|
|
|
18
18
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
19
19
|
{:klass=>:ol, :item_string=>"Accrued Liabilities Current"},
|
|
@@ -115,7 +115,7 @@ module FinModeling
|
|
|
115
115
|
{:klass=>:ol, :item_string=>"Accrued Liabilities Current"},
|
|
116
116
|
{:klass=>:ol, :item_string=>"Pension And Other Postretirement And Postemployment Benefit Plans Liabilities Noncurrent"},
|
|
117
117
|
{:klass=>:ol, :item_string=>"Other Liabilities Noncurrent"},
|
|
118
|
-
{:klass=>:
|
|
118
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
119
119
|
{:klass=>:cse, :item_string=>"Common Stock Value"},
|
|
120
120
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital"},
|
|
121
121
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
@@ -280,7 +280,7 @@ module FinModeling
|
|
|
280
280
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
281
281
|
{:klass=>:cse, :item_string=>"Treasury Stock Value"},
|
|
282
282
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
283
|
-
{:klass=>:
|
|
283
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
284
284
|
|
|
285
285
|
{:klass=>:fl, :item_string=>"Notes And Loans Payable Current"},
|
|
286
286
|
{:klass=>:ol, :item_string=>"Accounts Payable And Accrued Liabilities Current"},
|
|
@@ -376,7 +376,7 @@ module FinModeling
|
|
|
376
376
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital Common Stock"},
|
|
377
377
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
378
378
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
379
|
-
{:klass=>:
|
|
379
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
380
380
|
|
|
381
381
|
{:klass=>:ol, :item_string=>"Other Liabilities Noncurrent"},
|
|
382
382
|
{:klass=>:fl, :item_string=>"Accrued Income Taxes Current"},
|
|
@@ -410,7 +410,7 @@ module FinModeling
|
|
|
410
410
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital"},
|
|
411
411
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
412
412
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
413
|
-
{:klass=>:
|
|
413
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
414
414
|
|
|
415
415
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
416
416
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
@@ -447,7 +447,7 @@ module FinModeling
|
|
|
447
447
|
{:klass=>:fl, :item_string=>"Accrued Income Taxes Noncurrent"},
|
|
448
448
|
{:klass=>:ol, :item_string=>"Deferred Revenue Noncurrent"},
|
|
449
449
|
{:klass=>:ol, :item_string=>"Other Liabilities Noncurrent"},
|
|
450
|
-
{:klass=>:
|
|
450
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
451
451
|
{:klass=>:fl, :item_string=>"Preferred Stock Value"},
|
|
452
452
|
{:klass=>:cse, :item_string=>"Common Stock Including Additional Paid In Capital"},
|
|
453
453
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
@@ -485,7 +485,7 @@ module FinModeling
|
|
|
485
485
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
486
486
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
487
487
|
{:klass=>:cse, :item_string=>"Treasury Stock Value"},
|
|
488
|
-
{:klass=>:
|
|
488
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
489
489
|
|
|
490
490
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
491
491
|
{:klass=>:ol, :item_string=>"Accrued Liabilities Current"},
|
|
@@ -512,7 +512,7 @@ module FinModeling
|
|
|
512
512
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
513
513
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
514
514
|
{:klass=>:cse, :item_string=>"Treasury Stock Value"},
|
|
515
|
-
{:klass=>:
|
|
515
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
516
516
|
|
|
517
517
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
518
518
|
{:klass=>:ol, :item_string=>"Deferred Revenue Current"},
|
|
@@ -810,7 +810,7 @@ module FinModeling
|
|
|
810
810
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital Common Stock"},
|
|
811
811
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
812
812
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
813
|
-
{:klass=>:
|
|
813
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
814
814
|
|
|
815
815
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
816
816
|
{:klass=>:ol, :item_string=>"Employee Related Liabilities Current"},
|
|
@@ -875,7 +875,7 @@ module FinModeling
|
|
|
875
875
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
876
876
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
877
877
|
{:klass=>:cse, :item_string=>"Treasury Stock Value"},
|
|
878
|
-
{:klass=>:
|
|
878
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
879
879
|
|
|
880
880
|
{:klass=>:fl, :item_string=>"Convertible Debt Noncurrent"},
|
|
881
881
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
@@ -971,7 +971,7 @@ module FinModeling
|
|
|
971
971
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital Common Stock"},
|
|
972
972
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
973
973
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
974
|
-
{:klass=>:
|
|
974
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
975
975
|
|
|
976
976
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
977
977
|
{:klass=>:ol, :item_string=>"Accrued Revenue Share Obligation And Rebates"},
|
|
@@ -1067,7 +1067,7 @@ module FinModeling
|
|
|
1067
1067
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1068
1068
|
|
|
1069
1069
|
{:klass=>:cse, :item_string=>"Stockholders Equity"},
|
|
1070
|
-
{:klass=>:
|
|
1070
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1071
1071
|
{:klass=>:ol, :item_string=>"Other Liabilities Noncurrent"},
|
|
1072
1072
|
{:klass=>:fl, :item_string=>"Accrued Income Taxes Noncurrent"},
|
|
1073
1073
|
{:klass=>:ol, :item_string=>"Deferred Revenue Noncurrent"},
|
|
@@ -1115,7 +1115,7 @@ module FinModeling
|
|
|
1115
1115
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital Common Stock"},
|
|
1116
1116
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1117
1117
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1118
|
-
{:klass=>:
|
|
1118
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1119
1119
|
|
|
1120
1120
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1121
1121
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
@@ -1188,7 +1188,7 @@ module FinModeling
|
|
|
1188
1188
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1189
1189
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1190
1190
|
{:klass=>:cse, :item_string=>"Treasury Stock Value"},
|
|
1191
|
-
{:klass=>:
|
|
1191
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1192
1192
|
|
|
1193
1193
|
{:klass=>:fl, :item_string=>"Notes And Loans Payable Current"},
|
|
1194
1194
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
@@ -1202,7 +1202,7 @@ module FinModeling
|
|
|
1202
1202
|
{:klass=>:fl, :item_string=>"Preferred Stock Value"},
|
|
1203
1203
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1204
1204
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1205
|
-
{:klass=>:
|
|
1205
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1206
1206
|
|
|
1207
1207
|
{:klass=>:ol, :item_string=>"Deferred Revenue Current"},
|
|
1208
1208
|
{:klass=>:fl, :item_string=>"Deferred Tax Liabilities Current"},
|
|
@@ -1236,7 +1236,7 @@ module FinModeling
|
|
|
1236
1236
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Available For Sale Securities Adjustment Net Of Tax"},
|
|
1237
1237
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Foreign Currency Translation Adjustment Net Of Tax"},
|
|
1238
1238
|
|
|
1239
|
-
{:klass=>:
|
|
1239
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1240
1240
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1241
1241
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1242
1242
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital Common Stock"},
|
|
@@ -1330,7 +1330,7 @@ module FinModeling
|
|
|
1330
1330
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital"},
|
|
1331
1331
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1332
1332
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1333
|
-
{:klass=>:
|
|
1333
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1334
1334
|
|
|
1335
1335
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
1336
1336
|
{:klass=>:ol, :item_string=>"Employee Related Liabilities Current"},
|
|
@@ -1377,7 +1377,7 @@ module FinModeling
|
|
|
1377
1377
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital"},
|
|
1378
1378
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1379
1379
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1380
|
-
{:klass=>:
|
|
1380
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1381
1381
|
{:klass=>:fl, :item_string=>"Redeemable Noncontrolling Interest Equity Carrying Amount"},
|
|
1382
1382
|
|
|
1383
1383
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
@@ -1647,7 +1647,7 @@ module FinModeling
|
|
|
1647
1647
|
{:klass=>:cse, :item_string=>"Treasury Stock Value"},
|
|
1648
1648
|
{:klass=>:cse, :item_string=>"Retained Earnings Unappropriated"},
|
|
1649
1649
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1650
|
-
{:klass=>:
|
|
1650
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1651
1651
|
|
|
1652
1652
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
1653
1653
|
{:klass=>:ol, :item_string=>"Accrued Liabilities Current"},
|
|
@@ -1664,7 +1664,7 @@ module FinModeling
|
|
|
1664
1664
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital Common Stock"},
|
|
1665
1665
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1666
1666
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1667
|
-
{:klass=>:
|
|
1667
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1668
1668
|
|
|
1669
1669
|
{:klass=>:ol, :item_string=>"Accounts Payable And Accrued Liabilities Current"},
|
|
1670
1670
|
{:klass=>:ol, :item_string=>"Deferred Revenue Subscription And Support Current"},
|
|
@@ -1737,7 +1737,7 @@ module FinModeling
|
|
|
1737
1737
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1738
1738
|
{:klass=>:fl, :item_string=>"Statutory Accounting Practices Statutory Capital And Surplus Balance"},
|
|
1739
1739
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1740
|
-
{:klass=>:
|
|
1740
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1741
1741
|
|
|
1742
1742
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
1743
1743
|
{:klass=>:ol, :item_string=>"Accrued Liabilities Current"},
|
|
@@ -1861,7 +1861,7 @@ module FinModeling
|
|
|
1861
1861
|
{:klass=>:cse, :item_string=>"Additional Paid In Capital Common Stock"},
|
|
1862
1862
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1863
1863
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1864
|
-
{:klass=>:
|
|
1864
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1865
1865
|
|
|
1866
1866
|
{:klass=>:ol, :item_string=>"Deferred Revenue Current"},
|
|
1867
1867
|
{:klass=>:ol, :item_string=>"Accounts Payable And Accrued Liabilities Current"},
|
|
@@ -1888,7 +1888,7 @@ module FinModeling
|
|
|
1888
1888
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1889
1889
|
{:klass=>:cse, :item_string=>"Treasury Stock Value"},
|
|
1890
1890
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1891
|
-
{:klass=>:
|
|
1891
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1892
1892
|
|
|
1893
1893
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
1894
1894
|
{:klass=>:ol, :item_string=>"Employee Related Liabilities Current"},
|
|
@@ -1916,7 +1916,7 @@ module FinModeling
|
|
|
1916
1916
|
{:klass=>:cse, :item_string=>"Treasury Stock Value"},
|
|
1917
1917
|
{:klass=>:cse, :item_string=>"Retained Earnings Accumulated Deficit"},
|
|
1918
1918
|
{:klass=>:cse, :item_string=>"Accumulated Other Comprehensive Income Loss Net Of Tax"},
|
|
1919
|
-
{:klass=>:
|
|
1919
|
+
{:klass=>:mi, :item_string=>"Minority Interest"},
|
|
1920
1920
|
|
|
1921
1921
|
{:klass=>:ol, :item_string=>"Accounts Payable Current"},
|
|
1922
1922
|
{:klass=>:ol, :item_string=>"Accrued Liabilities Current"},
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module FinModeling
|
|
2
|
+
class LinearTrendForecastingPolicy
|
|
3
|
+
def initialize(args)
|
|
4
|
+
@vals = args
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def revenue_on(date)
|
|
8
|
+
@vals[:revenue_estimator].estimate_on(date)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def sales_pm_on(date)
|
|
12
|
+
@vals[:sales_pm_estimator].estimate_on(date)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def fi_over_nfa_on(date)
|
|
16
|
+
@vals[:fi_over_nfa_estimator].estimate_on(date)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def sales_over_noa_on(date)
|
|
20
|
+
@vals[:sales_over_noa_estimator].estimate_on(date)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -6,16 +6,17 @@ module FinModeling
|
|
|
6
6
|
|
|
7
7
|
BASE_FILENAME = File.join(FinModeling::BASE_PATH, "summaries/net_income_")
|
|
8
8
|
|
|
9
|
-
ALL_STATES =
|
|
10
|
-
NEXT_STATES = { nil
|
|
11
|
-
:or
|
|
12
|
-
:cogs
|
|
13
|
-
:oe
|
|
14
|
-
:oibt
|
|
15
|
-
:fibt
|
|
16
|
-
:tax
|
|
17
|
-
:ooiat
|
|
18
|
-
:
|
|
9
|
+
ALL_STATES = [ :or, :cogs, :oe, :oibt, :fibt, :tax, :ooiat, :ooiat_nci, :fiat ]
|
|
10
|
+
NEXT_STATES = { nil => [ :or ],
|
|
11
|
+
:or => [ :or, :cogs, :oe, :oibt, :fibt ],
|
|
12
|
+
:cogs => [ :cogs, :oe, :oibt, :fibt, :tax ],
|
|
13
|
+
:oe => [ :oe, :oibt, :fibt, :tax ],
|
|
14
|
+
:oibt => [ :oibt, :fibt, :tax ], # obit/fibt can cycle back/forth
|
|
15
|
+
:fibt => [ :obit, :fibt, :tax ], # obit/fibt can cycle back/forth
|
|
16
|
+
:tax => [ :ooiat, :ooiat_nci, :fiat ], # tax can't go to itself. only 1 such item.
|
|
17
|
+
:ooiat => [ :ooiat, :ooiat_nci, :fiat ], # other operating income after taxes
|
|
18
|
+
:ooiat_nci => [ :ooiat, :ooiat_nci, :fiat ], # ooiat related to non-controlling interest
|
|
19
|
+
:fiat => [ :ooiat, :ooiat_nci, :fiat ] }# financing income after taxes
|
|
19
20
|
|
|
20
21
|
def summary(args)
|
|
21
22
|
summary_cache_key = args[:period].to_pretty_s
|
|
@@ -37,5 +38,17 @@ module FinModeling
|
|
|
37
38
|
return thesummary
|
|
38
39
|
end
|
|
39
40
|
|
|
41
|
+
def has_revenue_item?
|
|
42
|
+
@has_revenue_item ||= leaf_items.any? do |leaf|
|
|
43
|
+
leaf.name.matches_any_regex?([/revenue/i, /sales/i])
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def has_tax_item?
|
|
48
|
+
@has_tax_item ||= leaf_items.any? do |leaf|
|
|
49
|
+
leaf.name.matches_any_regex?([/tax/i])
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
40
53
|
end
|
|
41
54
|
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module FinModeling
|
|
2
|
+
|
|
3
|
+
class NetIncomeSummaryFromDifferences
|
|
4
|
+
def initialize(ris1, ris2)
|
|
5
|
+
@ris1 = ris1
|
|
6
|
+
@ris2 = ris2
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def filter_by_type(key)
|
|
10
|
+
cs = FinModeling::CalculationSummary.new
|
|
11
|
+
case key
|
|
12
|
+
when :or
|
|
13
|
+
cs.title = "Operating Revenues"
|
|
14
|
+
cs.rows = [ CalculationRow.new(:key => "First Row", :vals => [ @ris1.operating_revenues.total] ),
|
|
15
|
+
CalculationRow.new(:key => "Second Row", :vals => [-@ris2.operating_revenues.total] ) ]
|
|
16
|
+
when :cogs
|
|
17
|
+
cs.title = "Cost of Revenues"
|
|
18
|
+
cs.rows = [ CalculationRow.new(:key => "First Row", :vals => [ @ris1.cost_of_revenues.total] ),
|
|
19
|
+
CalculationRow.new(:key => "Second Row", :vals => [-@ris2.cost_of_revenues.total] ) ]
|
|
20
|
+
when :oe
|
|
21
|
+
cs.title = "Operating Expenses"
|
|
22
|
+
cs.rows = [ CalculationRow.new(:key => "First Row", :vals => [ @ris1.operating_expenses.total] ),
|
|
23
|
+
CalculationRow.new(:key => "Second Row", :vals => [-@ris2.operating_expenses.total] ) ]
|
|
24
|
+
when :oibt
|
|
25
|
+
cs.title = "Operating Income from Sales, Before taxes"
|
|
26
|
+
cs.rows = [ CalculationRow.new(:key => "First Row", :vals => [ @ris1.operating_income_after_tax.rows[1].vals.first] ),
|
|
27
|
+
CalculationRow.new(:key => "Second Row", :vals => [-@ris2.operating_income_after_tax.rows[1].vals.first] ) ]
|
|
28
|
+
when :fibt
|
|
29
|
+
cs.title = "Financing Income, Before Taxes"
|
|
30
|
+
cs.rows = [ CalculationRow.new(:key => "First Row", :vals => [ @ris1.net_financing_income.rows[0].vals.first] ),
|
|
31
|
+
CalculationRow.new(:key => "Second Row", :vals => [-@ris2.net_financing_income.rows[0].vals.first] ) ]
|
|
32
|
+
when :tax
|
|
33
|
+
cs.title = "Taxes"
|
|
34
|
+
cs.rows = [ CalculationRow.new(:key => "First Row", :vals => [ @ris1.income_from_sales_after_tax.rows[1].vals.first] ),
|
|
35
|
+
CalculationRow.new(:key => "Second Row", :vals => [-@ris2.income_from_sales_after_tax.rows[1].vals.first] ) ]
|
|
36
|
+
when :ooiat
|
|
37
|
+
cs.title = "Other Operating Income, After Taxes"
|
|
38
|
+
cs.rows = [ CalculationRow.new(:key => "First Row", :vals => [ @ris1.operating_income_after_tax.rows[3].vals.first] ),
|
|
39
|
+
CalculationRow.new(:key => "Second Row", :vals => [-@ris2.operating_income_after_tax.rows[3].vals.first] ) ]
|
|
40
|
+
when :fiat
|
|
41
|
+
cs.title = "Financing Income, After Taxes"
|
|
42
|
+
cs.rows = [ CalculationRow.new(:key => "First Row", :vals => [ @ris1.net_financing_income.rows[2].vals.first] ),
|
|
43
|
+
CalculationRow.new(:key => "Second Row", :vals => [-@ris2.net_financing_income.rows[2].vals.first] ) ]
|
|
44
|
+
else
|
|
45
|
+
return nil
|
|
46
|
+
end
|
|
47
|
+
return cs
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
data/lib/finmodeling/paths.rb
CHANGED
|
File without changes
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
module FinModeling
|
|
2
2
|
class PeriodArray < Array
|
|
3
3
|
def quarterly
|
|
4
|
-
PeriodArray.new(self.select{ |x|
|
|
4
|
+
PeriodArray.new(self.select{ |x| x.is_duration? &&
|
|
5
|
+
(Xbrlware::DateUtil.days_between(x.value["end_date"], x.value["start_date"]) >= 2*28) &&
|
|
5
6
|
(Xbrlware::DateUtil.days_between(x.value["end_date"], x.value["start_date"]) <= 4*31) })
|
|
6
7
|
end
|
|
7
8
|
|
|
8
9
|
def halfyearly
|
|
9
|
-
PeriodArray.new(self.select{ |x|
|
|
10
|
+
PeriodArray.new(self.select{ |x| x.is_duration? &&
|
|
11
|
+
(Xbrlware::DateUtil.days_between(x.value["end_date"], x.value["start_date"]) >= 5*30) &&
|
|
10
12
|
(Xbrlware::DateUtil.days_between(x.value["end_date"], x.value["start_date"]) <= 7*31) })
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
def threequarterly
|
|
14
|
-
PeriodArray.new(self.select{ |x|
|
|
16
|
+
PeriodArray.new(self.select{ |x| x.is_duration? &&
|
|
17
|
+
(Xbrlware::DateUtil.days_between(x.value["end_date"], x.value["start_date"]) >= 8*30) &&
|
|
15
18
|
(Xbrlware::DateUtil.days_between(x.value["end_date"], x.value["start_date"]) <= 10*31) })
|
|
16
19
|
end
|
|
17
20
|
|
|
18
21
|
def yearly
|
|
19
|
-
PeriodArray.new(self.select{ |x|
|
|
22
|
+
PeriodArray.new(self.select{ |x| x.is_duration? &&
|
|
23
|
+
(Xbrlware::DateUtil.days_between(x.value["end_date"], x.value["start_date"]) >= 11*30) &&
|
|
20
24
|
(Xbrlware::DateUtil.days_between(x.value["end_date"], x.value["start_date"]) <= 13*31) })
|
|
21
25
|
end
|
|
22
26
|
end
|
|
@@ -2,9 +2,14 @@ module FinModeling
|
|
|
2
2
|
class QuarterlyReportFiling < AnnualReportFiling
|
|
3
3
|
|
|
4
4
|
def write_constructor(file, item_name)
|
|
5
|
-
balance_sheet.write_constructor(
|
|
6
|
-
income_statement.write_constructor(
|
|
7
|
-
|
|
5
|
+
balance_sheet .write_constructor(file, bs_name = item_name + "_bs" )
|
|
6
|
+
income_statement .write_constructor(file, is_name = item_name + "_is" ) if has_an_income_statement?
|
|
7
|
+
comprehensive_income_statement.write_constructor(file, cis_name = item_name + "_cis") if has_a_comprehensive_income_statement?
|
|
8
|
+
cash_flow_statement .write_constructor(file, cfs_name = item_name + "_cfs")
|
|
9
|
+
|
|
10
|
+
is_name = "nil" if !has_an_income_statement?
|
|
11
|
+
cis_name = "nil" if !has_a_comprehensive_income_statement?
|
|
12
|
+
ses_name = "nil" # because these only get reported in 10-k's?
|
|
8
13
|
|
|
9
14
|
names_of_discs = []
|
|
10
15
|
disclosures.each_with_index do |disclosure, idx|
|
|
@@ -16,7 +21,7 @@ module FinModeling
|
|
|
16
21
|
|
|
17
22
|
file.puts "#{SCHEMA_VERSION_ITEM} = #{CURRENT_SCHEMA_VERSION}"
|
|
18
23
|
|
|
19
|
-
file.puts "#{item_name} = FinModeling::CachedQuarterlyFiling.new(#{bs_name}, #{is_name}, #{cfs_name}, #{names_of_discs_str})"
|
|
24
|
+
file.puts "#{item_name} = FinModeling::CachedQuarterlyFiling.new(#{bs_name}, #{is_name}, #{cis_name}, #{cfs_name}, #{ses_name}, #{names_of_discs_str})"
|
|
20
25
|
end
|
|
21
26
|
|
|
22
27
|
end
|
data/lib/finmodeling/rate.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
module FinModeling
|
|
2
2
|
class Rate
|
|
3
|
+
attr_reader :value
|
|
4
|
+
|
|
3
5
|
def initialize(value)
|
|
4
6
|
@value = value
|
|
5
7
|
end
|
|
@@ -16,5 +18,11 @@ module FinModeling
|
|
|
16
18
|
annualize(from_days=365.0/4.0, to_days=365.0)
|
|
17
19
|
end
|
|
18
20
|
end
|
|
21
|
+
|
|
22
|
+
class DiscountRate < Rate
|
|
23
|
+
def annualize(from_days=365, to_days=365)
|
|
24
|
+
@value**(to_days.to_f/from_days.to_f)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
19
27
|
end
|
|
20
28
|
|
data/lib/finmodeling/ratio.rb
CHANGED
|
File without changes
|
|
@@ -1,45 +1,37 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
1
3
|
module FinModeling
|
|
2
4
|
class ReformulatedBalanceSheet
|
|
3
5
|
attr_accessor :period
|
|
6
|
+
attr_accessor :operating_assets, :financial_assets
|
|
7
|
+
attr_accessor :operating_liabilities, :financial_liabilities
|
|
8
|
+
attr_accessor :minority_interest
|
|
4
9
|
|
|
5
|
-
def initialize(period,
|
|
10
|
+
def initialize(period, assets, liabs_and_equity)
|
|
6
11
|
@period = period
|
|
7
|
-
@oa = assets_summary.filter_by_type(:oa)
|
|
8
|
-
@fa = assets_summary.filter_by_type(:fa)
|
|
9
|
-
@ol = liabs_and_equity_summary.filter_by_type(:ol)
|
|
10
|
-
@fl = liabs_and_equity_summary.filter_by_type(:fl)
|
|
11
|
-
@cse = liabs_and_equity_summary.filter_by_type(:cse)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def operating_assets
|
|
15
|
-
@oa
|
|
16
|
-
end
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
@fa
|
|
20
|
-
|
|
13
|
+
@operating_assets = assets.filter_by_type(:oa)
|
|
14
|
+
@financial_assets = assets.filter_by_type(:fa)
|
|
15
|
+
@operating_liabilities = liabs_and_equity.filter_by_type(:ol)
|
|
16
|
+
@financial_liabilities = liabs_and_equity.filter_by_type(:fl)
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
@
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def financial_liabilities
|
|
27
|
-
@fl
|
|
18
|
+
#@cse = liabs_and_equity.filter_by_type(:cse)
|
|
19
|
+
@minority_interest = liabs_and_equity.filter_by_type(:mi)
|
|
28
20
|
end
|
|
29
21
|
|
|
30
22
|
def net_operating_assets
|
|
31
23
|
cs = FinModeling::CalculationSummary.new
|
|
32
24
|
cs.title = "Net Operational Assets"
|
|
33
|
-
cs.rows = [ CalculationRow.new( :key => "OA", :vals => [ @
|
|
34
|
-
CalculationRow.new( :key => "OL", :vals => [ -@
|
|
25
|
+
cs.rows = [ CalculationRow.new( :key => "OA", :vals => [ @operating_assets.total ] ),
|
|
26
|
+
CalculationRow.new( :key => "OL", :vals => [ -@operating_liabilities.total ] ) ]
|
|
35
27
|
return cs
|
|
36
28
|
end
|
|
37
29
|
|
|
38
30
|
def net_financial_assets
|
|
39
31
|
cs = FinModeling::CalculationSummary.new
|
|
40
32
|
cs.title = "Net Financial Assets"
|
|
41
|
-
cs.rows = [ CalculationRow.new( :key => "FA", :vals => [ @
|
|
42
|
-
CalculationRow.new( :key => "FL", :vals => [ -@
|
|
33
|
+
cs.rows = [ CalculationRow.new( :key => "FA", :vals => [ @financial_assets.total ] ),
|
|
34
|
+
CalculationRow.new( :key => "FL", :vals => [ -@financial_liabilities.total ] ) ]
|
|
43
35
|
return cs
|
|
44
36
|
end
|
|
45
37
|
|
|
@@ -47,7 +39,8 @@ module FinModeling
|
|
|
47
39
|
cs = FinModeling::CalculationSummary.new
|
|
48
40
|
cs.title = "Common Shareholders' Equity"
|
|
49
41
|
cs.rows = [ CalculationRow.new( :key => "NOA", :vals => [ net_operating_assets.total ] ),
|
|
50
|
-
CalculationRow.new( :key => "NFA", :vals => [ net_financial_assets.total ] )
|
|
42
|
+
CalculationRow.new( :key => "NFA", :vals => [ net_financial_assets.total ] ),
|
|
43
|
+
CalculationRow.new( :key => "MI", :vals => [ -@minority_interest.total ] ) ]
|
|
51
44
|
return cs
|
|
52
45
|
end
|
|
53
46
|
|
|
@@ -55,13 +48,21 @@ module FinModeling
|
|
|
55
48
|
net_operating_assets.total / net_financial_assets.total
|
|
56
49
|
end
|
|
57
50
|
|
|
51
|
+
def change_in_noa(prev)
|
|
52
|
+
net_operating_assets.total - prev.net_operating_assets.total
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def change_in_cse(prev)
|
|
56
|
+
common_shareholders_equity.total - prev.common_shareholders_equity.total
|
|
57
|
+
end
|
|
58
|
+
|
|
58
59
|
def noa_growth(prev)
|
|
59
|
-
rate = (
|
|
60
|
+
rate = change_in_noa(prev) / prev.net_operating_assets.total
|
|
60
61
|
return annualize_rate(prev, rate)
|
|
61
62
|
end
|
|
62
63
|
|
|
63
64
|
def cse_growth(prev)
|
|
64
|
-
rate = (
|
|
65
|
+
rate = change_in_cse(prev) / prev.common_shareholders_equity.total
|
|
65
66
|
return annualize_rate(prev, rate)
|
|
66
67
|
end
|
|
67
68
|
|
|
@@ -73,27 +74,36 @@ module FinModeling
|
|
|
73
74
|
|
|
74
75
|
analysis.rows = []
|
|
75
76
|
if Config.balance_detail_enabled?
|
|
76
|
-
analysis.rows << CalculationRow.new(:key => "A ($MM)",:vals => [@
|
|
77
|
-
|
|
78
|
-
analysis.rows << CalculationRow.new(:key => "L ($MM)",:vals => [@
|
|
79
|
-
|
|
77
|
+
analysis.rows << CalculationRow.new(:key => "A ($MM)",:vals => [@operating_assets.total.to_nearest_million +
|
|
78
|
+
@financial_assets.total.to_nearest_million])
|
|
79
|
+
analysis.rows << CalculationRow.new(:key => "L ($MM)",:vals => [@operating_liabilities.total.to_nearest_million +
|
|
80
|
+
@financial_liabilities.total.to_nearest_million])
|
|
80
81
|
end
|
|
81
82
|
analysis.rows << CalculationRow.new(:key => "NOA ($MM)", :vals => [net_operating_assets.total.to_nearest_million])
|
|
82
83
|
if Config.balance_detail_enabled?
|
|
83
|
-
analysis.rows << CalculationRow.new(:key => "OA ($MM)",:vals => [operating_assets.total.to_nearest_million])
|
|
84
|
-
analysis.rows << CalculationRow.new(:key => "OL ($MM)",:vals => [operating_liabilities.total.to_nearest_million])
|
|
84
|
+
analysis.rows << CalculationRow.new(:key => "OA ($MM)",:vals => [@operating_assets.total.to_nearest_million])
|
|
85
|
+
analysis.rows << CalculationRow.new(:key => "OL ($MM)",:vals => [@operating_liabilities.total.to_nearest_million])
|
|
85
86
|
end
|
|
86
87
|
analysis.rows << CalculationRow.new(:key => "NFA ($MM)", :vals => [net_financial_assets.total.to_nearest_million])
|
|
87
88
|
if Config.balance_detail_enabled?
|
|
88
|
-
analysis.rows << CalculationRow.new(:key => "FA ($MM)",:vals => [financial_assets.total.to_nearest_million])
|
|
89
|
-
analysis.rows << CalculationRow.new(:key => "FL ($MM)",:vals => [financial_liabilities.total.to_nearest_million])
|
|
89
|
+
analysis.rows << CalculationRow.new(:key => "FA ($MM)",:vals => [@financial_assets.total.to_nearest_million])
|
|
90
|
+
analysis.rows << CalculationRow.new(:key => "FL ($MM)",:vals => [@financial_liabilities.total.to_nearest_million])
|
|
90
91
|
end
|
|
92
|
+
analysis.rows << CalculationRow.new(:key => "Minority Interest ($MM)", :vals => [@minority_interest.total.to_nearest_million])
|
|
91
93
|
analysis.rows << CalculationRow.new(:key => "CSE ($MM)", :vals => [common_shareholders_equity.total.to_nearest_million])
|
|
92
94
|
analysis.rows << CalculationRow.new(:key => "Composition Ratio", :vals => [composition_ratio] )
|
|
93
95
|
if prev.nil?
|
|
96
|
+
if Config.balance_detail_enabled?
|
|
97
|
+
analysis.rows << CalculationRow.new(:key => "NOA Δ ($MM)", :vals => [nil] )
|
|
98
|
+
analysis.rows << CalculationRow.new(:key => "CSE Δ ($MM)", :vals => [nil] )
|
|
99
|
+
end
|
|
94
100
|
analysis.rows << CalculationRow.new(:key => "NOA Growth", :vals => [nil] )
|
|
95
101
|
analysis.rows << CalculationRow.new(:key => "CSE Growth", :vals => [nil] )
|
|
96
102
|
else
|
|
103
|
+
if Config.balance_detail_enabled?
|
|
104
|
+
analysis.rows << CalculationRow.new(:key => "NOA Δ ($MM)", :vals => [change_in_noa(prev).to_nearest_million] )
|
|
105
|
+
analysis.rows << CalculationRow.new(:key => "CSE Δ ($MM)", :vals => [change_in_cse(prev).to_nearest_million] )
|
|
106
|
+
end
|
|
97
107
|
analysis.rows << CalculationRow.new(:key => "NOA Growth", :vals => [noa_growth(prev)] )
|
|
98
108
|
analysis.rows << CalculationRow.new(:key => "CSE Growth", :vals => [cse_growth(prev)] )
|
|
99
109
|
end
|
|
@@ -102,9 +112,9 @@ module FinModeling
|
|
|
102
112
|
end
|
|
103
113
|
|
|
104
114
|
def self.forecast_next(period, policy, last_re_bs, next_re_is)
|
|
105
|
-
noa = next_re_is.operating_revenues.total / Ratio.new(policy.
|
|
115
|
+
noa = next_re_is.operating_revenues.total / Ratio.new(policy.sales_over_noa_on(period.value)).yearly_to_quarterly
|
|
106
116
|
cse = last_re_bs.common_shareholders_equity.total + next_re_is.comprehensive_income.total
|
|
107
|
-
nfa = cse - noa
|
|
117
|
+
nfa = cse - noa # FIXME: this looks suspect. What about minority interests?
|
|
108
118
|
|
|
109
119
|
ForecastedReformulatedBalanceSheet.new(period, noa, nfa, cse)
|
|
110
120
|
end
|
|
@@ -122,55 +132,4 @@ module FinModeling
|
|
|
122
132
|
end
|
|
123
133
|
end
|
|
124
134
|
|
|
125
|
-
class ForecastedReformulatedBalanceSheet < ReformulatedBalanceSheet
|
|
126
|
-
def initialize(period, noa, nfa, cse)
|
|
127
|
-
@period = period
|
|
128
|
-
@noa = noa
|
|
129
|
-
@nfa = nfa
|
|
130
|
-
@cse = cse
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
def operating_assets
|
|
134
|
-
nil
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
def financial_assets
|
|
138
|
-
nil
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
def operating_liabilities
|
|
142
|
-
nil
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
def financial_liabilities
|
|
146
|
-
nil
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
def net_operating_assets
|
|
150
|
-
cs = FinModeling::CalculationSummary.new
|
|
151
|
-
cs.title = "Net Operational Assets"
|
|
152
|
-
cs.rows = [ CalculationRow.new( :key => "NOA", :vals => [@noa] ) ]
|
|
153
|
-
return cs
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
def net_financial_assets
|
|
157
|
-
cs = FinModeling::CalculationSummary.new
|
|
158
|
-
cs.title = "Net Financial Assets"
|
|
159
|
-
cs.rows = [ CalculationRow.new( :key => "NFA", :vals => [@nfa] ) ]
|
|
160
|
-
return cs
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def common_shareholders_equity
|
|
164
|
-
cs = FinModeling::CalculationSummary.new
|
|
165
|
-
cs.title = "Common Shareholders' Equity"
|
|
166
|
-
cs.rows = [ CalculationRow.new( :key => "CSE", :vals => [@cse] ) ]
|
|
167
|
-
return cs
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
def analysis(prev)
|
|
171
|
-
analysis = super(prev)
|
|
172
|
-
analysis.header_row.vals[0] += "E" # for estimated
|
|
173
|
-
return analysis
|
|
174
|
-
end
|
|
175
|
-
end
|
|
176
135
|
end
|