Python library for pricing autocallables
Project description
exotx
exotx is a Python wrapper for the QuantLib library, a powerful open-source library for quantitative finance. exotx provides a simple and user-friendly interface for pricing and analyzing financial derivatives using QuantLib's advanced numerical methods.
Installation
To install exotx, simply use pip:
pip install exotx
Usage
Define the product
import exotx
notional = 100
strike = 100.0
autocall_barrier_level = 1.0 # 100%
annual_coupon_value = 0.03 # 3.00%
coupon_barrier_level = 0.75 # 75%
protection_barrier_level = 0.75 # 75%
my_autocallable = exotx.Autocallable(notional, strike, autocall_barrier_level, annual_coupon_value, coupon_barrier_level, protection_barrier_level)
Define the static data
The object that represents static data such as the calendar, the day counter or the business day convention used.
From the constructor
my_static_data = exotx.StaticData(day_counter='Actual360', business_day_convention='ModifiedFollowing')
From JSON
my_json = {
'day_counter': 'Actual360',
'business_day_convention': 'ModifiedFollowing'
}
my_static_data = exotx.StaticData.from_json(my_json)
Define the market data
From the constructor
reference_date = '2015-11-06'
spot = 100.0
risk_free_rate = 0.01
dividend_rate = 0.0
black_scholes_volatility = 0.2
my_market_data = exotx.MarketData(reference_date, spot, risk_free_rate, dividend_rate, black_scholes_volatility=black_scholes_volatility)
From JSON
my_json = {
'reference_date': '2015-11-06',
'spot': 100,
'risk_free_rate': 0.01,
'dividend_rate': 0,
'black_scholes_volatility': 0.2
}
my_market_data = exotx.MarketData.from_json(my_json)
Price the product
Vanilla Option
from exotx.instruments import OptionType
from exotx.enums import PricingModel, NumericalMethod
strike = 90
option_maturity = '2016-05-04'
my_vanilla_option = exotx.VanillaOption(strike, option_maturity, OptionType.CALL)
my_pricing_config = exotx.PricingConfiguration(PricingModel.BLACK_SCHOLES, NumericalMethod.ANALYTIC, compute_greeks=True)
exotx.price(my_vanilla_option, my_market_data, my_static_data, my_pricing_config)
>>> {
'price': 13.83328710,
'delta': 0.77183751,
'gamma': 0.01609460,
'theta': -7.01024983
}
Auto-Callable
exotx.price(my_autocallable, my_market_data, my_static_data, model='black-scholes')
>>> 96.08517973497098
Contributing
We welcome contributions to exotx! If you find a bug or would like to request a new feature, please open an issue on the Github repository. If you would like to contribute code, please submit a pull request.
License
exotx is released under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file exotx-0.6.5.tar.gz
.
File metadata
- Download URL: exotx-0.6.5.tar.gz
- Upload date:
- Size: 33.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d469670645e6643e2cfbf4d4ff1f3e4d0716b4171ac4b36f4fc6b650a259d9e4 |
|
MD5 | d1eb8bd25c437b572525023e338095b2 |
|
BLAKE2b-256 | b4e1157d63e0e5af7ea995056f29c825fd27bbc0d4099bde8cb85de5a127338b |
File details
Details for the file exotx-0.6.5-py3-none-any.whl
.
File metadata
- Download URL: exotx-0.6.5-py3-none-any.whl
- Upload date:
- Size: 49.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e81d2be66095b4e2e2e54799707d84ae1cba7d630db8ba46befc8f27c5dd6510 |
|
MD5 | cb80e034baef5130cdaf0cabbaef3660 |
|
BLAKE2b-256 | b2e8fae8f871c6bf9573f2cf0558bec6297b4f0f1746bcfd4be10d90bef01b97 |