feat: funciones Python datascience, finance, cybersecurity y pipelines
Datascience: aggregate_by_group, deduplicate_entities/relations, detect_drift, diff_entities/relations, extract_entities/relations_llm, hotness_score, melt, merge_graphs, pivot, build_entity/relation_schema_prompt. Finance: avellaneda_stoikov_quotes, generate_gbm_prices, generate_taker_order, hawkes_intensity + módulo finance.py. Cybersecurity: envelope_encrypt/decrypt + módulo cybersecurity.py. Pipelines: extraction_pipeline, monte_carlo_market, run_market_sim. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
---
|
||||
name: avellaneda_stoikov_quotes
|
||||
kind: function
|
||||
lang: py
|
||||
domain: finance
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "avellaneda_stoikov_quotes(mid_price: float, inventory: float, gamma: float, sigma: float, spread_base: float, n_levels: int, qty_base: float) -> list[dict]"
|
||||
description: "Genera ordenes de market maker usando el modelo Avellaneda-Stoikov. Calcula precio de reserva y half spread optimos segun inventario y volatilidad."
|
||||
tags: [simulation, market-making, avellaneda-stoikov, montecarlo, finance, order-book]
|
||||
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
|
||||
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.
|
||||
Reference in New Issue
Block a user