Method

lot.freeSplits

List an account's splits that are in no lot, with the gain each would realise against a lot.

Lists the splits of an account that are in no lot, as the lot viewer's free splits. With lot, each also shows the gain it would realise against that lot. Use it to see what lot.assignSplit or lot.scrubAccount still has to place.

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.freeSplits","params":{"account":"Root:Assets:Broker:AAPL"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "split": "d0000000000000000000000000000001",
      "description": "Buy AAPL lot 1",
      "amount": {
        "num": "100",
        "denom": "1"
      },
      "…": "…"
    },
    {
      "split": "d0000000000000000000000000000004",
      "description": "Buy AAPL lot 2",
      "…": "…"
    },
    {
      "split": "d0000000000000000000000000000007",
      "description": "Sell AAPL",
      "amount": {
        "num": "-60",
        "denom": "1"
      },
      "…": "…"
    }
  ]
}

Command line

red-ale exec --book book.gnucash lot.freeSplits '{"account":"Root:Assets:Broker:AAPL"}'

It prints:

[
  {
    "split": "d0000000000000000000000000000001",
    "description": "Buy AAPL lot 1",
    "amount": {
      "num": "100",
      "denom": "1"
    },
    "…": "…"
  },
  {
    "split": "d0000000000000000000000000000004",
    "description": "Buy AAPL lot 2",
    "…": "…"
  },
  {
    "split": "d0000000000000000000000000000007",
    "description": "Sell AAPL",
    "amount": {
      "num": "-60",
      "denom": "1"
    },
    "…": "…"
  }
]

MCP tool call

Tool call:

{"name":"lot.freeSplits","arguments":{"account":"Root:Assets:Broker:AAPL"}}

Result:

{
  "content": [
    {
      "type": "text",
      "text": "[{\"split\":\"d0000000000000000000000000000001\",\"description\":\"Buy AAPL lot 1\",\"amount\":{\"num\":\"100\",\"denom\":\"1\"},\"…\":\"…\"},{\"split\":\"d0000000000000000000000000000004\",\"description\":\"Buy AAPL lot 2\",\"…\":\"…\"},{\"split\":\"d0000000000000000000000000000007\",\"description\":\"Sell AAPL\",\"amount\":{\"num\":\"-60\",\"denom\":\"1\"},\"…\":\"…\"}]"
    }
  ]
}

Effect: read.

Params

Params of lot.freeSplits.

  • account (AccountRef, required): The account.
  • lot (Guid or null): A lot of the account to compute each split's gain against.

Result

Type: array of LotSplitInfo.