Skip to content

feat: add Credit & Sovereign Risk, Sanctions, Interest Rates APIs (14 endpoints) - #74

Merged
otpixto7 merged 3 commits into
mainfrom
feat/api-coverage-sync
Jul 17, 2026
Merged

otpixto7 merged 3 commits into
mainfrom
feat/api-coverage-sync

Conversation

@alexpipipi

Copy link
Copy Markdown
Member

New API classes CreditSovereignRiskAPI / SanctionsAPI / InterestRatesAPI (14 methods) + facade + tests. pytest: 105 passed. Filter values URL-encoded.

Part of an updatelibs cross-repo sync adding 3 API families / 14 endpoints — Credit & Sovereign Risk (7), Sanctions/OFAC (4), Interest Rates (3) — across EODHD-openapi, Node SDK, Python SDK, Postman, and the Claude plugin. Sanctions uses bare query params (verified vs prometheus-web request classes + live prod); credit-risk & interest-rates use filter[...]. Bridge pre-push review (Codex + Gemini): no blockers.

Add three new API families covering 14 GET endpoints:
- Credit & Sovereign Risk (/api/credit-risk): sovereign risk-premium,
  credit-ratings, cds-spreads, default-spreads; corporate cmdi, hqm-yields;
  cds-market aggregates
- Sanctions (/api/sanctions): entities, vessels, programs, sources
- Interest Rates (/api/rates, /api/spreads): reference-rates, policy-rates,
  funding-stress (no pagination)

credit-risk and rates/spreads use filter[...] deep-object params; sanctions
uses BARE query params (q=, program=, type=, active=, imo=, flag=, vessel_type=,
source=, country=) per prometheus-web + live prod. Pagination is
page[offset]/page[limit] throughout (except funding-stress: none). Filter/param
values are URL-encoded via a shared helper so multi-word values do not corrupt
the query string. Sanctions validates source->ofac and type/active enums.
Registered in APIs/__init__.py, exposed via APIClient facade, covered by pytest.
otpixto7 and others added 2 commits July 17, 2026 10:27
… review)

Reviewed against prometheus-web request classes and the Node SDK; fixed 4
server-verified discrepancies:

- cds-market/aggregates: add filter[value] and filter[region] (server allows
  filter=array:metric,dimension,value,region,from,to; were missing)
- hqm-yields: accept comma-separated type (server uses CsvIn(['spot','par']),
  so "spot,par" is valid) instead of rejecting it
- reference-rates: stop hard-failing on non-USD/GBP/EUR currency; the server
  does not restrict currency (nullable|string|max:255), only uppercases it
- sanctions/programs and sanctions/sources: drop page_offset/page_limit; these
  endpoints take no params and are not paginated server-side

Updated tests accordingly (108 passed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…s (PR #74)

Multi-model review (Codex + opencode + aichat): all APPROVE_WITH_CHANGES.
Applied the agreed items:

- consolidate _filter/_param/_pagination into BaseAPI (were triplicated); omit
  blank/whitespace-only filter & bare values instead of emitting &filter[x]=/&x=
- pagination: enforce server bound 1 <= page_limit <= 100 and reject bools /
  non-whole floats (int() no longer silently coerces True->1, 1.9->1)
- HQM yields: rename shadowing `type` param to `yield_type` (serialised to
  filter[type], matching the entity_type pattern); a blank value is now omitted
  rather than raising
- sanctions: normalise blank q/source/entity_type/active to "absent" before
  validation so they omit instead of raising
- docs: fix stale facade currency docstring; clarify sanctions pagination applies
  to entities/vessels only
- tests: add facade-level suite (test_apiclient_new_apis.py, parse_qs based) plus
  blank-omit / pagination-bound / bool-reject cases

Declined (thin-client, documented): client-side enum validation for expandable
sets (currency already relaxed, tenor grid, metric, dimension) and server-side
business rules (date formats, string lengths) — left to the server.

pytest: 122 passed. Smoke test (14 endpoints + review behaviours): 22 passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@otpixto7
otpixto7 merged commit 3b0bb44 into main Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants