> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cotizave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Medias móviles SMA y EMA de tasas históricas

> Calcula SMA y EMA sobre cierres observados mediante stats=1&ma=N en el histórico de un ID de tasa.

Agrega `stats=1&ma=N` al histórico para recibir SMA y EMA. `N` debe ser un entero entre 2 y 365. La SMA usa los últimos cierres observados; la EMA utiliza toda la serie solicitada.

```bash curl theme={null}
curl "https://api.cotizave.com/v2/fx/VE/rates/ve-bcv/history?stats=1&ma=7" \
  -H "X-API-Key: $COTIZAVE_API_KEY"
```

Respuesta ilustrativa: `ma=7` agrega cinco campos a `stats`, aunque haya menos de siete cierres observados.

```json theme={null}
{
  "id": "ve-bcv",
  "market": "reference",
  "base": "USD",
  "quote": "VES",
  "from": "2026-11-03",
  "to": "2026-11-05",
  "granularity": "daily",
  "stats": {
    "count": 3,
    "min": 200,
    "max": 204,
    "avg": 202,
    "stddev": 2,
    "first": { "date": "2026-11-03", "mid": 200 },
    "last": { "date": "2026-11-05", "mid": 204 },
    "change": 4,
    "change_pct": 2,
    "period": 7,
    "sma": 202,
    "ema": 201.375,
    "vs_sma_pct": 0.9901,
    "vs_ema_pct": 1.3035
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.