Method

price.get

Describe one price.

Describes one price by GUID: the commodity, the currency, the time and local date, the source, the type and the value. GUIDs come from price.list and price.add.

Examples

Example: with a copy of the reports/test-data example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"price.get","params":{"price":"e0000000000000000000000000000001"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "guid": "e0000000000000000000000000000001",
    "commodity": "CURRENCY::GBP",
    "currency": "CURRENCY::USD",
    "date": "2000-02-15",
    "source": "user:xfer-dialog",
    "type": "test",
    "value": {
      "num": "3",
      "denom": "2"
    },
    "…": "…"
  }
}

Command line

red-ale exec --book book.gnucash price.get '{"price":"e0000000000000000000000000000001"}'

It prints:

{
  "guid": "e0000000000000000000000000000001",
  "commodity": "CURRENCY::GBP",
  "currency": "CURRENCY::USD",
  "date": "2000-02-15",
  "source": "user:xfer-dialog",
  "type": "test",
  "value": {
    "num": "3",
    "denom": "2"
  },
  "…": "…"
}

MCP tool call

Tool call:

{"name":"price.get","arguments":{"price":"e0000000000000000000000000000001"}}

Result:

{
  "structuredContent": {
    "guid": "e0000000000000000000000000000001",
    "commodity": "CURRENCY::GBP",
    "currency": "CURRENCY::USD",
    "date": "2000-02-15",
    "source": "user:xfer-dialog",
    "type": "test",
    "value": {
      "num": "3",
      "denom": "2"
    },
    "…": "…"
  }
}

Effect: read.

Params

Params naming one price.

  • price (Guid, required): The price's GUID.

Result

A price.

  • guid (Guid, required): Identity.
  • commodity (CommodityId, required): The commodity priced.
  • currency (CommodityId, required): The currency (or commodity) the value is in.
  • time (Timestamp, required): When the price applies.
  • date (Date or null): The local day of time, which the same-day rules use.
  • source (string or null): Where it came from, such as user:price-editor or Finance::Quote; kept as read even when GnuCash does not know it.
  • type (string or null): Its type, such as last, bid, ask, nav, transaction or unknown.
  • value (Amount, required): Units of currency per unit of commodity, exactly as stored.