journal: default valuation commodity comes from P directives only (#1239, #1253)

This commit is contained in:
Simon Michael 2020-06-12 21:25:38 -07:00
parent 43e43af10d
commit 03b4b2dedc
2 changed files with 8 additions and 6 deletions

View File

@ -314,6 +314,7 @@ pricesAtDate pricedirectives transactionimpliedmarketprices d =
-- trace ("pricesAtDate ("++show d++")") $
PriceGraph{prGraph=g, prNodemap=m, prDefaultValuationCommodities=defaultdests}
where
declaredprices = map priceDirectiveToMarketPrice $ filter ((<=d).pddate) pricedirectives
declaredandimpliedprices = latestPriceForEachPairOn pricedirectives transactionimpliedmarketprices d
-- infer any additional reverse prices not already declared or implied
@ -331,9 +332,10 @@ pricesAtDate pricedirectives transactionimpliedmarketprices d =
prices = declaredandimpliedprices ++ reverseprices
allcomms = map mpfrom prices
-- save the forward prices' destinations as the default valuation
-- commodity for those source commodities
defaultdests = M.fromList [(mpfrom,mpto) | MarketPrice{..} <- declaredandimpliedprices]
-- save the forward prices' destinations (but only from declared
-- market prices) as the default valuation commodity for those
-- source commodities
defaultdests = M.fromList [(mpfrom,mpto) | MarketPrice{..} <- declaredprices]
-- From a list of price directives in parse order, and a list of
-- transaction-implied market prices in parse order, get the effective

View File

@ -1153,9 +1153,9 @@ their *default valuation commodity*, using the [market prices](#market-prices)
in effect on a *default valuation date*. (More on these below.)
The default valuation commodity is the one referenced in the latest
applicable market price dated on or before the valuation date.
Typically your P declarations or currency exchange transactions
reference a single base currency, and -V will pick that.
applicable market price (declared by a P directive, for the source
commodity, dated on or before the valuation date). Typically your P
declarations reference a single base currency, and -V will pick that.
The default valuation date is today for single period reports (equivalent to `--value=now`),
or the last day of each subperiod for [multiperiod reports](#report-intervals) (equivalent to `--value=end`).