feat: plataforma completa de análisis de inversiones en tiempo real v2.0.0#3
Conversation
- requirements.txt: all dependencies (yfinance, streamlit, anthropic, telegram, twilio, plotly, ta) - config.py: central config with market settings, FRED indicators, API validation helpers - .env.example: template for API keys (Claude, Telegram, Twilio) - start.sh: one-command launcher for web app, Telegram bot, WhatsApp bot, or all - core/data/fetcher.py: FetcherMercado — universal real-time data engine (US stocks, LatAm, crypto) - Price, fundamentals, financial statements, Piotroski raw data, analyst consensus, news, options - core/data/macro.py: FRED macro dashboard (GDP, CPI, Fed funds, yield curve, unemployment) - core/analysis/fundamental.py: Piotroski F-Score (all 9 criteria), ROIC/WACC/EVA, earnings quality Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
🎉 Thanks for opening your first pull request in InvestSkill!
We're excited to review your contribution. Please ensure:
- All CI checks are passing
- You've filled out the PR template
- Documentation is updated (if needed)
- CHANGELOG.md is updated
A maintainer will review your PR shortly. Feel free to ask questions or request feedback!
Check out our Contributing Guide for more information.
There was a problem hiding this comment.
Code Review
This pull request implements the core infrastructure for InvestSkill, including configuration management, market and macro data fetchers, and a fundamental analysis engine. Feedback highlights a critical invalid AI model name in the configuration, a potential IndexError and performance inefficiency in the financial data parsing logic, and the fact that the startup script references entry-point files not included in this PR. Additionally, improvements regarding virtual environment usage and warning suppression were suggested.
|
|
||
| # ── IA ───────────────────────────────────────────────────── | ||
| ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY", "") | ||
| CLAUDE_MODEL = "claude-sonnet-4-6" |
There was a problem hiding this comment.
El identificador de modelo claude-sonnet-4-6 no es un nombre de modelo válido en la API de Anthropic. Actualmente, los modelos de la serie Sonnet siguen una nomenclatura como claude-3-5-sonnet-20240620. Usar un nombre incorrecto provocará fallos en las peticiones a la IA.
| CLAUDE_MODEL = "claude-sonnet-4-6" | |
| CLAUDE_MODEL = "claude-3-5-sonnet-20240620" |
| def get_val(df, keyword, col=0): | ||
| for k in df.index: | ||
| if keyword.lower() in str(k).lower(): | ||
| v = df.iloc[df.index.tolist().index(k), col] | ||
| return float(v) if pd.notna(v) else None | ||
| return None |
There was a problem hiding this comment.
La función get_val tiene dos problemas:
-
Vulnerabilidad: Lanzará un
IndexErrorsi el DataFrame tiene menos columnas de las esperadas (por ejemplo, siyfinancesolo devuelve datos del año actual y se solicitacol=1). -
Eficiencia:
df.index.tolist().index(k)es ineficiente ($O(N)$ dentro de un bucle $O(N)$), resultando en una complejidad$O(N^2)$ .
Se sugiere validar el número de columnas y usar enumerate para una búsqueda más eficiente.
| def get_val(df, keyword, col=0): | |
| for k in df.index: | |
| if keyword.lower() in str(k).lower(): | |
| v = df.iloc[df.index.tolist().index(k), col] | |
| return float(v) if pd.notna(v) else None | |
| return None | |
| def get_val(df, keyword, col=0): | |
| if col >= df.shape[1]: | |
| return None | |
| for i, k in enumerate(df.index): | |
| if keyword.lower() in str(k).lower(): | |
| v = df.iloc[i, col] | |
| return float(v) if pd.notna(v) else None | |
| return None |
|
|
||
| iniciar_app() { | ||
| echo -e "\n${VERDE}▶ Iniciando aplicación web en http://localhost:8501${NC}\n" | ||
| streamlit run app/main.py \ |
There was a problem hiding this comment.
El script intenta ejecutar app/main.py, pero este archivo no está incluido en los cambios de este pull request. Lo mismo sucede con los bots en las líneas 80 y 85. Esto causará que el script falle inmediatamente al intentar iniciar la aplicación. Si estos componentes son parte de fases posteriores, el script debería manejar su ausencia de forma controlada.
| from datetime import datetime, timedelta | ||
| from typing import Optional | ||
| import warnings | ||
| warnings.filterwarnings("ignore") |
There was a problem hiding this comment.
Suprimir todas las advertencias de forma global (warnings.filterwarnings("ignore")) en un módulo central es una práctica arriesgada. Esto puede ocultar problemas importantes como advertencias de deprecación en pandas o yfinance que podrían romper el código en el futuro. Se recomienda eliminar esta línea o ser más específico con los filtros.
| # Dependencias | ||
| if ! python3 -c "import streamlit" &>/dev/null; then | ||
| echo -e " ${AMARILLO}⚠ Instalando dependencias...${NC}" | ||
| pip3 install -r requirements.txt -q |
…gram & WhatsApp bots Analysis engines: - core/analysis/valuation.py: DCF (3 scenarios + sensitivity table), multiples (P/E, EV/EBITDA, P/FCF), Chowder rule, valuation score - core/analysis/technical.py: RSI, MACD, Bollinger Bands, ATR, Stochastic, support/resistance, trend score 0-10 - core/ai/analyst.py: Claude API integration — Spanish narratives for stock eval, DCF, technical, macro; final investment signal 0-10 Streamlit web app (6 pages): - app/main.py: main dashboard — real-time index bar, price chart with SMA/volume, key metrics, analyst consensus - pages/1: Piotroski F-Score (9 criteria), ROIC/WACC/EVA, financial statements charts (4 years) - pages/2: DCF 3-scenario model, sensitivity table, football field chart, multiples valuation - pages/3: candlestick chart + Bollinger Bands, all technical indicators, historical returns - pages/4: FRED macro dashboard — yield curve, time series of any indicator, AI macro narrative - pages/5: portfolio tracker — real-time P&L, sector allocation, historical performance - pages/6: full downloadable report — all analysis consolidated + JSON export Bots: - bots/telegram_bot.py: /precio /fundamental /dcf /tecnico /analizar /macro + free-text ticker support - bots/whatsapp_bot.py: Flask webhook via Twilio — same commands, proactive alert function Verified: all modules import correctly, live AAPL data fetches successfully ($260.48 USD) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thannks for the PR, please use english in both PR title and descriptions, and fix the git conflicts. |
Resumen
Plataforma profesional de análisis de inversiones en español, con datos en tiempo real, inteligencia artificial y múltiples interfaces (web, Telegram, WhatsApp).
Arquitectura
Características principales
Inicio rápido
Test plan
pip install -r requirements.txtsin errorespython3 -c "from core.data.fetcher import FetcherMercado; print(FetcherMercado(AAPL).precio_actual()[precio])"→ precio real./start.sh appabre Streamlit en http://localhost:8501IREN→ muestra precio, métricas, gráfico🤖 Generated with Claude Code