### Install Exonio Gem Source: https://github.com/noverde/exonio/blob/main/README.md Add the Exonio gem to your application's Gemfile and run bundle install, or install it directly using the gem install command. ```ruby gem 'exonio' ``` ```bash $ bundle ``` ```bash $ gem install exonio ``` -------------------------------- ### Calculate Sum of an Array (Sum) Source: https://github.com/noverde/exonio/blob/main/README.md Calculate the sum of all elements in a numeric array. This example sums the elements [1, 2, 3, 4, 5]. ```ruby Exonio.sum([1, 2, 3, 4, 5]) # ==> 15 ``` -------------------------------- ### Calculate Loan Payment (PMT) Source: https://github.com/noverde/exonio/blob/main/README.md Calculate the monthly payment for a loan. This example shows how to determine the payment for a $200,000 loan over 15 years at a 7.5% annual interest rate. ```ruby Exonio.pmt(0.075 / 12, 12 * 15, 200_000) # ==> -1854.0247200054619 ``` -------------------------------- ### Calculate Present Value (PV) Source: https://github.com/noverde/exonio/blob/main/README.md Calculate the present value of an investment needed to reach a future target amount with regular savings. This example calculates the initial deposit required to reach $20,000 in 10 years. ```ruby Exonio.pv(0.05 / 12, 12 * 10, -100, 20_000) # ==> -2715.0857731569663 ``` -------------------------------- ### Calculate Internal Rate of Return (IRR) Source: https://github.com/noverde/exonio/blob/main/README.md Calculate the internal rate of return for a series of cash flows. This example uses an initial investment and subsequent withdrawals. ```ruby Exonio.irr([-100, 39, 59, 55, 20]) # ==> 0.28095 ``` -------------------------------- ### Calculate Interest Portion of Payment (IPMT) Source: https://github.com/noverde/exonio/blob/main/README.md Determine the interest portion of a specific loan payment. This example calculates the interest for the 8th month of a 2-year loan. ```ruby Exonio.ipmt(0.075 / 12, 8, 12 * 2, 5_000.00) # ==> -22.612926783996798 ``` -------------------------------- ### Calculate Net Present Value (NPV) Source: https://github.com/noverde/exonio/blob/main/README.md Calculate the Net Present Value of an investment based on a discount rate and a series of cash flows. This example uses a discount rate of 0.281. ```ruby Exonio.npv(0.281, [-100, 39, 59, 55, 29]) # ==> -0.00661872883563408 ``` -------------------------------- ### Calculate Median of an Array (Median) Source: https://github.com/noverde/exonio/blob/main/README.md Calculate the median value of a numeric array. This example finds the median of [1, 2, 3, 6, 5, 4]. ```ruby Exonio.median([1, 2, 3, 6, 5, 4]) # ==> 3.5 ``` -------------------------------- ### Calculate Future Value (FV) Source: https://github.com/noverde/exonio/blob/main/README.md Calculate the future value of an investment considering initial deposit, periodic savings, interest rate, and compounding periods. This example calculates the future value after 10 years with monthly savings. ```ruby Exonio.fv(0.05 / 12, 10 * 12, -100, -100) # ==> 15692.928894335748 ``` -------------------------------- ### Calculate Interest Rate (RATE) Source: https://github.com/noverde/exonio/blob/main/README.md Determine the interest rate of a loan given the loan amount, payment amount, and number of periods. This example calculates the rate for a $50,000 loan paid over 3 years with $2,500 monthly payments. ```ruby Exonio.rate(12 * 3, 2_500, -50_000) # ==> 0.036006853458478955 ``` -------------------------------- ### Calculate Mean of an Array (Mean) Source: https://github.com/noverde/exonio/blob/main/README.md Calculate the arithmetic mean (average) of the elements in a numeric array. This example calculates the mean of [1, 2, 3, 4, 5]. ```ruby Exonio.mean([1, 2, 3, 4, 5]) # ==> 3.0 ``` -------------------------------- ### Calculate Nominal Interest Rate (NOMINAL) Source: https://github.com/noverde/exonio/blob/main/README.md Calculate the nominal interest rate from an effective annual rate and the number of compounding periods. This example calculates the nominal rate for an effective rate of 5% compounded 12 times per year. ```ruby Exonio.nominal(0.05, 12 / 6) # ==> 0.04939015319191986 ``` -------------------------------- ### Calculate Number of Periods (NPER) Source: https://github.com/noverde/exonio/blob/main/README.md Calculate the number of payment periods required to pay off a loan. This example determines how long it takes to pay off an $8,000 loan at 7% annual interest with $150 monthly payments. ```ruby Exonio.nper(0.07 / 12, -150, 8000) # ==> 64.07334877066185 ``` -------------------------------- ### Calculate Effective Annual Interest Rate (EFFECT) Source: https://github.com/noverde/exonio/blob/main/README.md Determine the effective annual interest rate given a nominal rate and the number of compounding periods per year. This example uses a 5% nominal rate compounded 10 times per year. ```ruby Exonio.effect(0.05, 10 * 12) # ==> 0.05126014873337037 ``` -------------------------------- ### PMT Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the payment for a loan based on constant payments and a constant interest rate. ```APIDOC ## PMT ### Description Calculates the payment for a loan based on constant payments and a constant interest rate. The payment includes principal and interest but excludes taxes, insurance, and other fees. ### Method `Exonio.pmt(rate, nper, pv, fv = 0)` ### Parameters #### Path Parameters - `rate` (Float) - The interest rate per period. - `nper` (Integer) - The total number of payment periods. - `pv` (Float) - The present value, or the total amount that a series of future payments is worth right now. - `fv` (Float, optional) - The future value, or a cash balance you want to attain after the last payment is made. Defaults to 0. ### Request Example ```ruby Exonio.pmt(0.075 / 12, 12 * 15, 200_000) # ==> -1854.0247200054619 ``` ``` -------------------------------- ### RATE Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the interest rate per period of an annuity. ```APIDOC ## RATE ### Description Calculates the interest rate per period of an annuity. An annuity is a series of equal cash payments made at equal intervals. ### Method `Exonio.rate(nper, pmt, pv, fv = 0)` ### Parameters #### Path Parameters - `nper` (Integer) - The total number of payment periods. - `pmt` (Float) - The payment made each period. It is negative for cash outflow. - `pv` (Float) - The present value, or the total amount that a series of future payments is worth right now. - `fv` (Float, optional) - The future value, or a cash balance you want to attain after the last payment is made. Defaults to 0. ### Request Example ```ruby Exonio.rate(12 * 3, 2_500, -50_000) # ==> 0.036006853458478955 ``` ``` -------------------------------- ### PV Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the present value of an investment based on periodic, constant payments and a constant interest rate. ```APIDOC ## PV ### Description Calculates the present value of an investment based on periodic, constant payments and a constant interest rate. The present value is the current value of a future sum of money or stream of cash flows given a specified rate of return. ### Method `Exonio.pv(rate, nper, pmt, fv = 0)` ### Parameters #### Path Parameters - `rate` (Float) - The interest rate per period. - `nper` (Integer) - The total number of payment periods. - `pmt` (Float) - The payment made each period. It is negative for cash outflow. - `fv` (Float, optional) - The future value, or a cash balance you want to attain after the last payment is made. Defaults to 0. ### Request Example ```ruby Exonio.pv(0.05 / 12, 12 * 10, -100, 20_000) # ==> -2715.0857731569663 ``` ``` -------------------------------- ### FV Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the future value of an investment based on periodic, constant payments and a constant interest rate. ```APIDOC ## FV ### Description Calculates the future value of an investment based on periodic, constant payments and a constant interest rate. By convention, a negative sign represents cash flow out. ### Method `Exonio.fv(rate, nper, pmt, pv = 0)` ### Parameters #### Path Parameters - `rate` (Float) - The interest rate per period. - `nper` (Integer) - The total number of payment periods. - `pmt` (Float) - The payment made each period. It is negative for cash outflow. - `pv` (Float, optional) - The present value, or the lump-sum amount that a series of future payments is worth right now. Defaults to 0. ### Request Example ```ruby Exonio.fv(0.05 / 12, 10 * 12, -100, -100) # ==> 15692.928894335748 ``` ``` -------------------------------- ### NPV Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the Net Present Value of an investment based on a discount rate and a series of future payments. ```APIDOC ## NPV ### Description Calculates the Net Present Value of an investment based on a discount rate and a series of future payments. The NPV is the current value of a future sum of money or stream of cash flows given a specified rate of return. ### Method `Exonio.npv(rate, values)` ### Parameters #### Path Parameters - `rate` (Float) - The discount rate over the length of the evaluation period. - `values` (Array of Floats) - An array of the payments in the future and at the end of the first period. The first element of `values` is the cash flow for the first period, the second element is the cash flow for the second period, and so on. ### Request Example ```ruby Exonio.npv(0.281, [-100, 39, 59, 55, 29]) # ==> -0.00661872883563408 ``` ``` -------------------------------- ### Sum Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the sum of all numbers in an array. ```APIDOC ## Sum ### Description Calculates the sum of all numbers in an array. ### Method `Exonio.sum(numbers)` ### Parameters #### Path Parameters - `numbers` (Array of Numeric) - An array of numbers to sum. ### Request Example ```ruby Exonio.sum([1, 2, 3, 4, 5]) # ==> 15 ``` ``` -------------------------------- ### NOMINAL Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the nominal interest rate given an effective annual interest rate and compounding periods per year. ```APIDOC ## NOMINAL ### Description The Excel NOMINAL function returns the nominal interest rate when given an effective annual interest rate and the number of compounding periods per year. The effective rate is the actual rate due to compounding. The nominal rate is typically the stated rate. ### Method `Exonio.nominal(rate, npery)` ### Parameters #### Path Parameters - `rate` (Float) - The effective annual interest rate. - `npery` (Integer) - The number of compounding periods per year. ### Request Example ```ruby Exonio.nominal(0.05, 12 / 6) # ==> 0.04939015319191986 ``` ``` -------------------------------- ### IPMT Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the interest portion of a payment for a given period. ```APIDOC ## IPMT ### Description Calculates the interest portion of a payment for a given period for an investment over a certain number of periods at a specific interest rate. ### Method `Exonio.ipmt(rate, per, nper, pv, fv = 0)` ### Parameters #### Path Parameters - `rate` (Float) - The interest rate per period. - `per` (Integer) - The payment period for which you want to find the interest. Must be between 1 and `nper`. - `nper` (Integer) - The total number of payment periods. - `pv` (Float) - The present value, or the total amount that a series of future payments is worth right now. - `fv` (Float, optional) - The future value, or a cash balance you want to attain after the last payment is made. Defaults to 0. ### Request Example ```ruby Exonio.ipmt(0.075 / 12, 8, 12 * 2, 5_000.00) # ==> -22.612926783996798 ``` ``` -------------------------------- ### IRR Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the internal rate of return for a series of cash flows. ```APIDOC ## IRR ### Description Calculates the internal rate of return for a series of cash flows occurring at regular intervals. The internal rate of return is the discount rate at which the net present value of all the cash flows (both positive and negative) from a particular project or investment equals zero. ### Method `Exonio.irr(values)` ### Parameters #### Path Parameters - `values` (Array of Floats) - An array of cash flows. The first value is the initial investment (negative) and subsequent values are cash flows at regular intervals. ### Request Example ```ruby Exonio.irr([-100, 39, 59, 55, 20]) # ==> 0.28095 ``` ``` -------------------------------- ### EFFECT Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the effective annual interest rate given a nominal rate and compounding periods per year. ```APIDOC ## EFFECT ### Description The Excel EFFECT function returns the effective annual interest rate, given a nominal interest rate and the number of compounding periods per year. The effective rate is the interest rate actually earned due to compounding. ### Method `Exonio.effect(rate, npery)` ### Parameters #### Path Parameters - `rate` (Float) - The nominal annual interest rate. - `npery` (Integer) - The number of compounding periods per year. ### Request Example ```ruby Exonio.effect(0.05, 10 * 12) # ==> 0.05126014873337037 ``` ``` -------------------------------- ### Mean Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the arithmetic mean (average) of numbers in an array. ```APIDOC ## Mean ### Description Calculates the arithmetic mean (average) of numbers in an array. ### Method `Exonio.mean(numbers)` ### Parameters #### Path Parameters - `numbers` (Array of Numeric) - An array of numbers to calculate the mean from. ### Request Example ```ruby Exonio.mean([1, 2, 3, 4, 5]) # ==> 3.0 ``` ``` -------------------------------- ### Median Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the median (middle value) of numbers in an array. ```APIDOC ## Median ### Description Calculates the median (middle value) of numbers in an array. If the array has an even number of elements, the median is the average of the two middle elements. ### Method `Exonio.median(numbers)` ### Parameters #### Path Parameters - `numbers` (Array of Numeric) - An array of numbers to calculate the median from. ### Request Example ```ruby Exonio.median([1, 2, 3, 6, 5, 4]) # ==> 3.5 ``` ``` -------------------------------- ### NPER Source: https://github.com/noverde/exonio/blob/main/README.md Calculates the number of periods required to pay off a loan or reach a desired future value. ```APIDOC ## NPER ### Description Calculates the number of periods required to pay off a loan or reach a desired future value given periodic, constant payments and a constant interest rate. ### Method `Exonio.nper(rate, pmt, pv, fv = 0)` ### Parameters #### Path Parameters - `rate` (Float) - The interest rate per period. - `pmt` (Float) - The payment made each period. It is negative for cash outflow. - `pv` (Float) - The present value, or the total amount that a series of future payments is worth right now. - `fv` (Float, optional) - The future value, or a cash balance you want to attain after the last payment is made. Defaults to 0. ### Request Example ```ruby Exonio.nper(0.07 / 12, -150, 8000) # ==> 64.07334877066185 ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.