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:
Viktor Barzin 2026-02-22 22:17:26 +00:00
parent 67e64fab18
commit d36ae40df1
No known key found for this signature in database
GPG key ID: 0EB088298288D958
18 changed files with 749 additions and 185 deletions

View file

@ -72,6 +72,7 @@ async def _fetch_historical_bars(
Returns the total number of bars published.
"""
from alpaca.data.enums import DataFeed
from alpaca.data.requests import StockBarsRequest
total_published = 0
@ -86,10 +87,14 @@ async def _fetch_historical_bars(
timeframe=timeframe,
start=start,
limit=limit,
feed=DataFeed.IEX,
)
bars = await asyncio.to_thread(client.get_stock_bars, request)
ticker_bars = bars[ticker] if ticker in bars else []
try:
ticker_bars = bars[ticker]
except (KeyError, IndexError):
ticker_bars = []
for bar in ticker_bars:
msg = _bar_to_dict(ticker, bar)
await publisher.publish(msg)
@ -120,6 +125,7 @@ async def _poll_latest_bars(
Returns the number of bars published.
"""
from alpaca.data.enums import DataFeed
from alpaca.data.requests import StockBarsRequest
published = 0
@ -134,10 +140,14 @@ async def _poll_latest_bars(
timeframe=timeframe,
start=start,
limit=1,
feed=DataFeed.IEX,
)
bars = await asyncio.to_thread(client.get_stock_bars, request)
ticker_bars = bars[ticker] if ticker in bars else []
try:
ticker_bars = bars[ticker]
except (KeyError, IndexError):
ticker_bars = []
if ticker_bars:
# Publish only the most recent bar
bar = ticker_bars[-1]