Comments (4)
Can you give me all of the code you used ?
from financepy.
class TestBond:
@pytest.fixture(scope='class')
def global_data(self):
# A 3 months treasure with 0 coupon per year.
bill = Bond(
issue_date=Date(25, 7, 2022),
maturity_date=Date(24, 10, 2022),
coupon=0,
freq_type=FrequencyTypes.SIMPLE,
accrual_type=DayCountTypes.ACT_ACT_ICMA
)
settlement_date = Date(8, 8, 2022)
return {
'bill': bill,
'date': settlement_date
}
def test_yield_to_maturity_no_coupon(self, global_data):
bond = global_data['bill']
assess_date = global_data['date']
clean_price = 99.7056
assert bond.yield_to_maturity(assess_date, clean_price, YTMCalcType.US_STREET) * 100 == \
pytest.approx(1.3998)
If I change the freq_type=FrequencyTypes.MONTHLY, the code ran well. The resulted ytm was close but still not precise.
If freq_type=FrequencyTypes.ANNUAL, the ytm was far away from the correct answer(1.3998)
from financepy.
Hi - this has been fixed. I added your test
https://github.com/domokane/FinancePy/blob/master/tests_golden/TestFinBondZeroCoupon.py
You will need to build it yourself or wait until the weekend and I will push a new version of financepy to PYPI.
from financepy.
Thank you for your quick fix.
It seems to me that it would be better to use the ACT_ACT_ISDA convention for Zero Coupon Bond, in case that the period crosses a leap year and a non-leap-year.
What's your opinion?
Do you mind if I change the DayCountTypes.ZERO algorithm in year_frac() to ACT_ACT_ISDA ?
from financepy.
Related Issues (20)
- CDSCurve class does not depend on recovery rate HOT 2
- Issue of Bond payment dates HOT 2
- "bond.full_price_from_ytm" is always computed by "face=100" right? HOT 2
- Accrued interest on coupon payment day HOT 2
- Add Equity Swap Product HOT 3
- Refactor barrier option code to extract core model code from products into model folder. HOT 11
- Alternative Interpolation Schemes for Longstaff Schwarz HOT 1
- Some swap suggestions
- 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
- Major implementation change for ibor_swap? A notebook example doesn't tie out anymore. HOT 12
- 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
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.