Skip to content

feat!: sync SDK with the current v3 API (remove oracle, fix model drift) - #33

Merged
vafanassieff merged 4 commits into
mainfrom
fix/remove-oracle-endpoints
Oct 26, 2026
Merged

vafanassieff merged 4 commits into
mainfrom
fix/remove-oracle-endpoints

Conversation

@CaoKha

@CaoKha CaoKha commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Why

The SDK had drifted from the v3 API. I diffed it against the published reference (apps/api-rest-v3/spec.frozen.json in the API repo, identical to the live https://api.lnmarkets.com/v3/spec.json) and the stream reference (apps/api-stream-v1/spec.frozen.json).

Removed (breaking)

  • client.oracle and models.oracle. LN Markets removed GET /oracle/index and GET /oracle/last-price on 2026-07-17 (API changelog), so they return 404, which made the integration tests fail on every run (e.g. on chore(deps): bump anyio from 4.13.0 to 4.14.2 #30). Migration: futures.get_ticker() for index/last price, futures.get_candles() for history.

Fixed

  • account.withdraw_on_chain() failed validation on success: the response model required uid, updated_at, block_id, confirmation_height and fee, which the API never returns.
  • futures.cross.new_order() required client_id, but the API treats it as optional.
  • GetCandlesParams.from_ is now optional, as in the API.

Added

  • Ticker: time, price_change_24h, exchanges_weights.
  • FuturesOrder.stoploss_mode (fixed / trailing), so a trailing stop can be set when opening an isolated trade.
  • Notifications read filter; the under_review, not_credited and on_hold on-chain deposit statuses; CreateSwapOutput.id.

⚠️ Merging publishes 0.2.0 to PyPI through publish.yml.

Verification

  • ruff check .: passes. pyright: 0 errors. pytest locally (no signet creds): 20 passed, 36 skipped
  • Re-ran the spec diff: no remaining mismatches except /time (intentional, see above)
  • Live check on mainnet and signet: the new ticker fields parse, and candles work without from

🤖 Generated with Claude Code

LN Markets removed GET /oracle/index and GET /oracle/last-price on
2026-07-17; both now return 404, which broke the integration tests.
Drop OracleClient, the oracle models, and their tests. Examples now read
the price from futures.get_ticker(). Bump to 0.2.0.

Co-Authored-By: Claude <noreply@anthropic.com>
@CaoKha
CaoKha requested a review from a team October 26, 2026 09:15
Diffed the SDK against the frozen v3 OpenAPI reference (spec.frozen.json,
identical to the live /v3/spec.json):

- WithdrawOnChainResponse required fields the API never returns, so
  withdraw_on_chain() failed validation on success
- cross new_order() required client_id; it is optional
- GetCandlesParams.from_ is optional
- add ticker time, price_change_24h and exchanges_weights
- add stoploss_mode on new isolated trades (trailing stop at creation)
- add the notifications read filter and the new on-chain deposit statuses
- add id on the new swap response

Integration tests now skip deposit tests when the signet account hits
TIER_LIMIT_EXCEEDED instead of failing.

Co-Authored-By: Claude <noreply@anthropic.com>
@CaoKha CaoKha changed the title feat!: remove oracle client (endpoints removed from API) feat!: sync SDK with the current v3 API (remove oracle, fix model drift) Oct 26, 2026
Since ln-markets #2033 (2026-07-29) every authenticated v3 request is
geo-blocked by source IP, and GitHub-hosted runners mostly egress from the
US, so the authenticated suite fails with 403 FORBIDDEN in CI.

Gate those tests behind one requires_auth marker: in CI they run only when
CI_PROXY_URL is set, and the workflow routes requests through it via
HTTPS_PROXY. Local runs are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
@CaoKha CaoKha self-assigned this Oct 26, 2026
Signet enforces KYC tier limits on deposits and trades. Move the
TIER_LIMIT_EXCEEDED skip from the three deposit tests into a conftest
hook so every test and fixture (trades, cross orders) skips on it, while
other API errors still fail.

Co-Authored-By: Claude <noreply@anthropic.com>
@CaoKha CaoKha added the chore Small tasks label Oct 26, 2026
@CaoKha
CaoKha requested a review from vafanassieff October 26, 2026 13:04
@vafanassieff
vafanassieff merged commit 0557dcd into main Oct 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Small tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants