Metadata-Version: 2.4
Name: fdequant
Version: 1.0.2
Summary: Institutional-Grade Quantitative Finance Library
Author: Aayush Mishra
License: Proprietary - All Rights Reserved
Project-URL: Homepage, https://github.com/your-username/fdequant
Project-URL: Repository, https://github.com/your-username/fdequant
Project-URL: Documentation, https://github.com/your-username/fdequant#readme
Project-URL: Issues, https://github.com/your-username/fdequant/issues
Keywords: quantitative-finance,backtesting,technical-analysis,trading,risk-management
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Developers
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: yfinance>=0.2.0
Requires-Dist: loguru>=0.6.0
Requires-Dist: scikit-learn>=1.0.0
Requires-Dist: xgboost>=1.5.0
Requires-Dist: openpyxl>=3.0.0
Provides-Extra: pdf
Requires-Dist: weasyprint>=59.0; extra == "pdf"
Provides-Extra: dev
Requires-Dist: build>=1.0.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Dynamic: license-file


```markdown
<div align="center">

# 🚀 fdequant

### Production-Ready Quantitative Finance Library for Python

Build, analyze, optimize, simulate, and evaluate quantitative trading strategies with a unified Python framework.

<p>

[![PyPI Version](https://img.shields.io/pypi/v/fdequant?style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/fdequant/)
[![Python](https://img.shields.io/pypi/pyversions/fdequant?style=for-the-badge&logo=python&logoColor=white)](https://pypi.org/project/fdequant/)
[![Downloads](https://img.shields.io/pypi/dm/fdequant?style=for-the-badge)](https://pypi.org/project/fdequant/)
[![License](https://img.shields.io/badge/License-Proprietary-red?style=for-the-badge)](LICENSE)

</p>

<p>

<a href="https://github.com/Aayushmishra52/fdequant">
<img src="https://img.shields.io/badge/GitHub-Repository-181717?style=for-the-badge&logo=github&logoColor=white">
</a>

<a href="https://www.linkedin.com/in/aayush-mishra52/">
<img src="https://img.shields.io/badge/LinkedIn-Connect-0077B5?style=for-the-badge&logo=linkedin&logoColor=white">
</a>

<a href="https://x.com/Aayushmishra52">
<img src="https://img.shields.io/badge/X-Follow-000000?style=for-the-badge&logo=x&logoColor=white">
</a>

<a href="mailto:aayushmishra062005@gmail.com">
<img src="https://img.shields.io/badge/Email-Contact-EA4335?style=for-the-badge&logo=gmail&logoColor=white">
</a>

</p>

---

**Production-Ready • Algorithmic Trading • Portfolio Analytics • Quantitative Research • Risk Management • Machine Learning**

```

  <p>
    <a href="#-key-features">Features</a> •
    <a href="#-installation">Installation</a> •
    <a href="#-quick-start">Quick Start</a> •
    <a href="#-license">License</a>
  </p>
</div>

---

## 👋 Why fdequant?

Hi, I'm Aayush Mishra, and I built fdequant to solve the pain points I saw firsthand in quantitative finance:

- **Fragmented tools**: Traders and analysts waste hours stitching together libraries.
- **Limited strategy testing**: Backtesting is often oversimplified or too slow.
- **No all-in-one solution**: Risk management, technical analysis, reporting, and screening are siloed.

fdequant changes that by being a single, production-grade library that handles everything from backtesting to reporting—so you can focus on what matters: building winning strategies.
**fdequant** is a **production-ready quantitative finance platform** that unifies **risk management, portfolio optimization, machine learning, technical analysis, strategy development, market screening, simulation, reporting, and algorithmic research** within a single Python package.

Designed with a modular architecture, clean APIs, and extensible components, **fdequant** enables developers, quantitative researchers, and fintech teams to build scalable financial applications, perform advanced quantitative analysis, and accelerate strategy development with confidence.

---

## 🚀 Key Features

# 🚀 Core Platform Capabilities

**fdequant** is a **production-ready quantitative finance library** designed for quantitative researchers, algorithmic traders, developers, fintech teams, and financial professionals. It combines advanced risk analytics, portfolio optimization, strategy development, technical analysis, market screening, simulation, and reporting into a unified Python framework.

The platform currently provides **11 production-ready capabilities** for quantitative research and financial engineering.

---

# 1. Advanced Risk Analysis

Perform comprehensive risk assessment for portfolios and individual financial instruments with a flexible and scalable analytics engine.

### Features

* Portfolio Risk Analysis
* Asset-Level Risk Assessment
* Volatility Analysis
* Exposure Analysis
* Correlation Analysis
* Multi-Asset Support
* Risk Decomposition
* Flexible Risk Framework

---

# 2. Real-Time Market Data Processing

Continuously process market data to keep portfolio analytics and risk calculations updated.

### Features

* Real-Time Market Updates
* Historical Market Data
* Automatic Data Synchronization
* Efficient Processing Pipeline
* Continuous Portfolio Monitoring
* High-Performance Data Handling

---

# 3. Machine Learning Risk Forecasting

Predict portfolio behavior and future market risk using machine learning models.

### Features

* Predictive Risk Analytics
* XGBoost-Based Forecasting
* Intelligent Risk Scoring
* Data-Driven Insights
* Future Risk Estimation
* Continuous Model Improvement

---

# 4. Portfolio Optimization Engine

Optimize portfolio allocations using quantitative optimization techniques.

### Features

* Maximum Sharpe Optimization
* Minimum Volatility Portfolio
* Efficient Portfolio Construction
* Risk-Adjusted Allocation
* Portfolio Rebalancing
* Performance Optimization

---

# 5. Custom Risk Metrics Framework

Measure portfolio health using built-in and custom quantitative metrics.

### Supported Metrics

* Value at Risk (VaR)
* Conditional Value at Risk (CVaR)
* Volatility
* Portfolio Exposure
* Expected Shortfall
* User-Defined Risk Metrics

---

# 6. Advanced Strategy Backtesting Engine

Design, evaluate, and validate trading strategies before deployment.

### Built-in Strategies

* SMA
* EMA
* RSI
* MACD
* Bollinger Bands
* Moving Average Cross

### Performance Analytics

* CAGR
* Annual Return
* Sharpe Ratio
* Sortino Ratio
* Calmar Ratio
* Profit Factor
* Win Rate
* Maximum Drawdown
* Equity Curve
* Trade History

---

# 7. Professional Stock Screener

Discover investment opportunities using powerful technical and fundamental filters.

### Technical Filters

* RSI
* EMA
* SMA
* MACD
* ADX
* ATR
* VWAP
* SuperTrend
* Bollinger Bands
* Ichimoku Cloud
* Breakout Detection
* Volume Spike
* Gap Analysis
* 52-Week High / Low

### Fundamental Filters

* Market Capitalization
* Price-to-Earnings (P/E)
* Price-to-Book (P/B)
* Earnings Per Share (EPS)
* Return on Equity (ROE)
* Dividend Yield
* Debt-to-Equity Ratio

### Additional Capabilities

* Ranking Engine
* CSV Export
* Custom Screening Rules

---

# 8. Monte Carlo Portfolio Simulation

Evaluate portfolio performance across thousands of simulated market scenarios.

### Simulation Options

* 10,000+
* 50,000+
* 100,000+

### Analytics

* Probability of Profit
* Probability of Loss
* VaR
* CVaR
* Confidence Intervals
* Best-Case Scenario
* Worst-Case Scenario
* Expected Portfolio Value
* Median Outcome

---

# 9. Technical Indicator Engine

A comprehensive technical analysis engine with production-ready indicators.

### Included Indicators

* RSI
* SMA
* EMA
* WMA
* VWAP
* MACD
* ATR
* ADX
* CCI
* ROC
* Momentum
* OBV
* CMF
* SuperTrend
* Ichimoku Cloud
* Stochastic RSI
* Williams %R
* Parabolic SAR
* Bollinger Bands
* Keltner Channel
* Donchian Channel

All indicators return clean Pandas objects for seamless integration into data science and quantitative workflows.

---

# 10. Professional Report Generator

Generate detailed reports suitable for portfolio reviews, quantitative research, and financial analysis.

### Export Formats

* PDF
* Excel
* HTML

### Report Contents

* Portfolio Summary
* Performance Analytics
* Risk Analysis
* Asset Allocation
* Strategy Performance
* Trade History
* Monte Carlo Results
* Technical Analysis Summary

---

# 11. Strategy Builder DSL

Build algorithmic trading strategies using a clean, fluent, and developer-friendly API.

### Workflow

* Define Entry Rules
* Configure Exit Conditions
* Apply Stop Loss
* Configure Take Profit
* Execute Backtests
* Evaluate Performance
* Iterate Strategies Quickly

The Strategy Builder significantly reduces development time while keeping strategies modular, readable, and easy to maintain.

---

## 📦 Installation

Install directly from PyPI:

```bash
pip install fdequant
```

Verify the installation:

```python
import fdequant

print(fdequant.__version__)
```

---

## Upgrade

```bash
pip install --upgrade fdequant
```
---

## 💡 Quick Start

Let's run a complete example that demonstrates the power of fdequant!

```python
import yfinance as yf
from fdequant import (
    Backtester,
    SMAStrategy,
    Strategy,
    StockScreener,
    MonteCarloSimulation,
    ReportGenerator
)

# 1. Backtest an SMA Crossover Strategy
data = yf.Ticker("AAPL").history(period="5y")
strategy = SMAStrategy(short_window=20, long_window=50)
backtester = Backtester(initial_capital=100000)
backtest_results = backtester.run(strategy, data)
print("Backtest Complete!")
print(f"Total Return: {backtest_results.total_return:.2%}")

# 2. Build a Custom Strategy with the DSL
def buy_condition(df):
    from fdequant import sma
    return sma(df['Close'], 20) > sma(df['Close'], 50)

def sell_condition(df):
    from fdequant import sma
    return sma(df['Close'], 20) < sma(df['Close'], 50)

custom_strategy = (
    Strategy()
    .buy_when(buy_condition)
    .sell_when(sell_condition)
    .stoploss(0.02)  # 2% stop loss
    .takeprofit(0.05)  # 5% take profit
)
dsl_results = custom_strategy.backtest(data, initial_capital=100000)

# 3. Screen for Promising Stocks
screener = (
    StockScreener(tickers=["AAPL", "MSFT", "GOOGL", "AMZN", "META"])
    .rsi_filter(min_val=30, max_val=70)
    .sma_filter(window=50, price_above=True)
    .load_data(period="1y")
)
screened_stocks = screener.run()
print("Screened Stocks:")
print(screened_stocks)

# 4. Run Monte Carlo Simulation
tickers = ["AAPL", "MSFT", "GOOGL"]
portfolio_data = yf.download(tickers, period="5y")['Close']
returns = portfolio_data.pct_change().dropna()
simulator = MonteCarloSimulation(initial_investment=10000, time_horizon=252)
mc_results = simulator.simulate(returns, num_simulations=10000)
print("\nMonte Carlo Results:")
print(f"Probability of Profit: {mc_results.probability_of_profit:.2%}")
print(f"VaR (95%): {mc_results.var_95:.2%}")

# 5. Generate a Professional Report
generator = ReportGenerator(title="fdequant Analysis Report")
generator.generate_excel(
    "fdequant_report.xlsx",
    performance=backtest_results,
    monte_carlo=mc_results,
    portfolio_data=screened_stocks
)
generator.generate_html(
    "fdequant_report.html",
    performance=backtest_results,
    monte_carlo=mc_results,
    portfolio_data=screened_stocks
)
print("\nReports generated: fdequant_report.xlsx and fdequant_report.html")
```

For more examples, check out `advanced_example.py` and `example.py`.

---

## 📊 Project Structure

```
fdequant/
├── fdequant/                   # Main library package
│   ├── indicators/             # Technical indicators
│   ├── backtesting/            # Backtesting engine & strategies
│   ├── screener/               # Stock screener
│   ├── monte_carlo/            # Monte Carlo simulation
│   ├── reports/                # Report generator
│   ├── strategy_dsl/           # Strategy builder DSL
│   ├── main.py                 # Original risk management features
│   └── oa_v2.py                # Ensemble risk assessment
├── advanced_example.py         # Advanced usage examples
├── example.py                  # Original risk management example
├── requirements.txt            # Dependencies
├── LICENSE                     # License (all rights reserved to Aayush Mishra)
└── README.md                   # This file!
```

---

## 🛠️ Tech Stack

- **Core**: Python 3.8+
- **Data**: pandas, numpy, yfinance
- **Machine Learning**: scikit-learn, XGBoost
- **Visualization/Reports**: openpyxl (Excel), weasyprint (optional PDF)
- **Logging**: loguru

---

## 🔒 License

**All Rights Reserved. Aayush Mishra.**

This software is the exclusive property of Aayush Mishra. No part of this library may be reproduced, modified, distributed, or used in any form without explicit written permission. **Editing or altering the code is strictly prohibited.**

For inquiries, contact Aayush Mishra.

---

## 🤝 About the Developer

Aayush Mishra built fdequant to bring institutional-grade quantitative finance tools to everyone. With deep expertise in machine learning, risk management, and financial markets, Aayush is passionate about building practical, production-ready solutions.

---

<div align="center">
  <p>Built with passion by Aayush Mishra</p>
</div>
