derivflow-finance 0.1.2__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.
- derivflow_finance-0.1.2/.dummy.txt +0 -0
- derivflow_finance-0.1.2/LICENSE +21 -0
- derivflow_finance-0.1.2/MANIFEST.in +37 -0
- derivflow_finance-0.1.2/PKG-INFO +313 -0
- derivflow_finance-0.1.2/README.md +253 -0
- derivflow_finance-0.1.2/comprehensive_demo.py +571 -0
- derivflow_finance-0.1.2/final_test.py +26 -0
- derivflow_finance-0.1.2/pyproject.toml +107 -0
- derivflow_finance-0.1.2/requirements.txt +9 -0
- derivflow_finance-0.1.2/setup.cfg +4 -0
- derivflow_finance-0.1.2/setup.py +120 -0
- derivflow_finance-0.1.2/src/derivflow/__init__.py +227 -0
- derivflow_finance-0.1.2/src/derivflow/_version.py +21 -0
- derivflow_finance-0.1.2/src/derivflow/calibration/__init__.py +14 -0
- derivflow_finance-0.1.2/src/derivflow/core/__init__.py +25 -0
- derivflow_finance-0.1.2/src/derivflow/core/pricing_engine.py +548 -0
- derivflow_finance-0.1.2/src/derivflow/exotic/__init__.py +158 -0
- derivflow_finance-0.1.2/src/derivflow/exotic/asian_options.py +603 -0
- derivflow_finance-0.1.2/src/derivflow/exotic/barrier_options.py +448 -0
- derivflow_finance-0.1.2/src/derivflow/greeks/__init__.py +18 -0
- derivflow_finance-0.1.2/src/derivflow/greeks/calculator.py +460 -0
- derivflow_finance-0.1.2/src/derivflow/models/__init__.py +18 -0
- derivflow_finance-0.1.2/src/derivflow/models/heston.py +432 -0
- derivflow_finance-0.1.2/src/derivflow/portfolio/__init__.py +22 -0
- derivflow_finance-0.1.2/src/derivflow/portfolio/portfolio_risk.py +653 -0
- derivflow_finance-0.1.2/src/derivflow/utils/__init__.py +18 -0
- derivflow_finance-0.1.2/src/derivflow/utils/market_data.py +594 -0
- derivflow_finance-0.1.2/src/derivflow/visualization/__init__.py +18 -0
- derivflow_finance-0.1.2/src/derivflow/visualization/dashboard.py +679 -0
- derivflow_finance-0.1.2/src/derivflow/volatility/__init__.py +20 -0
- derivflow_finance-0.1.2/src/derivflow/volatility/surface.py +511 -0
- derivflow_finance-0.1.2/src/derivflow_finance.egg-info/PKG-INFO +313 -0
- derivflow_finance-0.1.2/src/derivflow_finance.egg-info/SOURCES.txt +37 -0
- derivflow_finance-0.1.2/src/derivflow_finance.egg-info/dependency_links.txt +1 -0
- derivflow_finance-0.1.2/src/derivflow_finance.egg-info/entry_points.txt +3 -0
- derivflow_finance-0.1.2/src/derivflow_finance.egg-info/not-zip-safe +1 -0
- derivflow_finance-0.1.2/src/derivflow_finance.egg-info/requires.txt +26 -0
- derivflow_finance-0.1.2/src/derivflow_finance.egg-info/top_level.txt +1 -0
- derivflow_finance-0.1.2/tests/test_visualization/test_dashboard.py +214 -0
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jeevan B A
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Include documentation and metadata files
|
|
2
|
+
include README.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
include requirements.txt
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
include MANIFEST.in
|
|
7
|
+
|
|
8
|
+
# Include all Python files
|
|
9
|
+
recursive-include src *.py
|
|
10
|
+
recursive-include src *.pyx
|
|
11
|
+
recursive-include src *.pxd
|
|
12
|
+
|
|
13
|
+
# Include documentation
|
|
14
|
+
recursive-include docs *.rst
|
|
15
|
+
recursive-include docs *.md
|
|
16
|
+
recursive-include docs *.txt
|
|
17
|
+
recursive-include docs Makefile
|
|
18
|
+
recursive-include docs *.py
|
|
19
|
+
|
|
20
|
+
# Include examples and notebooks
|
|
21
|
+
recursive-include examples *.py
|
|
22
|
+
recursive-include examples *.ipynb
|
|
23
|
+
recursive-include notebooks *.ipynb
|
|
24
|
+
|
|
25
|
+
# Include test files
|
|
26
|
+
recursive-include tests *.py
|
|
27
|
+
|
|
28
|
+
# Exclude unnecessary files
|
|
29
|
+
global-exclude *.pyc
|
|
30
|
+
global-exclude *.pyo
|
|
31
|
+
global-exclude *.pyd
|
|
32
|
+
global-exclude __pycache__
|
|
33
|
+
global-exclude .git*
|
|
34
|
+
global-exclude .coverage*
|
|
35
|
+
global-exclude .pytest_cache
|
|
36
|
+
prune **/__pycache__
|
|
37
|
+
prune **/.pytest_cache
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: derivflow-finance
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Advanced derivatives analytics platform for quantitative finance
|
|
5
|
+
Home-page: https://github.com/jeevanba273/derivflow-finance
|
|
6
|
+
Author: Jeevan B A
|
|
7
|
+
Author-email: Jeevan B A <jeevanba273@gmail.com>
|
|
8
|
+
Maintainer-email: Jeevan B A <jeevanba273@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Homepage, https://github.com/jeevanba273/derivflow-finance
|
|
11
|
+
Project-URL: Documentation, https://github.com/jeevanba273/derivflow-finance/wiki
|
|
12
|
+
Project-URL: Repository, https://github.com/jeevanba273/derivflow-finance.git
|
|
13
|
+
Project-URL: Bug Tracker, https://github.com/jeevanba273/derivflow-finance/issues
|
|
14
|
+
Keywords: derivatives,finance,quantitative,options,pricing,risk,analytics,monte-carlo,black-scholes,greeks
|
|
15
|
+
Platform: any
|
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
|
17
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
18
|
+
Classifier: Intended Audience :: Science/Research
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
22
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
23
|
+
Classifier: Programming Language :: Python :: 3
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
29
|
+
Requires-Python: >=3.8
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Requires-Dist: numpy>=1.20.0
|
|
33
|
+
Requires-Dist: scipy>=1.7.0
|
|
34
|
+
Requires-Dist: pandas>=1.3.0
|
|
35
|
+
Requires-Dist: matplotlib>=3.4.0
|
|
36
|
+
Requires-Dist: plotly>=5.0.0
|
|
37
|
+
Requires-Dist: numba>=0.56.0
|
|
38
|
+
Requires-Dist: yfinance>=0.1.70
|
|
39
|
+
Requires-Dist: scikit-learn>=1.0.0
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
|
43
|
+
Requires-Dist: black>=21.0; extra == "dev"
|
|
44
|
+
Requires-Dist: flake8>=3.9; extra == "dev"
|
|
45
|
+
Requires-Dist: mypy>=0.910; extra == "dev"
|
|
46
|
+
Requires-Dist: jupyter>=1.0.0; extra == "dev"
|
|
47
|
+
Provides-Extra: docs
|
|
48
|
+
Requires-Dist: sphinx>=4.0; extra == "docs"
|
|
49
|
+
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
|
|
50
|
+
Requires-Dist: myst-parser>=0.15; extra == "docs"
|
|
51
|
+
Provides-Extra: visualization
|
|
52
|
+
Requires-Dist: plotly>=5.0.0; extra == "visualization"
|
|
53
|
+
Requires-Dist: matplotlib>=3.4.0; extra == "visualization"
|
|
54
|
+
Requires-Dist: seaborn>=0.11.0; extra == "visualization"
|
|
55
|
+
Dynamic: author
|
|
56
|
+
Dynamic: home-page
|
|
57
|
+
Dynamic: license-file
|
|
58
|
+
Dynamic: platform
|
|
59
|
+
Dynamic: requires-python
|
|
60
|
+
|
|
61
|
+
# 🚀 DERIVFLOW-FINANCE
|
|
62
|
+
|
|
63
|
+
**Advanced Derivatives Analytics Platform for Quantitative Finance**
|
|
64
|
+
|
|
65
|
+
[](https://badge.fury.io/py/derivflow-finance)
|
|
66
|
+
[](https://pypi.org/project/derivflow-finance/)
|
|
67
|
+
[](https://opensource.org/licenses/MIT)
|
|
68
|
+
[](https://pepy.tech/project/derivflow-finance)
|
|
69
|
+
|
|
70
|
+
**DERIVFLOW-FINANCE** is a comprehensive, professional-grade derivatives analytics platform built for quantitative finance professionals, researchers, and institutions. It provides advanced pricing models, risk analytics, and portfolio management tools with institutional-quality accuracy and performance.
|
|
71
|
+
|
|
72
|
+
## 🌟 **Key Features**
|
|
73
|
+
|
|
74
|
+
### 📊 **Advanced Pricing Models**
|
|
75
|
+
|
|
76
|
+
- **Multiple Methodologies**: Black-Scholes analytical, Binomial trees, Monte Carlo simulation
|
|
77
|
+
- **Exotic Options**: Barrier options (all variants), Asian options (arithmetic/geometric)
|
|
78
|
+
- **Stochastic Models**: Heston stochastic volatility model with calibration
|
|
79
|
+
- **Greeks Calculation**: Complete 1st, 2nd, and 3rd order Greeks with advanced sensitivities
|
|
80
|
+
|
|
81
|
+
### 💹 **Real-Time Market Data**
|
|
82
|
+
|
|
83
|
+
- **Live Data Integration**: Yahoo Finance API with intelligent caching
|
|
84
|
+
- **Options Chains**: Complete options data with implied volatilities
|
|
85
|
+
- **Historical Analytics**: Volatility calculation and risk-free rate extraction
|
|
86
|
+
- **Market Status**: Real-time market hours and trading status
|
|
87
|
+
|
|
88
|
+
### 📈 **Professional Risk Management**
|
|
89
|
+
|
|
90
|
+
- **Portfolio Analytics**: Multi-asset portfolio construction and valuation
|
|
91
|
+
- **VaR Calculation**: Parametric and Monte Carlo Value-at-Risk
|
|
92
|
+
- **Scenario Analysis**: Stress testing with custom scenarios
|
|
93
|
+
- **Hedging Optimization**: Delta hedging and risk minimization
|
|
94
|
+
|
|
95
|
+
### 🎨 **Interactive Visualizations**
|
|
96
|
+
|
|
97
|
+
- **3D Volatility Surfaces**: Professional volatility modeling with interpolation
|
|
98
|
+
- **Greeks Dashboards**: Interactive sensitivity analysis
|
|
99
|
+
- **Payoff Diagrams**: Option payoff and P&L visualization
|
|
100
|
+
- **Risk Charts**: Portfolio risk decomposition and analytics
|
|
101
|
+
|
|
102
|
+
## 🚀 **Quick Start**
|
|
103
|
+
|
|
104
|
+
### Installation
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pip install derivflow-finance
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Basic Usage
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from derivflow import PricingEngine, GreeksCalculator, VolatilitySurface
|
|
114
|
+
|
|
115
|
+
# Price a European option
|
|
116
|
+
from derivflow.core import price_european_option
|
|
117
|
+
price = price_european_option(S=100, K=105, T=0.25, r=0.05, sigma=0.2, option_type='call')
|
|
118
|
+
print(f"Option Price: ${price:.2f}")
|
|
119
|
+
|
|
120
|
+
# Calculate Greeks
|
|
121
|
+
from derivflow.greeks import GreeksCalculator
|
|
122
|
+
calc = GreeksCalculator()
|
|
123
|
+
greeks = calc.calculate_greeks(S=100, K=105, T=0.25, r=0.05, sigma=0.2, option_type='call')
|
|
124
|
+
print(f"Delta: {greeks.delta:.4f}")
|
|
125
|
+
|
|
126
|
+
# Price exotic options
|
|
127
|
+
from derivflow.exotic import BarrierOptions, AsianOptions
|
|
128
|
+
|
|
129
|
+
# Barrier option
|
|
130
|
+
barrier = BarrierOptions()
|
|
131
|
+
result = barrier.price(S=100, K=105, H=95, T=0.25, r=0.05, sigma=0.2,
|
|
132
|
+
barrier_type='down_and_out', option_type='call')
|
|
133
|
+
print(f"Barrier Option: ${result.price:.4f}")
|
|
134
|
+
|
|
135
|
+
# Asian option with variance reduction
|
|
136
|
+
asian = AsianOptions()
|
|
137
|
+
result = asian.price(S=100, K=105, T=0.25, r=0.05, sigma=0.2,
|
|
138
|
+
option_type='call', asian_type='arithmetic')
|
|
139
|
+
print(f"Asian Option: ${result.price:.4f} ± {result.std_error:.4f}")
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Portfolio Risk Analytics
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from derivflow.portfolio import PortfolioRiskAnalyzer
|
|
146
|
+
|
|
147
|
+
# Create portfolio
|
|
148
|
+
portfolio = PortfolioRiskAnalyzer()
|
|
149
|
+
|
|
150
|
+
# Add positions
|
|
151
|
+
portfolio.add_stock_position('AAPL', quantity=100, current_price=150, volatility=0.25)
|
|
152
|
+
portfolio.add_option_position('AAPL', quantity=10, current_price=150,
|
|
153
|
+
strike=155, expiry=0.25, option_type='call', volatility=0.25)
|
|
154
|
+
|
|
155
|
+
# Calculate risk metrics
|
|
156
|
+
portfolio_value = portfolio.calculate_portfolio_value()
|
|
157
|
+
greeks = portfolio.calculate_portfolio_greeks()
|
|
158
|
+
var_95, es_95 = portfolio.calculate_var_parametric(0.95)
|
|
159
|
+
|
|
160
|
+
print(f"Portfolio Value: ${portfolio_value:,.2f}")
|
|
161
|
+
print(f"Portfolio Delta: {greeks['delta']:.2f}")
|
|
162
|
+
print(f"95% VaR: ${var_95:,.2f}")
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Volatility Surface Modeling
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
from derivflow.volatility import create_sample_surface
|
|
169
|
+
|
|
170
|
+
# Create and build volatility surface
|
|
171
|
+
surface = create_sample_surface()
|
|
172
|
+
surface.build_surface()
|
|
173
|
+
|
|
174
|
+
# Get volatility smile
|
|
175
|
+
smile = surface.get_smile(expiry=0.25, num_points=10)
|
|
176
|
+
|
|
177
|
+
# Interpolate volatility
|
|
178
|
+
vol = surface.interpolate(strike=102, expiry=0.33)
|
|
179
|
+
print(f"Interpolated Volatility: {vol:.1%}")
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## 🎯 **Advanced Features**
|
|
183
|
+
|
|
184
|
+
### Stochastic Volatility Models
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
from derivflow.models import HestonModel
|
|
188
|
+
|
|
189
|
+
# Heston stochastic volatility
|
|
190
|
+
heston = HestonModel()
|
|
191
|
+
heston.set_parameters(v0=0.04, kappa=2.0, theta=0.04, sigma=0.3, rho=-0.7)
|
|
192
|
+
|
|
193
|
+
# Price with stochastic volatility
|
|
194
|
+
result = heston.price_option(S=100, K=105, T=0.25, r=0.05,
|
|
195
|
+
option_type='call', method='monte_carlo')
|
|
196
|
+
print(f"Heston Price: ${result.price:.4f}")
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Real-Time Market Data
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
from derivflow.utils import AdvancedMarketData
|
|
203
|
+
|
|
204
|
+
# Get live market data
|
|
205
|
+
market_data = AdvancedMarketData()
|
|
206
|
+
price, timestamp = market_data.get_current_price('AAPL')
|
|
207
|
+
vol = market_data.get_historical_volatility('AAPL', days=30)
|
|
208
|
+
|
|
209
|
+
print(f"Current AAPL: ${price:.2f}")
|
|
210
|
+
print(f"30-day Volatility: {vol:.1%}")
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## 📊 **Performance Benchmarks**
|
|
214
|
+
|
|
215
|
+
DERIVFLOW-FINANCE is optimized for institutional-grade performance:
|
|
216
|
+
|
|
217
|
+
- **Black-Scholes Pricing**: 4,000+ options per second
|
|
218
|
+
- **Monte Carlo Simulation**: 10,000 paths in <0.2 seconds
|
|
219
|
+
- **Asian Options**: 1,500x variance reduction with control variates
|
|
220
|
+
- **Greeks Calculation**: Complete sensitivity analysis in milliseconds
|
|
221
|
+
|
|
222
|
+
## 🎓 **Use Cases**
|
|
223
|
+
|
|
224
|
+
### **Investment Banking & Trading**
|
|
225
|
+
|
|
226
|
+
- Derivatives structuring and pricing
|
|
227
|
+
- Real-time risk management
|
|
228
|
+
- Volatility trading strategies
|
|
229
|
+
- Exotic products development
|
|
230
|
+
|
|
231
|
+
### **Academic Research**
|
|
232
|
+
|
|
233
|
+
- Financial engineering research
|
|
234
|
+
- Quantitative finance education
|
|
235
|
+
- PhD dissertations and papers
|
|
236
|
+
- Teaching materials and examples
|
|
237
|
+
|
|
238
|
+
### **Portfolio Management**
|
|
239
|
+
|
|
240
|
+
- Multi-asset portfolio construction
|
|
241
|
+
- Risk analytics and VaR calculation
|
|
242
|
+
- Hedging strategy optimization
|
|
243
|
+
- Stress testing and scenario analysis
|
|
244
|
+
|
|
245
|
+
### **Fintech Development**
|
|
246
|
+
|
|
247
|
+
- Pricing engines for trading platforms
|
|
248
|
+
- Risk management systems
|
|
249
|
+
- Regulatory compliance tools
|
|
250
|
+
- API development for financial services
|
|
251
|
+
|
|
252
|
+
## 🛠️ **Installation Options**
|
|
253
|
+
|
|
254
|
+
### Standard Installation
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
pip install derivflow-finance
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Development Installation
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
pip install derivflow-finance[dev]
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Full Installation (all features)
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
pip install derivflow-finance[visualization,testing,docs]
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## 📚 **Documentation**
|
|
273
|
+
|
|
274
|
+
- **API Reference**: Complete function and class documentation
|
|
275
|
+
- **User Guide**: Step-by-step tutorials and examples
|
|
276
|
+
- **Theory Guide**: Mathematical foundations and model explanations
|
|
277
|
+
- **Examples**: Jupyter notebooks with real-world applications
|
|
278
|
+
|
|
279
|
+
## 🤝 **Contributing**
|
|
280
|
+
|
|
281
|
+
We welcome contributions from the quantitative finance community! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
282
|
+
|
|
283
|
+
### Development Setup
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
git clone https://github.com/jeevanba273/derivflow-finance.git
|
|
287
|
+
cd derivflow-finance
|
|
288
|
+
pip install -e .[dev]
|
|
289
|
+
pytest tests/
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## 📄 **License**
|
|
293
|
+
|
|
294
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
295
|
+
|
|
296
|
+
## 🌟 **Acknowledgments**
|
|
297
|
+
|
|
298
|
+
- Built with modern Python scientific computing stack
|
|
299
|
+
- Inspired by quantitative finance research and industry best practices
|
|
300
|
+
- Designed for both academic research and commercial applications
|
|
301
|
+
|
|
302
|
+
## 📞 **Contact & Support**
|
|
303
|
+
|
|
304
|
+
- **Author**: Jeevan B A
|
|
305
|
+
- **Email**: jeevanba273@gmail.com
|
|
306
|
+
- **GitHub**: [@jeevanba273](https://github.com/jeevanba273)
|
|
307
|
+
- **Issues**: [GitHub Issues](https://github.com/jeevanba273/derivflow-finance/issues)
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
**⭐ Star this repository if DERIVFLOW-FINANCE helps your quantitative finance projects!**
|
|
312
|
+
|
|
313
|
+
**🚀 Built for the global quantitative finance community by Jeevan B A**
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# 🚀 DERIVFLOW-FINANCE
|
|
2
|
+
|
|
3
|
+
**Advanced Derivatives Analytics Platform for Quantitative Finance**
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/py/derivflow-finance)
|
|
6
|
+
[](https://pypi.org/project/derivflow-finance/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://pepy.tech/project/derivflow-finance)
|
|
9
|
+
|
|
10
|
+
**DERIVFLOW-FINANCE** is a comprehensive, professional-grade derivatives analytics platform built for quantitative finance professionals, researchers, and institutions. It provides advanced pricing models, risk analytics, and portfolio management tools with institutional-quality accuracy and performance.
|
|
11
|
+
|
|
12
|
+
## 🌟 **Key Features**
|
|
13
|
+
|
|
14
|
+
### 📊 **Advanced Pricing Models**
|
|
15
|
+
|
|
16
|
+
- **Multiple Methodologies**: Black-Scholes analytical, Binomial trees, Monte Carlo simulation
|
|
17
|
+
- **Exotic Options**: Barrier options (all variants), Asian options (arithmetic/geometric)
|
|
18
|
+
- **Stochastic Models**: Heston stochastic volatility model with calibration
|
|
19
|
+
- **Greeks Calculation**: Complete 1st, 2nd, and 3rd order Greeks with advanced sensitivities
|
|
20
|
+
|
|
21
|
+
### 💹 **Real-Time Market Data**
|
|
22
|
+
|
|
23
|
+
- **Live Data Integration**: Yahoo Finance API with intelligent caching
|
|
24
|
+
- **Options Chains**: Complete options data with implied volatilities
|
|
25
|
+
- **Historical Analytics**: Volatility calculation and risk-free rate extraction
|
|
26
|
+
- **Market Status**: Real-time market hours and trading status
|
|
27
|
+
|
|
28
|
+
### 📈 **Professional Risk Management**
|
|
29
|
+
|
|
30
|
+
- **Portfolio Analytics**: Multi-asset portfolio construction and valuation
|
|
31
|
+
- **VaR Calculation**: Parametric and Monte Carlo Value-at-Risk
|
|
32
|
+
- **Scenario Analysis**: Stress testing with custom scenarios
|
|
33
|
+
- **Hedging Optimization**: Delta hedging and risk minimization
|
|
34
|
+
|
|
35
|
+
### 🎨 **Interactive Visualizations**
|
|
36
|
+
|
|
37
|
+
- **3D Volatility Surfaces**: Professional volatility modeling with interpolation
|
|
38
|
+
- **Greeks Dashboards**: Interactive sensitivity analysis
|
|
39
|
+
- **Payoff Diagrams**: Option payoff and P&L visualization
|
|
40
|
+
- **Risk Charts**: Portfolio risk decomposition and analytics
|
|
41
|
+
|
|
42
|
+
## 🚀 **Quick Start**
|
|
43
|
+
|
|
44
|
+
### Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install derivflow-finance
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Basic Usage
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from derivflow import PricingEngine, GreeksCalculator, VolatilitySurface
|
|
54
|
+
|
|
55
|
+
# Price a European option
|
|
56
|
+
from derivflow.core import price_european_option
|
|
57
|
+
price = price_european_option(S=100, K=105, T=0.25, r=0.05, sigma=0.2, option_type='call')
|
|
58
|
+
print(f"Option Price: ${price:.2f}")
|
|
59
|
+
|
|
60
|
+
# Calculate Greeks
|
|
61
|
+
from derivflow.greeks import GreeksCalculator
|
|
62
|
+
calc = GreeksCalculator()
|
|
63
|
+
greeks = calc.calculate_greeks(S=100, K=105, T=0.25, r=0.05, sigma=0.2, option_type='call')
|
|
64
|
+
print(f"Delta: {greeks.delta:.4f}")
|
|
65
|
+
|
|
66
|
+
# Price exotic options
|
|
67
|
+
from derivflow.exotic import BarrierOptions, AsianOptions
|
|
68
|
+
|
|
69
|
+
# Barrier option
|
|
70
|
+
barrier = BarrierOptions()
|
|
71
|
+
result = barrier.price(S=100, K=105, H=95, T=0.25, r=0.05, sigma=0.2,
|
|
72
|
+
barrier_type='down_and_out', option_type='call')
|
|
73
|
+
print(f"Barrier Option: ${result.price:.4f}")
|
|
74
|
+
|
|
75
|
+
# Asian option with variance reduction
|
|
76
|
+
asian = AsianOptions()
|
|
77
|
+
result = asian.price(S=100, K=105, T=0.25, r=0.05, sigma=0.2,
|
|
78
|
+
option_type='call', asian_type='arithmetic')
|
|
79
|
+
print(f"Asian Option: ${result.price:.4f} ± {result.std_error:.4f}")
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Portfolio Risk Analytics
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from derivflow.portfolio import PortfolioRiskAnalyzer
|
|
86
|
+
|
|
87
|
+
# Create portfolio
|
|
88
|
+
portfolio = PortfolioRiskAnalyzer()
|
|
89
|
+
|
|
90
|
+
# Add positions
|
|
91
|
+
portfolio.add_stock_position('AAPL', quantity=100, current_price=150, volatility=0.25)
|
|
92
|
+
portfolio.add_option_position('AAPL', quantity=10, current_price=150,
|
|
93
|
+
strike=155, expiry=0.25, option_type='call', volatility=0.25)
|
|
94
|
+
|
|
95
|
+
# Calculate risk metrics
|
|
96
|
+
portfolio_value = portfolio.calculate_portfolio_value()
|
|
97
|
+
greeks = portfolio.calculate_portfolio_greeks()
|
|
98
|
+
var_95, es_95 = portfolio.calculate_var_parametric(0.95)
|
|
99
|
+
|
|
100
|
+
print(f"Portfolio Value: ${portfolio_value:,.2f}")
|
|
101
|
+
print(f"Portfolio Delta: {greeks['delta']:.2f}")
|
|
102
|
+
print(f"95% VaR: ${var_95:,.2f}")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Volatility Surface Modeling
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from derivflow.volatility import create_sample_surface
|
|
109
|
+
|
|
110
|
+
# Create and build volatility surface
|
|
111
|
+
surface = create_sample_surface()
|
|
112
|
+
surface.build_surface()
|
|
113
|
+
|
|
114
|
+
# Get volatility smile
|
|
115
|
+
smile = surface.get_smile(expiry=0.25, num_points=10)
|
|
116
|
+
|
|
117
|
+
# Interpolate volatility
|
|
118
|
+
vol = surface.interpolate(strike=102, expiry=0.33)
|
|
119
|
+
print(f"Interpolated Volatility: {vol:.1%}")
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 🎯 **Advanced Features**
|
|
123
|
+
|
|
124
|
+
### Stochastic Volatility Models
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from derivflow.models import HestonModel
|
|
128
|
+
|
|
129
|
+
# Heston stochastic volatility
|
|
130
|
+
heston = HestonModel()
|
|
131
|
+
heston.set_parameters(v0=0.04, kappa=2.0, theta=0.04, sigma=0.3, rho=-0.7)
|
|
132
|
+
|
|
133
|
+
# Price with stochastic volatility
|
|
134
|
+
result = heston.price_option(S=100, K=105, T=0.25, r=0.05,
|
|
135
|
+
option_type='call', method='monte_carlo')
|
|
136
|
+
print(f"Heston Price: ${result.price:.4f}")
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Real-Time Market Data
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from derivflow.utils import AdvancedMarketData
|
|
143
|
+
|
|
144
|
+
# Get live market data
|
|
145
|
+
market_data = AdvancedMarketData()
|
|
146
|
+
price, timestamp = market_data.get_current_price('AAPL')
|
|
147
|
+
vol = market_data.get_historical_volatility('AAPL', days=30)
|
|
148
|
+
|
|
149
|
+
print(f"Current AAPL: ${price:.2f}")
|
|
150
|
+
print(f"30-day Volatility: {vol:.1%}")
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## 📊 **Performance Benchmarks**
|
|
154
|
+
|
|
155
|
+
DERIVFLOW-FINANCE is optimized for institutional-grade performance:
|
|
156
|
+
|
|
157
|
+
- **Black-Scholes Pricing**: 4,000+ options per second
|
|
158
|
+
- **Monte Carlo Simulation**: 10,000 paths in <0.2 seconds
|
|
159
|
+
- **Asian Options**: 1,500x variance reduction with control variates
|
|
160
|
+
- **Greeks Calculation**: Complete sensitivity analysis in milliseconds
|
|
161
|
+
|
|
162
|
+
## 🎓 **Use Cases**
|
|
163
|
+
|
|
164
|
+
### **Investment Banking & Trading**
|
|
165
|
+
|
|
166
|
+
- Derivatives structuring and pricing
|
|
167
|
+
- Real-time risk management
|
|
168
|
+
- Volatility trading strategies
|
|
169
|
+
- Exotic products development
|
|
170
|
+
|
|
171
|
+
### **Academic Research**
|
|
172
|
+
|
|
173
|
+
- Financial engineering research
|
|
174
|
+
- Quantitative finance education
|
|
175
|
+
- PhD dissertations and papers
|
|
176
|
+
- Teaching materials and examples
|
|
177
|
+
|
|
178
|
+
### **Portfolio Management**
|
|
179
|
+
|
|
180
|
+
- Multi-asset portfolio construction
|
|
181
|
+
- Risk analytics and VaR calculation
|
|
182
|
+
- Hedging strategy optimization
|
|
183
|
+
- Stress testing and scenario analysis
|
|
184
|
+
|
|
185
|
+
### **Fintech Development**
|
|
186
|
+
|
|
187
|
+
- Pricing engines for trading platforms
|
|
188
|
+
- Risk management systems
|
|
189
|
+
- Regulatory compliance tools
|
|
190
|
+
- API development for financial services
|
|
191
|
+
|
|
192
|
+
## 🛠️ **Installation Options**
|
|
193
|
+
|
|
194
|
+
### Standard Installation
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
pip install derivflow-finance
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Development Installation
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
pip install derivflow-finance[dev]
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Full Installation (all features)
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
pip install derivflow-finance[visualization,testing,docs]
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## 📚 **Documentation**
|
|
213
|
+
|
|
214
|
+
- **API Reference**: Complete function and class documentation
|
|
215
|
+
- **User Guide**: Step-by-step tutorials and examples
|
|
216
|
+
- **Theory Guide**: Mathematical foundations and model explanations
|
|
217
|
+
- **Examples**: Jupyter notebooks with real-world applications
|
|
218
|
+
|
|
219
|
+
## 🤝 **Contributing**
|
|
220
|
+
|
|
221
|
+
We welcome contributions from the quantitative finance community! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
222
|
+
|
|
223
|
+
### Development Setup
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
git clone https://github.com/jeevanba273/derivflow-finance.git
|
|
227
|
+
cd derivflow-finance
|
|
228
|
+
pip install -e .[dev]
|
|
229
|
+
pytest tests/
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 📄 **License**
|
|
233
|
+
|
|
234
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
235
|
+
|
|
236
|
+
## 🌟 **Acknowledgments**
|
|
237
|
+
|
|
238
|
+
- Built with modern Python scientific computing stack
|
|
239
|
+
- Inspired by quantitative finance research and industry best practices
|
|
240
|
+
- Designed for both academic research and commercial applications
|
|
241
|
+
|
|
242
|
+
## 📞 **Contact & Support**
|
|
243
|
+
|
|
244
|
+
- **Author**: Jeevan B A
|
|
245
|
+
- **Email**: jeevanba273@gmail.com
|
|
246
|
+
- **GitHub**: [@jeevanba273](https://github.com/jeevanba273)
|
|
247
|
+
- **Issues**: [GitHub Issues](https://github.com/jeevanba273/derivflow-finance/issues)
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
**⭐ Star this repository if DERIVFLOW-FINANCE helps your quantitative finance projects!**
|
|
252
|
+
|
|
253
|
+
**🚀 Built for the global quantitative finance community by Jeevan B A**
|