Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7753521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:04:49+00:00 2026-06-01T12:04:49+00:00

Was wondering if anyone can point me to an open source java quant library

  • 0

Was wondering if anyone can point me to an open source java quant library that provides implementation for Excel Price and Yield functions.

Thanks,
Tapasvi

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:04:50+00:00Added an answer on June 1, 2026 at 12:04 pm

    The Excel PRICE function is a simple sum of discounted cash flows, discounted assuming a flat zero rate discounting curve. It is documented here: Excel Help / PRICE.

    I wrote a small Java version of the function, which I am posting below. The Java version just takes a “time to maturity” and does not support different daycountings, while the Excel PRICE function takes a settlement date and maturity date and supports different daycountings. However, you can attribute for the different daycountings by converting the coupon. Note also that the Excel function has a strange hardcoded notional of 100 in front of the coupon.

    An Excel sheet benchmarking the two implementations can be downloaded here. The sheet requires “Obba”.

    The Excel YIELD function is just a Newton solver applied to the PRICE function, see Excel Help / YIELD. A Java implementation of the Newton solver can be found at finmath.net.

    /*
     * Created on 07.04.2012
     */
    
    /**
     * This class implements some functions as static class methods.
     *
     * (c) Copyright 2012 Christian Fries.
     *
     * @author Christian Fries
     * @version 1.0
     */
    public class SpreadsheetFunctions {
    
        /**
         * Re-implementation of the Excel PRICE function (a rather primitive bond price formula).
         * The reimplementation is not exact, because this function does not consider daycount conventions.
         * We assume we have (int)timeToMaturity/frequency future periods and the running period has
         * an accrual period of timeToMaturity - frequency * ((int)timeToMaturity/frequency).
         * 
         * @param timeToMaturity The time to maturity.
         * @param coupon Coupon payment.
         * @param yield Yield (discount factor, using frequency: 1/(1 + yield/frequency).
         * @param redemption Redemption (notional repayment).
         * @param frequency Frequency (1,2,4).
         * @return price Clean price.
         */
        public static double price(
                double timeToMaturity,
                double coupon,
                double yield,
                double redemption,
                int frequency)
        {
            double price = 0.0;
    
            if(timeToMaturity > 0) {
                price += redemption;
            }
    
            double paymentTime = timeToMaturity;
            while(paymentTime > 0) {
                price += coupon/frequency;
    
                // Discount back
                price = price / (1.0 + yield / frequency);
                paymentTime -= 1.0 / frequency;
            }
    
            // Accrue running period
            double accrualPeriod = 0.0-paymentTime; // amount of running period which lies in the past (before settlement)
            price *= Math.pow(1.0 + yield / frequency, accrualPeriod*frequency);
            price -= coupon/frequency * accrualPeriod*frequency;
    
            return price;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if anyone can point me to a library that can search
I'm wondering if anyone can recommend a good C++ tree implementation, hopefully one that
I was wondering if anyone could point to an Open Source date utility class
I was wondering if anyone can point me in the right direction. I have
I am wondering if anyone can point me in the direction of learning how
Wondering if anyone can suggest a good file replication tool that will replicate across
I'm wondering if anyone can point me at resources dealing with the low(ish) level
I was wondering if anyone can point me in the direction of examples or
I'm just wondering if anyone can point me at a jQuery carousel, like the
Hay, i was wondering if anyone can point me to a a tutorial on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.