feat: funciones Python para core, cybersecurity, datascience y finance
Agrega funciones Python reutilizables organizadas por dominio: - core: composicion funcional (pipe, compose, map, filter, reduce, etc.) - cybersecurity: analisis de amenazas y puertos - datascience: estadisticas y deteccion de outliers - finance: indicadores tecnicos y analisis financiero
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: vwap
|
||||
kind: function
|
||||
lang: py
|
||||
domain: finance
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "def vwap(prices: list, volumes: list) -> float"
|
||||
description: "Calcula el Volume-Weighted Average Price (VWAP)."
|
||||
tags: [finance, vwap, volume, indicator, python]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/finance/finance.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
prices = [100.0, 101.0, 102.0, 101.5]
|
||||
volumes = [1000, 1500, 1200, 800]
|
||||
result = vwap(prices, volumes)
|
||||
# 101.0888...
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Formula: sum(price_i * volume_i) / sum(volume_i).
|
||||
Retorna 0.0 si las listas estan vacias, tienen distinto tamanio, o el volumen total es cero.
|
||||
Reference in New Issue
Block a user