Skip to content

[P1][Sprint 1][Parity] Add typed Spreads and market Indicators resources #99

Closed

Description

@karlwaldman

Why

The published API contract includes /v1/spreads/* and /v1/indicators/* operations. Node has typed resources; Python has neither. oilpriceapi.analysis is local calculation and is not API endpoint coverage.

Acceptance criteria

  • Implement typed sync and async methods for the published spreads and indicators operations selected by the support manifest.
  • Preserve timestamps, provenance, units, nulls, and pagination.
  • Cover valid envelopes, malformed 200 responses, 401/402/403/429, no-data, and timeout recovery.
  • Add examples, reference docs, and live smoke coverage.
  • Update machine-readable capabilities and cut a minor release.

Delivery

Python package release; independent of Rails/web.

Activity

  1. karlwaldman commented on Sep 13, 2026

    @karlwaldman
    MemberAuthor

    Premise check before implementation, verified 2026-09-13 against oilpriceapi-api origin/main 02196c516 and live production (paid test account):

    • Routes exist. config/routes.rb has 15 /v1/spreads/* routes and 13 /v1/indicators/* routes, all on V1::SpreadsController, and every spreads/indicators route returned a response in production.
    • "Selected by the support manifest": no such manifest exists. Nothing in python-sdk, oilpriceapi-api, oilpriceapi-node or website-clean is a support manifest. The route list above was used as the selection instead.
    • "Machine-readable capabilities": no such file exists in python-sdk. The only machine-readable artifact is the snippet manifest (examples/snippets/manifest-source.json). Its test executes every snippet against a fixture server that serves only price routes, so these resources were not added there. No new metadata file was invented.
    • "Node has typed resources" is only nominally true. Node's spreads/indicators types do not match the wire, and its methods cannot pass required parameters (pair, commodity, code), so they return 400. Filed as [P2] spreads and indicators resources are typed against a shape the API does not send, and omit required parameters oilpriceapi-node#112. The Python models are typed from captured production bodies, not from Node.
    • 402 is not emitted by these routes. Entitlement is check_analytics_access → 403 PREMIUM_REQUIRED. 402 is covered as status mapping only.
    • congressional-trades is excluded. It has never returned data (404 DATA_NOT_AVAILABLE with an internal config message), so there is no shape to type. Filed as OilpriceAPI/oilpriceapi-api#8478.
    • "Cut a minor release" is deferred. The release was held back by instruction; CHANGELOG is under [Unreleased] only.

    API defects found while typing, all filed or commented:

    • oilpriceapi-api#8476: CFTC history spec_net_pct_oi is always 0 (integer division).
    • oilpriceapi-api#8477: the 3-2-1 composite never emits data_stale.
    • oilpriceapi-api#5913 comment: history routes return an empty 200 for unknown selectors, and bad dates silently fall back to the default window.
    • oilpriceapi-api#3297 comment: intermittent 500s from price-context.
  2. added a commit that references this issue on Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew featurepriority: highShould be fixed soonqaQuality assurance and testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions