{"id":16105068,"url":"https://github.com/intgr/pg_financial","last_synced_at":"2025-03-18T08:31:35.743Z","repository":{"id":21590810,"uuid":"24910882","full_name":"intgr/pg_financial","owner":"intgr","description":"PostgreSQL extension with functions and aggregates for financial calculations","archived":false,"fork":false,"pushed_at":"2023-06-18T15:13:35.000Z","size":28,"stargazers_count":24,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-16T18:21:19.302Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"postgresql","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intgr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-07T20:48:01.000Z","updated_at":"2025-02-09T19:50:48.000Z","dependencies_parsed_at":"2024-10-27T17:27:09.184Z","dependency_job_id":"66e7dd26-b094-4b59-af94-84864b4ee8d1","html_url":"https://github.com/intgr/pg_financial","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intgr%2Fpg_financial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intgr%2Fpg_financial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intgr%2Fpg_financial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intgr%2Fpg_financial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intgr","download_url":"https://codeload.github.com/intgr/pg_financial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244184104,"owners_count":20412154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-09T19:08:20.319Z","updated_at":"2025-03-18T08:31:35.322Z","avatar_url":"https://github.com/intgr.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"PostgreSQL Financial Extension\n==============================\n[![PGXN version](https://badge.fury.io/pg/financial.svg)](https://badge.fury.io/pg/financial)\n[![Tests status](https://github.com/intgr/pg_financial/workflows/Tests/badge.svg?branch=master)](https://github.com/intgr/pg_financial/actions?query=workflow:Tests)\n\nThis is a PostgreSQL extension for financial calculations.\n\nFunctions provided:\n\n* `xirr(amounts, dates [, guess])` - Irregular Internal Rate of Return.\n  Aggregate function, much like XIRR in spreadsheet programs (Excel,\n  LibreOffice, etc).\n\n\nInstallation\n------------\n\n`pg_financial` is tested with PostgreSQL versions from 10 to 15.\n\nTo build and install this extension, simply run:\n\n    % make\n    % sudo make install\n\nThen, to activate this extension in your database, run the SQL:\n\n    CREATE EXTENSION financial;\n\nIf you run into problems with building, see [PostgreSQL wiki for\ntroubleshooting](https://wiki.postgresql.org/wiki/Extension_build_troubleshooting)\n\n\n`xirr` aggregate function\n-------------------------\n\nThe basic form of the XIRR function is: `xirr(amounts, dates [, guess])`\n\nSince XIRR is fundamentally an imprecise function, `amounts` is of type float8\n(double precision). `dates` is timestamp with time zone.\n\nFor example, if table `transaction` has columns `amount` and `time`, do this:\n\n    db=# SELECT xirr(amount, time ORDER BY time) FROM transaction;\n            xirr        \n    --------------------\n     0.0176201237088334\n\nThe `guess` argument (also float8) is an optional initial guess. When omitted,\nthe function will use annualized return as the guess, which is usually\nreliable. Excel and LibreOffice, however, use a guess of 0.1 by default:\n\n    SELECT xirr(amount, time, 0.1 ORDER BY time) FROM transaction;\n\nLike any aggregate function, you can use `xirr` with GROUP BY or as a window\nfunction, e.g:\n\n    SELECT portfolio, xirr(amount, time ORDER BY time)\n        FROM transaction GROUP BY portfolio;\n\n    SELECT xirr(amount, time) OVER (ORDER BY time)\n        FROM transaction;\n\nThere are situations where XIRR (Newton's method) fails to arrive at a result.\nIn these cases, the function returns NULL. Sometimes providing a better guess\nhelps, but some inputs are simply indeterminate.\n\nBecause XIRR needs to do multiple passes over input data, all inputs to the\naggregate function are held in memory (16 bytes per row). Beware that this can\ncause the server to run out of memory with extremely large data sets.\n\nChangelog\n---------\n\nUnreleased (2023):\n\n* Migrate from Travis to GitHub Actions CI\n* Run CI tests with PostgreSQL versions 10 ... 15\n  (no code changes were necessary)\n\n1.0.1 (2015-06-18)\n\n* Fix read of uninitialized data\n* Implemented continuous integration via Travis-CI\n* Minor tweaks to documentation and code\n\n1.0.0 (2014-09-18)\n\n* First stable release, fixes two Makefile issues\n\n0.0.2 (2013-06-05)\n\n* First release, contains `xirr` aggregate function\n\nCopyright and License\n---------------------\n\nCopyright (c) 2013-2023 Marti Raudsepp \u003cmarti@juffo.org\u003e\n\npg\\_financial and all related files are available under [The PostgreSQL\nLicense](http://www.opensource.org/licenses/PostgreSQL). See LICENSE file for\ndetails.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintgr%2Fpg_financial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintgr%2Fpg_financial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintgr%2Fpg_financial/lists"}