Skip to main content

structools

Helpful tools for QIS and Pricing Structuring teams

Installation

$ pip install structools

Usage

Every new functionality developed in this package has been interfaced so you have very little to do!

Start by creating a file launch.py with the following lines

from structools.launch import start

if __name__ == "__main__":

    start()

Then open the terminal in the folder where the file launch.py is located and simply run the following command

$ streamlit run launch.py

Structools offers the possibility to download your backtest results as excel files!

Welcome to Structools!

Advanced/Further Development

For those willing to dive deeper into the code, please find below a brief way to generate your backtest:

import numpy as np
from structools.tools.date_tools import DateModel
from structools.products.basic_products import Basket
from structools.products.autocalls import Phoenix, Athena
from structools.backtest.backtester import Backtester

# Underlying creation Worst-Of 2
nominal = 1_000_000
L_COMPO = ["AAPL", "^FCHI", "^SPX", "MSFT"]
N = len(L_COMPO)
arr_weights = np.ones(N) * 1/N
basket_wof = Basket.from_params(
    size=nominal,
    N=2,
    name="WOF2",
    worst=True,
    best=False,
    compo=L_COMPO,
    weights=arr_weights
)

# Create default phoenix with custom underlying
my_phoenix = Phoenix.from_params(underlying=basket_wof)
my_phoenix.set_parameter("coupon", 0.1)                 # Changing the coupon value to 10%

# Configure the backtest - 10 years history for the my_phoenix product
history_length = 10
backtester = Backtester.init_backtester(
    product=my_phoenix,
    backtest_length=history_length,
    investment_horizon=my_phoenix.maturity
)

# Running the backtest
dict_res = backtester.backtest_autocall()

All the functionalities of the root package of this package are still available via the following command:

import pybacktestchain

The relevant information about this pacakage is available here: https://pypi.org/project/pybacktestchain/

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

structools was created by Romain Pifaut. It is licensed under the terms of the MIT license.

Credits

structools was created with cookiecutter and the py-pkgs-cookiecutter template.

Metadata

Release files for structools 0.19.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for structools 0.19.3
File Size Uploaded
structools-0.19.3.tar.gz 22.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for structools 0.19.3
File Interpreter ABI Platform
structools-0.19.3-py3-none-any.whl Python 3 none any Details

Total release size: 50.8 kB

Release files / structools-0.19.3.tar.gz

Download URL structools-0.19.3.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4517c20a09e499c27624773938551a60124d8f91f4c111a83173624b07d83550
BLAKE2b-256 checksum
How to use checksums
7a9986b28828a4a8ed9bed55886a23f1a153cb0d0a393245bb3096d46535a259
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.11

Release files / structools-0.19.3-py3-none-any.whl

Download URL structools-0.19.3-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98299e7e87f6d14d7a0697d1f87998b6736adf0941dfd73bb699034e4104d753
BLAKE2b-256 checksum
How to use checksums
c1e4ea255787384b79c03c7c90a0254c45e2fdbf940967022f7e51c41f156e45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.11

Release history Release notifications | RSS feed

This release

0.19.3 This release

2 release files

0.19.2

2 release files

0.19.1

2 release files

0.18.3

2 release files

0.18.1

2 release files

0.17.9

2 release files

0.17.8

2 release files

0.17.7

2 release files

0.17.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page