stochvolmodels 1.0.15__tar.gz → 1.0.16__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/PKG-INFO +1 -1
  2. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/pyproject.toml +1 -1
  3. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/__init__.py +1 -2
  4. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/analytic/bsm.py +3 -0
  5. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/analytic/tdist.py +2 -1
  6. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/gmm_pricer.py +3 -3
  7. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/utils/funcs.py +3 -9
  8. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/LICENSE.txt +0 -0
  9. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/README.md +0 -0
  10. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/data/__init__.py +0 -0
  11. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/data/fetch_option_chain.py +0 -0
  12. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/data/option_chain.py +0 -0
  13. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/data/test_option_chain.py +0 -0
  14. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/__init__.py +0 -0
  15. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/analytic/__init__.py +0 -0
  16. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/analytic/bachelier.py +0 -0
  17. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/hawkes_jd_pricer.py +0 -0
  18. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/heston_pricer.py +0 -0
  19. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/logsv/__init__.py +0 -0
  20. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/logsv/affine_expansion.py +0 -0
  21. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/logsv/vol_moments_ode.py +0 -0
  22. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/logsv_pricer.py +0 -0
  23. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/model_pricer.py +0 -0
  24. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/pricers/tdist_pricer.py +0 -0
  25. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/tests/__init__.py +0 -0
  26. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/tests/bsm_mgf_pricer.py +0 -0
  27. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/tests/qv_pricer.py +0 -0
  28. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/utils/__init__.py +0 -0
  29. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/utils/config.py +0 -0
  30. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/utils/mc_payoffs.py +0 -0
  31. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/utils/mgf_pricer.py +0 -0
  32. {stochvolmodels-1.0.15 → stochvolmodels-1.0.16}/stochvolmodels/utils/plots.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stochvolmodels
3
- Version: 1.0.15
3
+ Version: 1.0.16
4
4
  Summary: Implementation of stochastic volatility models for option pricing
5
5
  Home-page: https://github.com/ArturSepp/StochVolModels
6
6
  License: LICENSE.txt
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "stochvolmodels"
3
- version = "1.0.15"
3
+ version = "1.0.16"
4
4
  description = "Implementation of stochastic volatility models for option pricing"
5
5
  license = "LICENSE.txt"
6
6
  authors = ["Artur Sepp <artursepp@gmail.com>"]
@@ -22,8 +22,7 @@ from stochvolmodels.utils.funcs import (
22
22
  to_flat_np_array,
23
23
  update_kwargs,
24
24
  ncdf,
25
- npdf,
26
- npdf1
25
+ npdf
27
26
  )
28
27
 
29
28
  from stochvolmodels.pricers.analytic.bsm import (
@@ -249,6 +249,8 @@ def compute_bsm_strike_from_delta(ttm: float,
249
249
  Vega
250
250
  ****************************
251
251
  """
252
+
253
+
252
254
  @njit
253
255
  def compute_bsm_vanilla_vega(ttm: float,
254
256
  forward: float,
@@ -308,6 +310,7 @@ Gamma
308
310
  ****************************
309
311
  """
310
312
 
313
+
311
314
  @njit
312
315
  def compute_bsm_vanilla_gamma(ttm: float,
313
316
  forward: float,
@@ -33,7 +33,8 @@ def cdf_tdist(x: Union[np.ndarray, float], mu: float, vol: float, nu: float, ttm
33
33
  return cdf
34
34
 
35
35
 
36
- def cum_mean_tdist(x: Union[np.ndarray, float], mu: float = 0, vol: float = 0.2, nu: float = 3.0, ttm: float = 0.25) -> Union[float, np.ndarray]:
36
+ def cum_mean_tdist(x: Union[np.ndarray, float], mu: float = 0, vol: float = 0.2, nu: float = 3.0, ttm: float = 0.25
37
+ ) -> Union[float, np.ndarray]:
37
38
  """
38
39
  cumulative expected value
39
40
  h = int^{x}_{-\infty} u f(u)du
@@ -10,7 +10,7 @@ from numba.typed import List
10
10
  from typing import Tuple
11
11
  from enum import Enum
12
12
 
13
- from stochvolmodels.utils.funcs import to_flat_np_array, timer, npdf1
13
+ from stochvolmodels.utils.funcs import to_flat_np_array, timer
14
14
  import stochvolmodels.pricers.analytic.bsm as bsm
15
15
  from stochvolmodels.pricers.model_pricer import ModelParams, ModelPricer
16
16
  from stochvolmodels.utils.config import VariableType
@@ -37,7 +37,7 @@ class GmmParams(ModelParams):
37
37
  state_pdfs = np.zeros((len(x), len(self.gmm_weights)))
38
38
  agg_pdf = np.zeros_like(x)
39
39
  for idx, (gmm_weight, mu, vol) in enumerate(zip(self.gmm_weights, self.gmm_mus, self.gmm_vols)):
40
- state_pdf = npdf1(x, mu=mu*self.ttm, vol=vol*np.sqrt(self.ttm))
40
+ state_pdf = npdf(x, mu=mu*self.ttm, vol=vol*np.sqrt(self.ttm))
41
41
  state_pdfs[:, idx] = state_pdf
42
42
  agg_pdf += gmm_weight*state_pdf
43
43
  return state_pdfs, agg_pdf
@@ -45,7 +45,7 @@ class GmmParams(ModelParams):
45
45
  def compute_pdf(self, x: np.ndarray):
46
46
  pdfs = np.zeros_like(x)
47
47
  for gmm_weight, mu, vol in zip(self.gmm_weights, self.gmm_mus, self.gmm_vols):
48
- pdfs = pdfs + gmm_weight*npdf1(x, mu=mu*self.ttm, vol=vol*np.sqrt(self.ttm))
48
+ pdfs = pdfs + gmm_weight*npdf(x, mu=mu*self.ttm, vol=vol*np.sqrt(self.ttm))
49
49
  return pdfs
50
50
 
51
51
 
@@ -5,7 +5,7 @@ import functools
5
5
  import time
6
6
  import numpy as np
7
7
  import pandas as pd
8
- from numba import njit, int32, int64
8
+ from numba import njit
9
9
  from numba.typed import List
10
10
  from typing import Tuple, Dict, Any, Optional, Union
11
11
 
@@ -92,11 +92,5 @@ def ncdf(x: Union[float, np.ndarray]) -> Union[float, np.ndarray]:
92
92
 
93
93
 
94
94
  @njit(cache=False, fastmath=True)
95
- def npdf(x: Union[float, np.ndarray]) -> Union[float, np.ndarray]:
96
- return np.exp(-0.5*np.square(x))/np.sqrt(2.0*np.pi)
97
-
98
-
99
- @njit(cache=False, fastmath=True)
100
- def npdf1(x: Union[float, np.ndarray], mu: float, vol: float) -> Union[float, np.ndarray]:
101
- vol2 = vol*vol
102
- return np.exp(-0.5*np.square(x-mu)/vol2)/np.sqrt(2.0*np.pi*vol2)
95
+ def npdf(x: Union[float, np.ndarray], mu: float = 0.0, vol: float = 1.0) -> Union[float, np.ndarray]:
96
+ return np.exp(-0.5*np.square((x-mu)/vol))/(vol*np.sqrt(2.0*np.pi))