Class: FinModeling::ReformulatedCashFlowStatement
- Inherits:
-
Object
- Object
- FinModeling::ReformulatedCashFlowStatement
- Defined in:
- lib/finmodeling/reformulated_cash_flow_statement.rb
Constant Summary collapse
- ALLOWED_IMBALANCE =
1.0
Instance Attribute Summary collapse
-
#period ⇒ Object
Returns the value of attribute period.
Class Method Summary collapse
Instance Method Summary collapse
- #-(re_cfs2) ⇒ Object
- #analysis(inc_stmt) ⇒ Object
- #cash_from_operations ⇒ Object
- #cash_investments_in_operations ⇒ Object
- #financing_flows ⇒ Object
- #flows_are_balanced? ⇒ Boolean
- #flows_are_plausible? ⇒ Boolean
- #free_cash_flow ⇒ Object
-
#initialize(period, cash_change_summary) ⇒ ReformulatedCashFlowStatement
constructor
A new instance of ReformulatedCashFlowStatement.
- #ni_over_c(inc_stmt) ⇒ Object
- #payments_to_debtholders ⇒ Object
- #payments_to_stockholders ⇒ Object
Constructor Details
#initialize(period, cash_change_summary) ⇒ ReformulatedCashFlowStatement
Returns a new instance of ReformulatedCashFlowStatement.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 5 def initialize(period, cash_change_summary) @period = period @c = cash_change_summary.filter_by_type(:c) # just make this a member.... @i = cash_change_summary.filter_by_type(:i) @d = cash_change_summary.filter_by_type(:d) @f = cash_change_summary.filter_by_type(:f) @c.title = "Cash from operations" @i.title = "Cash investments in operations" @d.title = "Payments to debtholders" @f.title = "Payments to stockholders" if !(cash_change_summary.is_a? CashChangeSummaryFromDifferences) @d.rows << CalculationRow.new(:key => "Investment in Cash and Equivalents", :type => :d, :vals => [-cash_change_summary.total]) end end |
Instance Attribute Details
#period ⇒ Object
Returns the value of attribute period.
3 4 5 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 3 def period @period end |
Class Method Details
.empty_analysis ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 66 def self.empty_analysis analysis = CalculationSummary.new analysis.title = "" analysis.header_row = CalculationHeader.new(:key => "", :vals => ["Unknown..."]) analysis.rows = [] analysis.rows << CalculationRow.new(:key => "C ($MM)", :vals => [nil]) analysis.rows << CalculationRow.new(:key => "I ($MM)", :vals => [nil]) analysis.rows << CalculationRow.new(:key => "d ($MM)", :vals => [nil]) analysis.rows << CalculationRow.new(:key => "F ($MM)", :vals => [nil]) analysis.rows << CalculationRow.new(:key => "FCF ($MM)", :vals => [nil]) analysis.rows << CalculationRow.new(:key => "NI / C", :vals => [nil]) return analysis end |
Instance Method Details
#-(re_cfs2) ⇒ Object
25 26 27 28 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 25 def -(re_cfs2) summary = CashChangeSummaryFromDifferences.new(self, re_cfs2) return ReformulatedCashFlowStatement.new(@period, summary) end |
#analysis(inc_stmt) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 83 def analysis(inc_stmt) analysis = CalculationSummary.new analysis.title = "" analysis.header_row = CalculationHeader.new(:key => "", :vals => [@period.value["end_date"].to_s]) analysis.rows = [] analysis.rows << CalculationRow.new(:key => "C ($MM)", :vals => [cash_from_operations.total.to_nearest_million]) analysis.rows << CalculationRow.new(:key => "I ($MM)", :vals => [cash_investments_in_operations.total.to_nearest_million]) analysis.rows << CalculationRow.new(:key => "d ($MM)", :vals => [payments_to_debtholders.total.to_nearest_million]) analysis.rows << CalculationRow.new(:key => "F ($MM)", :vals => [payments_to_stockholders.total.to_nearest_million]) analysis.rows << CalculationRow.new(:key => "FCF ($MM)", :vals => [free_cash_flow.total.to_nearest_million]) if inc_stmt analysis.rows << CalculationRow.new(:key => "NI / C", :vals => [ni_over_c(inc_stmt)]) else analysis.rows << CalculationRow.new(:key => "NI / C", :vals => [nil]) end return analysis end |
#cash_from_operations ⇒ Object
30 31 32 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 30 def cash_from_operations @c end |
#cash_investments_in_operations ⇒ Object
34 35 36 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 34 def cash_investments_in_operations @i end |
#financing_flows ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 54 def financing_flows cs = FinModeling::CalculationSummary.new cs.title = "Financing Flows" cs.rows = [ CalculationRow.new(:key => "Payments to debtholders (d)", :vals => [@d.total] ), CalculationRow.new(:key => "Payments to stockholders (F)", :vals => [@f.total] ) ] return cs end |
#flows_are_balanced? ⇒ Boolean
105 106 107 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 105 def flows_are_balanced? (free_cash_flow.total - financing_flows.total) < ALLOWED_IMBALANCE end |
#flows_are_plausible? ⇒ Boolean
109 110 111 112 113 114 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 109 def flows_are_plausible? return [ payments_to_debtholders, payments_to_stockholders, cash_from_operations, cash_investments_in_operations ].all?{ |x| x.total.abs > 1.0 } end |
#free_cash_flow ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 46 def free_cash_flow cs = FinModeling::CalculationSummary.new cs.title = "Free Cash Flow" cs.rows = [ CalculationRow.new(:key => "Cash from Operations (C)", :vals => [@c.total] ), CalculationRow.new(:key => "Cash Investment in Operations (I)", :vals => [@i.total] ) ] return cs end |
#ni_over_c(inc_stmt) ⇒ Object
62 63 64 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 62 def ni_over_c(inc_stmt) inc_stmt.comprehensive_income.total.to_f / cash_from_operations.total end |
#payments_to_debtholders ⇒ Object
38 39 40 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 38 def payments_to_debtholders @d end |
#payments_to_stockholders ⇒ Object
42 43 44 |
# File 'lib/finmodeling/reformulated_cash_flow_statement.rb', line 42 def payments_to_stockholders @f end |