hledger-irr 0.1.1.4 → 0.1.1.5
raw patch · 2 files changed
+14/−13 lines, 2 filesdep +Decimaldep ~hledger-lib
Dependencies added: Decimal
Dependency ranges changed: hledger-lib
Files
- Main.hs +4/−3
- hledger-irr.cabal +10/−10
Main.hs view
@@ -14,6 +14,7 @@ import Data.List import Data.Ord import Statistics.Math.RootFinding+import Data.Decimal import Paths_hledger_irr ( version )@@ -105,7 +106,7 @@ when (null (optInvAcc opts)) (commandLineError "required --investment-account option is missing\n") when (null (optInterestAcc opts)) (commandLineError "required --interest-account option is missing\n") when (length args > 0) (commandLineError "no command line arguments allowed")- jnl' <- readJournalFile Nothing Nothing (optInput opts) >>= either fail return+ jnl' <- readJournalFile Nothing Nothing True (optInput opts) >>= either fail return let ts = jtxns $ filterJournalTransactions (Acct (optInvAcc opts)) jnl' when (null ts) $ do@@ -148,7 +149,7 @@ -- 0% is always a solution, so require at least something here putStr $ printf "%s - %s: " (showDate ibegin) (showDate iend)- case ridders 0.00001 (0.000001,1000) (aquantity . interestSum iend totalCF) of+ case ridders 0.00001 (0.000001,1000) (realToFrac . aquantity . interestSum iend totalCF) of Root rate -> putStrLn (printf "%0.2f%%" ((rate-1)*100)) _ -> putStrLn "Error: Failed to find solution." @@ -169,7 +170,7 @@ -- | Divide an amount's quantity by a constant. multiplyAmount :: Amount -> Double -> Amount-multiplyAmount a@Amount{aquantity=q} d = a{aquantity=q*d}+multiplyAmount a@Amount{aquantity=q} d = a{aquantity=q *. d} interestSum :: Day -> CashFlow -> Double -> Amount
hledger-irr.cabal view
@@ -1,5 +1,5 @@ Name: hledger-irr-Version: 0.1.1.4+Version: 0.1.1.5 Synopsis: computes the internal rate of return of an investment License: BSD3 License-file: LICENSE@@ -64,17 +64,17 @@ > 2011/04/01: €-50.00 > 2011/05/01: €47.00 > 2011/06/01: €90.00- > 2011/01/01 - 2014/05/01: 17.72%+ > 2011/01/01 - 2015/03/01: -100.00% > $ hledger-irr -f speculation.ledger -t "Rate Gain" -i Speculation -e 2011-03-01- > 2011/01/01 - 2011/03/01: 26.11%+ > 2011/01/01 - 2011/03/01: 26.12% > $ hledger-irr -f speculation.ledger -t "Rate Gain" -i Speculation -b 2011-03-01- > 2011/03/01 - 2014/05/01: 12.28%+ > 2011/03/01 - 2015/03/01: -100.00% > $ hledger-irr -f speculation.ledger -t "Rate Gain" -i Speculation --monthly- > 2011/01/01 - 2011/02/01: 12.43%- > 2011/02/01 - 2011/03/01: 41.57%- > 2011/03/01 - 2011/04/01: -51.45%- > 2011/04/01 - 2011/05/01: 32.27%- > 2011/05/01 - 2011/06/01: 96.01%+ > 2011/01/01 - 2011/02/01: 12.49%+ > 2011/02/01 - 2011/03/01: 41.55%+ > 2011/03/01 - 2011/04/01: -51.44%+ > 2011/04/01 - 2011/05/01: 32.24%+ > 2011/05/01 - 2011/06/01: 95.92% . Running the utility with @--help@ gives a brief overview over the available options:@@ -104,7 +104,7 @@ Executable hledger-irr Main-is: Main.hs- Build-depends: base >= 3 && < 5, hledger-lib == 0.20.* || == 0.21.* || == 0.22.* || == 0.23.*, time, Cabal, statistics >= 0.10+ Build-depends: base >= 3 && < 5, hledger-lib >= 0.23.98 && < 0.25, Decimal, time, Cabal, statistics >= 0.10 Ghc-Options: -Wall source-repository head