---
name: sma
kind: function
lang: py
domain: finance
version: "1.0.0"
purity: pure
signature: "def sma(data: list, period: int) -> list"
description: "Calcula la media movil simple (SMA) de una serie de precios."
tags: [finance, moving-average, indicator, python]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: []
params:
  - name: data
    desc: "lista de precios o valores a suavizar (ej: precios de cierre diarios)"
  - name: period
    desc: "tamanio de la ventana movil en numero de periodos (tipico: 5, 10, 20, 50, 200). Mayor periodo = mas suavizado."
output: "lista de valores SMA con len(data) - period + 1 elementos (mas corta que la entrada)"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/finance/finance.py"
---

## Ejemplo

```python
prices = [10, 11, 12, 13, 14, 15]
result = sma(prices, 3)
# [11.0, 12.0, 13.0, 14.0]
```

## Notas

Retorna lista mas corta que la entrada (len - period + 1 elementos).
Si period es mayor que len(data) o menor/igual a 0, retorna lista vacia.
