-
Notifications
You must be signed in to change notification settings - Fork 7
Apr25 #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Apr25 #274
Changes from 38 commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
a1c453d
bump version to-> < 0.45.1 >
yellowbean ab60b99
include Pre: HasPass/IsOutstanding
yellowbean c6515d3
move away from stack
yellowbean c4d5d71
update cabal
yellowbean d08a81d
include UT
yellowbean cfc20b7
Lift pool current balance query
yellowbean dcfae79
update cabal
yellowbean d4f5004
add eq to result component
yellowbean a88d06c
Vector to test
yellowbean b31abf1
clean up
yellowbean e23fae1
rm pj freeze
yellowbean 8e8531e
remove Amount, convert to Balance
yellowbean b56adf2
License to 2025
yellowbean 2e77b88
Using DL
yellowbean 1cc8b56
Opt with DList on Mortgage
yellowbean 92d27c9
expose DL to Installment
yellowbean 2db1ccd
DList to Stmt
yellowbean e0c9c41
fix stmt
yellowbean 1acbb9b
fix UT
yellowbean 19d2c99
bump version to-> < 0.45.2 >
yellowbean 4d943a6
update workflow
yellowbean d42f576
stack to cabal in docker
yellowbean 8bee0e7
new docker
yellowbean 4c0d521
fix docker
yellowbean 70b8906
udpate df
yellowbean 1c8817e
fix df
yellowbean b627069
fix df
yellowbean 1be016a
df
yellowbean 0aad9cf
refactor Z-bond due prin
yellowbean 72cfcef
clean up
yellowbean 6232a66
enable maxSpread
yellowbean 3fcbdc4
bump version to-> < 0.45.3 >
yellowbean a27a869
[root finder] finalise new spread finder
yellowbean d2bb0ff
minor clean
yellowbean 473f07c
trigger logs use DList
yellowbean cf264bd
Expose bal in FixedAsset; Expose extend periods in FixedAsset
yellowbean 97a03cf
WIP
yellowbean 706e4b1
Finalized DDB in Fixed Asset
yellowbean 063726d
Update CHANGELOG.md
yellowbean 8e65054
Update CHANGELOG.md
yellowbean 15a8366
UT-pass
yellowbean 8e7093c
compete testbySpread
yellowbean 5c1b47d
bump version to-> < 0.45.4 >
yellowbean 68862a5
Merge branch 'Apr25_2' of https://github.com/yellowbean/Hastructure i…
yellowbean c6b11a0
Expose default on lease
yellowbean 6d0615d
add default value to pricing function
yellowbean cb675a2
Revert "add default value to pricing function"
yellowbean 965a238
fix frist loss algo
yellowbean 1c5cd30
bump version to-> < 0.45.5 >
yellowbean 082b68b
LEASE: fix current balance
yellowbean 4055839
fix default on rental algo
yellowbean f544050
bump version to-> < 0.45.6 >
yellowbean 3de2c31
expose rental change vec
yellowbean 73eceb8
bump version to-> < 0.45.7 >
yellowbean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,12 +35,13 @@ jobs: | |
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| stack update | ||
| stack build | ||
| cabal update | ||
| - name: Build | ||
| run: stack build | ||
| run: cabal build | ||
| - name: Run tests | ||
| run: stack test | ||
| run: cabal test | ||
|
|
||
| - name: Badge Action | ||
| uses: emibcn/[email protected] | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| cabal-version: 1.12 | ||
| cabal-version: 3.0 | ||
|
|
||
| -- This file has been generated from package.yaml by hpack version 0.37.0. | ||
| -- | ||
|
|
@@ -13,7 +13,7 @@ bug-reports: https://github.com/yellowbean/Hastructure/issues | |
| author: Xiaoyu | ||
| maintainer: [email protected] | ||
| copyright: 2025 Xiaoyu, Zhang | ||
| license: BSD3 | ||
| license: BSD-3-Clause | ||
| license-file: LICENSE | ||
| build-type: Simple | ||
| extra-source-files: | ||
|
|
@@ -24,6 +24,8 @@ source-repository head | |
| type: git | ||
| location: https://github.com/yellowbean/Hastructure | ||
|
|
||
| with-compiler: ghc-9.8.2 | ||
|
|
||
| library | ||
| exposed-modules: | ||
| Accounts | ||
|
|
@@ -67,7 +69,6 @@ library | |
| Util | ||
| Validation | ||
| Waterfall | ||
| WebUI | ||
| other-modules: | ||
| Paths_Hastructure | ||
| hs-source-dirs: | ||
|
|
@@ -84,7 +85,6 @@ library | |
| , hashable | ||
| , ieee754 | ||
| , lens | ||
| , lucid | ||
| , math-functions | ||
| , monad-loops | ||
| , mtl | ||
|
|
@@ -104,9 +104,12 @@ library | |
| , template-haskell | ||
| , text | ||
| , time | ||
| , vector | ||
| , wai | ||
| , yaml | ||
| , vector | ||
| , MissingH | ||
| , dlist | ||
| -- , proto3-wire | ||
| default-language: Haskell2010 | ||
|
|
||
| executable Hastructure-exe | ||
|
|
@@ -135,7 +138,6 @@ executable Hastructure-exe | |
| , http-types | ||
| , ieee754 | ||
| , lens | ||
| , lucid | ||
| , math-functions | ||
| , monad-loops | ||
| , mtl | ||
|
|
@@ -158,11 +160,12 @@ executable Hastructure-exe | |
| , text | ||
| , time | ||
| , unordered-containers | ||
| , vector | ||
| , wai | ||
| , wai-cors | ||
| , warp | ||
| , yaml | ||
| , dlist | ||
| -- , proto3-suite | ||
| default-language: Haskell2010 | ||
|
|
||
| test-suite Hastructure-test | ||
|
|
@@ -205,7 +208,6 @@ test-suite Hastructure-test | |
| , hashable | ||
| , ieee754 | ||
| , lens | ||
| , lucid | ||
| , math-functions | ||
| , monad-loops | ||
| , mtl | ||
|
|
@@ -229,7 +231,9 @@ test-suite Hastructure-test | |
| , template-haskell | ||
| , text | ||
| , time | ||
| , vector | ||
| , wai | ||
| , yaml | ||
| , vector | ||
| , MissingH | ||
| , dlist | ||
| default-language: Haskell2010 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,6 @@ import GHC.Generics | |
| import GHC.Real | ||
| import qualified Data.ByteString.Lazy.Char8 as BL8 | ||
| import qualified Data.ByteString.Char8 as BS | ||
| import Lucid hiding (type_) | ||
| import Network.Wai | ||
| import Network.Wai.Handler.Warp | ||
| import Network.Wai.Middleware.Cors | ||
|
|
@@ -101,7 +100,7 @@ debug = flip Debug.Trace.trace | |
|
|
||
|
|
||
| version1 :: Version | ||
| version1 = Version "0.44.2" | ||
| version1 = Version "0.45.3" | ||
|
|
||
|
|
||
| wrapRun :: DealType -> Maybe AP.ApplyAssumptionType -> AP.NonPerfAssumption -> RunResp | ||
|
|
@@ -301,22 +300,18 @@ testByDefault dt assumps [email protected]{AP.revolving = mRevo | |
|
|
||
| -- add spread to bonds till PV of bond (discounted by pricing assumption) equals to face value | ||
| -- with constraint that all liabilities are paid off | ||
| testBySpread :: DealRunInput -> (BondName,[BondName]) -> Double -> Double | ||
| testBySpread (dt,mPAssump,runAssump) (bn,bnds) f | ||
| testBySpread :: DealRunInput -> BondName -> Double -> Double | ||
| testBySpread (dt,mPAssump,runAssump) bn f | ||
| = let | ||
| runResult = wrapRun (modifyDealType (DM.AddSpreadToBonds bnds) f dt) mPAssump runAssump | ||
| runResult = wrapRun (modifyDealType (DM.AddSpreadToBonds [bn]) f dt) mPAssump runAssump | ||
| in | ||
| case runResult of | ||
| Right (d, mPoolCfMap, mResult, pResult) -> | ||
| let | ||
| v = getPriceValue $ pResult Map.! bn | ||
| bond = dtToBonds d Map.! bn | ||
| bondBal = L.getOriginBalance $ dtToBonds d Map.! bn | ||
| in | ||
| -- if L.getCurBalance bond > 0 then | ||
| if True then | ||
| 1.0 | ||
| else | ||
| (fromRational . toRational) (v - L.getOriginBalance bond) | ||
| (fromRational . toRational) $ bondBal - v -- `debug` ("rate"++ show f ++ "bondBal:"++ show bondBal++"v:"++ show v) | ||
| Left errorMsg -> error $ "Error in test fun for spread testing" ++ show errorMsg | ||
|
|
||
| runRootFinderBy :: RootFindReq -> Handler (Either String RootFindResp) | ||
|
|
@@ -335,15 +330,15 @@ runRootFinderBy (FirstLossReq (dt,Just assumps,[email protected] | |
| NotBracketed -> Left "Not able to bracket the root" | ||
| SearchFailed -> Left "Not able to find the root" | ||
|
|
||
| runRootFinderBy (MaxSpreadToFaceReq (dt,pAssump,dAssump) (bn,bnds)) | ||
| runRootFinderBy (MaxSpreadToFaceReq (dt,pAssump,dAssump) bn) | ||
| = return $ | ||
| let | ||
| itertimes = 500 | ||
| def = RiddersParam { riddersMaxIter = itertimes, riddersTol = RelTol 0.0001} | ||
| in | ||
| case ridders def (0.00,200.0) (testBySpread (dt,pAssump,dAssump) (bn,bnds)) of | ||
| case ridders def (0.00,200.0) (testBySpread (dt,pAssump,dAssump) bn) of | ||
| Root r -> let | ||
| dt' = modifyDealType (DM.AddSpreadToBonds bnds) r dt | ||
| dt' = modifyDealType (DM.AddSpreadToBonds [bn]) r dt | ||
| in | ||
| Right $ BestSpreadResult r (dtToBonds dt') dt' | ||
| NotBracketed -> Left "Not able to bracket the root" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.