Comments (12)
Thanks. I will look into this. I have not had time to push the most recent changes. Maybe this weekend.
from financepy.
Hi Professor, I've probably introduced the changes related to the swap legs, so happy to pick up this review this weekend if you are ok with it.
from financepy.
from financepy.
Alright, I started looking into this.
- Formatting: Indeed the choice I made to include print_payments within print_valuation wasn't good, what if I refactored the valuation table schema like the image below + remove print_payments from it? I.e. Upside: Quite concise table, with all relevant info / Downside: User would need to print_payments to check Start/End Accrual valuation dates, otherwise the table would be too long to display. Let me know if you have a better idea!
- Values not matching: I suspect that this isn't related to my change, but of course gonna keep debugging this. Looking at the notebook @ version 0.184, noticed the column "Rate/IBOR" used to derive the cashflows are quite different (e.g. comparing the two images, for 1st payment, it is 2.005 in one,and 1.97758 in the other, which explains the final difference). Nevertheless, the logic to derive the rates shown wasn't changed in my PR, @domokane are you aware of any change that might be related to this?
I'll take a look again later
Cheers,
Matheus
from financepy.
Apparently the float_leg issue was introduced in commit 2d43d10.
If you look at the changes in swap_float_leg.py, you'll notice fwd_rate calculation changed to use index_alpha instead of pay_alpha, which explains the IBOR Rate change I highlighted above.
Professor, do you recall why this was necessary?
PS: For the 1st payment in the example above, we have:
Pay_alpha == 0.2555555
Index_alpha == 0.2520547
Which is explained by Index being in Act_365F day count, whereas Pay_alpha is ACT_360 - the two account for 92 days of accrual.
Thanks
from financepy.
Hi - I believe I did this as it seemed appropriate to separate the choice of accrual method for the index from the choice of accrual method for the payment leg. Perhaps I have mispecified the index accrual method in the example - it should be the same as the payment method ? Would that fix the problem ?
from financepy.
Hi @domokane, thanks for your reply.
- I don't think you mispecified the index accrual method. The example setup is in accordance to the one for QL: http://gouthamanbalaraman.com/blog/interest-rate-swap-quantlib-python.html (Libor is in Act/365F, whereas swap is in Act/360)
- It is possible that the new/current result for float_leg is right - although I haven't given too much though on that yet, I think your change is appropriate.
from financepy.
After giving it some thought, I'm quite confident that the updated value for the float leg is the right one - the changes you've made look good to me. Besides that, considering that we're setting Libor rate at a flat 2%, the figures above tell us that in version 0.184 (which matches the results in the blog), the Libor rate was off a bit, coming in at 1.97%.
from financepy.
OK. Thanks.
from financepy.
Thank you, when I find sometime I'll create a PR for the formatting fix.
from financepy.
Thanks for looking at this. If we confirm the current methodology is right, I strongly recommend refreshing the related notebooks too see the impacts if possible. As I see, the valuation difference can be as large as 15-20% for example in FINIBORSWAP_DefiningAFixedFloatingSwap.ipynb
. What's more, since swap is fundamental in building curves, e.g. in CDS valuation, I wonder if our results could still tie with Markit.
I am willing to help on this as well, but in coming weeks.
from financepy.
from financepy.
Related Issues (20)
- argument type issue - FXVanillaOption with SABR model HOT 3
- Re-generate manual when master is updated HOT 5
- Date Schedule._generate issue HOT 2
- Example of SOFR curve
- Potential issues for CDS pricing HOT 4
- Bond Curve Fitting HOT 1
- Inconsistency in Day Count in Index Curve? HOT 3
- CDSOption insensitive to vol for Receiver HOT 4
- Division with wrong day count convention causes incorrect forward rates HOT 1
- Bond OAS and accrued interest HOT 2
- barrierOpt.value issue HOT 2
- choose to apply a Black'76 in Fx Vanilla option HOT 1
- Build SOFR curve - suggestions
- Updated FINGBMPROCESS_generatePaths HOT 4
- Backtesting of Strategy HOT 4
- 'bond.print_payments' error HOT 2
- typo in "acccrued"
- Name 'swap_types' is not defined HOT 3
- How to deal with same maturity bonds for bootstrap curve? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from financepy.