{"id":25722695,"url":"https://github.com/nolantait/bankroll","last_synced_at":"2026-06-12T06:02:18.019Z","repository":{"id":59150963,"uuid":"456959368","full_name":"nolantait/bankroll","owner":"nolantait","description":"A ruby library for calculating the time value of money with ordinary fixed annuities like mortgages","archived":false,"fork":false,"pushed_at":"2022-03-02T03:57:49.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-28T20:32:57.815Z","etag":null,"topics":["finance","mortgage","mortgage-calculator","mortgages","ruby","time-value-of-money"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nolantait.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-08T14:09:14.000Z","updated_at":"2024-05-26T03:35:29.000Z","dependencies_parsed_at":"2022-09-13T10:50:19.819Z","dependency_job_id":null,"html_url":"https://github.com/nolantait/bankroll","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nolantait/bankroll","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nolantait%2Fbankroll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nolantait%2Fbankroll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nolantait%2Fbankroll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nolantait%2Fbankroll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nolantait","download_url":"https://codeload.github.com/nolantait/bankroll/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nolantait%2Fbankroll/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34043822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["finance","mortgage","mortgage-calculator","mortgages","ruby","time-value-of-money"],"created_at":"2025-02-25T19:39:36.510Z","updated_at":"2026-06-12T06:02:17.997Z","avatar_url":"https://github.com/nolantait.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bankroll\n\nBankroll is a set of financial calculations for mortgages and loans.\n\nThe goal of this library is to make time value of money calculations\nunderstandable and decomposed into well written functions.\n\nI find most financial math libraries to be somewhat opaque so hopefully\nthis helps when learning how to calculate mortgages and other annuity based\ninvestments.\n\nFeatures:\n- Uses safe math with BigDecimal through the Bankroll::Decimal api\n- Handles only ordinary annuities (annuities due at the END of the period)\n- Implements most excel functions using some inspiration from Exonio gem\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'bankroll'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install bankroll\n\n## Usage\n\n```ruby\n\n# What is the monthly payment?\npayment = Bankroll.payment(\n  periods: 360, \n  interest_rate: 0.01 / 12.0,\n  present_value: 1_000_000\n).round\nputs payment #=\u003e Bankroll::Decimal[\"3_216.40\"]\n\n# What was the original loan amount?\noriginal_amount = Bankroll.present_value(\n  periods: 360, # 30 years\n  monthly_payment: 3_216.40, \n  interest_rate: 0.01 / 12.0, # 1% APR\n).round\n\nputs original_amount #=\u003e Bankroll::Decimal[\"1_000_001.49\"]\n\n# What does the balance look like after a single mortgage payment?\nunpaid_balance = Bankroll.unpaid_balance(\n  present_value: 1_000_000,\n  interest_rate: 0.01 / 12.0,\n  periods: 360,\n  period: 1,\n  payment: 3_216.40\n).round\n\nputs unpaid_balance #=\u003e Bankroll::Decimal[\"997_616.94\"]\n\n# What was the interest rate?\ninterest_rate = Bankroll.interest_rate(\n  present_value: 1_000_000,\n  periods: 360,\n  payment: -3_216.40,\n).round(3)\n\nputs interest_rate #=\u003e Bankroll::Decimal[\"0.833e-3\"]\n\n# What is the annuity factor of a rate for n periods?\nannuity_factor = Bankroll.annuity_factor(\n  interest_rate: 0.01,\n  periods: 2\n).round(4)\n\nputs annuity_factor #=\u003e Bankroll::Decimal[\"1.9704\"]\n\n# What is the total interest paid on a 500_000 1% mortgage\ninterest_paid = Bankroll.cumulative_interest(\n  periods: 360,\n  interest_rate: 0.01 / 12.0,\n  payment: 1_608.20,\n  present_value: 500_000\n).round\n\nputs interest_paid #=\u003e Bankroll::Decimal[\"832.34\"]\n\n# What is the total cost of a 500_000 1% loan with interest?\ntotal_amount = Bankroll.future_value(\n  present_value: 0,\n  interest_rate: 0.01 / 12.0,\n  periods: 360,\n  payment: 1_608.20\n).round\n\nputs total_amount #=\u003e Bankroll::Decimal[\"647_846.10\"]\n\n# What is the interest payment on the 17th period of a $165,000 3% mortgage?\ninterest_payment = Bankroll.interest_payment(\n  interest_rate: 0.03 / 12.0,\n  periods: 360,\n  period: 17,\n  present_value: 165_000\n).round\n\nputs interest_payment #=\u003e Bankroll::Decimal[\"400.96\"]\n\n# How many periods until a -$1000 account with -$100/month reaches $10_000 with\n# 12% interest rate?\ntotal_periods = Bankroll.total_periods(\n  interest_rate: 0.12 / 12.0,\n  payment: -100,\n  present_value: -1_000,\n  future_value: 10_000\n)\n\nputs total_periods #=\u003e Bankroll::Decimal[\"59.67\"]\n\n# What is the amortization schedule of a $165_000 3% 30 year mortgage?\namortization_schedule = Bankroll.amortization_schedule(\n  present_value: 165_000,\n  interest_rate: 0.03 / 12.0,\n  periods: 360\n)\n\nputs amortization_schedule.payments #=\u003e [\n#   Bankroll::AmortizationSchedule::Payment.new(\n#     payment: Bankroll::Decimal[\"695.65\"],\n#     principal: Bankroll::Decimal[\"283.15\"],\n#     interest: Bankroll::Decimal[\"412.50\"],\n#     total_interest: Bankroll::Decimal[\"412.50\"],\n#     balance: Bankroll::Decimal[\"164_716.85\"]\n#   )\n#   ... and 359 more payments\n# ]\n\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. \nThen, run `rake spec` to run the tests. You can also run `bin/console` for an \ninteractive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. \nTo release a new version, update the version number in `version.rb`, and then \nrun `bundle exec rake release`, which will create a git tag for the version, \npush git commits and the created tag, and push the `.gem` file \nto [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/nolantait/bankroll.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnolantait%2Fbankroll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnolantait%2Fbankroll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnolantait%2Fbankroll/lists"}