988e901066
Añade campos params y output al frontmatter YAML de las 506 funciones del registry. Cada parámetro tiene descripción semántica (qué representa, unidades, rango típico) y cada función describe qué produce su output. Permite a agentes razonar sobre cadenas de composición (ej: prices → log_return → sharpe_ratio) sin leer código.
2.3 KiB
2.3 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | |||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| avellaneda_stoikov_quotes | function | py | finance | 1.0.0 | pure | avellaneda_stoikov_quotes(mid_price: float, inventory: float, gamma: float, sigma: float, spread_base: float, n_levels: int, qty_base: float) -> list[dict] | Genera ordenes de market maker usando el modelo Avellaneda-Stoikov. Calcula precio de reserva y half spread optimos segun inventario y volatilidad. |
|
false |
|
lista de ordenes con campos {'side': 'buy'|'sell', 'price': float, 'qty': float} | false | python/functions/finance/finance.py |
Ejemplo
orders = avellaneda_stoikov_quotes(
mid_price=100.0,
inventory=0.0,
gamma=0.1,
sigma=0.02,
spread_base=0.5,
n_levels=3,
qty_base=10.0,
)
# [
# {'side': 'buy', 'price': 99.75, 'qty': 10.0},
# {'side': 'sell', 'price': 100.25, 'qty': 10.0},
# ...
# ]
Notas
Funcion pura — sin aleatoriedad.
gamma controla la aversion al riesgo de inventario: mayor gamma = spreads mas amplios.
inventory positivo sesga los quotes hacia venta (reduce inventario largo).
Cada nivel adicional ensancha el spread en half_spread * 0.5 y aumenta la cantidad en qty_base * 0.5.
Ordenes con precio <= 0 se descartan automaticamente.