financepy


Namefinancepy JSON
Version 0.310 PyPI version JSON
download
home_pagehttps://github.com/domokane/FinancePy
SummaryA Finance Securities Valuation Library
upload_time2023-08-25 14:17:37
maintainer
docs_urlNone
authorDominic O'Kane
requires_python>=3.6
license
keywords finance options bonds valuation derivatives
VCS
bugtrack_url
requirements numba numpy scipy llvmlite ipython matplotlib pandas prettytable
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Latest News and Versions
24 August 2023 - Version 0.31 released

Schedule 
- Corrected bug in schedule generation
- Corrected bug in CDS protection leg integral
Bond Classes have been amended
- Changed full price to dirty price in functions UPDATE YOUR CODE PLEASE
- Removed face amount from bond class - how much you buy is not intrinsic to a bond
- Made number of ex-dividend days a member of bond class
- Revised acccrued and principal functions to take face amount as input

29 May 2023 - Version 0.30 released
- Added PrettyPrint to required dependencies

22 Nov 22
Version 0.260 has been released and pushed to PyPI
- Create Date from python datetime
- Zero coupon bond class
- Fixed bug in bond payment date

31-Aug-2022
Version 0.240 has just been released and pushed to PyPI with changes
- Negative terms in date class
- Recovery rates do not default to standard value for CDS curves 

# DISCLAIMER

This software is distributed FREE AND WITHOUT ANY WARRANTY. 

Report any bugs or suggestions here as an issue. 

# CONTRIBUTORS WANTED !

If you have a knowledge of Quantitative Finance and a reasonable knowledge of Python, then please consider contributing to this project. There are small tasks and big tasks to be done. Just look in the list of Issues and you may find something you can do. Before you begin, please comment in the issue thread in case someone else may be working on that issue. Or you can contact me directly at dominic.okane at edhec.edu. 

If you are a user and require some additional functionality, then please add it as an issue.

# Quick Start Guide

FinancePy can be installed from pip using the following command:

`pip install financepy`

To upgrade an existing installation type:

`pip install --upgrade financepy`

I have encountered problems using Anaconda3-2020.07 due to some Numba and LLVMLite problems. However Anaconda3-2020.02 works.

## Using FinancePy in a Jupyter Notebook

Once financepy has been installed, it is easy to get started.

Just download the project and examine the set of Jupyter Notebooks in the notebooks folder.

A pdf manual describing all of the functions can be found in the project directory.

## Overview

FinancePy is a python-based library that is currently in beta version. It covers the following functionality:

* Valuation and risk models for a wide range of equity, FX, interest rate and credit derivatives.

Although it is written entirely in Python, it can achieve speeds comparable to C++ by using Numba. As a result the user has both the ability to examine the underlying code and the ability to perform pricing and risk at speeds which compare to a library written in C++.

The target audience for this library includes:

* Students of finance and students of python
* Academics teaching finance or conducting research into finance
* Traders wishing to price or risk-manage a derivative.
* Quantitative analysts seeking to price or reverse engineer a price.
* Risk managers wishing to replicate and understand price sensitivity.
* Portfolio managers wishing to check prices or calculate risk measures.
* Fund managers wanting to value a portfolio or examine a trading strategy.

Users should have a good, but not advanced, understanding of Python. In terms of Python, the style of the library has been determined subject to the following criteria:

1. To make the code as simple as possible so that those with a basic Python fluency can understand and check the code.
2. To keep all the code in Python so users can look through the code to the lowest level.
3. To offset the performance impact of (2) by leveraging Numba to make the code as fast as possible without resorting to Cython.
4. To make the design product-based rather than model-based so someone wanting to price a specific product can easily find that without having to worry too much about the model – just use the default – unless they want to. For most products, a Monte-Carlo implementation has been provided both as a reference for testing and as a way to better understand how the product functions in terms of payments, their timings and conditions.
5. To make the library as complete as possible so a user can find all their required finance-related functionality in one place. This is better for the user as they only have to learn one interface.
6. To avoid complex designs. Limited inheritance unless it allows for significant code reuse. Some code duplication is OK, at least temporarily.
7. To have good documentation and easy-to-follow examples.
8. To make it easy for interested parties to contribute.

In many cases the valuations should be close to if not identical to those produced by financial systems such as Bloomberg. However for some products, larger value differences may arise due to differences in date generation and interpolation schemes. Over time it is hoped to reduce the size of such differences.

Important Note:

* IF YOU HAVE ANY PRICING OR RISK EXAMPLES YOU WOULD LIKE REPLICATED, SEND SCREENSHOTS OF ALL THE UNDERLYING DATA, MODEL DETAILS AND VALUATION.
* IF THERE IS A PRODUCT YOU WOULD LIKE TO HAVE ADDED, SEND ME THE REQUEST.
* IF THERE IS FUNCTIONALITY YOU WOULD LIKE ADDED, SEND ME A REQUEST.

## The Library Design

The underlying Python library is split into a number of major modules:

* Utils - These are utility functions used to assist you with modelling a security. These include dates (Date), calendars, schedule generation, some finance-related mathematics functions and some helper functions.
* Market - These are modules that capture the market information used to value a security. These include interest rate and credit curves, volatility surfaces and prices.
* Models - These are the low-level models used to value derivative securities ranging from Black-Scholes to complex stochastic volatility models.
* Products - These are the actual securities and range from Government bonds to Bermudan swaptions.

Any product valuation is the result of the following data design:

**VALUATION** = **PRODUCT** + **MODEL** + **MARKET**

The interface to each product has a value() function that will take a model and market to produce a price.

## Author

Dominic O'Kane. I am a Professor of Finance at the EDHEC Business School in Nice, France. I have 12 years of industry experience and over 15 years of academic experience.

Contact me at dominic.okane at edhec.edu.

## Dependencies

FinancePy depends on Numpy, Numba, Scipy and basic python libraries such as os, sys and datetime.

## Changelog

See the changelog for a detailed history of changes.

## Contributions

Contributions are very welcome. There are a number of requirements:

* The code should be Pep8 compliant.
* Comments are required for every class and function and they should be a clear description.
* At least one broad test case and a set of unit tests must be provided for every function.
* Avoid very pythonic constructions. For example a loop is as good as a list comprehension. And with numba it can be faster. Readability is the priority.

## License

 GPL-3.0 License - See the license file in this folder for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/domokane/FinancePy",
    "name": "financepy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "FINANCE,OPTIONS,BONDS,VALUATION,DERIVATIVES",
    "author": "Dominic O'Kane",
    "author_email": "dominic.okane@edhec.edu",
    "download_url": "https://files.pythonhosted.org/packages/62/2c/4a78556418154bf718efa57f941b4c99fe1418d3f14f29c3bb6cab1ad6d5/financepy-0.310.tar.gz",
    "platform": null,
    "description": "# Latest News and Versions\r\n24 August 2023 - Version 0.31 released\r\n\r\nSchedule \r\n- Corrected bug in schedule generation\r\n- Corrected bug in CDS protection leg integral\r\nBond Classes have been amended\r\n- Changed full price to dirty price in functions UPDATE YOUR CODE PLEASE\r\n- Removed face amount from bond class - how much you buy is not intrinsic to a bond\r\n- Made number of ex-dividend days a member of bond class\r\n- Revised acccrued and principal functions to take face amount as input\r\n\r\n29 May 2023 - Version 0.30 released\r\n- Added PrettyPrint to required dependencies\r\n\r\n22 Nov 22\r\nVersion 0.260 has been released and pushed to PyPI\r\n- Create Date from python datetime\r\n- Zero coupon bond class\r\n- Fixed bug in bond payment date\r\n\r\n31-Aug-2022\r\nVersion 0.240 has just been released and pushed to PyPI with changes\r\n- Negative terms in date class\r\n- Recovery rates do not default to standard value for CDS curves \r\n\r\n# DISCLAIMER\r\n\r\nThis software is distributed FREE AND WITHOUT ANY WARRANTY. \r\n\r\nReport any bugs or suggestions here as an issue. \r\n\r\n# CONTRIBUTORS WANTED !\r\n\r\nIf you have a knowledge of Quantitative Finance and a reasonable knowledge of Python, then please consider contributing to this project. There are small tasks and big tasks to be done. Just look in the list of Issues and you may find something you can do. Before you begin, please comment in the issue thread in case someone else may be working on that issue. Or you can contact me directly at dominic.okane at edhec.edu. \r\n\r\nIf you are a user and require some additional functionality, then please add it as an issue.\r\n\r\n# Quick Start Guide\r\n\r\nFinancePy can be installed from pip using the following command:\r\n\r\n`pip install financepy`\r\n\r\nTo upgrade an existing installation type:\r\n\r\n`pip install --upgrade financepy`\r\n\r\nI have encountered problems using Anaconda3-2020.07 due to some Numba and LLVMLite problems. However Anaconda3-2020.02 works.\r\n\r\n## Using FinancePy in a Jupyter Notebook\r\n\r\nOnce financepy has been installed, it is easy to get started.\r\n\r\nJust download the project and examine the set of Jupyter Notebooks in the notebooks folder.\r\n\r\nA pdf manual describing all of the functions can be found in the project directory.\r\n\r\n## Overview\r\n\r\nFinancePy is a python-based library that is currently in beta version. It covers the following functionality:\r\n\r\n* Valuation and risk models for a wide range of equity, FX, interest rate and credit derivatives.\r\n\r\nAlthough it is written entirely in Python, it can achieve speeds comparable to C++ by using Numba. As a result the user has both the ability to examine the underlying code and the ability to perform pricing and risk at speeds which compare to a library written in C++.\r\n\r\nThe target audience for this library includes:\r\n\r\n* Students of finance and students of python\r\n* Academics teaching finance or conducting research into finance\r\n* Traders wishing to price or risk-manage a derivative.\r\n* Quantitative analysts seeking to price or reverse engineer a price.\r\n* Risk managers wishing to replicate and understand price sensitivity.\r\n* Portfolio managers wishing to check prices or calculate risk measures.\r\n* Fund managers wanting to value a portfolio or examine a trading strategy.\r\n\r\nUsers should have a good, but not advanced, understanding of Python. In terms of Python, the style of the library has been determined subject to the following criteria:\r\n\r\n1. To make the code as simple as possible so that those with a basic Python fluency can understand and check the code.\r\n2. To keep all the code in Python so users can look through the code to the lowest level.\r\n3. To offset the performance impact of (2) by leveraging Numba to make the code as fast as possible without resorting to Cython.\r\n4. To make the design product-based rather than model-based so someone wanting to price a specific product can easily find that without having to worry too much about the model \u00e2\u20ac\u201c just use the default \u00e2\u20ac\u201c unless they want to. For most products, a Monte-Carlo implementation has been provided both as a reference for testing and as a way to better understand how the product functions in terms of payments, their timings and conditions.\r\n5. To make the library as complete as possible so a user can find all their required finance-related functionality in one place. This is better for the user as they only have to learn one interface.\r\n6. To avoid complex designs. Limited inheritance unless it allows for significant code reuse. Some code duplication is OK, at least temporarily.\r\n7. To have good documentation and easy-to-follow examples.\r\n8. To make it easy for interested parties to contribute.\r\n\r\nIn many cases the valuations should be close to if not identical to those produced by financial systems such as Bloomberg. However for some products, larger value differences may arise due to differences in date generation and interpolation schemes. Over time it is hoped to reduce the size of such differences.\r\n\r\nImportant Note:\r\n\r\n* IF YOU HAVE ANY PRICING OR RISK EXAMPLES YOU WOULD LIKE REPLICATED, SEND SCREENSHOTS OF ALL THE UNDERLYING DATA, MODEL DETAILS AND VALUATION.\r\n* IF THERE IS A PRODUCT YOU WOULD LIKE TO HAVE ADDED, SEND ME THE REQUEST.\r\n* IF THERE IS FUNCTIONALITY YOU WOULD LIKE ADDED, SEND ME A REQUEST.\r\n\r\n## The Library Design\r\n\r\nThe underlying Python library is split into a number of major modules:\r\n\r\n* Utils - These are utility functions used to assist you with modelling a security. These include dates (Date), calendars, schedule generation, some finance-related mathematics functions and some helper functions.\r\n* Market - These are modules that capture the market information used to value a security. These include interest rate and credit curves, volatility surfaces and prices.\r\n* Models - These are the low-level models used to value derivative securities ranging from Black-Scholes to complex stochastic volatility models.\r\n* Products - These are the actual securities and range from Government bonds to Bermudan swaptions.\r\n\r\nAny product valuation is the result of the following data design:\r\n\r\n**VALUATION** = **PRODUCT** + **MODEL** + **MARKET**\r\n\r\nThe interface to each product has a value() function that will take a model and market to produce a price.\r\n\r\n## Author\r\n\r\nDominic O'Kane. I am a Professor of Finance at the EDHEC Business School in Nice, France. I have 12 years of industry experience and over 15 years of academic experience.\r\n\r\nContact me at dominic.okane at edhec.edu.\r\n\r\n## Dependencies\r\n\r\nFinancePy depends on Numpy, Numba, Scipy and basic python libraries such as os, sys and datetime.\r\n\r\n## Changelog\r\n\r\nSee the changelog for a detailed history of changes.\r\n\r\n## Contributions\r\n\r\nContributions are very welcome. There are a number of requirements:\r\n\r\n* The code should be Pep8 compliant.\r\n* Comments are required for every class and function and they should be a clear description.\r\n* At least one broad test case and a set of unit tests must be provided for every function.\r\n* Avoid very pythonic constructions. For example a loop is as good as a list comprehension. And with numba it can be faster. Readability is the priority.\r\n\r\n## License\r\n\r\n GPL-3.0 License - See the license file in this folder for details.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A Finance Securities Valuation Library",
    "version": "0.310",
    "project_urls": {
        "Homepage": "https://github.com/domokane/FinancePy"
    },
    "split_keywords": [
        "finance",
        "options",
        "bonds",
        "valuation",
        "derivatives"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "46caa36e427ccac520e97f4d47a76639c597656f381e32267b55f935ad965024",
                "md5": "9c12e0c9054994fd7c61f3dad07def1d",
                "sha256": "6986c7ca57545aaaa045dd576335adfc66317b4200645e81d61cb18173c5c777"
            },
            "downloads": -1,
            "filename": "financepy-0.310-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c12e0c9054994fd7c61f3dad07def1d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 628617,
            "upload_time": "2023-08-25T14:17:34",
            "upload_time_iso_8601": "2023-08-25T14:17:34.651784Z",
            "url": "https://files.pythonhosted.org/packages/46/ca/a36e427ccac520e97f4d47a76639c597656f381e32267b55f935ad965024/financepy-0.310-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "622c4a78556418154bf718efa57f941b4c99fe1418d3f14f29c3bb6cab1ad6d5",
                "md5": "b8e48f7c0d6acdb3969cadd664a3bb9f",
                "sha256": "5e78ac111cca02b2c80478878a71e1e0a319d5ba8b541956ee574803ea4676ff"
            },
            "downloads": -1,
            "filename": "financepy-0.310.tar.gz",
            "has_sig": false,
            "md5_digest": "b8e48f7c0d6acdb3969cadd664a3bb9f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 462848,
            "upload_time": "2023-08-25T14:17:37",
            "upload_time_iso_8601": "2023-08-25T14:17:37.422063Z",
            "url": "https://files.pythonhosted.org/packages/62/2c/4a78556418154bf718efa57f941b4c99fe1418d3f14f29c3bb6cab1ad6d5/financepy-0.310.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-25 14:17:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "domokane",
    "github_project": "FinancePy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "numba",
            "specs": [
                [
                    "==",
                    "0.55.2"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.21.6"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    "==",
                    "1.10.0"
                ]
            ]
        },
        {
            "name": "llvmlite",
            "specs": [
                [
                    "==",
                    "0.38.0"
                ]
            ]
        },
        {
            "name": "ipython",
            "specs": [
                [
                    "==",
                    "8.10.0"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    "==",
                    "3.5.2"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "1.1.3"
                ]
            ]
        },
        {
            "name": "prettytable",
            "specs": [
                [
                    "==",
                    "3.6.0"
                ]
            ]
        }
    ],
    "lcname": "financepy"
}
        
Elapsed time: 0.17747s