quantmod 0.1.4__tar.gz → 0.1.5__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.
- {quantmod-0.1.4 → quantmod-0.1.5}/.gitignore +2 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/PKG-INFO +49 -32
- quantmod-0.1.5/README.md +86 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/pyproject.toml +3 -3
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/changelog.md +11 -1
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/index.md +0 -3
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/user-guide/examples/optionpricing.md +18 -0
- quantmod-0.1.5/quantmod/docs/user-guide/installation.md +14 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/mkdocs.yml +19 -14
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/models/montecarlo.py +11 -3
- quantmod-0.1.4/README.md +0 -69
- quantmod-0.1.4/quantmod/docs/user-guide/installation.md +0 -21
- {quantmod-0.1.4 → quantmod-0.1.5}/.github/workflows/ci.yml +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/.github/workflows/publish.yml +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/LICENSE.txt +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/__init__.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/charts/__init__.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/charts/plotting.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/charts/themes.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/datasets/__init__.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/datasets/data/nifty50.csv +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/datasets/data/spx.csv +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/datasets/dataloader.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/db/__init__.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/db/database.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/derivatives/__init__.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/derivatives/nse.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/about.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/charts.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/datasets.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/db.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/derivatives.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/indicators.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/license.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/markets.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/models.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/risk.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/timeseries.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/user-guide/examples/database.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/user-guide/examples/datasets.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/user-guide/examples/nseoption.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/user-guide/examples/performance.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/user-guide/examples/risk.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/user-guide/examples/stockprice.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/user-guide/examples/technicals.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/user-guide/examples/timeseries.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/docs/user-guide/examples/visualisation.md +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/indicators/__init__.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/indicators/indicators.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/main.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/markets/__init__.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/markets/bb.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/markets/yahoo.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/models/__init__.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/models/binomial.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/models/blackscholes.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/models/gbs.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/models/optioninputs.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/risk/__init__.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/risk/var.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/risk/varbacktest.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/risk/varinputs.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/timeseries/__init__.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/timeseries/performance.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/timeseries/timeseries.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/quantmod/utils.py +0 -0
- {quantmod-0.1.4 → quantmod-0.1.5}/uv.lock +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantmod
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Quantitative finance toolkit for Python — markets, options, risk, and time series
|
|
5
|
-
Project-URL: Homepage, https://kannansingaravelu.com
|
|
5
|
+
Project-URL: Homepage, https://docs.kannansingaravelu.com
|
|
6
6
|
Project-URL: Repository, https://github.com/kannansingaravelu/quantmod
|
|
7
|
-
Project-URL: Documentation, https://kannansingaravelu.com
|
|
7
|
+
Project-URL: Documentation, https://docs.kannansingaravelu.com
|
|
8
8
|
Author-email: Kannan Singaravelu <inquant@outlook.com>
|
|
9
9
|
License: Apache-2.0
|
|
10
10
|
License-File: LICENSE.txt
|
|
@@ -36,72 +36,89 @@ Requires-Dist: urllib3==1.26.15
|
|
|
36
36
|
Requires-Dist: yfinance>=1.0
|
|
37
37
|
Description-Content-Type: text/markdown
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
The quantmod package is inspired by the popular R package of the same name but reimagined for the modern Python data stack. It’s designed to support data scientists, analysts, and AI researchers with tools for fast, flexible data exploration and visualization. Whether you're working with time series, building machine learning pipelines, or prototyping data-driven ideas, quantmod offers a clean, intuitive interface that helps you move quickly from data to insight.
|
|
41
|
-
|
|
39
|
+
quantmod is a Python library for market data access, quantitative analysis, and financial modeling. It provides a unified framework to move seamlessly from data ingestion to derivatives analytics, pricing, risk analysis, and visualization.
|
|
42
40
|
|
|
43
41
|
## Installation
|
|
44
|
-
|
|
42
|
+
|
|
43
|
+
Install quantmod using pip:
|
|
45
44
|
|
|
46
45
|
```bash
|
|
47
46
|
pip install quantmod
|
|
48
47
|
```
|
|
49
48
|
|
|
49
|
+
Or, using uv:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
uv add quantmod
|
|
53
|
+
```
|
|
50
54
|
|
|
51
55
|
## Modules
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
* [datasets](https://kannansingaravelu.com/quantmod/datasets/)
|
|
55
|
-
* [derivatives](https://kannansingaravelu.com/quantmod/derivatives/)
|
|
56
|
-
* [indicators](https://kannansingaravelu.com/quantmod/indicators/)
|
|
57
|
-
* [markets](https://kannansingaravelu.com/quantmod/markets/)
|
|
58
|
-
* [models](https://kannansingaravelu.com/quantmod/models/)
|
|
59
|
-
* [risk](https://kannansingaravelu.com/quantmod/risk/)
|
|
60
|
-
* [timeseries](https://kannansingaravelu.com/quantmod/timeseries/)
|
|
57
|
+
### Data & Markets
|
|
61
58
|
|
|
59
|
+
- [datasets](https://docs.kannansingaravelu.com/datasets/)
|
|
60
|
+
- [database](https://docs.kannansingaravelu.com/db/)
|
|
61
|
+
- [markets](https://docs.kannansingaravelu.com/markets/)
|
|
62
|
+
- [derivatives](https://docs.kannansingaravelu.com/derivatives/)
|
|
63
|
+
|
|
64
|
+
### Quant & Analytics
|
|
65
|
+
|
|
66
|
+
- [charts](https://docs.kannansingaravelu.com/charts/)
|
|
67
|
+
- [models](https://docs.kannansingaravelu.com/models/)
|
|
68
|
+
- [risk](https://docs.kannansingaravelu.com/risk/)
|
|
69
|
+
- [indicators](https://docs.kannansingaravelu.com/indicators/)
|
|
70
|
+
- [timeseries](https://docs.kannansingaravelu.com/timeseries/)
|
|
62
71
|
|
|
63
72
|
## Quickstart
|
|
64
73
|
|
|
65
74
|
```py
|
|
66
|
-
#
|
|
75
|
+
# Market data
|
|
67
76
|
from quantmod.markets import getData, getTicker
|
|
68
77
|
|
|
69
|
-
#
|
|
78
|
+
# Visualization
|
|
70
79
|
import quantmod.charts
|
|
71
80
|
|
|
72
|
-
# Option
|
|
73
|
-
from quantmod.models import
|
|
81
|
+
# Option pricing models
|
|
82
|
+
from quantmod.models import (
|
|
83
|
+
OptionInputs,
|
|
84
|
+
Black76,
|
|
85
|
+
BlackScholes,
|
|
86
|
+
MonteCarloOptionPricing
|
|
87
|
+
)
|
|
74
88
|
|
|
75
89
|
# Risk measures
|
|
76
|
-
from quantmod.risk import
|
|
77
|
-
|
|
78
|
-
|
|
90
|
+
from quantmod.risk import (
|
|
91
|
+
RiskInputs,
|
|
92
|
+
ValueAtRisk,
|
|
93
|
+
ConditionalVaR,
|
|
94
|
+
VarBacktester
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Time series utilities
|
|
79
98
|
from quantmod.timeseries import *
|
|
80
99
|
|
|
81
100
|
# Technical indicators
|
|
82
101
|
from quantmod.indicators import ATR
|
|
83
102
|
|
|
84
|
-
# Derivatives
|
|
103
|
+
# Derivatives (option chain analytics)
|
|
85
104
|
from quantmod.derivatives import maxpain
|
|
86
105
|
|
|
87
|
-
# Datasets
|
|
106
|
+
# Datasets
|
|
88
107
|
from quantmod.datasets import fetch_historical_data
|
|
89
108
|
```
|
|
109
|
+
|
|
90
110
|
<br>
|
|
91
111
|
Note: quantmod is currently under active development, and anticipate ongoing enhancements and additions. The aim is to continually improve the package and expand its capabilities to meet the evolving needs of the community.
|
|
92
112
|
|
|
93
|
-
|
|
94
113
|
## Examples
|
|
95
|
-
Refer to the [examples](https://kannansingaravelu.com/) section for more details.
|
|
96
114
|
|
|
115
|
+
Refer to the [examples](https://docs.kannansingaravelu.com/examples/) section for detailed use cases and workflows.
|
|
97
116
|
|
|
98
117
|
## Changelog
|
|
99
|
-
The list of changes to quantmod between each release can be found [here](https://kannansingaravelu.com/quantmod/changelog/)
|
|
100
|
-
|
|
101
118
|
|
|
102
|
-
|
|
103
|
-
[Join the quantmod server](https://discord.com/invite/DXQyezbJ) to share feature requests, report bugs, and discuss the package.
|
|
119
|
+
See the full list of changes [here](https://docs.kannansingaravelu.com/changelog/)
|
|
104
120
|
|
|
121
|
+
## Legal
|
|
105
122
|
|
|
106
|
-
|
|
107
|
-
|
|
123
|
+
`quantmod` is distributed under the **Apache Software License**.
|
|
124
|
+
See the [LICENSE](https://www.apache.org/licenses/LICENSE-2.0.txt) for details.
|
quantmod-0.1.5/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
quantmod is a Python library for market data access, quantitative analysis, and financial modeling. It provides a unified framework to move seamlessly from data ingestion to derivatives analytics, pricing, risk analysis, and visualization.
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
Install quantmod using pip:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install quantmod
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or, using uv:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
uv add quantmod
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Modules
|
|
18
|
+
|
|
19
|
+
### Data & Markets
|
|
20
|
+
|
|
21
|
+
- [datasets](https://docs.kannansingaravelu.com/datasets/)
|
|
22
|
+
- [database](https://docs.kannansingaravelu.com/db/)
|
|
23
|
+
- [markets](https://docs.kannansingaravelu.com/markets/)
|
|
24
|
+
- [derivatives](https://docs.kannansingaravelu.com/derivatives/)
|
|
25
|
+
|
|
26
|
+
### Quant & Analytics
|
|
27
|
+
|
|
28
|
+
- [charts](https://docs.kannansingaravelu.com/charts/)
|
|
29
|
+
- [models](https://docs.kannansingaravelu.com/models/)
|
|
30
|
+
- [risk](https://docs.kannansingaravelu.com/risk/)
|
|
31
|
+
- [indicators](https://docs.kannansingaravelu.com/indicators/)
|
|
32
|
+
- [timeseries](https://docs.kannansingaravelu.com/timeseries/)
|
|
33
|
+
|
|
34
|
+
## Quickstart
|
|
35
|
+
|
|
36
|
+
```py
|
|
37
|
+
# Market data
|
|
38
|
+
from quantmod.markets import getData, getTicker
|
|
39
|
+
|
|
40
|
+
# Visualization
|
|
41
|
+
import quantmod.charts
|
|
42
|
+
|
|
43
|
+
# Option pricing models
|
|
44
|
+
from quantmod.models import (
|
|
45
|
+
OptionInputs,
|
|
46
|
+
Black76,
|
|
47
|
+
BlackScholes,
|
|
48
|
+
MonteCarloOptionPricing
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
# Risk measures
|
|
52
|
+
from quantmod.risk import (
|
|
53
|
+
RiskInputs,
|
|
54
|
+
ValueAtRisk,
|
|
55
|
+
ConditionalVaR,
|
|
56
|
+
VarBacktester
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Time series utilities
|
|
60
|
+
from quantmod.timeseries import *
|
|
61
|
+
|
|
62
|
+
# Technical indicators
|
|
63
|
+
from quantmod.indicators import ATR
|
|
64
|
+
|
|
65
|
+
# Derivatives (option chain analytics)
|
|
66
|
+
from quantmod.derivatives import maxpain
|
|
67
|
+
|
|
68
|
+
# Datasets
|
|
69
|
+
from quantmod.datasets import fetch_historical_data
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
<br>
|
|
73
|
+
Note: quantmod is currently under active development, and anticipate ongoing enhancements and additions. The aim is to continually improve the package and expand its capabilities to meet the evolving needs of the community.
|
|
74
|
+
|
|
75
|
+
## Examples
|
|
76
|
+
|
|
77
|
+
Refer to the [examples](https://docs.kannansingaravelu.com/examples/) section for detailed use cases and workflows.
|
|
78
|
+
|
|
79
|
+
## Changelog
|
|
80
|
+
|
|
81
|
+
See the full list of changes [here](https://docs.kannansingaravelu.com/changelog/)
|
|
82
|
+
|
|
83
|
+
## Legal
|
|
84
|
+
|
|
85
|
+
`quantmod` is distributed under the **Apache Software License**.
|
|
86
|
+
See the [LICENSE](https://www.apache.org/licenses/LICENSE-2.0.txt) for details.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quantmod"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.5"
|
|
8
8
|
description = "Quantitative finance toolkit for Python — markets, options, risk, and time series"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "Apache-2.0" }
|
|
@@ -41,9 +41,9 @@ dependencies = [
|
|
|
41
41
|
]
|
|
42
42
|
|
|
43
43
|
[project.urls]
|
|
44
|
-
Homepage = "https://kannansingaravelu.com
|
|
44
|
+
Homepage = "https://docs.kannansingaravelu.com"
|
|
45
45
|
Repository = "https://github.com/kannansingaravelu/quantmod"
|
|
46
|
-
Documentation = "https://kannansingaravelu.com
|
|
46
|
+
Documentation = "https://docs.kannansingaravelu.com"
|
|
47
47
|
|
|
48
48
|
[project.scripts]
|
|
49
49
|
inquant = "quantmod:hello"
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 0.1.5
|
|
4
|
+
|
|
5
|
+
- fixed Monte Carlo drift to honour cost of carry (`drift = r − q`)
|
|
6
|
+
- `MonteCarloOptionPricing` now applies `dividend_yield` (continuous yield or FX rate differential); previously hard-coded `drift = r`, which over-priced options on dividend-paying underlyings
|
|
7
|
+
- `dividend_yield` defaults to `0`, preserving prior behaviour for non-dividend cases
|
|
8
|
+
- refreshed README and documentation
|
|
9
|
+
- reorganized modules into "Data & Markets" and "Quant & Analytics" sections
|
|
10
|
+
- updated quickstart imports (`Black76`, `BlackScholes`) and added `uv` install instructions
|
|
11
|
+
- regrouped navigation and updated docs site URL
|
|
12
|
+
|
|
3
13
|
## 0.1.4
|
|
4
14
|
|
|
5
15
|
- replaced `BlackScholesOptionPricing` with Generalized Black-Scholes (GBS) framework
|
|
@@ -15,7 +25,7 @@
|
|
|
15
25
|
- added `MonteCarloResult` dataclass (price, std error, 95% CI, metadata)
|
|
16
26
|
- parameters renamed: `nsims` → `n_simulations`, `timestep` → `n_steps`
|
|
17
27
|
|
|
18
|
-
|
|
28
|
+
0.1.3
|
|
19
29
|
|
|
20
30
|
---
|
|
21
31
|
|
|
@@ -67,9 +67,6 @@ Refer to the [examples](user-guide/examples/optionpricing.md) section for more d
|
|
|
67
67
|
## Changelog
|
|
68
68
|
The list of changes to quantmod between each release can be found [here](changelog.md)
|
|
69
69
|
|
|
70
|
-
## Community
|
|
71
|
-
[Join the quantmod server](https://discord.com/invite/DXQyezbJ) to share feature requests, report bugs, and discuss the package.
|
|
72
|
-
|
|
73
70
|
## Legal
|
|
74
71
|
`quatmod` is distributed under the **Apache Software License**. See the [LICENSE.txt](https://www.apache.org/licenses/LICENSE-2.0.txt) file in the release for details.
|
|
75
72
|
|
|
@@ -165,6 +165,24 @@ print(mc.results())
|
|
|
165
165
|
──────────────────────────────────────────────────
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
+
### European option — continuous dividend yield
|
|
169
|
+
|
|
170
|
+
The drift reflects cost of carry (`r − q`), so a non-zero `dividend_yield`
|
|
171
|
+
(continuous yield, or the rate differential for FX) is honoured.
|
|
172
|
+
|
|
173
|
+
```py
|
|
174
|
+
div_inputs = OptionInputs(spot=100, strike=100, rate=0.05, ttm=1.0,
|
|
175
|
+
volatility=0.20, dividend_yield=0.03)
|
|
176
|
+
|
|
177
|
+
mc = MonteCarloOptionPricing(
|
|
178
|
+
div_inputs,
|
|
179
|
+
n_simulations=100_000,
|
|
180
|
+
option_type=OptionType.CALL,
|
|
181
|
+
seed=42,
|
|
182
|
+
)
|
|
183
|
+
print(mc.results().price) # cheaper than the q=0 call above
|
|
184
|
+
```
|
|
185
|
+
|
|
168
186
|
### European option — Sobol quasi-random (faster convergence)
|
|
169
187
|
|
|
170
188
|
```py
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
site_name: quantmod
|
|
2
|
-
site_url: https://kannansingaravelu.com
|
|
2
|
+
site_url: https://docs.kannansingaravelu.com
|
|
3
3
|
docs_dir: docs
|
|
4
4
|
site_dir: ../site
|
|
5
5
|
|
|
6
6
|
nav:
|
|
7
7
|
- Home: index.md
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
8
|
+
|
|
9
|
+
- Data & Markets:
|
|
10
|
+
- Database: db.md
|
|
11
|
+
- Datasets: datasets.md
|
|
12
|
+
- Derivatives: derivatives.md
|
|
13
|
+
- Markets: markets.md
|
|
14
|
+
|
|
15
|
+
- Quant & Analytics:
|
|
16
|
+
- Charts: charts.md
|
|
17
|
+
- Models: models.md
|
|
18
|
+
- Risk: risk.md
|
|
19
|
+
- Indicators: indicators.md
|
|
20
|
+
- Timeseries: timeseries.md
|
|
17
21
|
|
|
18
22
|
- User Guide:
|
|
19
23
|
- Installation: user-guide/installation.md
|
|
@@ -29,9 +33,10 @@ nav:
|
|
|
29
33
|
- Technical Indicators: user-guide/examples/technicals.md
|
|
30
34
|
- Time Series Analysis: user-guide/examples/timeseries.md
|
|
31
35
|
|
|
32
|
-
- About:
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
- About:
|
|
37
|
+
- About: about.md
|
|
38
|
+
- Changelog: changelog.md
|
|
39
|
+
- License: license.md
|
|
35
40
|
|
|
36
41
|
theme:
|
|
37
42
|
name: material
|
|
@@ -141,4 +146,4 @@ markdown_extensions:
|
|
|
141
146
|
generic: true
|
|
142
147
|
|
|
143
148
|
copyright: |
|
|
144
|
-
© 2024-
|
|
149
|
+
© 2024-2026 Kannan Singaravelu
|
|
@@ -209,6 +209,7 @@ class MonteCarloOptionPricing:
|
|
|
209
209
|
self._S = inputs.spot
|
|
210
210
|
self._K = inputs.strike
|
|
211
211
|
self._r = inputs.rate
|
|
212
|
+
self._q = inputs.dividend_yield
|
|
212
213
|
self._t = inputs.ttm
|
|
213
214
|
self._sigma = inputs.volatility
|
|
214
215
|
self._n_steps = n_steps
|
|
@@ -295,11 +296,18 @@ class MonteCarloOptionPricing:
|
|
|
295
296
|
|
|
296
297
|
def _simulate_paths(self, z: np.ndarray) -> np.ndarray:
|
|
297
298
|
"""
|
|
298
|
-
Simulate Geometric Brownian Motion price paths
|
|
299
|
+
Simulate Geometric Brownian Motion price paths under risk-neutral
|
|
300
|
+
measure with cost-of-carry ``b = r − q``.
|
|
299
301
|
|
|
300
302
|
Uses the log-return form to avoid compounding floating-point errors:
|
|
301
303
|
|
|
302
|
-
S(t+Δt) = S(t) · exp[(r
|
|
304
|
+
S(t+Δt) = S(t) · exp[(r − q − σ²/2)·Δt + σ·√Δt·Z]
|
|
305
|
+
|
|
306
|
+
Setting ``dividend_yield = 0`` (default) reduces the drift to the
|
|
307
|
+
plain ``r`` previously assumed. For Black76-style forward inputs,
|
|
308
|
+
pass ``rate = 0`` (since the forward is a martingale under the
|
|
309
|
+
risk-neutral measure) — the discount factor is then unitless and
|
|
310
|
+
the caller is responsible for applying ``exp(−r·T)`` externally.
|
|
303
311
|
|
|
304
312
|
Parameters
|
|
305
313
|
----------
|
|
@@ -313,7 +321,7 @@ class MonteCarloOptionPricing:
|
|
|
313
321
|
Column 0 is the initial spot price ``S``.
|
|
314
322
|
"""
|
|
315
323
|
dt = self._t / self._n_steps
|
|
316
|
-
drift = (self._r - 0.5 * self._sigma ** 2) * dt
|
|
324
|
+
drift = (self._r - self._q - 0.5 * self._sigma ** 2) * dt
|
|
317
325
|
diffusion = self._sigma * np.sqrt(dt) * z # (n_sims, n_steps)
|
|
318
326
|
cum_log = np.cumsum(drift + diffusion, axis=1) # (n_sims, n_steps)
|
|
319
327
|
paths = self._S * np.exp(
|
quantmod-0.1.4/README.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
The quantmod package is inspired by the popular R package of the same name but reimagined for the modern Python data stack. It’s designed to support data scientists, analysts, and AI researchers with tools for fast, flexible data exploration and visualization. Whether you're working with time series, building machine learning pipelines, or prototyping data-driven ideas, quantmod offers a clean, intuitive interface that helps you move quickly from data to insight.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
The easiest way to install quantmod is using pip:
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
pip install quantmod
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Modules
|
|
14
|
-
|
|
15
|
-
* [charts](https://kannansingaravelu.com/quantmod/charts/)
|
|
16
|
-
* [datasets](https://kannansingaravelu.com/quantmod/datasets/)
|
|
17
|
-
* [derivatives](https://kannansingaravelu.com/quantmod/derivatives/)
|
|
18
|
-
* [indicators](https://kannansingaravelu.com/quantmod/indicators/)
|
|
19
|
-
* [markets](https://kannansingaravelu.com/quantmod/markets/)
|
|
20
|
-
* [models](https://kannansingaravelu.com/quantmod/models/)
|
|
21
|
-
* [risk](https://kannansingaravelu.com/quantmod/risk/)
|
|
22
|
-
* [timeseries](https://kannansingaravelu.com/quantmod/timeseries/)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## Quickstart
|
|
26
|
-
|
|
27
|
-
```py
|
|
28
|
-
# Retrieves market data & ticker object
|
|
29
|
-
from quantmod.markets import getData, getTicker
|
|
30
|
-
|
|
31
|
-
# Charting module
|
|
32
|
-
import quantmod.charts
|
|
33
|
-
|
|
34
|
-
# Option price
|
|
35
|
-
from quantmod.models import OptionInputs, BlackScholesOptionPricing, MonteCarloOptionPricing
|
|
36
|
-
|
|
37
|
-
# Risk measures
|
|
38
|
-
from quantmod.risk import RiskInputs, ValueAtRisk, ConditionalVaR, VarBacktester
|
|
39
|
-
|
|
40
|
-
# Calculates price return of different time period.
|
|
41
|
-
from quantmod.timeseries import *
|
|
42
|
-
|
|
43
|
-
# Technical indicators
|
|
44
|
-
from quantmod.indicators import ATR
|
|
45
|
-
|
|
46
|
-
# Derivatives functions
|
|
47
|
-
from quantmod.derivatives import maxpain
|
|
48
|
-
|
|
49
|
-
# Datasets functions
|
|
50
|
-
from quantmod.datasets import fetch_historical_data
|
|
51
|
-
```
|
|
52
|
-
<br>
|
|
53
|
-
Note: quantmod is currently under active development, and anticipate ongoing enhancements and additions. The aim is to continually improve the package and expand its capabilities to meet the evolving needs of the community.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
## Examples
|
|
57
|
-
Refer to the [examples](https://kannansingaravelu.com/) section for more details.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
## Changelog
|
|
61
|
-
The list of changes to quantmod between each release can be found [here](https://kannansingaravelu.com/quantmod/changelog/)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
## Community
|
|
65
|
-
[Join the quantmod server](https://discord.com/invite/DXQyezbJ) to share feature requests, report bugs, and discuss the package.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
## Legal
|
|
69
|
-
`quatmod` is distributed under the **Apache Software License**. See the [LICENSE.txt](https://www.apache.org/licenses/LICENSE-2.0.txt) file in the release for details.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Installation
|
|
2
|
-
|
|
3
|
-
## pip
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
pip install quantmod
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## uv
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
uv add quantmod
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## From source
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
git clone https://github.com/kannansingaravelu/quantmod.git
|
|
19
|
-
cd quantmod
|
|
20
|
-
uv sync
|
|
21
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|