Coder Social home page Coder Social logo

Comments (4)

luajalla avatar luajalla commented on July 18, 2024

Looks like there's an issue with yield function and the last period before maturity (n <= 1), it doesn't take the price into account:
https://github.com/fsprojects/ExcelFinancialFunctions/blob/master/src/ExcelFinancialFunctions/bonds.fs#L69

Unfortunately I can't test the fix or release a new package, my laptop is still not repaired, but here's a travis build (yield branch):
https://travis-ci.org/fsprojects/ExcelFinancialFunctions/builds/81302367

from excelfinancialfunctions.

paigeNOTRS avatar paigeNOTRS commented on July 18, 2024

Thank you for such a quick response. I resolved the issue on my side by using a different calculation for 1 coupon period. I was going to post it today. On my next update I will try the Travis branch.

The following is the solution I am using.

coupdays = Excel.FinancialFunctions.Financial.CoupDays(settle, dtPar, Frequency.SemiAnnual, DayCountBasis.UsPsa30_360);
coupdaysnc = Excel.FinancialFunctions.Financial.CoupDaysNC(settle, dtPar, Frequency.SemiAnnual, DayCountBasis.UsPsa30_360);
coupnum = Excel.FinancialFunctions.Financial.CoupNum(settle, dtPar, Frequency.SemiAnnual, DayCountBasis.UsPsa30_360);

E = coupdays;
A = coupdays - coupdaysnc;
DSR = coupdaysnc;

if (coupnum == 1)
{
newPar = (((ParPrce / 100 + coupon / frequency) - (dblPrice / 100 + (A / E * coupon / frequency))) / (dblPrice / 100 + (A / E * coupon / frequency))) * ((frequency * E) / DSR);
Debug.Print(newCall.ToString());
}
else
{
newPar = Excel.FinancialFunctions.Financial.Yield(settle, dtPar, coupon, dblPrice, ParPrce, Frequency.SemiAnnual, DayCountBasis.UsPsa30_360);
}

Thanks for your help and for such a great tool.

from excelfinancialfunctions.

jcoliz avatar jcoliz commented on July 18, 2024

This issue refers to commit 2e9d9b1, which indeed looks like it did not get merged. Will leave this issue open to track.

from excelfinancialfunctions.

jcoliz avatar jcoliz commented on July 18, 2024

Looks like this was actually already merged 9/21/2015, my mistake. I added an explicit test case.

from excelfinancialfunctions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.