Metadata-Version: 2.4
Name: sistema-optimizacion-mat
Version: 0.2.0
Summary: MAT backtesting engine (BTC/ETH futures) plus DRE MVP orchestration components.
License-Expression: MIT
Project-URL: Homepage, https://github.com/emilianob-ux/SISTEMA-OPTIMIZACION-MAT
Project-URL: Documentation, https://github.com/emilianob-ux/SISTEMA-OPTIMIZACION-MAT/blob/main/docs/tutorial_quickstart.md
Project-URL: Repository, https://github.com/emilianob-ux/SISTEMA-OPTIMIZACION-MAT
Project-URL: Issues, https://github.com/emilianob-ux/SISTEMA-OPTIMIZACION-MAT/issues
Project-URL: PyPI, https://pypi.org/project/sistema-optimizacion-mat/
Keywords: backtest,quantitative-finance,binance,futures,monte-carlo,optimization
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<3,>=1.24
Requires-Dist: requests<3,>=2.28.0
Provides-Extra: dev
Requires-Dist: pytest<9,>=8; extra == "dev"
Requires-Dist: ruff<1,>=0.9; extra == "dev"
Requires-Dist: pre-commit<5,>=4; extra == "dev"
Requires-Dist: pydantic<3,>=2; extra == "dev"
Requires-Dist: scipy<2,>=1.11; extra == "dev"
Requires-Dist: fastapi<1,>=0.115; extra == "dev"
Requires-Dist: uvicorn<1,>=0.30; extra == "dev"
Requires-Dist: httpx<1,>=0.27; extra == "dev"
Requires-Dist: redis<6,>=5; extra == "dev"
Requires-Dist: fakeredis<3,>=2; extra == "dev"
Dynamic: license-file

﻿# Sistema de optimización MAT + Decision Resilience Engine (DRE)

Framework de investigación y ejecución para **optimización cuantitativa resiliente**:

- **MAT**: backtest compuesto BTC/ETH (futuros USDT) con ventanas deslizantes, funding y optimización de reglas de señal.
- **DRE (MVP)**: orquestador con FSM, governance append-only, checkpoints/resume, API FastAPI, storage memoria/Redis y puente de medición a MAT.

[![CI](https://github.com/emilianob-ux/SISTEMA-OPTIMIZACION-MAT/actions/workflows/ci.yml/badge.svg)](https://github.com/emilianob-ux/SISTEMA-OPTIMIZACION-MAT/actions/workflows/ci.yml)
[![Python 3.11+](https://img.shields.io/badge/python-3.11%20|%203.12-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![PyPI](https://img.shields.io/pypi/v/sistema-optimizacion-mat.svg)](https://pypi.org/project/sistema-optimizacion-mat/)

> **Aviso legal:** software experimental para investigación. El rendimiento pasado no garantiza resultados futuros.

---

## Qué aporta este proyecto

- **Reproducibilidad:** CI y tests activos, dataset sintético y contratos versionados.
- **Resiliencia de decisiones:** flujo con estados, auditoría, colisión `run_id`/`data_hash`, checkpoints y reanudación.
- **Operabilidad real:** API HTTP, almacenamiento Redis opcional y trazas append-only en SQLite.
- **Extensibilidad:** separación clara entre simulador MAT, skills DRE y contratos ICD.

---

## Instalación

### Uso rápido desde PyPI (MAT)

```bash
pip install sistema-optimizacion-mat
```

### Entorno completo del repo (MAT + DRE)

```bash
pip install -r requirements.txt -r requirements-dev.txt
```

---

## Inicio rápido MAT

```bash
python scripts/bootstrap_synthetic_candles_db.py
pytest tests/ -q
python compound_optimize_runner.py --db data/synthetic_signal_tune.db --holdout-frac 0.2
```

Salida: JSON en stdout (por ejemplo `p_win_terminal`, `p_ruin`, `walk_forward`).

Optimización de señales:

```bash
python scripts/optimize_signal_grid.py --db data/synthetic_signal_tune.db --preset smoke --skip-pairs --holdout-frac 0.2
```

- Dataset esperado: [`docs/DATASET.md`](docs/DATASET.md)
- Ejemplos `--signal-config`: [`docs/signal_rules_examples.md`](docs/signal_rules_examples.md)

---

## API DRE (MVP)

Levantar servicio:

```bash
python scripts/run_dre_api.py --db data/dre_governance.sqlite
```

Endpoints:

- `GET /dre/health`
- `POST /dre/simulate`
- `POST /dre/resume`

Ejemplo mínimo:

```bash
curl -X POST "http://127.0.0.1:8000/dre/simulate" \
  -H "Content-Type: application/json" \
  -d '{
    "run_id": "opt_20260506_000100_v5.0",
    "data_hash": "sha256:demo",
    "rng_seed": 7,
    "variant": "standard"
  }'
```

---

## Arquitectura y documentos

- Índice docs: [`docs/README.md`](docs/README.md)
- PDR DRE (01–05): [`docs/pdr/README.md`](docs/pdr/README.md)
- Arquitectura técnica DRE v1.1: [`docs/DRE_TECHNICAL_ARCHITECTURE.md`](docs/DRE_TECHNICAL_ARCHITECTURE.md)
- Estado implementación vs roadmap: [`docs/DRE_IMPLEMENTATION_STATUS.md`](docs/DRE_IMPLEMENTATION_STATUS.md)
- Módulo DRE: [`dre/README.md`](dre/README.md)

---

## Estado actual

- Tests: `pytest tests/ -q` (incluye `test_dre_*`).
- Calidad: `ruff check .`.
- `main` con pipeline estable y documentación lista para comité técnico.

---

## Licencia y seguridad

- Licencia: [MIT](LICENSE)
- Reporte de seguridad: [SECURITY.md](SECURITY.md)
- Historial: [CHANGELOG.md](CHANGELOG.md)
