I am new to OG. Can someone please guide me to the API for calculating accrued interest on bonds. I have the specifics such as settle date, day count , coupon, previous payment date. Wondering if there is a way in OG to calculate how much accrued is due at the time of the transaction.
Currently we can only calculate accrued interest for interest rates swaps. I’ve raised a ticket to add support for bonds:
Good news! I was wrong, we do have support for accrued interest on bonds, but only on our lower-level pricer API:
LocalDate settlementDate = LocalDate.of(...); FixedCouponBond bond = ...; // create the bond ResolvedFixedCouponBond resolvedBond = bond.resolve(ReferenceData.standard()); double accruedInterest = DiscountingFixedCouponBondProductPricer.DEFAULT.accruedInterest(resolvedBond, settlementDate);
It is also worth looking at the test case for this code:
Bonds - Calculate yield from price contributions or prices from yields
Thanks for the prompt response. I am quite excited to try this out. Sick of dealing with Fincads and Numerixes of the world. Our use case is C# -> Java. I believe there was some github project for the OG platfor that allowed seamless integration of C# with .NET but seems there is no such thing for Strata yet.
Can you tell me what is the best practice to find Strata documentation ? Do i go to http://strata.opengamma.io/apidocs/ and start searching ? To be specific, how would i have know to find this accrued interest function ? Additionally, there are 100s of APIs in this apidocs link. Is there some overarching documentation that gives the documentation some structure.
The best place to start is the product coverage page:
The “Asset class” column contains links for some asset classes leading to detailed documentation.
If there is a tick in the “Examples” column for an asset class then there is an example in the
strata-examples module. When there is an example for an asset class that is a good place to start.
If there is a tick in the “Calc API” column then the asset class can be used with Strata’s high-level calculation API. This is the easiest API to use and is the only one that allows calculations for mixed portfolios, multiple measures and multiple scenarios. This the API used in many of the examples, for example
If there is a tick in the “Pricer” column it means there is low-level calculation support for the asset class but it has not been integrated into the higher-level API yet. If this is the case then you should look in the
strata-pricer project. There is a package for each asset class and the calculations are implemented in a class whose name include the asset class and ends with
Pricer. For example the fixed coupon bond code is in the package
com.opengamma.strata.pricer.bond in a class called
Ultimately we would like to provide examples for all asset classes and support them in the high-level API but that work is not yet complete.