Financial Math
A set of financial equations.
This library provides a set of financial equations. This library is based on the book titled:
Matemáticas financieras
El valor del dinero en el tiempo
by Zbigniew Kozikowski Zarska
Installation
Add this line to your application's Gemfile:
gem 'financial_math'
And then execute:
$ bundle
Or install it yourself as:
$ gem install financial_math
## Content
This cover the next topics in financial math:
- Geometric Progression
- Arithemetic Progression
- Simple Interest
- Compound Interest
More content will be added, soon, like:
- Annuities
- Valuation
- Amortization
- Stock market math
Usage
To calculate the last item of a geometric progression:
progression = FinancialMath::GeometricProgression.new(initial_value: 1100, ratio: 1.1, times: 5)
progression.last_item
To calculate the future value:
class Accountant
include FinancialMath::SimpleInterest
end
accountant = Accountant.new
accountant.future_value(present_value: 100_000.0, interest_rate: 0.05, periods: 3)
The interest rate must be in terms of years, if your problem is expressed in terms of days or months, provide the frequency of conversion and the periods in terms of days.
class Accountant
include FinancialMath::SimpleInterest
end
accountant = Accountant.new
accountant.future_value(present_value: 1500.0, interest_rate: 0.45, periods: 3, frequency: 360)
Available simple interest formulas

Available compound interest formulas

Development
If want test this gem without clone this repo, type:
$ gem install financial_math --dev
This command will get the development dependencies installed too.
Release History
- 1.0.3
- FIX: Fix bad release
- 1.0.2
- ADD: Add version badge and fix some typos in README
- 1.0.1
- FIX: Fix bad release
- 1.0.0
- CHANGE: Remove
SimpleInterest() - CHANGE: Remove
CompoundInterest() - ADD: Add
CompoundInterestsub-modules - ADD: Add
SimpleInterestsub-modules
- CHANGE: Remove
- 0.7.0
- ADD: Add
present_value,continous_present_valuetoCompoundInterestas public methods - ADD: Add
internal_rate_of_return,real_rate_of_returnanda_good_investment?toCompoundInterestas public methods
- ADD: Add
- 0.6.0
- ADD: Add
@frequencytoSimpleInterestclass - CHANGE: Change the
periods_in_daysmehtod tofactorinSimpleInterest
- ADD: Add
- 0.5.0
- ADD: Add
average_growth_rateandcontinous_future_valuepublic methods toCompoundInterestclass
- ADD: Add
- 0.4.1
- CHANGE: Update docs (module code remains unchanged)
- 0.4.0
- ADD: Add
CompoundInterestclass
- ADD: Add
- 0.3.1
- CHANGE: Update docs (module code remains unchanged)
- 0.3.0
- ADD: Add
SimpleInterestclass
- ADD: Add
- 0.3.0
- ADD: Add
GEometricProgressionclass
- ADD: Add
- 0.2.0
- ADD: Add
ArithemeticProgressionclass
- ADD: Add
- 0.1.0
- The first proper release
- ADD: The basic file with basic equations
- 0.0.1
- Work in progress
Meta
Daniel Omar Vergara Pérez – @dan1_net – [email protected]
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/dany2691/financial_math. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
Contributing
- Fork it (https://github.com/dany2691/financial_math/fork)
- Create your feature branch (
git checkout -b feature/fooBar) - Commit your changes (
git commit -am 'Add some fooBar') - Push to the branch (
git push origin feature/fooBar) - Create a new Pull Request
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the FinancialMath project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.