Pre-release
This release is a pre-release and may not be stable for production use.
Quick Start
Tools for analyzing risk in DeFi.
Dependencies
- python3 version 3.8 or greater, python3-dev
Installation
via pip
You can install the latest release via pip:
pip install ape-risk
via setuptools
You can clone the repository and use setuptools for the most up-to-date version:
git clone https://github.com/ApeWorX/ape-risk.git
cd ape-risk
python3 setup.py install
Quick Usage
Provides hypothesis strategies to use in fuzz tests.
e.g. Mock prices generated by Geometric Brownian motion:
import numpy as np
from ape_risk import strategies
@given(strategies.gbms(initial_value=1.0, num_points=100000, params=[0, 0.005]))
def test_gbms_param_fuzz(p):
# strat gives a numpy.ndarray of simulated prices for each hypothesis run
assert p.shape == (100000, 1)
assert isinstance(p, np.ndarray)
C = np.asarray([[1, 0.5, 0.8], [0.5, 1, 0.4], [0.8, 0.4, 1]])
scale = np.linalg.cholesky(C).tolist()
@given(strategies.multi_gbms(initial_values=[1.0, 0.9, 0.8], num_points=100000, num_rvs=3, params=[0, 0.005], scale=scale, shift=[0, 0, 0]))
def test_multi_gbms_param_fuzz(p):
# strat gives a numpy.ndarray of multiple simulated prices for each hypothesis run
assert p.shape == (100000, 1, 3)
assert isinstance(p, np.ndarray)
Development
This project is in development and should be considered an alpha. Things might not be in their final state and breaking changes may occur. Comments, questions, criticisms and pull requests are welcomed.
Metadata
Release files for ape-risk 0.1.0a4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ape-risk-0.1.0a4.tar.gz | 524.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ape_risk-0.1.0a4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 536.5 kB
Release files / ape-risk-0.1.0a4.tar.gz
| Download URL | ape-risk-0.1.0a4.tar.gz |
|---|---|
| Size | 524.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
983d5125c4c9db153c598e6a879e3c58b33c0b1a6b33d6665703155179184f3b
|
|
BLAKE2b-256 checksum How to use checksums |
2af91ea80e0c3fc0bab282e8721047d6836649da957c94e3f3c670225e757f41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.17
|
Release files / ape_risk-0.1.0a4-py3-none-any.whl
| Download URL | ape_risk-0.1.0a4-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8934af2fd5691402c30a047e03ee41d927771121d44735bd77216d148f2cb9f0
|
|
BLAKE2b-256 checksum How to use checksums |
46c217490715bee07a0689a53d1369adb3fc5e1069971029551ce7d589b08daa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.17
|