hax-0.0.2: Haskell cash-flow and tax simulation

Safe HaskellNone
LanguageHaskell2010

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 Entitys from Accounting.

They are implemented using the more basic combinators from Bookkeeping.

Many assets make use the InterestRates defined below.

Synopsis

The Asset class

class Asset a where Source #

An asset is anything that can be handled within an accounting action.

Minimal complete definition

handle

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 InterestRates iSource accounts.

Other names: Revolving credit, line of credit, Kontokorrent

Constructors

TransactionalAccount 

Fields

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.

data Loan Source #

Constructors

Loan 

Fields

Instances

Liquitidy Simulation

data Liquidity Source #

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 

Instances

Helpers

duration :: PaymentType -> InterestRate -> Decimal Source #

Calculate the number of periods time until the loan is completely repaid.

annuity Source #

Arguments

:: Decimal

number of periods

-> Decimal

interest rate

-> Amount 

Calculate the annuity (as a fraction of the principal) for a given number of periods interest rate.

Fixed Payments

data FixedPayment Source #

Recurring Fixed Payment

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

interest :: InterestRate -> Amount -> Amount Source #

Calculate the interest for a given amount

currentInterest :: (Monoid w, Ledger l) => InterestRate -> AccountName -> AmountA s l w Source #

Calculate the interest for a current balance of an account

interestTx Source #

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.