Class: FinModeling::ReformulatedBalanceSheet

Inherits:
Object
  • Object
show all
Defined in:
lib/finmodeling/reformulated_balance_sheet.rb

Direct Known Subclasses

ForecastedReformulatedBalanceSheet

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(period, assets, liabs_and_equity) ⇒ ReformulatedBalanceSheet

Returns a new instance of ReformulatedBalanceSheet.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 10

def initialize(period, assets, liabs_and_equity)
  @period = period

  @operating_assets = assets.filter_by_type(:oa)
  @financial_assets = assets.filter_by_type(:fa)
  @operating_liabilities = liabs_and_equity.filter_by_type(:ol)
  @financial_liabilities = liabs_and_equity.filter_by_type(:fl)

  #@cse = liabs_and_equity.filter_by_type(:cse)
  @minority_interest = liabs_and_equity.filter_by_type(:mi)
end

Instance Attribute Details

#financial_assetsObject

Returns the value of attribute financial_assets.



6
7
8
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 6

def financial_assets
  @financial_assets
end

#financial_liabilitiesObject

Returns the value of attribute financial_liabilities.



7
8
9
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 7

def financial_liabilities
  @financial_liabilities
end

#minority_interestObject

Returns the value of attribute minority_interest.



8
9
10
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 8

def minority_interest
  @minority_interest
end

#operating_assetsObject

Returns the value of attribute operating_assets.



6
7
8
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 6

def operating_assets
  @operating_assets
end

#operating_liabilitiesObject

Returns the value of attribute operating_liabilities.



7
8
9
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 7

def operating_liabilities
  @operating_liabilities
end

#periodObject

Returns the value of attribute period.



5
6
7
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 5

def period
  @period
end

Class Method Details

.forecast_next(period, policy, last_re_bs, next_re_is) ⇒ Object



114
115
116
117
118
119
120
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 114

def self.forecast_next(period, policy, last_re_bs, next_re_is)
  noa = next_re_is.operating_revenues.total / Ratio.new(policy.sales_over_noa_on(period.value)).yearly_to_quarterly
  cse = last_re_bs.common_shareholders_equity.total + next_re_is.comprehensive_income.total
  nfa = cse - noa # FIXME: this looks suspect. What about minority interests?

  ForecastedReformulatedBalanceSheet.new(period, noa, nfa, cse)
end

Instance Method Details

#analysis(prev) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 69

def analysis(prev)
  analysis = CalculationSummary.new
  
  analysis.title = ""
  analysis.header_row = CalculationHeader.new(:key => "", :vals => [@period.to_pretty_s])
  
  analysis.rows = []
  if Config.balance_detail_enabled?
    analysis.rows << CalculationRow.new(:key => "A ($MM)",:vals => [@operating_assets.total.to_nearest_million +
                                                                    @financial_assets.total.to_nearest_million])
    analysis.rows << CalculationRow.new(:key => "L ($MM)",:vals => [@operating_liabilities.total.to_nearest_million +
                                                                    @financial_liabilities.total.to_nearest_million])
  end
  analysis.rows << CalculationRow.new(:key => "NOA ($MM)", :vals => [net_operating_assets.total.to_nearest_million])
  if Config.balance_detail_enabled?
    analysis.rows << CalculationRow.new(:key => "OA ($MM)",:vals => [@operating_assets.total.to_nearest_million])
    analysis.rows << CalculationRow.new(:key => "OL ($MM)",:vals => [@operating_liabilities.total.to_nearest_million])
  end
  analysis.rows << CalculationRow.new(:key => "NFA ($MM)", :vals => [net_financial_assets.total.to_nearest_million])
  if Config.balance_detail_enabled?
    analysis.rows << CalculationRow.new(:key => "FA ($MM)",:vals => [@financial_assets.total.to_nearest_million])
    analysis.rows << CalculationRow.new(:key => "FL ($MM)",:vals => [@financial_liabilities.total.to_nearest_million])
  end
  analysis.rows << CalculationRow.new(:key => "Minority Interest ($MM)", :vals => [@minority_interest.total.to_nearest_million])
  analysis.rows << CalculationRow.new(:key => "CSE ($MM)", :vals => [common_shareholders_equity.total.to_nearest_million])
  analysis.rows << CalculationRow.new(:key => "Composition Ratio", :vals => [composition_ratio] )
  if prev.nil?
    if Config.balance_detail_enabled?
      analysis.rows << CalculationRow.new(:key => "NOA Δ ($MM)", :vals => [nil] )
      analysis.rows << CalculationRow.new(:key => "CSE Δ ($MM)", :vals => [nil] )
    end
    analysis.rows << CalculationRow.new(:key => "NOA Growth", :vals => [nil] )
    analysis.rows << CalculationRow.new(:key => "CSE Growth", :vals => [nil] )
  else
    if Config.balance_detail_enabled?
      analysis.rows << CalculationRow.new(:key => "NOA Δ ($MM)", :vals => [change_in_noa(prev).to_nearest_million] )
      analysis.rows << CalculationRow.new(:key => "CSE Δ ($MM)", :vals => [change_in_cse(prev).to_nearest_million] )
    end
    analysis.rows << CalculationRow.new(:key => "NOA Growth", :vals => [noa_growth(prev)] )
    analysis.rows << CalculationRow.new(:key => "CSE Growth", :vals => [cse_growth(prev)] )
  end
  
  return analysis
end

#change_in_cse(prev) ⇒ Object



55
56
57
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 55

def change_in_cse(prev)
  common_shareholders_equity.total - prev.common_shareholders_equity.total
end

#change_in_noa(prev) ⇒ Object



51
52
53
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 51

def change_in_noa(prev)
  net_operating_assets.total - prev.net_operating_assets.total
end

#common_shareholders_equityObject



38
39
40
41
42
43
44
45
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 38

def common_shareholders_equity
  cs = FinModeling::CalculationSummary.new
  cs.title = "Common Shareholders' Equity"
  cs.rows = [ CalculationRow.new( :key => "NOA", :vals => [  net_operating_assets.total ] ),
              CalculationRow.new( :key => "NFA", :vals => [  net_financial_assets.total ] ),
              CalculationRow.new( :key => "MI",  :vals => [  -@minority_interest.total ] ) ]
  return cs
end

#composition_ratioObject



47
48
49
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 47

def composition_ratio
  net_operating_assets.total / net_financial_assets.total
end

#cse_growth(prev) ⇒ Object



64
65
66
67
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 64

def cse_growth(prev)
  rate = change_in_cse(prev) / prev.common_shareholders_equity.total
  return annualize_rate(prev, rate)
end

#net_financial_assetsObject



30
31
32
33
34
35
36
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 30

def net_financial_assets
  cs = FinModeling::CalculationSummary.new
  cs.title = "Net Financial Assets"
  cs.rows = [ CalculationRow.new( :key => "FA", :vals => [  @financial_assets.total ] ),
              CalculationRow.new( :key => "FL", :vals => [ -@financial_liabilities.total ] ) ]
  return cs
end

#net_operating_assetsObject



22
23
24
25
26
27
28
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 22

def net_operating_assets
  cs = FinModeling::CalculationSummary.new
  cs.title = "Net Operational Assets"
  cs.rows = [ CalculationRow.new( :key => "OA", :vals => [  @operating_assets.total ] ),
              CalculationRow.new( :key => "OL", :vals => [ -@operating_liabilities.total ] ) ]
  return cs
end

#noa_growth(prev) ⇒ Object



59
60
61
62
# File 'lib/finmodeling/reformulated_balance_sheet.rb', line 59

def noa_growth(prev)
  rate = change_in_noa(prev) / prev.net_operating_assets.total
  return annualize_rate(prev, rate)
end