Skip to content

Commit

Permalink
remove debug
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowbean committed Dec 12, 2024
1 parent 4ca6677 commit 9ebd988
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 27 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
<!-- towncrier release notes start -->


## 0.40.9
### 2024-12-11
* ENHANCE: Ensure <limit> always return positive ,otherwise engine will throw error
* NEW: add new action `changeStatus` in waterfall, with optional `Pre` as condition to trigger the status change


## 0.40.6
### 2024-12-06
* NEW: new formula `ledgerBalanceBy`, which return either `Credit` or `Debit` balance of a ledger
* FIX: step-up coupon bond which has a floater index will increase forever
* ENHANCE: refactor on `PDL` book type.
* ENHANCE:


## 0.40.1
Expand Down
2 changes: 1 addition & 1 deletion Hastructure.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: Hastructure
version: 0.40.9
version: 0.40.9
description: Please see the README on GitHub at <https://github.com/yellowbean/Hastructure#readme>
category: StructuredFinance;Securitisation;Cashflow
homepage: https://github.com/yellowbean/Hastructure#readme
Expand Down
23 changes: 6 additions & 17 deletions src/Deal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ run t@TestDeal{accounts=accMap,fees=feeMap,triggers=mTrgMap,bonds=bndMap,status=
return (prepareDeal finalDeal,newLogs++[EndRun (Just (getDate ad)) "No Pool Cashflow/All Account is zero/Not revolving"]) -- `debug` ("End of pool collection with logs with length "++ show (length log))

| otherwise
= case ad `debug` ("Action"++show ad++">>\n")of
= case ad of
PoolCollection d _ ->
if any (> 0) remainCollectionNum then
let
Expand Down Expand Up @@ -860,7 +860,7 @@ appendCollectedCF d t@TestDeal { pool = pt } poolInflowMap
0 -> 0
_ -> CF.mflowBalance $ last txnCollected
txnToAppend = CF.patchCumulative currentStats [] txnCollected
accUpdated = Map.adjust (over P.poolFutureTxn (++ txnToAppend)) k acc `debug` ("date"++show d ++ "appending txn"++ show txnToAppend)
accUpdated = Map.adjust (over P.poolFutureTxn (++ txnToAppend)) k acc
in
Map.adjust
(over P.poolIssuanceStat (Map.insert RuntimeCurrentPoolBalance balInCollected))
Expand All @@ -885,16 +885,8 @@ removePoolCf t@TestDeal{pool=pt} =
ResecDeal uds -> ResecDeal uds
_ -> error "not implement"
in
t {pool=newPt}
t {pool = newPt}

-- ^ TODO: need to set cashflow to different pool other than SoloPool
-- setFutureCF :: Ast.Asset a => TestDeal a -> CF.CashFlowFrame -> TestDeal a
-- setFutureCF t@TestDeal{pool = (SoloPool p )} cf
-- = let
-- newPool = p {P.futureCf = Just cf}
-- newPoolType = SoloPool newPool
-- in
-- t {pool = newPoolType }

populateDealDates :: DateDesp -> DealStatus -> (Date,Date,Date,[ActionOnDate],[ActionOnDate],Date)
populateDealDates (WarehousingDates begDate rampingPoolDp rampingBondDp statedDate)
Expand Down Expand Up @@ -950,12 +942,9 @@ runPool (P.Pool [] (Just (CF.CashFlowFrame _ txn)) _ asof _ (Just dp)) (Just (AP
-- use interest rate assumption
runPool (P.Pool as _ _ asof _ _) Nothing mRates
-- = Right $ map (\x -> (Ast.calcCashflow x asof mRates,Map.empty)) as
= let
cfs::(Either String [CF.CashFlowFrame]) = sequenceA $ map (\x -> Ast.calcCashflow x asof mRates) as
in
do
cf <- cfs
return [ (x, Map.empty) | x <- cf ]
= do
cf <- sequenceA $ map (\x -> Ast.calcCashflow x asof mRates) as
return [ (x, Map.empty) | x <- cf ]

-- asset cashflow with credit stress
---- By pool level
Expand Down
6 changes: 2 additions & 4 deletions src/Deal/DealAction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,8 @@ performActionWrap d
-- REMOVE future cf
newPfInRc = foldr (Map.adjust (set CF.cashflowTxn [])) pcf (Map.keys poolMapToLiq)
-- Update current balance to zero
in
Right (t {accounts = accMapAfterLiq , pool = newPt} , rc {runPoolFlow = newPfInRc}, logs )
in
Right (t {accounts = accMapAfterLiq , pool = newPt} , rc {runPoolFlow = newPfInRc}, logs)


performActionWrap d (t, rc, logs) (W.WatchVal ms dss)
Expand Down Expand Up @@ -718,13 +718,11 @@ performActionWrap d (t, rc, logs) (W.ChangeStatus mPre newSt)
return (t, rc, logs)

-- ^ go down to performAction

performActionWrap d (t, rc, logs) a
= do
dealAfterExe <- performAction d t a
return (dealAfterExe, rc, logs)


performAction :: Ast.Asset a => Date -> TestDeal a -> W.Action -> Either String (TestDeal a)
performAction d t@TestDeal{accounts=accMap, ledgers = Just ledgerM}
(W.TransferAndBook mLimit an1 an2 (dr, lName) mComment)
Expand Down
6 changes: 3 additions & 3 deletions src/Deal/DealQuery.hs
Original file line number Diff line number Diff line change
Expand Up @@ -427,19 +427,19 @@ queryCompound t@TestDeal{accounts=accMap, bonds=bndMap, ledgers=ledgersM, fees=f
Nothing
else
Just (x!!lookupIndx))
pCollectedTxns `debug` ("date"++show d++"Pool collection: "++ show pCollectedTxns)
pCollectedTxns -- `debug` ("date"++show d++"Pool collection: "++ show pCollectedTxns)
in
do
curPoolBalM <- sequenceA $
Map.mapWithKey
(\k v -> queryCompound t d (FutureCurrentPoolBalance (Just [k])))
pStat `debug` ("date"++show d++"Pool stats collection: "++ show pStat)
pStat -- `debug` ("date"++show d++"Pool stats collection: "++ show pStat)
let poolStat = Map.mapWithKey
(\k v ->
case v of
Just _v -> sum $ CF.lookupSource _v <$> ps
Nothing -> sum $ CF.lookupSourceM (fromRational (curPoolBalM Map.! k)) Nothing <$> ps)
pStat `debug` ("date"++show d++"query pool current pool stat 2" ++ show pStat )
pStat -- `debug` ("date"++show d++"query pool current pool stat 2" ++ show pStat )
return $ sum $ Map.elems $ toRational <$> poolStat -- `debug` ("query pool current stats"++ show poolStat)

FuturePoolScheduleCfPv asOfDay pm mPns ->
Expand Down
2 changes: 1 addition & 1 deletion swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -19275,7 +19275,7 @@
"name": "BSD 3"
},
"title": "Hastructure API",
"version": "0.40.5"
"version": "0.40.9"
},
"openapi": "3.0.0",
"paths": {
Expand Down

0 comments on commit 9ebd988

Please sign in to comment.