Skip to main content

A package for simulating and plotting stochastic processes using discretization of SDEs.

Project description

SDEs

Screenshot 2024-05-15 at 08 49 20
  • Euler scheme does not require derivatives, but Milstein and Runge-Kutta discretization schemes do...

  • List of processes implemented:

    • 'BM', 'GBM', 'OU', 'ExponentialOU', '(Heston) GBMSA', 'srGBM', 'SBM', 'BrownianBridge', 'BrownianMeander', 'BrownianExcursion', 'DysonBM', 'StickyBM', 'ReflectingBM', 'CorrelatedBM', 'CorrelatedGBM', 'CircleBM', 'dDimensionalBM', '3dGBM', '3dOU', 'StochasticLogisticGrowth', 'StochasticExponentialDecay', 'SinCosVectorNoiseIto', 'PolynomialItoProcess', 'WrightFisherDiffusion', 'WeibullDiffusion', 'WeibullDiffusion2', 'ExpTC', 'MRSqrtDiff',

      'VG', 'VGSA', 'Merton', 'ATSM', 'ATSM_SV', 'CEV', 'CIR', 'Vasicek', 'ExponentialVasicek', 'SABR', 'ShiftedSABR',
      'DTDG', 'CKLS', 'HullWhite', 'LotkaVolterra', 'TwoFactorHullWhite', 'BlackKarasinski', 'Chen', 'LongstaffSchwartz', 'BDT', 'HoLee', 'CIR++', 'CIR2++', 'KWF',

      'Bates','GeneralBergomi', 'OneFactorBergomi', 'RoughBergomi', 'RoughVolatility', 'RfSV', 'SinRFSV', 'TanhRFSV', 'ARIMA', 'GARCH', 'GARCHJump', 'VIX', 'GaussTanhPolyRFSV', 'LaplaceTanhPolyRFSV', 't_TanhPolyRFSV', 'CauchyTanhPolyRFSV', 'triangularTanhPolyRFSV', 'GumbelTanhPolyRFSV', 'LogisticTanhPolyRFSV',

      'SCP_mean_reverting', 'SCP_modified_OU', 'SCP_tanh_Ito', 'SCP_arctan_Ito', 'SCQuanto', 'WrightFisherSC', 'Jacobi',

      'fBM', 'GFBM', 'fOU', 'fIM', 'tanh_fOU', 'Poly_fOU', 'fStochasticLogisticGrowth', 'fStochasticExponentialDecay', 'fBM_WrightFisherDiffusion', 'fSV', 'Bessel', 'SquaredBessel', 'ConicDiffusionMartingale', 'ConicUnifDiffusionMartingale', 'ConicHalfUnifDiffusionMartingale', 'SinFourierDecompBB', 'MixedFourierDecompBB', 'kCorrelatedGBMs', 'kCorrelatedBMs'

  • StochasticProcessSimulator.py script can be used to obtain paths from the desired SDE/process.

  • The main function of interest is StochasticProcessSimulator() which produces the paths and includes the options of plotting and recording execution time(s).

  • READ_ME_SPS.txt describes all of the function arguments and their default settings.

  • Simulating_SDEs_Euler_all_plots.ipynb shows an example of how this function can be used to produce plots of all the types of SDEs.

  • Simulating_SDEs_Euler_simple_examples.ipynb (versions 1-4 of notebook) shows some simple examples of how this function can be used to produce stylized plots...

  • NB: In StochasticProcessSimulator(), 'kCorrelatedGBMs' and 'kCorrelatedBMs' are implemented without the option of producing plots...

  • 3dBMCube.ipynb and 3dBMSphere.ipynb are two examples demonstrating how StochasticProcessSimulator() can be integrated with more specific plotting requirements to produce plots of 3d BM paths constrained to a cube and sphere, respectively.

Installation

StochasticProcessSimulator is available on pypi and can be installed as follows

pip install StochasticProcessSimulator

Dependencies

StochasticProcessSimulator relies on

  • numpy for random number generation and math functions,
  • scipy and statsmodels for support for some specific distributions,
  • matplotlib for creating visualisations.

Quick-Start

StochasticProcessSimulator allows you to simulate and plot paths from different stochastic processes in a simple way.

For instance, the following code

from StochasticProcessSimulator import StochasticProcessSimulator as SPS
simulator = SPS(
            process_type='GBM', do_plot=True)
paths = simulator.simulate()

produces the following output:

Future work:

  • add handling of parameter inputs that break validity conditions...
  • add Milstein and Runge-Kutta discretization schemes...
  • add more SDEs/processes...
  • This is a very rough implementation, and there are lots of improvements to be made. Any suggestions and improvements are welcome and appreciated.

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

StochasticProcessSimulator-0.1.3.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

StochasticProcessSimulator-0.1.3-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file StochasticProcessSimulator-0.1.3.tar.gz.

File metadata

File hashes

Hashes for StochasticProcessSimulator-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d13d5fad43e23680dbf0ed60796a8f4db5f93e58ab155cc8f2aea74b5312641d
MD5 b81d6093250fceaa9af16cc50fb19b26
BLAKE2b-256 8fb6813861ffb5422a7bb01b7e75beb482b244268e3e5a0f2c6b6c1ba90e5e8b

See more details on using hashes here.

File details

Details for the file StochasticProcessSimulator-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for StochasticProcessSimulator-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 69a3fcff161d50c1a1bb948a1c712958ef0166f8bcb802c419601ade14f868fb
MD5 d01a5a6e6ac959232b9a171478e141ca
BLAKE2b-256 b7a937e63ecc77bd99774a64656756c66e8c6d0d3b10a3fddcb4a181cbce09bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page