lib: Hledger.Data.Journal: journalAddPricesFromEquity -> journalInferCosts

This commit is contained in:
Simon Michael 2023-01-19 09:17:56 -10:00
parent 440f808b3d
commit dfea6eaee2
2 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ module Hledger.Data.Journal (
journalCommodityStyles,
journalToCost,
journalAddInferredEquityPostings,
journalAddPricesFromEquity,
journalInferCosts,
journalReverse,
journalSetLastReadTime,
journalRenumberAccountDeclarations,
@ -881,8 +881,8 @@ journalAddInferredEquityPostings j = journalMapTransactions (transactionAddInfer
equityAcct = journalConversionAccount j
-- | Add inferred transaction prices from equity postings.
journalAddPricesFromEquity :: Journal -> Either String Journal
journalAddPricesFromEquity j = do
journalInferCosts :: Journal -> Either String Journal
journalInferCosts j = do
ts <- mapM (transactionAddPricesFromEquity $ jaccounttypes j) $ jtxns j
return j{jtxns=ts}

View File

@ -324,7 +324,7 @@ journalFinalise iopts@InputOpts{..} f txt pj = do
>>= (if auto_ && not (null $ jtxnmodifiers pj)
then journalAddAutoPostings _ioDay balancingopts_ -- Add auto postings if enabled, and account tags if needed
else pure)
>>= (if infer_costs_ then journalAddPricesFromEquity else pure) -- Add inferred transaction prices from equity postings, if present
>>= (if infer_costs_ then journalInferCosts else pure) -- Add inferred transaction prices from equity postings, if present
>>= journalBalanceTransactions balancingopts_ -- Balance all transactions and maybe check balance assertions.
<&> (if infer_equity_ then journalAddInferredEquityPostings else id) -- Add inferred equity postings, after balancing and generating auto postings
<&> journalInferMarketPricesFromTransactions -- infer market prices from commodity-exchanging transactions