lot.list
List an account's lots as the lot viewer shows them, optionally only open or closed ones.
Lists an account's lots as GnuCash's lot viewer shows them: opened earliest first, empty lots last. A lot groups the
splits of one account that buy and later sell the same holding; it is closed when it has splits and their amounts
sum to zero. state is all (the default), open or closed. Each lot shows its balance, its realized gains and
how many splits it holds.
A lot's title is null until it is set; lots made by red-ale are titled Lot <n>.
Examples
Example: with a copy of the reports/lots-baseline example book open as book.gnucash.
JSON-RPC
Request:
{"jsonrpc":"2.0","id":1,"method":"lot.list","params":{"account":"Root:Assets:Broker:AAPL"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"guid": "10000000000000000000000000000000",
"title": null,
"closed": false,
"openDate": "2020-01-01",
"balance": {
"num": "100",
"denom": "1"
},
"splitCount": 1,
"…": "…"
}
]
}
Command line
red-ale exec --book book.gnucash lot.list '{"account":"Root:Assets:Broker:AAPL"}'
It prints:
[
{
"guid": "10000000000000000000000000000000",
"title": null,
"closed": false,
"openDate": "2020-01-01",
"balance": {
"num": "100",
"denom": "1"
},
"splitCount": 1,
"…": "…"
}
]
MCP tool call
Tool call:
{"name":"lot.list","arguments":{"account":"Root:Assets:Broker:AAPL"}}
Result:
{
"content": [
{
"type": "text",
"text": "[{\"guid\":\"10000000000000000000000000000000\",\"title\":null,\"closed\":false,\"openDate\":\"2020-01-01\",\"balance\":{\"num\":\"100\",\"denom\":\"1\"},\"splitCount\":1,\"…\":\"…\"}]"
}
]
}
Effect: read.
Params
Params of lot.list.
account(AccountRef, required): The account.state(LotState):all(default),openorclosed.
Result
Type: array of LotInfo.