Safe Haskell | None |
---|---|
Language | Haskell2010 |
HAX.Assets
Contents
Description
This module provides a collection of accounting actions for
different asset/account types implemented via the Asset
class.
Use these actions to build more complex accounting actions for
Entity
s from Accounting.
They are implemented using the more basic combinators from Bookkeeping.
Many assets make use the InterestRate
s defined below.
- class Asset a where
- data TransactionalAccount = TransactionalAccount {}
- data PaymentType
- data Loan = Loan {}
- data Liquidity = Liquidity {
- lFrom :: AccountName
- lTo :: AccountName
- lPayments :: [Amount]
- duration :: PaymentType -> InterestRate -> Decimal
- annuity :: Decimal -> Decimal -> Amount
- data FixedPayment = FixedPayment {}
- data InterestRate = IR {
- iRate :: Amount
- iSource :: AccountName
- interest :: InterestRate -> Amount -> Amount
- currentInterest :: (Monoid w, Ledger l) => InterestRate -> AccountName -> AmountA s l w
- interestTx :: InterestRate -> String -> AccountName -> Maybe (AmountRW s) -> AmountRW s
The Asset class
An asset is anything that can be handled within an accounting action.
Minimal complete definition
Methods
handle :: a -> AccountingRW s () Source #
derives the action corresponding to the asset's characteristics
Transactional Account with asymmetric interest rates.
data TransactionalAccount Source #
This assets calculates interest according to its average positive
and negative account balances over the last time period and debits
it againt the InterestRate
s iSource
accounts.
Other names: Revolving credit, line of credit, Kontokorrent
Constructors
TransactionalAccount | |
Fields
|
Instances
Loan with fixed (annuity) or variable payments
data PaymentType Source #
Select a payment schedule
Constructors
Linear Decimal | Decreasing payments with fixed repay and decreasing interest portions. The number specifies the repay as a fraction of the principal amount. |
Annuity Decimal | Fixed payments with decreasing interest and increasing repay portions. The number specifies the initial repay as a fraction of the principal amount. |
Instances
Constructors
Loan | |
Fields
|
Liquitidy Simulation
This Asset
produces a list of twelve payments, one for each
month, that are shifted in such a way, that they sum up to zero
Constructors
Liquidity | |
Fields
|
Helpers
duration :: PaymentType -> InterestRate -> Decimal Source #
Calculate the number of periods time until the loan is completely repaid.
Calculate the annuity (as a fraction of the principal) for a given number of periods interest rate.
Fixed Payments
Interest Rates
data InterestRate Source #
Interest rates together with the nominal account, the could be identified with the source (for incoming interest payments) or sink (for outgoing, i.e. negative interest payments).
For example, if the interest is an expense, iSource
could be
"Expenses". If the interest is capital yield, iSource
could be
"Income".
Constructors
IR | |
Fields
|
currentInterest :: (Monoid w, Ledger l) => InterestRate -> AccountName -> AmountA s l w Source #
Calculate the interest for a current balance of an account
Arguments
:: InterestRate | |
-> String | comment |
-> AccountName | Sink account |
-> Maybe (AmountRW s) | optional: Use this amount instead of the balance of the sink account |
-> AmountRW s |
Calculate and transfer the interest from the iSource
account to
some other account.