{"id":18053959,"url":"https://github.com/danielstern/financejs","last_synced_at":"2026-01-19T16:33:10.808Z","repository":{"id":27569811,"uuid":"31052145","full_name":"danielstern/financejs","owner":"danielstern","description":"A library for calculating things","archived":false,"fork":false,"pushed_at":"2016-11-20T20:03:01.000Z","size":781,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T08:26:35.931Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielstern.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-20T05:19:57.000Z","updated_at":"2019-07-15T21:34:37.000Z","dependencies_parsed_at":"2022-09-02T11:23:39.327Z","dependency_job_id":null,"html_url":"https://github.com/danielstern/financejs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/danielstern/financejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstern%2Ffinancejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstern%2Ffinancejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstern%2Ffinancejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstern%2Ffinancejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielstern","download_url":"https://codeload.github.com/danielstern/financejs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielstern%2Ffinancejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28574401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T16:29:19.148Z","status":"ssl_error","status_checked_at":"2026-01-19T16:29:17.772Z","response_time":67,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-10-31T00:08:39.706Z","updated_at":"2026-01-19T16:33:10.780Z","avatar_url":"https://github.com/danielstern.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# financejs ($$$)\nfinance.js *(`$$$`)*is a powerful javascript library that specializes in amortization.\n\n## See it an action: http://danielstern.ca/mortgage2\n\nusing the amortize function, you can gain very powerful insights into a mortgage. \n\n- call `balances()` to get an array of the balance sheets at every period in the term\n- define functions for interest and expenses for powerful customization\n- calculate income, expenses and deductions for every period\n- awesome syntax\n\n### dependencies\nnone\n\n## `amortize`\nGet an amortization with handy-D3 like syntax and D3 compatible output.\n\nExample:\n\n```javascript\nvar mortgage = $$$.amortize(136900)\n.interest(function(d,i){\n\tvar interest = 0.04 + ((i / 12 /  8) * 0.01);\n\treturn interest;\n})\n.down('20%')\n.period('25y')\n.income('rent',function(d,i){\n\treturn 1100 + i * 3;\n})\n.expense('maintenance',400.75)\n.expense('property tax',1200 / 12)\n.expense('improvements', 1000 / 12)\n.expense('down payment interest', function(d,i){\n\treturn d.down() * 0.068 / 12;\n})\n.expense('insurance', function(d,i){\n\treturn d.principal() * 0.005 / 12;\n})\n.depreciation('4%')\n.expense('property management',function(d,i){\n\treturn d.income('rent').value(d,i) * 0.8;\n})\n.income('parking',120)\n.taxrate(0.37)\n\nmortgage.balances(); // [Array(240)]\n\nmortgage.balances()[150]\n{\t\n\tP: 70359.36, // amount owing\n\tequity: 66540.63, // amount you own\n\tinterest_paid: 327.663, // interest paid this period \n\tinterest_rate: 0.055, // interest rate this period (calculated)\n\tequity_paid: 327.29, // equity paid this period\n\tcap_rate: 0.0208, // return on the value of property (annualized)\n\tdeductions_from_depreciation: 168.84, // the amount of taxes credits available from depreciation\n\tdeductions_from_expenses: 753.42,\n\tdepreciation: 456.33, // how much the value of the house depreciated\n\texpenses: 2036.278, // total expenses this month\n\texpenses_calculated: Array[6], // an array of details on the calculated expenses\n\tincome: 1670, // total inocome this month\n\tincomes_calculated: Array[2], // // an array of details on the calculated incomes\n\tnet_after_deductions: 228.32, // income this month after deducting expenses and depreciation from taxes\n\tnet_before_deductions: -693.94, // gross income minus expenses\n\tpayment: 654.95, // how much is due this month in the mortgage\n\tperiod: 150, // what period (month) it is, relative to the first payment at 0\n\troi: 0.0343 // return on your equity (annualized)\n}\n```\n      \n### Use with D3\n\n```javascript\nd3\n\t.select('svg')\n\t.data($$$.amortize(100000).balances())\n\t.enter(); //sweet!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielstern%2Ffinancejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielstern%2Ffinancejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielstern%2Ffinancejs/lists"}