lot.get
Describe one lot with its splits.
Describes one lot with its splits. Each split shows its amount, its adjusted amount (the amount restated in the units
after any later stock split), its value, the capital gain it realised and its kind: normal, gains or
stockSplit. Reading never writes: gains that are out of date are reported as recorded, where GnuCash's viewer
recomputes them. Use lot.computeGains to bring them up to date.
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.get","params":{"lot":"10000000000000000000000000000000"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"guid": "10000000000000000000000000000000",
"closed": false,
"balance": {
"num": "100",
"denom": "1"
},
"splits": [
{
"split": "d0000000000000000000000000000000",
"description": "Buy AAPL lot baseline",
"amount": {
"num": "100",
"denom": "1"
},
"value": {
"num": "500000",
"denom": "100"
},
"kind": "normal",
"…": "…"
}
],
"…": "…"
}
}
Command line
red-ale exec --book book.gnucash lot.get '{"lot":"10000000000000000000000000000000"}'
It prints:
{
"guid": "10000000000000000000000000000000",
"closed": false,
"balance": {
"num": "100",
"denom": "1"
},
"splits": [
{
"split": "d0000000000000000000000000000000",
"description": "Buy AAPL lot baseline",
"amount": {
"num": "100",
"denom": "1"
},
"value": {
"num": "500000",
"denom": "100"
},
"kind": "normal",
"…": "…"
}
],
"…": "…"
}
MCP tool call
Tool call:
{"name":"lot.get","arguments":{"lot":"10000000000000000000000000000000"}}
Result:
{
"structuredContent": {
"guid": "10000000000000000000000000000000",
"closed": false,
"balance": {
"num": "100",
"denom": "1"
},
"splits": [
{
"split": "d0000000000000000000000000000000",
"description": "Buy AAPL lot baseline",
"amount": {
"num": "100",
"denom": "1"
},
"value": {
"num": "500000",
"denom": "100"
},
"kind": "normal",
"…": "…"
}
],
"…": "…"
}
}
Effect: read.
Params
Params naming a lot.
lot(Guid, required): The lot.
Result
The result of lot.get.
guid(Guid, required): The lot.account(Guid, required): Its account.title(string or null): Title.notes(string or null): Notes.invoice(Guid or null): The invoice the lot belongs to (the viewer's typeI).closed(boolean, required): The lot has splits and its balance is zero.openDate(Date or null): Posted date of its earliest split.closeDate(Date or null): Posted date of its latest split, when closed.balance(Amount, required): Sum of its splits' amounts, restated after stock splits.gainsCurrency(CommodityId or null): Currency of its realised gains.realizedGains(Amount, required): Realised gains: the values of its gains splits in that currency.splitCount(integer (uint), required): How many splits it holds.splits(array of LotSplitInfo, required): Its splits, earliest first.