Ledger
A Ledger is a list of Transactions from the perspective of a particular Account. Ledgers are ordered by Transaction time, and include a running Account Balance for every line.
You can request Ledgers in arbitrary Global or Custom Units, not just the native unit of the target Account. If you request a Ledger in a unit other than the target Account native unit, Amatino will compute and return unrealised gains and losses.
Amatino will return a maximum total of 1,000 Ledger Rows per retrieval request. If the Ledger you define spans more than 1,000 rows, it will be broken into pages you can retrieve seperately.
The Ledger Object
The Amatino API returns Ledger objects with the following structure
Root Type
JSON Object
Object Structure
type | JSON Number |
key | "account_id" |
example | 42 |
description | An integer identifier of the Account this Ledger describes |
type | JSON String |
key | "start_time" |
example | "2017-01-01_17:22:16.00000" |
description | Time at which the ledger window starts, in the format YYYY-MM-DD_HH24:MI:SS.US |
type | JSON String |
key | "end_time" |
example | "2018-02-07_17:22:16.51245" |
description | Time at which the ledger window ends, in the format YYYY-MM-DD_HH24:MI:SS.US |
type | JSON Boolean |
key | "recursive" |
example | False |
description | A bool asserting that this is not a Recursive Ledger. Always false |
type | JSON String |
key | "generated_time" |
example | "2018-05-02_05:01:54.72941" |
description | Time that this Ledger was computed, in the format YYYY-MM-DD_HH24:MI:SS.US |
type | JSON Number or JSON Null |
key | "global_unit_denomination" |
example | 5 |
description | The id of the global unit in which this Ledger is denominated, if applicable |
type | JSON Number or JSON Null |
key | "custom_unit_denomination" |
example | null |
description | The id of the custom unit in which this Ledger is denominated, if applicable. |
type | JSON Number |
key | "page" |
example | 2 |
description | The page number covered by this ledger object |
type | JSON Number |
key | "number_of_pages" |
example | 3 |
description | The number of pages this Ledger covers, in total |
type | JSON Bool |
key | "ordered_oldest_first" |
example | true |
description | True of the ledger presents oldest transactions first, false if newest first |
type | JSON Array |
key | "ledger_rows" |
list objects | Ledger Row |
example | See Ledger Rows |
description | A list of Ledger Row objects |
Retrieve Ledger
API Path | /accounts/ledger |
HTTP Method | GET |
Description Descr. | Retrieve a Ledger for an account or accounts |
Required Headers
Key | X-Signature |
Value | Your Session signature |
Example | "yxATCPRKAAXHNiPctNQPHEGGVJF"... |
Key | X-Session-ID |
Value | An an integer Session ID |
Example | 7449059267091272858 |
Required URL Parameters
Key | entity_id |
Type | string |
Description Descr. | The entity id of the entity from which you wish to retrieve a Ledger |
Example | oB3cjSNKXklkJ4Tb |
Repeatable | No |
Required JSON Data
Root type
Object Structure
type | JSON Number |
key | "account_id" |
example | 42 |
description | The unique integer identifier of the Account for which you would like to retrieve a Ledger |
type | JSON String or JSON Null |
key | "start_time" |
example | "2018-01-01_00:00:00.00000" |
description | The time at which the Ledger will start. Specify JSON Null to start at request time |
type | JSON String or JSON Null |
key | "end_time" |
example | "2018-12-31_00:00:00.00000" |
description | The time at which the Ledger will end. Specify JSON Null to end at start time less one year |
type | JSON Number or JSON Null |
key | "page" |
example | 2 |
description | The page to retrieve. Specify JSON Null to retrieve the first page. |
type | JSON Number or JSON Null |
source | /units/list |
key | "global_unit_denomination" |
example | 5 |
description | The id of the global unit denomination in which you would like to view the Ledger, if desired. Specify JSON Null both here and in the custom unit to retrieve the transaction in the target Account's native unit. |
type | JSON Number or JSON Null |
source | /custom_units/list |
key | "custom_unit_denomination" |
example | null |
description | The id of the custom unit in which you would like to view the Ledger, if desired. Specify JSON Null both here and in the custom unit to retrieve the transaction in the target Account's native unit. |
type | JSON Bool |
key | "order_oldest_first" |
example | false |
description | Specify true to order the ledger oldest first, false to reverse. |
Returns
Root Type
JSON Array