Hermes logoHermes
Core Concepts

Connectors

Ten source connectors ship with Hermes, each exposing an async fetch() that returns canonical records and sits behind the shared RawCache.

All connectors at a glance

SourceClassCache TTLStatus
World Bankhermes.connectors.World_bank7 daysWorking
IMF (SDMX)hermes.connectors.IMF7 daysWorking
FREDhermes.connectors.FRED30 daysWorking
Binancehermes.connectors.Binance1 dayWorking
Finnhubhermes.connectors.FINNHUB7 daysWorking
Yfinancehermes.connectors.Yfinance1 dayWorking
SEC EDGARhermes.connectors.SECEDGAR7 daysWorking
OpenSanctionshermes.connectors.OpenSanction30 daysWorking
Bundled datasetshermes.connectors.PUBLIC_DATASETWorking
GDELThermes.connectors.GDELTStub

Source coverage spans global macro, financial markets, corporate filings, sanctions and governance intelligence. TTLs are deliberately conservative for stable public sources and tighter for fast-moving market data.

The connector contract

A connector answers one question: how do I get this source's data? In Hermes, each connector package pairs its fetch() with a parser, a normalizer and field mappings. Connectors can provide authentication, requests, pagination, rate limiting, retries and source-specific parsing — but generic retry, caching and validation belong to Hermes infrastructure, not to the connector.

Connectors use aiohttp with exponential-backoff retries (sleeps 2**attempt seconds) and resolve keys through RawCache.get_or_fetch.

World Bank

ItemDetail
Classhermes.connectors.World_bank
Base URLhttps://api.worldbank.org/v2
Cache sourceworld_bank · TTL 7 days
fetch()fetch(country_code, indicator_code, frequency=None, most_recent=None, per_page=1000, page=1, force=False)
ReturnDataFrame with date, indicator_id, indicator_name, country, value, source
python
from hermes import Hermes
hermes = Hermes(opensanction_api="x", new_data_api="x",
                sec_username="x", sec_email="x")

df = hermes.world_bank.fetch(
    country_code="BR",
    indicator_code="SP.POP.TOTL",   # total population
    frequency="Y",
)

IMF (SDMX)

ItemDetail
Classhermes.connectors.IMF
Base URLhttps://api.imf.org/external/sdmx/3.0/data/dataflow/
Cache sourceimf · TTL 7 days
fetch()fetch(country, agency, dataflow_id, key, version='~', force=False)
ReturnNormalized SDMX DataFrame; empty DataFrame on 404
python
# IMF WEO government debt (% of GDP)
df = hermes.imf.fetch(
    country="US",
    agency="IMF.RES",
    dataflow_id="WEO",
    key="GGXWDG_NGDP",
)

FRED

ItemDetail
Classhermes.connectors.FRED
Base URLhttps://api.stlouisfed.org/fred/series/observations
Cache sourcefred · TTL 30 days
fetch()fetch(series_id, timeout=30.0, retries=3, force=False)

23 curated macro series are defined in fred/mappings.py, including GDPC1, A191RL1Q225SBEA, INDPRO, CPIAUCSL, CPILFESL, PCEPI, UNRATE, PAYEMS, CIVPART, FEDFUNDS, DGS10, DGS2, DGS3MO, T10Y2Y, T10Y3M, M2SL, TOTBKCR, HOUST, EXHOSLUSM495S, SP500, VIXCLS, DTWEXBGS.

python
fd = hermes.fred.fetch(series_id="CPIAUCSL")  # CPI

Binance

ItemDetail
Classhermes.connectors.Binance
Base URLapi.binance.com (spot) / fapi.binance.com (future)
Cache sourcebinance · TTL 1 day
fetch()fetch(mode, endpoint, symbol, interval=None, limit=None, period=None, retries=3, timeout=30.0, force=False)
fetch_history()fetch_history(symbol, interval='1d', market='future', years=2, max_concurrent=10)

Endpoints (per binance/mappings.py): ohlcv, trades, aggregated_trades, order_book, best_bid_ask, 24hr, exchangeInfo; plus future-only fundingRate, openInterest, premiumIndex, openInterestHist, longShortRatio, topLongShortAccountRatio, topLongShortPositionRatio. fetch_history splits the range into 1000-bar windows fetched concurrently (semaphore = 10).

python
# 2 years of daily BTCUSDT futures candles
df = hermes.binance.fetch_history(
    symbol="BTCUSDT", interval="1d",
    market="future", years=2,
)

Finnhub

ItemDetail
Classhermes.connectors.FINNHUB
Base URLhttps://finnhub.io/api/v1
Cache sourcefinnhub · TTL 7 days
fetch()fetch(endpoint, symbol, resolution=None, _from=None, _to=None, force=False)
fetch_candles_history()fetch_candles_history(symbol, resolution='D', years=2)

Endpoints: candles, quote, profile, metric, peers, earnings, insider, eps, ebitda, revenue, news, symbol. Lookback is capped by FINNHUB_MAX_DAYS per resolution (e.g. 1m/5m → 7d, 15m–1h → 30d, D/W/M → 365d).

Yfinance

ItemDetail
Classhermes.connectors.Yfinance
Cache sourceyfinance · TTL 1 day
fetch()fetch(endpoint, symbol, force=False) — endpoints: quote, eps_estimate, revenue_estimate, earnings_history
fetch_history()fetch_history(symbol, interval='1d', years=2)

Raised restricted intervals (raises ValueError for unsupported ones). The interval map: 1m/5m/15m/30m/1h/1d map to themselves, 1w → 1wk, 1M → 1mo.

SEC EDGAR

ItemDetail
Classhermes.connectors.SECEDGAR
Base URLhttps://data.sec.gov/api/xbrl/companyfacts
Cache sourcesec_edgar · TTL 7 days
fetch()fetch(symbol, timeout=30.0, retries=3, force=False)

Resolves a ticker to its CIK via sec-cik-mapper and requests <user-agent> <email> as required by the SEC. The SEC_TAG_MAP (sec/tags.py) maps canonical fields to XBRL GAAP tags — e.g. revenue, net_income, operating_cash_flow, long_term_debt, shares_outstanding, dividends, buybacks, etc.

OpenSanctions

ItemDetail
Classhermes.connectors.OpenSanction
Base URLhttps://api.opensanctions.org
AuthAuthorization: ApiKey &lt;key&gt;
Cache sourceOpenSanction · TTL 30 days
fetch()fetch(country, dataset, limit=50, changed_since=None, topic=None, facets=None, force=False)

Supports datasets such as us_ofac_sdn, eu_fsf, uk_fcdos and un_sc. Country ISO3 is converted to ISO2 internally before filtering.

GDELT

ItemDetail
Classhermes.connectors.GDELT
StatusStub (empty class)

The GDELT connector is scaffolded but not yet implemented — global news/event data powers the geopolitical features, which are similarly stubbed.

Bundled public datasets

ItemDetail
Classhermes.connectors.PUBLIC_DATASET
Locationhermes/connectors/lib/datasets/

Reads bundled local CSVs, country-filtered with years converted to datetime:

fetch_hrs(country)
human_right_score
fetch_hdi(country)
human development index (iso3, year, score)
fetch_cpi(country)
global CPI
fetch_fsi(country)
fragile states index (Total 0–120)
fetch_nato(country)
NATO membership
fetch_crs(country)
climate readiness score
fetch_cvs(country)
climate vulnerability score
fetch_sipri(country)
SIPRI military expenditure

Retries & timeouts

Every connector
All HTTP connectors default to retries=3 and timeout=30.0, retrying with exponential backoff. Pass force=True to bypass the cache.

Backoff sleeps 2**attempt seconds so transient failures settle quickly without hammering the source. Because retry, caching and validation are handled by Hermes infrastructure rather than each connector, adding a new source never means re-implementing that plumbing.