feat: productionize local service — fix signal pipeline, lower thresholds, add company-name ticker extraction
- Point Ollama to local instance via host.docker.internal, use gemma3 model - Remove Docker Ollama service (using host's Ollama instead) - Add company-name-to-ticker mapping (Apple→AAPL, Tesla→TSLA, etc.) for RSS articles - Lower signal thresholds for faster feedback with paper trading: - FinBERT confidence: 0.6→0.4, signal strength: 0.3→0.15 - News strategy: article_count 2→1, confidence 0.5→0.3, score ±0.3→±0.15 - Fix market data BarSet access bug (BarSet.__contains__ returns False incorrectly) - Fix market data SIP feed error by switching to IEX feed for free Alpaca accounts - Fix nginx proxy routing for /api/auth/* to api-gateway /auth/* - Add seed_sample_data script - Update tests for new thresholds and alpaca mock modules
This commit is contained in:
parent
67e64fab18
commit
d36ae40df1
18 changed files with 749 additions and 185 deletions
|
|
@ -34,7 +34,7 @@ class FinBERTAnalyzer:
|
|||
self._pipeline = pipeline(
|
||||
"sentiment-analysis",
|
||||
model=self.model_name,
|
||||
return_all_scores=True,
|
||||
top_k=None,
|
||||
)
|
||||
logger.info("FinBERT model loaded successfully")
|
||||
return self._pipeline
|
||||
|
|
@ -84,8 +84,9 @@ class FinBERTAnalyzer:
|
|||
def _parse_scores(results: list[list[dict[str, Any]]]) -> tuple[float, float]:
|
||||
"""Map pipeline output to ``(score, confidence)``.
|
||||
|
||||
The ``return_all_scores=True`` pipeline returns a list of lists of dicts:
|
||||
``[[{"label": "positive", "score": 0.85}, ...]]``.
|
||||
With ``top_k=None`` the pipeline returns either:
|
||||
- ``[[{"label": "positive", "score": 0.85}, ...]]`` (older transformers)
|
||||
- ``[{"label": "positive", "score": 0.85}, ...]`` (newer transformers)
|
||||
|
||||
Mapping:
|
||||
- ``"positive"`` -> +1
|
||||
|
|
@ -98,8 +99,8 @@ class FinBERTAnalyzer:
|
|||
"""
|
||||
label_map = {"positive": 1.0, "negative": -1.0, "neutral": 0.0}
|
||||
|
||||
# results is [[{label, score}, ...]]
|
||||
scores = results[0]
|
||||
# Handle both [[{label, score}, ...]] and [{label, score}, ...]
|
||||
scores = results[0] if isinstance(results[0], list) else results
|
||||
|
||||
sentiment_score = 0.0
|
||||
confidence = 0.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue