Class: RMarket::Beliefs::DividendGenerator
- Inherits:
-
Object
- Object
- RMarket::Beliefs::DividendGenerator
- Defined in:
- lib/rmarket/beliefs/news.rb
Overview
Mean reverting dividend generation
Instance Attribute Summary collapse
-
#kappa ⇒ Object
readonly
Returns the value of attribute kappa.
-
#last_period_dividend ⇒ Object
readonly
Returns the value of attribute last_period_dividend.
Instance Method Summary collapse
- #dividend_mean ⇒ Object
- #dividend_std ⇒ Object
- #generate_next_dividend ⇒ Object
-
#initialize(dividend_distribution, kappa = 0) ⇒ DividendGenerator
constructor
A new instance of DividendGenerator.
Constructor Details
#initialize(dividend_distribution, kappa = 0) ⇒ DividendGenerator
Returns a new instance of DividendGenerator.
35 36 37 38 |
# File 'lib/rmarket/beliefs/news.rb', line 35 def initialize(dividend_distribution, kappa=0) @dividend_distribution, @kappa = dividend_distribution, kappa @next_period_dividend = dividend_mean end |
Instance Attribute Details
#kappa ⇒ Object (readonly)
Returns the value of attribute kappa.
31 32 33 |
# File 'lib/rmarket/beliefs/news.rb', line 31 def kappa @kappa end |
#last_period_dividend ⇒ Object (readonly)
Returns the value of attribute last_period_dividend.
31 32 33 |
# File 'lib/rmarket/beliefs/news.rb', line 31 def last_period_dividend @last_period_dividend end |
Instance Method Details
#dividend_mean ⇒ Object
32 |
# File 'lib/rmarket/beliefs/news.rb', line 32 def dividend_mean; @dividend_distribution.mu; end |
#dividend_std ⇒ Object
33 |
# File 'lib/rmarket/beliefs/news.rb', line 33 def dividend_std; @dividend_distribution.sigma; end |
#generate_next_dividend ⇒ Object
40 41 42 43 44 |
# File 'lib/rmarket/beliefs/news.rb', line 40 def generate_next_dividend @next_shock = @dividend_distribution.sample @last_period_dividend = @next_period_dividend @next_period_dividend = (dividend_mean*@kappa)+((1-@kappa)*@next_period_dividend)+next_shock end |