Spaces:
Runtime error
Runtime error
Commit History
-
fix: two-layer cache to eliminate Yahoo Finance rate limits
EymenLayer 1 — requests-cache (SQLite on /tmp/finsight_http_cache): - Intercepts ALL HTTP calls made by yfinance transparently - 10-min TTL, stale_if_error=True (serves cached data on network failure) - Persists across Streamlit reruns (SQLite file survives rerun) - Added requests-cache>=1.2.0 to requirements.txt Layer 2 — in-memory TTLCache: - Avoids even SQLite disk lookups within a session - clear_cache() now clears both SQLite AND in-memory simultaneously Effect: After first successful fetch, subsequent loads are instant even if Yahoo rate-limits. Refresh button clears both layers.a3c7eeb -
refactor: principal engineer audit — full production-grade rewrite
EymenArchitecture: - @st.cache_resource replaces session_state singletons (process-level, not rerun-level) - Strict SoC: UI layer contains zero business logic - Pure functions in technical.py easy to unit-test in isolation - Prompt engineering isolated in claude_client.py (_build_analysis_prompt, _inject_context) Error handling: - Specific exception catching at every callsite (RateLimitError, TickerNotFoundError, LLMRateLimitError, DocumentParseError, DocumentLoadError, IndexNotFoundError) - Zero bare 'except Exception' in UI layer - All errors map to user-friendly messages with actionable guidance Typing & Docs: - Google-style docstrings on all public classes and functions - Full type annotations including return types, args, raises - MessageList type alias for clarity Logging: - stdlib logging throughout (no print, no structlog dependency) - configure_logging() called once at app startup - Noisy third-party loggers suppressed Caching: - @st.cache_resource for StockClient, ClaudeClient…7dcad13 -
refactor: Principal Engineer audit — production-grade rewrite
EymenCore changes: - exceptions.py: full hierarchy (RateLimitError, NetworkTimeoutError, LLMRateLimitError, DocumentParseError, ContextWindowExceededError) with __init__ args, docstrings, and no string-matching required by callers - logger.py: stdlib-only (no structlog dep), colourised dev / key=value prod, noisy third-party loggers silenced, idempotent bootstrap - settings.py: field_validator for log_level and chunk_overlap, typed properties with full docstrings, Pydantic v2 compatible - stock_client.py: _classify_error() maps raw exceptions to typed domain errors; _fetch_with_retry() handles RateLimitError specifically vs NetworkTimeoutError vs DataFetchError; StockInfo dataclass documented; UA rotation; configurable TTL/retry/timeout from settings - technical.py: _validate_ohlcv() guard, _safe() helper prevents NaN comparison crashes, SignalMap type alias, full Google-style docstrings - claude_client.py: _create_with_retry() catches specific anthropic exception types (R…2b13db0 -
fix: yfinance rate limit — retry backoff, UA rotation, 10min cache, better error UI
Eymene8ec288 -
feat: initial FinSight MVP — stock analysis, RAG, conversational chat
Eymenfa77b99