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++")") $ -- trace ("pricesAtDate ("++show d++")") $
PriceGraph{prGraph=g, prNodemap=m, prDefaultValuationCommodities=defaultdests} PriceGraph{prGraph=g, prNodemap=m, prDefaultValuationCommodities=defaultdests}
where where
declaredprices = map priceDirectiveToMarketPrice $ filter ((<=d).pddate) pricedirectives
declaredandimpliedprices = latestPriceForEachPairOn pricedirectives transactionimpliedmarketprices d declaredandimpliedprices = latestPriceForEachPairOn pricedirectives transactionimpliedmarketprices d
-- infer any additional reverse prices not already declared or implied -- infer any additional reverse prices not already declared or implied
@ -331,9 +332,10 @@ pricesAtDate pricedirectives transactionimpliedmarketprices d =
prices = declaredandimpliedprices ++ reverseprices prices = declaredandimpliedprices ++ reverseprices
allcomms = map mpfrom prices allcomms = map mpfrom prices
-- save the forward prices' destinations as the default valuation -- save the forward prices' destinations (but only from declared
-- commodity for those source commodities -- market prices) as the default valuation commodity for those
defaultdests = M.fromList [(mpfrom,mpto) | MarketPrice{..} <- declaredandimpliedprices] -- source commodities
defaultdests = M.fromList [(mpfrom,mpto) | MarketPrice{..} <- declaredprices]
-- From a list of price directives in parse order, and a list of -- From a list of price directives in parse order, and a list of
-- transaction-implied market prices in parse order, get the effective -- 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.) in effect on a *default valuation date*. (More on these below.)
The default valuation commodity is the one referenced in the latest The default valuation commodity is the one referenced in the latest
applicable market price dated on or before the valuation date. applicable market price (declared by a P directive, for the source
Typically your P declarations or currency exchange transactions commodity, dated on or before the valuation date). Typically your P
reference a single base currency, and -V will pick that. 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`), 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`). or the last day of each subperiod for [multiperiod reports](#report-intervals) (equivalent to `--value=end`).