Class: Mosaic::Sdk::Models::Nav

Inherits:
Base
  • Object
show all
Defined in:
lib/mosaic/sdk/models/nav.rb

Overview

Represents the collection of NAVs (Net Asset Values) from the Mosaic API.

NAVs are always accessed in the context of a clone via /v2/clones/:clone_id/navs. In addition to the standard Base#list and #create methods, this class provides #latest and #for_date for convenient access to specific NAV values.

Examples:

Get the latest NAV for a clone

dna = Mosaic::Sdk.Dna(42)
clone = dna.clones(7)
clone.navs.latest.data

List all NAVs for a clone

clone.navs.list

Create a NAV

clone.navs.create(date: '2025-01-15', value: 100.0)

Get the NAV for a specific date

clone.navs.for_date(Date.new(2025, 1, 15)).data
clone.navs.for_date('2025-01-15').data

Defined Under Namespace

Classes: Instance

Instance Method Summary collapse

Methods inherited from Base

#initialize, #list

Constructor Details

This class inherits a constructor from Mosaic::Sdk::Models::Base

Instance Method Details

#create(price:, unit:, date:, pricing_method:, bank_id:) ⇒ Instance

Creates a new NAV for the parent clone.

Parameters:

  • price (Float)

    the NAV price

  • unit (String)

    the price format: 'percentage' (%) or 'price' (P) (mapped to market_price_kind)

  • date (Date, String)

    the NAV date

  • pricing_method (String)

    the pricing method (mapped to market_price_type). One of: net_asset_value_final, last_paid_price, mid_price, pair, estimate_valuation, adjusted_price_after_sec_event, settlement, proxy_price, nav_valuation

  • bank_id (Integer)

    the associated bank ID

Returns:

  • (Instance)

    the created NAV instance

#for_date(date) ⇒ Instance

Returns the NAV for a specific date.

Parameters:

  • date (Date, String)

    the date to look up, either as a Date object or a string in 'YYYY-MM-DD' format

Returns:

  • (Instance)

    the NAV instance for the given date

#latestInstance

Returns the latest NAV for the parent clone.

Returns:

  • (Instance)

    the latest NAV instance