lot.create
Make an empty lot in an account, titled `Lot <n>` unless a title is given.
Makes an empty lot in an account. Its title is Lot <n> from the account's counter unless you give title, and
you can give notes. Put splits in it with lot.assignSplit. You rarely need this:
assigning a split without naming a lot opens one for you.
Examples
Example: with a copy of the reports/investment-lots example book open as book.gnucash.
JSON-RPC
Request:
{"jsonrpc":"2.0","id":1,"method":"lot.create","params":{"account":"Root:Assets:Broker:AAPL"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"guid": "…",
"title": "Lot 0",
"closed": false,
"balance": {
"num": "0",
"denom": "1"
},
"splitCount": 0,
"…": "…"
}
}
Command line
red-ale exec --book book.gnucash lot.create '{"account":"Root:Assets:Broker:AAPL"}'
It prints:
{
"guid": "…",
"title": "Lot 0",
"closed": false,
"balance": {
"num": "0",
"denom": "1"
},
"splitCount": 0,
"…": "…"
}
MCP tool call
Tool call:
{"name":"lot.create","arguments":{"account":"Root:Assets:Broker:AAPL"}}
Result:
{
"structuredContent": {
"guid": "…",
"title": "Lot 0",
"closed": false,
"balance": {
"num": "0",
"denom": "1"
},
"splitCount": 0,
"…": "…"
}
}
Effect: write, on the Book.
Params
Params of lot.create.
account(AccountRef, required): The account to hold the lot.title(string or null): Title; by defaultLot <n>.notes(string or null): Notes.
Result
A lot, as the lot viewer lists it.
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.