Skip to content

feat(v1.6.6): RPI books, stock dual earn, CrossEx securities - #5

Merged
JJ-Cro merged 15 commits into
masterfrom
update19102026
Oct 21, 2026
Merged

JJ-Cro merged 15 commits into
masterfrom
update19102026

Conversation

@JJ-Cro

@JJ-Cro JJ-Cro commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Summary

Gate API v4.106.150-157 on top of 1.6.5. Version 1.6.6.

Depends on sieblyio#147. Upstream master is still 1.6.4 (9dc4d70). This branch starts at update16102026 (916c60a, v1.6.5). The three commits under that are sieblyio#147. Review the 1.6.6 commit once sieblyio#147 is merged, or merge this after it.

gateio-api is this SDK (REST and WebSocket). Gate's official gate-api package is REST only. README section "Why not raw ws?" covers reconnect, heartbeats, resubscribe, auth, and typed events, with a public spot ticker snippet.

Changelog

  • TradFi TradFiGetKlinesParams / getTradFiKlines JSDoc. Docs: begin_time and end_time are Unix seconds, limit max 500. Live XAUUSD on 19 Oct 2026: millisecond times return an empty list; limit with begin_time and end_time returns INVALID_ARGUMENT; begin_time without end_time returns HTTP 400, label INTERNAL_SERVER_ERROR, message "Service is busy. Please try again later."
  • Public getSpotRpiOrderBook (GET /spot/rpi_order_book) and getFuturesRpiOrderBook (GET /futures/{settle}/rpi_order_book).
  • Stock dual earn: GET/POST /earn/dual/stock/orders, GET /earn/dual/stock/investment_plan, project-recommend, balance, order-refund-preview, POST order-refund, POST modify-order-reinvest. type (call / put) on dual investment plans.
  • CrossEx stock and ETF: symbol shape {market}_{STOCK|ETF}_{code}_USDT, orders need cross-exchange mode, GTC, and qty (no quote_qty), prices in USD/HKD/KRW/JPY. Required tag on GET /crossex/rule/symbols. getCrossExSecurityPositions (GET /crossex/security_positions).
  • Account book: statement_type includes SECURITY_DIVIDEND and SECURITY_CORPORATE_ACTION. Optional statement_type filter on the request. Existing type field kept for older responses.
  • README: "Why not raw ws?"

Checked, no code change:

  • stop_profit / stop_loss on Order (SpotOrder), OrderPatch (UpdateSpotOrderReq), and BatchAmendItem (UpdateSpotBatchOrdersReq) are already SpotOrderTPSL | {} | null. null leaves the protection unchanged, {} cancels it. Matches v4.106.156.
  • Hand-written examples do not call getTradFiKlines. The wrong (params) call is only in generated examples/apidoc/RestClient/getTradFiKlines.js, which is not hand-edited.

Checks

  • npx eslint src clean
  • npm run build clean
  • Keyless tests: v106150, baseUrl, priceOrderAmend, wsStore, public.test.ts
  • Live public calls: spot and futures RPI books, TradFi XAUUSD klines (limit, begin+end, begin only, limit+range, millisecond times), dual investment plan type: call, CrossEx US_STOCK_AAPL_USDT tag "Apple Inc."
Open in Web Open in Cursor 

cursoragent and others added 15 commits October 16, 2026 10:14
TestNet REST `futuresTestnet` now uses https://api-testnet.gateapi.io/api/v4.
`baseUrlKey: 'testnet'` is the same host for spot and futures. `futuresTestnet` stays as an alias.

WebSocket TestNet:
- spot: wss://ws-testnet.gate.com/v4/ws/spot
- options: wss://ws-testnet.gate.com/v4/ws/options
- USDT perpetual, BTC perpetual, and delivery hosts still match current Gate docs

Changelog:
- v4.106.160: updateFuturesPriceTriggeredOrder uses PUT /futures/{settle}/price_orders/amend/{order_id}; order_id stays in the body
- v4.106.159: stock trade_status is pre_market | open | post_market
- v4.106.158: OTC fiat and stablecoin order lists use data.lists
- v4.106.148: stock trade_mode, order status, and finish_as enums
- v4.106.147: futures account_book type dividend
- Futures place-order requests accept tpsl_tp_bbo_type and tpsl_sl_bbo_type

Skipped:
- stock time_in_force GTC: docs only list day
- stock client_order_id: already on CreateStockOrderReq
- tpsl bbo fields on FuturesOrder responses: already present

Co-authored-by: Jerko J <JJ-Cro@users.noreply.github.com>
Stop importing FuturesAccountBookType from request types. Response records use FuturesAccountBookRecordType.

Co-authored-by: Jerko J <JJ-Cro@users.noreply.github.com>
Changelog:
- TradFi klines JSDoc: Unix seconds, limit max 500, limit cannot be combined with begin_time and end_time (INVALID_ARGUMENT), begin_time without end_time returns Service is busy
- Public GET /spot/rpi_order_book and GET /futures/{settle}/rpi_order_book
- Stock dual earn under /earn/dual/stock/* and type call|put on dual investment plans
- CrossEx stock/ETF order notes, required tag on /crossex/rule/symbols, GET /crossex/security_positions
- Account book SECURITY_DIVIDEND and SECURITY_CORPORATE_ACTION on statement_type
- README section Why not raw ws, and how this package differs from REST-only gate-api

Co-authored-by: Jerko J <JJ-Cro@users.noreply.github.com>
WebSocket TestNet is useTestnet: true. Drop the baseUrlKey TestNet write-up from the README, quickstart, and option comments.

Co-authored-by: Jerko J <JJ-Cro@users.noreply.github.com>
Co-authored-by: Jerko J <JJ-Cro@users.noreply.github.com>
REST TestNet: useTestnet true uses https://api-testnet.gateapi.io/api/v4. An explicit baseUrl or baseUrlKey still wins.

Co-authored-by: Jerko J <JJ-Cro@users.noreply.github.com>
@JJ-Cro
JJ-Cro merged commit 18a1588 into master Oct 21, 2026
0 of 2 checks passed
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