Class: Ledger::Sdk::Models::Account::Instance

Inherits:
Base::Instance show all
Defined in:
lib/ledger/sdk/models/account.rb

Overview

Represents an individual account instance.

Has an association to Position allowing navigation to the positions attached to this account.

Instance Method Summary collapse

Methods inherited from Base::Instance

association, #data, #initialize

Constructor Details

This class inherits a constructor from Ledger::Sdk::Models::Base::Instance

Instance Method Details

#balances(name) ⇒ Balance

Access the balances of this account for a given balance name.

Parameters:

  • name (String)

    the balance name. Known names: official, official_with_updated_price, transparent, transparent_with_updated_price. Not validated by the SDK.

Returns:

  • (Balance)

    the balance collection scoped to this account

#performance(from: nil, to: nil, method: nil, name: nil, income: nil, granularity: nil) ⇒ Hash

This account's performance over a window: its own composed return and each of its lines' contribution to it, decomposed into what the price and the currency each drove. Read-only.

Contributions are shares of THIS account's return, not the portfolio's — the same line read from the container answers a different figure. contribution_series, when present, likewise describes only this account.

contribution is null — the key is there, its value is not — whenever there is nothing to decompose: a cash line, or a window ledger cannot chain. Null says "no answer"; a zero would have claimed the lines produced nothing.

Ledger defaults to to the account's latest revalued balance date and from to thirty days before it. An unreadable date, an unknown method, name or granularity falls back to the default rather than failing.

Parameters:

  • from (String, Date, nil) (defaults to: nil)

    window start (ISO 8601)

  • to (String, Date, nil) (defaults to: nil)

    window end (ISO 8601)

  • method (String, nil) (defaults to: nil)

    twr (default), mwr or dietz (Modified Dietz)

  • name (String, nil) (defaults to: nil)

    balance series: official, official_with_updated_price (default), transparent, transparent_with_updated_price

  • income (String, nil) (defaults to: nil)

    net (default) or gross of withholding tax

  • granularity (String, nil) (defaults to: nil)

    day, month, quarter, semester or year to also get contribution_series; omitted when nil

Returns:

  • (Hash)

    the performance document

#positions(associated_id = nil) ⇒ Position, Position::Instance

Access the positions associated with this account.

Parameters:

  • associated_id (String, Integer, nil) (defaults to: nil)

    ID of a specific position, or nil to get the collection

Returns: