d58b7919

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

Add lot prices

An asset held at a lot price becomes its own commodity: `2 SWDA lot @ 500 EUR`
is an amount of 2 in the commodity "SWDA acquired at 500 EUR per unit", a
distinct key in every balance map from plain `SWDA` and from `SWDA` bought at
another price.

A lot balances at its lot rate, exactly like `@` does, and converts one to one
into the commodity it is a lot of, so it is worth whatever the underlying is
worth rather than what it cost.  Disposal is a negative posting in the same lot,
which leaves the difference between basis and proceeds for a capital gains
posting to absorb.  A lot-free assertion sums across every lot of a symbol, so
an assertion copied off a broker statement stays writable once lots are in play.

This also splits `Currency`, which was doing two jobs: a declared currency, and
whatever a balance is denominated in.  The lot rode on it as a Maybe field,
which is why `declaredCurrency` had to exist.  A `Commodity` is now a currency
or a lot, and one rule decides every site: conversion targets are currencies,
balance keys are commodities.

What follows from the types rather than from a validity rule:

  * a cost converts to a `Currency`, so nothing can convert into a lot
  * a `Lot` holds a `Currency`, so a lot of a lot cannot be built
  * `PostingPrice` has nowhere to put a cost beside a lot

A currency can no longer be called `lot`.

Total

16s

Created Started Finished

Time to Start Worker time Duration Time to finish Idle
Config 0s 3s 3s 3s 0s
Eval 3s 13s 13s 17s 0s
Build 14s 0s 0s 14s 0s
Suite 0s 16s 16s 17s 0s

Timeline

Config Eval Build
0s10s