yellowbean / Hastructure

ABS/MBS cashflow engine written in Haskell, with API to Python and C/Java (on the way)
https://deal-bench.xyz
Other
16 stars 4 forks source link

Floating coupon of asset increase/decrease by a rounding amount #43

Closed yellowbean closed 1 year ago

yellowbean commented 1 year ago

the issue is :

there are two types of rounding in the library:

so, I make a type RoundingBy which can either hold Balance IRate type of number

data RoundingBy a = RoundCeil a 
         | RoundFloor a
         deriving (Show,Generic)

roundingBy :: (Fractional a,RealFrac a,Integral a) => RoundingBy a -> a -> a
roundingBy (RoundFloor x) n = x * floor ( n / x)
roundingBy (RoundCeil x) n = x * (ceiling (n / x))
yellowbean commented 1 year ago

https://github.com/yellowbean/Hastructure/commit/37c752ffb5f2d44cebee2156cab6a4c876ccc43f

Exposed in ARM rate with Floater2 ..

There is incompatible change on Floater type ...

or ...we can include Floater3.....