Class: RMarket::Beliefs::DividendGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/rmarket/beliefs/news.rb

Overview

Mean reverting dividend generation

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#kappaObject (readonly)

Returns the value of attribute kappa.



31
32
33
# File 'lib/rmarket/beliefs/news.rb', line 31

def kappa
  @kappa
end

#last_period_dividendObject (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_meanObject



32
# File 'lib/rmarket/beliefs/news.rb', line 32

def dividend_mean; @dividend_distribution.mu; end

#dividend_stdObject



33
# File 'lib/rmarket/beliefs/news.rb', line 33

def dividend_std; @dividend_distribution.sigma; end

#generate_next_dividendObject



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