feat: competitive intelligence & historical pattern matching layer
This commit is contained in:
@@ -10,6 +10,7 @@ from minio import Minio
|
||||
from services.adapters.base import AdapterResult
|
||||
from services.adapters.broker_adapter import AlpacaBrokerAdapter, TradingMode
|
||||
from services.adapters.filings_adapter import SECEdgarAdapter
|
||||
from services.adapters.macro_news_adapter import MacroNewsAdapter
|
||||
from services.adapters.market_adapter import PolygonMarketAdapter
|
||||
from services.adapters.news_adapter import PolygonNewsAdapter
|
||||
from services.adapters.web_scrape_adapter import WebScrapeAdapter
|
||||
@@ -69,11 +70,14 @@ async def process_job(
|
||||
logger.warning("No adapter for source_type=%s", source_type)
|
||||
return
|
||||
|
||||
# Macro sources may not have a company_id
|
||||
company_id = job.get("company_id")
|
||||
|
||||
# Record ingestion run
|
||||
run_id = await pool.fetchval(
|
||||
"""INSERT INTO ingestion_runs (source_id, company_id, source_type, status)
|
||||
VALUES ($1, $2, $3, 'running') RETURNING id""",
|
||||
source_id, job["company_id"], source_type,
|
||||
source_id, company_id, source_type,
|
||||
)
|
||||
|
||||
try:
|
||||
@@ -159,7 +163,7 @@ async def process_job(
|
||||
|
||||
# Link duplicate documents to this company if not already linked
|
||||
company_id = job.get("company_id")
|
||||
if company_id and deduped_count:
|
||||
if company_id and deduped_count and source_type not in ("macro_news",):
|
||||
from services.shared.metadata import persist_document_company_mention
|
||||
for dup in dup_items:
|
||||
existing_id = dup.get("_dedupe_existing_id")
|
||||
@@ -234,6 +238,9 @@ async def main():
|
||||
mode=TradingMode.LIVE if cfg.broker.mode == "live" else TradingMode.PAPER,
|
||||
base_url=cfg.broker.base_url,
|
||||
),
|
||||
"macro_news": MacroNewsAdapter(
|
||||
api_key=cfg.market_data.api_key,
|
||||
),
|
||||
}
|
||||
|
||||
logger.info("Ingestion worker started")
|
||||
|
||||
Reference in New Issue
Block a user