packages feed

Hastructure 0.50.0 → 0.50.2

raw patch · 10 files changed

+32/−40 lines, 10 filesdep −ieee754dep −regex-tdfadep ~basedep ~containersdep ~deepseqPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: ieee754, regex-tdfa

Dependency ranges changed: base, containers, deepseq, exceptions, hashable, template-haskell

API changes (from Hackage documentation)

- AssetClass.Loan: projectLoanFlow :: ((Balance, Int, IRate), Balance, Date, AmortPlan, DayCount, IRate, Rational) -> (Dates, [DefaultRate], [PrepaymentRate], [IRate], [Int]) -> ([TsRow], Rational)
+ AssetClass.Loan: projectLoanFlow :: ((Balance, Int, IRate), Balance, Date, AmortPlan, DayCount, IRate, Rational) -> (Dates, [DefaultRate], [PrepaymentRate], [IRate], [Int]) -> (DList TsRow, Balance, Date, Rational)
- Types: Ended :: Date -> DealStatus
+ Types: Ended :: Maybe Date -> DealStatus

Files

Hastructure.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           Hastructure-version:        0.50.0+version: 0.50.2 synopsis:       Cashflow modeling library for structured finance description:    Please see the README on GitHub at <https://github.com/yellowbean/Hastructure#readme> category:       StructuredFinance,Securitisation,Cashflow@@ -76,19 +76,19 @@       src   build-depends:     Decimal >= 0.5.2 && < 0.6,-    base >= 4.18.0 && < 4.21,-    deepseq >= 1.5.1 && < 1.6,+    base >= 4.18.0 && < 4.21.0,+    deepseq >= 1.5.0 && < 1.6,     MissingH >= 1.6.0 && < 1.7,-    containers >= 0.6.8 && < 0.7,-    template-haskell >= 2.20.0 && < 2.21.1.0,+    containers >= 0.6.8 && < 0.7.1,+    template-haskell >= 2.20.0 && < 2.22.1.0,     bytestring >= 0.12.1 && < 0.13,-    exceptions >= 0.10.7 && < 0.11,+    -- exceptions >= 0.10.7 && < 0.11,     mtl >= 2.3.1 && < 2.4,     time >= 1.12.2 && < 1.13,     text >= 2.1.1 && < 2.2,     regex-base >= 0.94.0 && < 0.95,     aeson >= 2.2.3 && < 2.3,-    hashable >= 1.4.7 && < 1.5,+    hashable >= 1.4.7 && < 1.5.1,     dlist >= 1.0 && < 1.1,     scientific >= 0.3.8 && < 0.4,     vector >= 0.13.2 && < 0.14,@@ -98,7 +98,7 @@     attoparsec-aeson >= 2.2.2 && < 2.3,     generic-lens >= 2.2.2 && < 2.3,     http-types >= 0.12.4 && < 0.13,-    ieee754 >= 0.8.0 && < 0.9,+    -- ieee754 >= 0.8.0 && < 0.9,     lens >= 5.2.3 && < 5.3.6,     parallel >= 3.2.2 && < 3.3,     math-functions >= 0.3.4 && < 0.4,@@ -106,7 +106,7 @@     numeric-limits >= 0.1.0 && < 0.2,     openapi3 >= 3.2.4 && < 3.3,     regex-pcre-builtin >= 0.95.2 && < 0.96,-    regex-tdfa >= 1.3.2 && < 1.4,+    -- regex-tdfa >= 1.3.2 && < 1.4,     servant >= 0.20.2 && < 0.21,     servant-openapi3 >= 2.0.1 && < 2.1,     servant-server >= 0.20.2 && < 0.21,@@ -135,7 +135,7 @@   build-depends:     Hastructure,     Decimal,-    base >= 4.18.0 && < 4.20,+    base >= 4.18.0 && < 4.21.0,     deepseq,     MissingH,     containers,@@ -157,7 +157,6 @@     attoparsec-aeson,     generic-lens,     http-types,-    ieee754,     lens,     parallel,     math-functions,@@ -165,7 +164,6 @@     numeric-limits,     openapi3,     regex-pcre-builtin,-    regex-tdfa,     servant,     servant-openapi3,     servant-server,@@ -216,7 +214,7 @@   build-depends:     Hastructure,     Decimal,-    base >= 4.18.0 && < 4.20,+    base >= 4.18.0 && < 4.21,     deepseq,     MissingH,     containers,@@ -238,7 +236,6 @@     attoparsec-aeson,     generic-lens,     http-types,-    ieee754,     lens,     parallel,     math-functions,@@ -246,7 +243,6 @@     numeric-limits,     openapi3,     regex-pcre-builtin,-    regex-tdfa,     servant,     servant-openapi3,     servant-server,
app/Main.hs view
@@ -104,7 +104,7 @@   version1 :: Version -version1 = Version "0.50.0"+version1 = Version "0.50.2"   wrapRun :: [D.ExpectReturn] -> DealType -> Maybe AP.ApplyAssumptionType -> AP.NonPerfAssumption -> RunResp
src/AssetClass/Loan.hs view
@@ -32,20 +32,21 @@ import qualified Asset as A import Control.Lens hiding (element) import Control.Lens.TH+import qualified Data.DList as DL debug = flip trace   -- instance Asset Loan where-projectLoanFlow :: ((Balance,Int,IRate), Balance, Date, AmortPlan, DayCount, IRate, Rational) -> (Dates, [DefaultRate],[PrepaymentRate],[IRate],[Int]) -> ([CF.TsRow],Rational)+projectLoanFlow :: ((Balance,Int,IRate), Balance, Date, AmortPlan, DayCount, IRate, Rational) -> (Dates, [DefaultRate],[PrepaymentRate],[IRate],[Int]) -> (DL.DList CF.TsRow, Balance, Date ,Rational) projectLoanFlow ((originBal,ot,or), startBal, lastPayDate, pt, dc,startRate, begFactor) (cfDates,defRates,ppyRates,rateVector,remainTerms) =    let      initRow = CF.LoanFlow lastPayDate startBal 0.0 0.0 0.0 0.0 0.0 0.0 startRate Nothing   in      foldl-      (\(acc,factor) (pDate, ppyRate, defRate, intRate, rt)+      (\(acc,begBal,lastPaidDate,factor) (pDate, ppyRate, defRate, intRate, rt)         -> let -             begBal = view CF.tsRowBalance (last acc)-             lastPaidDate = getDate (last acc)+             -- begBal = view CF.tsRowBalance (last acc)+             -- lastPaidDate = getDate (last acc)              newDefault = mulBR begBal defRate              newPrepay = mulBR (begBal - newDefault) ppyRate              intBal = begBal - newDefault - newPrepay@@ -72,9 +73,11 @@                          _ -> error $ "failed to match Loan Project newPrin"++ show (rt,pt)              endBal = intBal - newPrin            in-             (acc ++ [CF.LoanFlow pDate endBal newPrin newInt newPrepay newDefault 0.0 0.0 intRate Nothing]+             (DL.snoc acc (CF.LoanFlow pDate endBal newPrin newInt newPrepay newDefault 0.0 0.0 intRate Nothing)+             ,endBal+             ,pDate              ,newFactor))-      ([initRow],begFactor)+      (DL.singleton initRow, startBal, lastPayDate, begFactor)       (zip5 cfDates ppyRates defRates rateVector remainTerms)    instance Asset Loan where@@ -146,8 +149,8 @@                           in                              divideBB cb (scheduleBals!!(ot - rt))                          _ -> 1.0  -          let (txns,_) = projectLoanFlow ((ob,ot,getOriginRate pl), cb,lastPayDate,prinPayType,dc,cr,initFactor) (cfDates,defRates,ppyRates,rateVector,remainTerms)  -- `debug` (" rateVector"++show rateVector)-          let (futureTxns,historyM) = CF.cutoffTrs asOfDay (patchLossRecovery txns recoveryAssump)+          let (txns,_,_,_) = projectLoanFlow ((ob,ot,getOriginRate pl), cb,lastPayDate,prinPayType,dc,cr,initFactor) (cfDates,defRates,ppyRates,rateVector,remainTerms)  -- `debug` (" rateVector"++show rateVector)+          let (futureTxns,historyM) = CF.cutoffTrs asOfDay (patchLossRecovery (DL.toList txns) recoveryAssump)           let begBal = CF.buildBegBal futureTxns           return $ (applyHaircut ams (CF.CashFlowFrame (begBal,asOfDay,Nothing) futureTxns), historyM)   -- ^ Project cashflow for defautled loans 
src/AssetClass/ProjectedCashFlow.hs view
@@ -184,7 +184,7 @@     getOriginBal x = getCurrentBal x     getOriginRate x = 0.0 -    isDefaulted f = error ""+    isDefaulted f = False     getOriginDate f = error ""     getOriginInfo f = error "" @@ -208,16 +208,10 @@     projCashflow f asOfDay (pAssump, _, _) mRates       = do           (fixedCashFlow, floatedCashFlow) <- seperateCashflows f (Just pAssump) mRates-          return $ (foldl CF.combine fixedCashFlow floatedCashFlow, Map.empty)-          --(fixedCashFlow, Map.empty)+          return (foldl CF.combine fixedCashFlow floatedCashFlow, Map.empty)      projCashflow a b c d = Left $ "Failed to match when proj projected flow with assumption >>" ++ show a ++ show b ++ show c ++ show d          getBorrowerNum f = 0      splitWith f rs = [f]---- instance IR.UseRate ProjectedCashflow where ---       isAdjustbleRate _ = False---       getIndex _ = Nothing---       getIndexes _ = Nothing
src/Deal.hs view
@@ -62,7 +62,7 @@ import Data.Maybe import Data.Either import Data.Aeson hiding (json)-import qualified Data.Aeson.Encode.Pretty as Pretty+-- import qualified Data.Aeson.Encode.Pretty as Pretty import Language.Haskell.TH import Data.Aeson.TH import Data.Aeson.Types@@ -393,7 +393,7 @@ run :: Ast.Asset a => TestDeal a -> Map.Map PoolId CF.PoolCashflow -> Maybe [ActionOnDate] -> Maybe [RateAssumption] -> Maybe ([Pre],[Pre])         -> Maybe (Map.Map String (RevolvingPool,AP.ApplyAssumptionType)) -> DL.DList ResultComponent          -> Either String (TestDeal a,DL.DList ResultComponent, Map.Map PoolId CF.PoolCashflow)-run t@TestDeal{status=(Ended endedDate)} pCfM ads _ _ _ log  = return (t,DL.snoc log (EndRun (Just endedDate) "By Status:Ended"), pCfM)+run t@TestDeal{status=(Ended endedDate)} pCfM ads _ _ _ log  = return (t,DL.snoc log (EndRun endedDate "By Status:Ended"), pCfM) run t pCfM (Just []) _ _ _ log  = return (t,DL.snoc log (EndRun Nothing "No Actions"), pCfM) run t pCfM (Just [HitStatedMaturity d]) _ _ _ log  = return (t, DL.snoc log (EndRun (Just d) "Stop: Stated Maturity"), pCfM) run t pCfM (Just (StopRunFlag d:_)) _ _ _ log  = return (t, DL.snoc log (EndRun (Just d) "Stop Run Flag"), pCfM)@@ -702,7 +702,7 @@                                             L.payYield d intToPay bnd1)                                         (bonds t)                                         bondPricingResult-                run t {bonds = depositBondFlow, status = Ended d} Map.empty (Just []) rates calls rAssump $ DL.snoc log (EndRun (Just d) "MakeWhole call")+                run t {bonds = depositBondFlow, status = Ended (Just d)} Map.empty (Just []) rates calls rAssump $ DL.snoc log (EndRun (Just d) "MakeWhole call")                  FundBond d Nothing bName accName fundAmt ->           let 
src/Deal/DealAction.hs view
@@ -55,7 +55,7 @@ import Data.Maybe import Data.Either import Data.Aeson hiding (json)-import qualified Data.Aeson.Encode.Pretty as Pretty+-- import qualified Data.Aeson.Encode.Pretty as Pretty import Language.Haskell.TH import Data.Aeson.TH import Data.Aeson.Types
src/Deal/DealBase.hs view
@@ -48,7 +48,6 @@ import Data.Maybe import Data.Ratio import Data.Aeson hiding (json)-import qualified Data.Aeson.Encode.Pretty as Pretty import Language.Haskell.TH import Data.Aeson.TH import Data.Aeson.Types
src/Deal/DealMod.hs view
@@ -48,7 +48,7 @@ import Data.Maybe import Data.Ratio import Data.Aeson hiding (json)-import qualified Data.Aeson.Encode.Pretty as Pretty+-- import qualified Data.Aeson.Encode.Pretty as Pretty import Language.Haskell.TH import Data.Aeson.TH import Data.Aeson.Types
src/Lib.hs view
@@ -27,7 +27,7 @@ import Data.Aeson.TH import Data.Aeson.Types import Data.Aeson hiding (json)-import Text.Regex.TDFA+-- import Text.Regex.TDFA import Data.Fixed (Fixed(..), HasResolution,Centi, resolution) import Data.Ratio import Types
src/Types.hs view
@@ -487,7 +487,7 @@                 | PreClosing DealStatus             -- ^ Deal is not closed, but has a closing date                 | Warehousing (Maybe DealStatus)    -- ^ Deal is not closed, but closing date is not determined yet                 | Called                            -- ^ Deal is called-                | Ended Date                        -- ^ Deal is marked as closed+                | Ended (Maybe Date)                -- ^ Deal is marked as closed                 deriving (Show,Ord,Eq,Read, Generic)  -- ^ pricing methods for assets