feat: reconcile SDK with v1 API routes (v0.1.1)#2
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
feat: reconcile SDK with v1 API routes (v0.1.1)#2devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
f68ae31 to
58079db
Compare
Reconcile every method signature against backend/api/routes/v1/*: - data.orderbook: market -> market_id (was silently dropped), require start/end, add offset, fix limit defaults (5000/50000) - data.spot_klines: add (GET /data/spot/klines) - backtests.orderbook: add (GET /backtests/atop/orderbook) - backtests.dataset: add (POST /backtests/atop/dataset) Review hardening: - backtests.run() now raises ItoAPIError on terminal 'failed'/'error' status instead of returning silently (README example indexes metrics) - version is sourced once from package metadata (importlib.metadata) for both __version__ and the User-Agent header — no more 3-place drift - drop unreachable 429 from RETRYABLE_STATUS_CODES (handled in its own branch) Bump 0.1.0 -> 0.1.1. 26 tests passing, ruff clean. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
58079db to
67fbb43
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reconciles the published SDK against the canonical v1 API surface (
backend/api/routes/v1/*in ito-cloud-runtime, mirrored by the docs catalogv1-api-docs.json) so every method signature matches the real routes exactly. Fixes a real bug indata.orderbookand fills three gaps where the API exposed endpoints the SDK didn't. Bumps0.1.0 -> 0.1.1.data.orderbook— bugfixThe published method sent
market=but the API readsmarket_id=(so the filter was silently ignored), and madestart/endoptional even though the API requires them.New methods (endpoints already live, were missing from SDK)
All signatures now match the
client.*examples in the docs catalog 1:1. Tests cover the new methods and assert query/body params are sent correctly (24 passing, ruff clean).Link to Devin session: https://app.devin.ai/sessions/ef08e8d7517d4afcaf2492b519ab9a1a
Requested by: @alejandorosumah-mansa
Greptile Summary
This PR reconciles the SDK with the live v1 API surface, fixing a silent bug in
data.orderbook(wrong param namemarket→market_id, requiredstart/end) and adding three previously-missing endpoints (data.spot_klines,backtests.orderbook,backtests.dataset). It also closes all three issues flagged in the prior review cycle.data.orderbookbugfix: renamesmarket→market_idso the filter is actually sent, promotesstart/endto required positional args, and raises the default limit from 1 000 to 5 000.data.spot_klines(GET/data/spot/klines),backtests.orderbook(GET/backtests/atop/orderbook), andbacktests.dataset(POST/backtests/atop/dataset) fill the three SDK gaps.run()now raisesItoAPIErroron"failed"/"error"status,User-Agentreads fromimportlib.metadata, and the unreachable429entry is removed fromRETRYABLE_STATUS_CODES.Confidence Score: 5/5
Safe to merge — all changes are additive or fix previously broken parameter names, and every new code path is covered by tests.
The diff is a straightforward API surface reconciliation: one param rename, two new GET wrappers, one new POST wrapper, and three housekeeping fixes from the prior review. All new paths have corresponding tests asserting both return values and wire-level params. No behavioral regressions were found in existing methods.
No files require special attention.
Important Files Changed
data.orderbookbug (renamesmarket→market_id, makesstart/endrequired, bumps default limit 1000→5000, addsoffset) and adds newspot_klinesmethod with correct params.orderbook,dataset) matching live API routes; fixesrun()to raiseItoAPIErroron"failed"/"error"status instead of silently returning.importlib.metadata; removes the unreachable429fromRETRYABLE_STATUS_CODESwith an explanatory comment.__version__with aimportlib.metadatalookup, falling back to"0.0.0"for uninstalled source trees.orderbooksignature; covers therun()failure path with a dedicatedItoAPIErrorassertion test.orderbooksignature and the three new methods.Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant Caller participant SDK participant API Note over SDK,API: data.orderbook (bugfix) Caller->>SDK: data.orderbook(venue, start, end, market_id?) SDK->>API: "GET /data/orderbook?venue=&start=&end=&market_id=" API-->>SDK: "{data: {snapshots: [...]}}" SDK-->>Caller: dict Note over SDK,API: data.spot_klines (new) Caller->>SDK: data.spot_klines(symbol, start, end, interval?) SDK->>API: "GET /data/spot/klines?symbol=&start=&end=&interval=" API-->>SDK: "{data: {klines: [...]}}" SDK-->>Caller: dict Note over SDK,API: backtests.orderbook (new) Caller->>SDK: backtests.orderbook(start, end, source?, venue?, market_id?) SDK->>API: "GET /backtests/atop/orderbook?start=&end=&..." API-->>SDK: "{data: {rows: [...]}}" SDK-->>Caller: dict Note over SDK,API: backtests.dataset (new) Caller->>SDK: backtests.dataset(symbol, start, end, interval?, include_l2?) SDK->>API: POST /backtests/atop/dataset API-->>SDK: "{data: {windows: [...], spot_klines: [...]}}" SDK-->>Caller: dict Note over SDK,API: backtests.run() (fixed error handling) Caller->>SDK: backtests.run(strategy_id, dataset_id, ...) SDK->>API: POST /backtests/atop API-->>SDK: "{data: {run_id, status: accepted}}" loop poll SDK->>API: "GET /backtests/atop/{run_id}" API-->>SDK: "{data: {status: running|succeeded|failed}}" end alt "status == succeeded" SDK-->>Caller: result dict else "status == failed / error" SDK-->>Caller: raises ItoAPIError else timeout exceeded SDK-->>Caller: raises TimeoutError end%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant Caller participant SDK participant API Note over SDK,API: data.orderbook (bugfix) Caller->>SDK: data.orderbook(venue, start, end, market_id?) SDK->>API: "GET /data/orderbook?venue=&start=&end=&market_id=" API-->>SDK: "{data: {snapshots: [...]}}" SDK-->>Caller: dict Note over SDK,API: data.spot_klines (new) Caller->>SDK: data.spot_klines(symbol, start, end, interval?) SDK->>API: "GET /data/spot/klines?symbol=&start=&end=&interval=" API-->>SDK: "{data: {klines: [...]}}" SDK-->>Caller: dict Note over SDK,API: backtests.orderbook (new) Caller->>SDK: backtests.orderbook(start, end, source?, venue?, market_id?) SDK->>API: "GET /backtests/atop/orderbook?start=&end=&..." API-->>SDK: "{data: {rows: [...]}}" SDK-->>Caller: dict Note over SDK,API: backtests.dataset (new) Caller->>SDK: backtests.dataset(symbol, start, end, interval?, include_l2?) SDK->>API: POST /backtests/atop/dataset API-->>SDK: "{data: {windows: [...], spot_klines: [...]}}" SDK-->>Caller: dict Note over SDK,API: backtests.run() (fixed error handling) Caller->>SDK: backtests.run(strategy_id, dataset_id, ...) SDK->>API: POST /backtests/atop API-->>SDK: "{data: {run_id, status: accepted}}" loop poll SDK->>API: "GET /backtests/atop/{run_id}" API-->>SDK: "{data: {status: running|succeeded|failed}}" end alt "status == succeeded" SDK-->>Caller: result dict else "status == failed / error" SDK-->>Caller: raises ItoAPIError else timeout exceeded SDK-->>Caller: raises TimeoutError endReviews (3): Last reviewed commit: "feat: reconcile SDK with v1 API routes +..." | Re-trigger Greptile