Class: Ledger::Sdk::Models::Position

Inherits:
Base
  • Object
show all
Defined in:
lib/ledger/sdk/models/position.rb

Overview

Represents the collection of positions (portfolio lines) from the Ledger API.

Positions are accessed either in the context of a single account via /containers/:container_id/accounts/:account_id/positions, container-wide via /containers/:container_id/positions (every account's positions in one call), or root-level via /positions. The root endpoint REQUIRES a filters[code] security-code filter — without it the Ledger API rejects the call with a 422; filters[code_kind] (isin, ticker, …) disambiguates a code string shared across kinds, and a filters[container] filter can be added alongside to narrow the root lookup down to a single container. The Ledger API exposes no individual position endpoint: position data is only available through Base#list.

Examples:

List positions for an account

positions = Ledger::Sdk.Container(42).accounts(7).positions.list
positions.first.data # => { 'id' => 3, 'currency' => 'USD', ... }

List every position of a container in one call

positions = Ledger::Sdk.Container(42).positions.list

Look up positions across every container, filtered by code

positions = Ledger::Sdk.Position.list { { filters: { code: 'FR0000120271' } } }

Defined Under Namespace

Classes: Instance

Method Summary

Methods inherited from Base

#initialize, #list

Constructor Details

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