How yigitcemakbas/yarn works
yarn is an in-house Finnhub-compatible market-data API backed by a database that a separate worker refreshes. The principal flow is a client request to a Finnhub-shaped route, database lookup, and JSON response; unseen tickers can trigger warming. In parallel, scheduled jobs gather SEC, investor-relations, newswire, and GDELT data, transform it into company, earnings, recommendation, and news records, and persist it. The graph preserves README capabilities and indexed modules; some internal links rely on the SOURCE INDEX rather than inspected implementation excerpts.
Main entry points: scheduler.py Refresh scheduler · news.py News ingestion · routes.py Finnhub routes · earnings_dates.py Date confirmation
Components 22
API compatibility
- Finnhub routes
app/compat/finnhub/routes.py - API authentication
app/compat/finnhub/auth.py - API application
app/main.py
Refresh orchestration
- Refresh scheduler
app/jobs/scheduler.py - On-demand warming
app/pipelines/warmup.py
Market data pipelines
- Company directory
app/pipelines/companies.py - Reported earnings
app/pipelines/earnings.py - Date confirmation
app/pipelines/earnings_dates.py - News ingestion
app/pipelines/news.py - Press releases
app/pipelines/press_release.py - Rating trends
app/pipelines/recommendations.py
Data sources
- SEC EDGAR
app/sources/sec.py - IR calendars
app/sources/ir_events.py - GDELT news
app/sources/gdelt.py - Newswire feeds
app/sources/feeds.py - Article pages
app/sources/news_article.py - Scraper policy
app/sources/base_scraper.py - Host rate limiter
app/sources/rate_limit.py
Persistence
- Database sessions
app/db/session.py - Market data tables
app/models/__init__.py
Other components
- Loom client
- PostgreSQL
Connections 36
- Loom client → Finnhub routes: requests
README.md - API application → Finnhub routes: registers
app/main.py - API application → API authentication: configures
app/main.py - Finnhub routes → Database sessions: opens session
app/compat/finnhub/routes.py - Finnhub routes → Market data tables: queries
app/compat/finnhub/routes.py - Finnhub routes → On-demand warming: warms ticker
app/compat/finnhub/routes.py - Finnhub routes → Rating trends: loads trends
app/compat/finnhub/routes.py - Database sessions → PostgreSQL: connects
app/db/session.py - Refresh scheduler → Company directory: syncs directory
app/jobs/scheduler.py - Refresh scheduler → Reported earnings: refreshes earnings
app/jobs/scheduler.py - Refresh scheduler → Date confirmation: refreshes dates
app/jobs/scheduler.py - Refresh scheduler → News ingestion: polls news
app/jobs/scheduler.py - Refresh scheduler → SEC EDGAR: polls filings
app/jobs/scheduler.py - Refresh scheduler → GDELT news: rotates company news
app/jobs/scheduler.py - Refresh scheduler → IR calendars: refreshes calendars
app/jobs/scheduler.py - Company directory → SEC EDGAR: reads SEC data
app/pipelines/companies.py - Reported earnings → SEC EDGAR: reads filings
app/pipelines/earnings.py - Reported earnings → Press releases: uses releases
app/pipelines/earnings.py - Date confirmation → Reported earnings: builds on events
app/pipelines/earnings_dates.py - Date confirmation → IR calendars: reads calendars
app/pipelines/earnings_dates.py - Date confirmation → SEC EDGAR: checks filings
app/pipelines/earnings_dates.py - News ingestion → GDELT news: ingests articles
app/pipelines/news.py - News ingestion → Newswire feeds: ingests releases
app/pipelines/news.py - News ingestion → Article pages: fetches descriptions
app/pipelines/news.py - News ingestion → Date confirmation: records announcements
app/pipelines/news.py - IR calendars → Scraper policy: uses scraper
app/sources/ir_events.py - Article pages → Scraper policy: uses scraper
app/sources/news_article.py - Scraper policy → Host rate limiter: throttles requests
app/sources/base_scraper.py - SEC EDGAR → Host rate limiter: throttles requests
app/sources/sec.py - Newswire feeds → Host rate limiter: throttles requests
app/sources/feeds.py - GDELT news → Host rate limiter: throttles requests
app/sources/gdelt.py - Company directory → Market data tables: updates records
app/pipelines/companies.py - Reported earnings → Market data tables: stores events
app/pipelines/earnings.py - Date confirmation → Market data tables: updates dates
app/pipelines/earnings_dates.py - News ingestion → Market data tables: stores articles
app/pipelines/news.py - Rating trends → Market data tables: reads ratings
app/pipelines/recommendations.py