PriceDB
This is feature is only available on development version of Tackler |
See Commodity Price Manual how to do Market Value analysis with commodities. |
PriceDB is file format used to store market value (prices) of commodities, shares and currency exchange rates at certain point of time. The syntax is simple and there are ready-to-use data sources available, for example pricedb currency rate database. There are also external PTA price fetching tools to collect price data from various sources.
Configuration
Location of the pricedb is defined either by price
section in
tackler.toml or by CLI.
[price] db-path = "journal/txns/price.db" lookup-type = "last-price" ... [Report] commodity = "TCKLR"
The CLI option is --pricedb
, see tackler --help
for all price related CLI options: --report.commodity
, --price.lookup-type
and --price.before
File Format
Used pricedb file format is compatible with other PTA tools (e.g. Ledger, hledger and pricedb currency rate database).
This is an example of EUR to CAD rate:
P 2025-03-07 EUR 1.5566 CAD ; The official rate of ECB
Above is an example of one record of currency rate of EUR to CAD, as rated by the Central Bank of Europe on Mar 7th 2025.
Syntax
Each pricedb record is one row, containing space separated fields:
'P' TIMESTAMP SRC_COMMODITY AMOUNT TRG_COMMODITY OPT_COMMENT 'P' ...
- TIMESTAMP
-
This is the time of price value (rate) when it was rated. See Timestamp handling for info about various timestamp formats.
- SRC_COMMODITY
-
This is the source commodity of price conversion
- AMOUNT
-
This is the rate of conversion (one source commodity in the target commodity)
- TRG_COMMODITY
-
This is the target commodity of the conversion
- OPT_COMMENT (optional)
-
Optional comment for price record. It’s prefixed with
';' space+
. This syntax is same as with Txn comments.
Timestamp handling
The timestamp
will use the same logic as transaction timestamps:
Timestamp could be:
-
RFC3339 timestamp with offset information (
2024-12-31T14:15:16+02:00
) -
Timestamp without zone or offset (
2024-12-31T14:15:16
), then thekernel.timestamp.timezone
value is used as zone/offset. -
Date (
2024-12-31
), thenkernel.timestamp.default-time
is used withkernel.timestamp.timezone
.
The resulting timestamp has always time and offset.