Class: BondCalculator::Bond

Inherits:
Object
  • Object
show all
Defined in:
lib/bond_calculator/bond.rb

Overview

Bond is a PORO that represent the structure of benchmark and curve cvs’s header

Author:

  • Lucas Sant’ Anna

Since:

  • 0.0.1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ <void>

Parameters:

  • args (Hash)

    The options to create a Bond with

Options Hash (args):

  • :type (String)

    Type of the Bond currencty we implement the calculation for corporate and government only.

  • :bond (String)

    Name of the company who is offering the Bond.

  • :term (String)

    Number of years to pay.

  • :yield (String)

    The interest rate.

Since:

  • 0.0.1



23
24
25
26
27
28
# File 'lib/bond_calculator/bond.rb', line 23

def initialize(args)
  @type = format_type(args['type'])
  @name = format_bond(args['bond'])
  @term_years = format_term(args['term'])
  @yield_percent = format_yield(args['yield'])
end

Instance Attribute Details

#nameObject (readonly)

Since:

  • 0.0.1



12
13
14
# File 'lib/bond_calculator/bond.rb', line 12

def name
  @name
end

#term_yearsObject (readonly)

Since:

  • 0.0.1



12
13
14
# File 'lib/bond_calculator/bond.rb', line 12

def term_years
  @term_years
end

#typeObject (readonly)

Since:

  • 0.0.1



12
13
14
# File 'lib/bond_calculator/bond.rb', line 12

def type
  @type
end

#yield_percentObject (readonly)

Since:

  • 0.0.1



12
13
14
# File 'lib/bond_calculator/bond.rb', line 12

def yield_percent
  @yield_percent
end