@travishorn/financejs
    Preparing search index...

    Function price

    • Calculates the price per $100 face value of a security that pays periodic interest.

      Remarks:

      • The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 2008, and is purchased by a buyer six months later. The issue date would be January 1, 2008, the settlement date would be July 1, 2008, and the maturity date would be January 1, 2038, which is 30 years after the January 1, 2008, issue date.
      • settlement, maturity, frequency, and basis are truncated to integers.
      • If settlement or maturity is not a valid date, an error is thrown.
      • If yld < 0 or if rate < 0, an error is thrown.
      • If redemption <= 0, an error is thrown.
      • If frequency is any number other than 1, 2, or 4, an error is thrown.
      • If basis < 0 or if basis > 4 and error is thrown.
      • If settlement >= maturity, an error is thrown.
      • When N > 1 (N is the number of coupons payable between the settlement date and redemption date), the calculation is: PRICE =[redemption / (1 + yld/frequency)^(N-1 + DSC/E)] +[SUM(k=1 to N) (100 * rate/frequency) / (1 + yld/frequency)^(k-1 + DSC/E)] - (100 * rate/frequency * A/E), where:
        • DSC = number of days from settlement to next coupon date.
        • E = number of days in coupon period in which the settlement date falls.
        • A = number of days from beginning of coupon period to settlement date.
      • When N = 1, the calculation is: `DSR = E - A; T1 = 100 * (rate / frequency)
        • redemption; T2 = (yld / frequency) * (DSR / E) + 1; T3 = 100 * (rate / frequency) * (A / E); Price = (T1 / T2) - T3`.

      Parameters

      • settlement: Date

        The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.

      • maturity: Date

        The security's maturity date. The maturity date is the date when the security expires.

      • rate: number

        The security's annual coupon rate.

      • yld: number

        The security's annual yield.

      • redemption: number

        The security's redemption value per $100 face value.

      • frequency: 1 | 2 | 4

        The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.

      • Optionalbasis: 0 | 1 | 2 | 3 | 4 = 0

        The type of day count basis to use. 0 or omitted = US (NASD 30/360), 1 = actual/actual, 2 = actual/360, 3 = actual/365, 4 = European 30/360.

      Returns number

      the price per $100 face value

      price(new Date("2008-02-15"), new Date("2017-11-15"), 0.0575, 0.065, 100, 2, 0); // 94.63436162