Class: Gnucash::SecurityQuote

Inherits:
Object
  • Object
show all
Includes:
Gnucash::Support::LightInspect
Defined in:
lib/gnucash/security.rb

Overview

Price quote for a security (commodity) from the GnuCash price database: the value of one unit of the security expressed in currency as of date.

Since:

  • 1.6.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gnucash::Support::LightInspect

#inspect

Constructor Details

#initialize(value:, currency_space:, currency_id:, date:) ⇒ SecurityQuote

Returns a new instance of SecurityQuote.

Since:

  • 1.6.0



23
24
25
26
27
28
# File 'lib/gnucash/security.rb', line 23

def initialize(value:, currency_space:, currency_id:, date:)
  @value = value
  @currency_space = currency_space
  @currency_id = currency_id
  @date = date
end

Instance Attribute Details

#currency_idString (readonly)

Returns Commodity id of the quote currency (e.g. “USD”).

Returns:

  • (String)

    Commodity id of the quote currency (e.g. “USD”).

Since:

  • 1.6.0



18
19
20
# File 'lib/gnucash/security.rb', line 18

def currency_id
  @currency_id
end

#currency_spaceString (readonly)

Returns Commodity namespace (GnuCash “space”) of the quote currency.

Returns:

  • (String)

    Commodity namespace (GnuCash “space”) of the quote currency.

Since:

  • 1.6.0



15
16
17
# File 'lib/gnucash/security.rb', line 15

def currency_space
  @currency_space
end

#dateDate (readonly)

Returns Date of the price in the book (quote time, date-only).

Returns:

  • (Date)

    Date of the price in the book (quote time, date-only).

Since:

  • 1.6.0



21
22
23
# File 'lib/gnucash/security.rb', line 21

def date
  @date
end

#valueValue (readonly)

Returns Price of one unit of the security in the quote currency.

Returns:

  • (Value)

    Price of one unit of the security in the quote currency.

Since:

  • 1.6.0



12
13
14
# File 'lib/gnucash/security.rb', line 12

def value
  @value
end

Instance Method Details

#attributesObject

Since:

  • 1.6.0



30
31
32
# File 'lib/gnucash/security.rb', line 30

def attributes
  %i[value currency_space currency_id date]
end