Library for generating various stochastic price sequences
Project description
Price process generator
This library provides various generators of stochastic processes modelling real price processes. The generated synthetic price data can be used in Monte Carlo simulations (or similar statistical experiments) and potentially even to train ML algorithms.
Currently the implemented/planned generators are
Installation
pip install price_process to get the current PyPi version or clone this repo and run pip install . in the directory
for most recent version.
Basic usage
The standard model of stochastic price dynamics is the SDE
with solution the geometric Brownian motion
In order to display, say 10 samples of a 1000 point process, one would run
from price_process.process import *
price_proc = Gaussian([1000, 10]).to_geometric(0, 0.04)
price_proc.plot()
The np.ndarray output is accessed through
price_proc.process
Custom process
Custom generators can be implemented by subclassing Process. Here is how one might implement the gamma process
for instance
from price_process.process import *
from scipy.stats import gamma
import numpy as np
class Gamma(Process):
def __init__(self, alpha, beta, size, initial=0, T=1):
super().__init__(size, initial=initial, T=T)
self.alpha, self.beta = alpha, beta
self.rvs = gamma.rvs(alpha, size=self.size, scale=1/self.beta)
self.process = np.cumsum(self.rvs, axis=0)
See this for a more advanced use case.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file price_process-1.0.tar.gz.
File metadata
- Download URL: price_process-1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bb3351686ec326acb6621e589a879e2e03c7a66643463c4b2fef908bc65fff7
|
|
| MD5 |
b2c3068983061fcf98a2fd4eda131a57
|
|
| BLAKE2b-256 |
97e07d202b63a38be06af0f6904dc21e7ff4a20af38d8e46cac6026425cb6124
|
File details
Details for the file price_process-1.0-py3-none-any.whl.
File metadata
- Download URL: price_process-1.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5695eeb760fc438135cb96803d23c91971bd6b05eb8d83c7c7a920c8ef25acf
|
|
| MD5 |
df9052b4411f7e146a5f4c38d41f3dcd
|
|
| BLAKE2b-256 |
f02042eaceb68600705b839b1f2af349f8df5bb67b8274d651ea5e3d98793a8f
|