From fa912d11b1302e06c1673896e729c76fc577c084 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 26 Oct 2026 08:08:09 +0000 Subject: [PATCH 1/2] docs(v1.3.1): surface Coinbase Advanced Trade in README and package metadata Changelog: - Lead the README heading with Coinbase Advanced Trade. - Name this package as the Coinbase Advanced Trade SDK in the opening paragraph. - Lead the npm description with Coinbase Advanced Trade. - Add keywords: coinbase advanced trade, advanced trade, coinbase advanced trade api, coinbase advanced trade sdk. - Bump version from 1.3.0 to 1.3.1 in package.json and package-lock.json. Co-authored-by: Jerko J --- README.md | 4 ++-- package-lock.json | 4 ++-- package.json | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 179f899..4013a24 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Node.js & JavaScript SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets +# Coinbase Advanced Trade - Node.js & JavaScript SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets

@@ -19,7 +19,7 @@ [1]: https://www.npmjs.com/package/coinbase-api -Updated & performant JavaScript & Node.js SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets: +Coinbase Advanced Trade SDK for Node.js and JavaScript. Updated & performant JavaScript & Node.js SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets: - Professional, robust & performant Coinbase SDK with extensive production use in live trading environments. - Complete integration with all Coinbase APIs - supports both retail and institutional REST clients and WebSockets: diff --git a/package-lock.json b/package-lock.json index e7e8bea..6fe877f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coinbase-api", - "version": "1.3.0", + "version": "1.3.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coinbase-api", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "dependencies": { "@types/ws": "8.18.1", diff --git a/package.json b/package.json index 3b3a8cd..e9911c2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coinbase-api", - "version": "1.3.0", - "description": "Complete Node.js & JavaScript SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets, with TypeScript & strong end to end tests.", + "version": "1.3.1", + "description": "Coinbase Advanced Trade SDK for Node.js and JavaScript. Complete Node.js & JavaScript SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets, with TypeScript & strong end to end tests.", "scripts": { "clean": "rm -rf dist", "build": "npm run clean && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && bash ./postBuild.sh", @@ -68,6 +68,10 @@ }, "keywords": [ "coinbase", + "coinbase advanced trade", + "advanced trade", + "coinbase advanced trade api", + "coinbase advanced trade sdk", "coinbase api", "coinbase node", "coinbase node api", From 39b2b1d3720ca0bd010285b09541f6e750683149 Mon Sep 17 00:00:00 2001 From: JJ-Cro sync bot Date: Mon, 26 Oct 2026 09:09:27 +0100 Subject: [PATCH 2/2] chore: regenerate endpoint docs and examples --- docs/endpointFunctionList.md | 210 +- .../acceptBlockRfq.js | 2 +- .../addBlockRfqQuote.js | 2 +- .../approveBlockTrade.js | 2 +- .../CBAdvancedTradeGlobalClient/auth.js | 2 +- .../CBAdvancedTradeGlobalClient/cancelAll.js | 2 +- .../cancelAllBlockRfqQuotes.js | 2 +- .../cancelAllByCurrency.js | 2 +- .../cancelAllByCurrencyPair.js | 2 +- .../cancelAllByInstrument.js | 2 +- .../cancelAllByKindOrType.js | 2 +- .../cancelBlockRfq.js | 2 +- .../cancelBlockRfqQuote.js | 2 +- .../cancelBlockRfqTrigger.js | 2 +- .../cancelByLabel.js | 2 +- .../cancelOrder.js | 2 +- .../changeMarginModel.js | 2 +- .../closePosition.js | 2 +- .../createBlockRfq.js | 2 +- .../createCombo.js | 2 +- .../disableCancelOnDisconnect.js | 2 +- .../editBlockRfqQuote.js | 2 +- .../enableCancelOnDisconnect.js | 2 +- .../executeBlockTrade.js | 2 +- .../getAccessLog.js | 2 +- .../getAccountSummaries.js | 2 +- .../getAccountSummary.js | 2 +- .../getAnnouncements.js | 2 +- .../getBlockRfqMakers.js | 2 +- .../getBlockRfqQuotes.js | 2 +- .../getBlockRfqTrades.js | 2 +- .../getBlockRfqUserInfo.js | 2 +- .../getBlockRfqs.js | 2 +- .../getBlockTrade.js | 2 +- .../getBlockTradeRequests.js | 2 +- .../getBlockTrades.js | 2 +- .../getBookSummaryByCurrency.js | 2 +- .../getBookSummaryByInstrument.js | 2 +- .../getBrokerTradeRequests.js | 2 +- .../getBrokerTrades.js | 2 +- .../getCancelOnDisconnect.js | 2 +- .../getComboDetails.js | 2 +- .../getComboIds.js | 2 +- .../CBAdvancedTradeGlobalClient/getCombos.js | 2 +- .../getContractSize.js | 2 +- .../getCurrencies.js | 2 +- .../getDeliveryPrices.js | 2 +- .../getExpirations.js | 2 +- .../getFundingChartData.js | 2 +- .../getFundingRateHistory.js | 2 +- .../getFundingRateValue.js | 2 +- .../getHistoricalVolatility.js | 2 +- .../getIndexChartData.js | 2 +- .../getIndexPrice.js | 2 +- .../getIndexPriceNames.js | 2 +- .../getInstrument.js | 2 +- .../getInstruments.js | 2 +- .../getLastSettlementsByCurrency.js | 2 +- .../getLastSettlementsByInstrument.js | 2 +- .../getLastTradesByCurrency.js | 2 +- .../getLastTradesByCurrencyAndTime.js | 2 +- .../getLastTradesByInstrument.js | 2 +- .../getLastTradesByInstrumentAndTime.js | 2 +- .../getLegPrices.js | 2 +- .../CBAdvancedTradeGlobalClient/getMargins.js | 2 +- .../getMarkPriceHistory.js | 2 +- .../getOpenOrders.js | 2 +- .../getOpenOrdersByCurrency.js | 2 +- .../getOpenOrdersByInstrument.js | 2 +- .../getOpenOrdersByLabel.js | 2 +- .../getOrderBook.js | 2 +- .../getOrderBookByInstrumentId.js | 2 +- .../getOrderHistoryByCurrency.js | 2 +- .../getOrderHistoryByInstrument.js | 2 +- .../getOrderMarginByIds.js | 2 +- .../getOrderState.js | 2 +- .../getOrderStateByLabel.js | 2 +- .../getPosition.js | 2 +- .../getPositions.js | 2 +- .../getSettlementHistoryByCurrency.js | 2 +- .../getSettlementHistoryByInstrument.js | 2 +- .../CBAdvancedTradeGlobalClient/getStatus.js | 2 +- .../getSupportedIndexNames.js | 2 +- .../CBAdvancedTradeGlobalClient/getTicker.js | 2 +- .../CBAdvancedTradeGlobalClient/getTime.js | 2 +- .../getTradeVolumes.js | 2 +- .../getTradingviewChartData.js | 2 +- .../getTransactionLog.js | 2 +- .../getTriggerOrderHistory.js | 2 +- .../getUserTradesByCurrency.js | 2 +- .../getUserTradesByCurrencyAndTime.js | 2 +- .../getUserTradesByInstrument.js | 2 +- .../getUserTradesByInstrumentAndTime.js | 2 +- .../getUserTradesByOrder.js | 2 +- .../getVolatilityIndexData.js | 2 +- .../invalidateBlockTradeSignature.js | 2 +- .../rejectBlockTrade.js | 2 +- .../simulateBlockTrade.js | 2 +- .../simulatePme.js | 2 +- .../simulatePortfolio.js | 2 +- .../CBAdvancedTradeGlobalClient/submitBuy.js | 2 +- .../CBAdvancedTradeGlobalClient/submitSell.js | 2 +- .../testConnection.js | 2 +- .../updateOrder.js | 2 +- .../updateOrderByLabel.js | 2 +- .../verifyBlockTrade.js | 2 +- llms.txt | 43901 +++------------- 107 files changed, 6914 insertions(+), 37407 deletions(-) diff --git a/docs/endpointFunctionList.md b/docs/endpointFunctionList.md index 7ba67f7..3218a07 100644 --- a/docs/endpointFunctionList.md +++ b/docs/endpointFunctionList.md @@ -113,111 +113,111 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [auth()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L227) | | POST | `/api/v2 public/auth` | -| [getAnnouncements()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L242) | | POST | `/api/v2 public/get_announcements` | -| [getBlockRfqTrades()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L257) | | POST | `/api/v2 public/get_block_rfq_trades` | -| [getBookSummaryByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L274) | | POST | `/api/v2 public/get_book_summary_by_currency` | -| [getBookSummaryByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L290) | | POST | `/api/v2 public/get_book_summary_by_instrument` | -| [getComboDetails()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L305) | | POST | `/api/v2 public/get_combo_details` | -| [getComboIds()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L320) | | POST | `/api/v2 public/get_combo_ids` | -| [getCombos()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L334) | | POST | `/api/v2 public/get_combos` | -| [getContractSize()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L352) | | POST | `/api/v2 public/get_contract_size` | -| [getCurrencies()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L368) | | POST | `/api/v2 public/get_currencies` | -| [getDeliveryPrices()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L383) | | POST | `/api/v2 public/get_delivery_prices` | -| [getExpirations()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L400) | | POST | `/api/v2 public/get_expirations` | -| [getFundingChartData()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L417) | | POST | `/api/v2 public/get_funding_chart_data` | -| [getFundingRateHistory()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L435) | | POST | `/api/v2 public/get_funding_rate_history` | -| [getFundingRateValue()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L453) | | POST | `/api/v2 public/get_funding_rate_value` | -| [getHistoricalVolatility()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L470) | | POST | `/api/v2 public/get_historical_volatility` | -| [getIndexChartData()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L487) | | POST | `/api/v2 public/get_index_chart_data` | -| [getIndexPrice()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L503) | | POST | `/api/v2 public/get_index_price` | -| [getIndexPriceNames()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L520) | | POST | `/api/v2 public/get_index_price_names` | -| [getInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L537) | | POST | `/api/v2 public/get_instrument` | -| [getInstruments()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L561) | | POST | `/api/v2 public/get_instruments` | -| [getLastSettlementsByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L589) | | POST | `/api/v2 public/get_last_settlements_by_currency` | -| [getLastSettlementsByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L616) | | POST | `/api/v2 public/get_last_settlements_by_instrument` | -| [getLastTradesByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L638) | | POST | `/api/v2 public/get_last_trades_by_currency` | -| [getLastTradesByCurrencyAndTime()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L659) | | POST | `/api/v2 public/get_last_trades_by_currency_and_time` | -| [getLastTradesByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L678) | | POST | `/api/v2 public/get_last_trades_by_instrument` | -| [getLastTradesByInstrumentAndTime()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L697) | | POST | `/api/v2 public/get_last_trades_by_instrument_and_time` | -| [getMarkPriceHistory()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L714) | | POST | `/api/v2 public/get_mark_price_history` | -| [getOrderBook()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L733) | | POST | `/api/v2 public/get_order_book` | -| [getOrderBookByInstrumentId()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L750) | | POST | `/api/v2 public/get_order_book_by_instrument_id` | -| [getSupportedIndexNames()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L767) | | POST | `/api/v2 public/get_supported_index_names` | -| [getTime()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L781) | | POST | `/api/v2 public/get_time` | -| [getTradeVolumes()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L799) | | POST | `/api/v2 public/get_trade_volumes` | -| [getTradingviewChartData()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L820) | | POST | `/api/v2 public/get_tradingview_chart_data` | -| [getVolatilityIndexData()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L837) | | POST | `/api/v2 public/get_volatility_index_data` | -| [getStatus()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L850) | | POST | `/api/v2 public/status` | -| [testConnection()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L862) | | POST | `/api/v2 public/test` | -| [getTicker()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L881) | | POST | `/api/v2 public/ticker` | -| [submitBuy()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L908) | :closed_lock_with_key: | POST | `/api/v2 private/buy` | -| [submitSell()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L931) | :closed_lock_with_key: | POST | `/api/v2 private/sell` | -| [updateOrder()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L953) | :closed_lock_with_key: | POST | `/api/v2 private/edit` | -| [updateOrderByLabel()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L973) | :closed_lock_with_key: | POST | `/api/v2 private/edit_by_label` | -| [cancelOrder()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L991) | :closed_lock_with_key: | POST | `/api/v2 private/cancel` | -| [cancelByLabel()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1012) | :closed_lock_with_key: | POST | `/api/v2 private/cancel_by_label` | -| [cancelAll()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1030) | :closed_lock_with_key: | POST | `/api/v2 private/cancel_all` | -| [cancelAllByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1047) | :closed_lock_with_key: | POST | `/api/v2 private/cancel_all_by_currency` | -| [cancelAllByCurrencyPair()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1066) | :closed_lock_with_key: | POST | `/api/v2 private/cancel_all_by_currency_pair` | -| [cancelAllByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1085) | :closed_lock_with_key: | POST | `/api/v2 private/cancel_all_by_instrument` | -| [cancelAllByKindOrType()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1104) | :closed_lock_with_key: | POST | `/api/v2 private/cancel_all_by_kind_or_type` | -| [closePosition()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1123) | :closed_lock_with_key: | POST | `/api/v2 private/close_position` | -| [getOpenOrders()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1139) | :closed_lock_with_key: | POST | `/api/v2 private/get_open_orders` | -| [getOpenOrdersByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1155) | :closed_lock_with_key: | POST | `/api/v2 private/get_open_orders_by_currency` | -| [getOpenOrdersByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1171) | :closed_lock_with_key: | POST | `/api/v2 private/get_open_orders_by_instrument` | -| [getOpenOrdersByLabel()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1187) | :closed_lock_with_key: | POST | `/api/v2 private/get_open_orders_by_label` | -| [getOrderState()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1211) | :closed_lock_with_key: | POST | `/api/v2 private/get_order_state` | -| [getOrderStateByLabel()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1234) | :closed_lock_with_key: | POST | `/api/v2 private/get_order_state_by_label` | -| [getOrderHistoryByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1254) | :closed_lock_with_key: | POST | `/api/v2 private/get_order_history_by_currency` | -| [getOrderHistoryByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1274) | :closed_lock_with_key: | POST | `/api/v2 private/get_order_history_by_instrument` | -| [getOrderMarginByIds()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1290) | :closed_lock_with_key: | POST | `/api/v2 private/get_order_margin_by_ids` | -| [getTriggerOrderHistory()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1308) | :closed_lock_with_key: | POST | `/api/v2 private/get_trigger_order_history` | -| [getUserTradesByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1329) | :closed_lock_with_key: | POST | `/api/v2 private/get_user_trades_by_currency` | -| [getUserTradesByCurrencyAndTime()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1352) | :closed_lock_with_key: | POST | `/api/v2 private/get_user_trades_by_currency_and_time` | -| [getUserTradesByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1373) | :closed_lock_with_key: | POST | `/api/v2 private/get_user_trades_by_instrument` | -| [getUserTradesByInstrumentAndTime()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1395) | :closed_lock_with_key: | POST | `/api/v2 private/get_user_trades_by_instrument_and_time` | -| [getUserTradesByOrder()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1416) | :closed_lock_with_key: | POST | `/api/v2 private/get_user_trades_by_order` | -| [getMargins()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1433) | :closed_lock_with_key: | POST | `/api/v2 private/get_margins` | -| [getAccountSummaries()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1450) | :closed_lock_with_key: | POST | `/api/v2 private/get_account_summaries` | -| [getAccountSummary()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1474) | :closed_lock_with_key: | POST | `/api/v2 private/get_account_summary` | -| [getPosition()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1493) | :closed_lock_with_key: | POST | `/api/v2 private/get_position` | -| [getPositions()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1512) | :closed_lock_with_key: | POST | `/api/v2 private/get_positions` | -| [changeMarginModel()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1531) | :closed_lock_with_key: | POST | `/api/v2 private/change_margin_model` | -| [getAccessLog()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1548) | :closed_lock_with_key: | POST | `/api/v2 private/get_access_log` | -| [getTransactionLog()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1575) | :closed_lock_with_key: | POST | `/api/v2 private/get_transaction_log` | -| [getSettlementHistoryByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1598) | :closed_lock_with_key: | POST | `/api/v2 private/get_settlement_history_by_currency` | -| [getSettlementHistoryByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1621) | :closed_lock_with_key: | POST | `/api/v2 private/get_settlement_history_by_instrument` | -| [simulatePortfolio()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1641) | :closed_lock_with_key: | POST | `/api/v2 private/simulate_portfolio` | -| [simulatePme()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1661) | :closed_lock_with_key: | POST | `/api/v2 private/pme/simulate` | -| [enableCancelOnDisconnect()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1685) | :closed_lock_with_key: | POST | `/api/v2 private/enable_cancel_on_disconnect` | -| [disableCancelOnDisconnect()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1701) | :closed_lock_with_key: | POST | `/api/v2 private/disable_cancel_on_disconnect` | -| [getCancelOnDisconnect()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1714) | :closed_lock_with_key: | POST | `/api/v2 private/get_cancel_on_disconnect` | -| [createCombo()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1731) | :closed_lock_with_key: | POST | `/api/v2 private/create_combo` | -| [getLegPrices()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1748) | :closed_lock_with_key: | POST | `/api/v2 private/get_leg_prices` | -| [createBlockRfq()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1763) | :closed_lock_with_key: | POST | `/api/v2 private/create_block_rfq` | -| [cancelBlockRfq()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1779) | :closed_lock_with_key: | POST | `/api/v2 private/cancel_block_rfq` | -| [acceptBlockRfq()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1792) | :closed_lock_with_key: | POST | `/api/v2 private/accept_block_rfq` | -| [cancelBlockRfqTrigger()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1805) | :closed_lock_with_key: | POST | `/api/v2 private/cancel_block_rfq_trigger` | -| [getBlockRfqs()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1818) | :closed_lock_with_key: | POST | `/api/v2 private/get_block_rfqs` | -| [addBlockRfqQuote()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1831) | :closed_lock_with_key: | POST | `/api/v2 private/add_block_rfq_quote` | -| [editBlockRfqQuote()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1847) | :closed_lock_with_key: | POST | `/api/v2 private/edit_block_rfq_quote` | -| [cancelBlockRfqQuote()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1860) | :closed_lock_with_key: | POST | `/api/v2 private/cancel_block_rfq_quote` | -| [cancelAllBlockRfqQuotes()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1873) | :closed_lock_with_key: | POST | `/api/v2 private/cancel_all_block_rfq_quotes` | -| [getBlockRfqQuotes()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1886) | :closed_lock_with_key: | POST | `/api/v2 private/get_block_rfq_quotes` | -| [getBlockRfqMakers()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1899) | :closed_lock_with_key: | POST | `/api/v2 private/get_block_rfq_makers` | -| [getBlockRfqUserInfo()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1912) | :closed_lock_with_key: | POST | `/api/v2 private/get_block_rfq_user_info` | -| [executeBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1925) | :closed_lock_with_key: | POST | `/api/v2 private/execute_block_trade` | -| [verifyBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1938) | :closed_lock_with_key: | POST | `/api/v2 private/verify_block_trade` | -| [approveBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1951) | :closed_lock_with_key: | POST | `/api/v2 private/approve_block_trade` | -| [rejectBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1964) | :closed_lock_with_key: | POST | `/api/v2 private/reject_block_trade` | -| [simulateBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1977) | :closed_lock_with_key: | POST | `/api/v2 private/simulate_block_trade` | -| [invalidateBlockTradeSignature()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1990) | :closed_lock_with_key: | POST | `/api/v2 private/invalidate_block_trade_signature` | -| [getBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2003) | :closed_lock_with_key: | POST | `/api/v2 private/get_block_trade` | -| [getBlockTrades()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2016) | :closed_lock_with_key: | POST | `/api/v2 private/get_block_trades` | -| [getBlockTradeRequests()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2029) | :closed_lock_with_key: | POST | `/api/v2 private/get_block_trade_requests` | -| [getBrokerTrades()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2042) | :closed_lock_with_key: | POST | `/api/v2 private/get_broker_trades` | -| [getBrokerTradeRequests()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2055) | :closed_lock_with_key: | POST | `/api/v2 private/get_broker_trade_requests` | +| [auth()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L171) | | POST | `/api/v2/public/auth` | +| [getAnnouncements()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L186) | | POST | `/api/v2/public/get_announcements` | +| [getBlockRfqTrades()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L201) | | POST | `/api/v2/public/get_block_rfq_trades` | +| [getBookSummaryByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L218) | | POST | `/api/v2/public/get_book_summary_by_currency` | +| [getBookSummaryByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L236) | | POST | `/api/v2/public/get_book_summary_by_instrument` | +| [getComboDetails()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L253) | | POST | `/api/v2/public/get_combo_details` | +| [getComboIds()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L268) | | POST | `/api/v2/public/get_combo_ids` | +| [getCombos()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L282) | | POST | `/api/v2/public/get_combos` | +| [getContractSize()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L300) | | POST | `/api/v2/public/get_contract_size` | +| [getCurrencies()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L316) | | POST | `/api/v2/public/get_currencies` | +| [getDeliveryPrices()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L331) | | POST | `/api/v2/public/get_delivery_prices` | +| [getExpirations()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L348) | | POST | `/api/v2/public/get_expirations` | +| [getFundingChartData()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L365) | | POST | `/api/v2/public/get_funding_chart_data` | +| [getFundingRateHistory()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L383) | | POST | `/api/v2/public/get_funding_rate_history` | +| [getFundingRateValue()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L403) | | POST | `/api/v2/public/get_funding_rate_value` | +| [getHistoricalVolatility()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L420) | | POST | `/api/v2/public/get_historical_volatility` | +| [getIndexChartData()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L439) | | POST | `/api/v2/public/get_index_chart_data` | +| [getIndexPrice()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L455) | | POST | `/api/v2/public/get_index_price` | +| [getIndexPriceNames()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L472) | | POST | `/api/v2/public/get_index_price_names` | +| [getInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L489) | | POST | `/api/v2/public/get_instrument` | +| [getInstruments()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L513) | | POST | `/api/v2/public/get_instruments` | +| [getLastSettlementsByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L541) | | POST | `/api/v2/public/get_last_settlements_by_currency` | +| [getLastSettlementsByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L570) | | POST | `/api/v2/public/get_last_settlements_by_instrument` | +| [getLastTradesByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L594) | | POST | `/api/v2/public/get_last_trades_by_currency` | +| [getLastTradesByCurrencyAndTime()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L617) | | POST | `/api/v2/public/get_last_trades_by_currency_and_time` | +| [getLastTradesByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L638) | | POST | `/api/v2/public/get_last_trades_by_instrument` | +| [getLastTradesByInstrumentAndTime()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L659) | | POST | `/api/v2/public/get_last_trades_by_instrument_and_time` | +| [getMarkPriceHistory()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L678) | | POST | `/api/v2/public/get_mark_price_history` | +| [getOrderBook()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L697) | | POST | `/api/v2/public/get_order_book` | +| [getOrderBookByInstrumentId()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L714) | | POST | `/api/v2/public/get_order_book_by_instrument_id` | +| [getSupportedIndexNames()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L733) | | POST | `/api/v2/public/get_supported_index_names` | +| [getTime()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L749) | | POST | `/api/v2/public/get_time` | +| [getTradeVolumes()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L767) | | POST | `/api/v2/public/get_trade_volumes` | +| [getTradingviewChartData()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L788) | | POST | `/api/v2/public/get_tradingview_chart_data` | +| [getVolatilityIndexData()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L807) | | POST | `/api/v2/public/get_volatility_index_data` | +| [getStatus()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L822) | | POST | `/api/v2/public/status` | +| [testConnection()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L834) | | POST | `/api/v2/public/test` | +| [getTicker()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L853) | | POST | `/api/v2/public/ticker` | +| [submitBuy()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L880) | :closed_lock_with_key: | POST | `/api/v2/private/buy` | +| [submitSell()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L903) | :closed_lock_with_key: | POST | `/api/v2/private/sell` | +| [updateOrder()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L925) | :closed_lock_with_key: | POST | `/api/v2/private/edit` | +| [updateOrderByLabel()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L945) | :closed_lock_with_key: | POST | `/api/v2/private/edit_by_label` | +| [cancelOrder()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L963) | :closed_lock_with_key: | POST | `/api/v2/private/cancel` | +| [cancelByLabel()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L984) | :closed_lock_with_key: | POST | `/api/v2/private/cancel_by_label` | +| [cancelAll()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1004) | :closed_lock_with_key: | POST | `/api/v2/private/cancel_all` | +| [cancelAllByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1021) | :closed_lock_with_key: | POST | `/api/v2/private/cancel_all_by_currency` | +| [cancelAllByCurrencyPair()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1042) | :closed_lock_with_key: | POST | `/api/v2/private/cancel_all_by_currency_pair` | +| [cancelAllByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1063) | :closed_lock_with_key: | POST | `/api/v2/private/cancel_all_by_instrument` | +| [cancelAllByKindOrType()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1084) | :closed_lock_with_key: | POST | `/api/v2/private/cancel_all_by_kind_or_type` | +| [closePosition()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1105) | :closed_lock_with_key: | POST | `/api/v2/private/close_position` | +| [getOpenOrders()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1121) | :closed_lock_with_key: | POST | `/api/v2/private/get_open_orders` | +| [getOpenOrdersByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1139) | :closed_lock_with_key: | POST | `/api/v2/private/get_open_orders_by_currency` | +| [getOpenOrdersByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1157) | :closed_lock_with_key: | POST | `/api/v2/private/get_open_orders_by_instrument` | +| [getOpenOrdersByLabel()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1175) | :closed_lock_with_key: | POST | `/api/v2/private/get_open_orders_by_label` | +| [getOrderState()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1201) | :closed_lock_with_key: | POST | `/api/v2/private/get_order_state` | +| [getOrderStateByLabel()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1226) | :closed_lock_with_key: | POST | `/api/v2/private/get_order_state_by_label` | +| [getOrderHistoryByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1248) | :closed_lock_with_key: | POST | `/api/v2/private/get_order_history_by_currency` | +| [getOrderHistoryByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1270) | :closed_lock_with_key: | POST | `/api/v2/private/get_order_history_by_instrument` | +| [getOrderMarginByIds()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1288) | :closed_lock_with_key: | POST | `/api/v2/private/get_order_margin_by_ids` | +| [getTriggerOrderHistory()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1308) | :closed_lock_with_key: | POST | `/api/v2/private/get_trigger_order_history` | +| [getUserTradesByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1331) | :closed_lock_with_key: | POST | `/api/v2/private/get_user_trades_by_currency` | +| [getUserTradesByCurrencyAndTime()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1356) | :closed_lock_with_key: | POST | `/api/v2/private/get_user_trades_by_currency_and_time` | +| [getUserTradesByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1380) | :closed_lock_with_key: | POST | `/api/v2/private/get_user_trades_by_instrument` | +| [getUserTradesByInstrumentAndTime()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1404) | :closed_lock_with_key: | POST | `/api/v2/private/get_user_trades_by_instrument_and_time` | +| [getUserTradesByOrder()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1428) | :closed_lock_with_key: | POST | `/api/v2/private/get_user_trades_by_order` | +| [getMargins()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1447) | :closed_lock_with_key: | POST | `/api/v2/private/get_margins` | +| [getAccountSummaries()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1464) | :closed_lock_with_key: | POST | `/api/v2/private/get_account_summaries` | +| [getAccountSummary()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1490) | :closed_lock_with_key: | POST | `/api/v2/private/get_account_summary` | +| [getPosition()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1511) | :closed_lock_with_key: | POST | `/api/v2/private/get_position` | +| [getPositions()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1530) | :closed_lock_with_key: | POST | `/api/v2/private/get_positions` | +| [changeMarginModel()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1549) | :closed_lock_with_key: | POST | `/api/v2/private/change_margin_model` | +| [getAccessLog()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1568) | :closed_lock_with_key: | POST | `/api/v2/private/get_access_log` | +| [getTransactionLog()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1595) | :closed_lock_with_key: | POST | `/api/v2/private/get_transaction_log` | +| [getSettlementHistoryByCurrency()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1620) | :closed_lock_with_key: | POST | `/api/v2/private/get_settlement_history_by_currency` | +| [getSettlementHistoryByInstrument()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1646) | :closed_lock_with_key: | POST | `/api/v2/private/get_settlement_history_by_instrument` | +| [simulatePortfolio()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1669) | :closed_lock_with_key: | POST | `/api/v2/private/simulate_portfolio` | +| [simulatePme()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1691) | :closed_lock_with_key: | POST | `/api/v2/private/pme/simulate` | +| [enableCancelOnDisconnect()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1715) | :closed_lock_with_key: | POST | `/api/v2/private/enable_cancel_on_disconnect` | +| [disableCancelOnDisconnect()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1733) | :closed_lock_with_key: | POST | `/api/v2/private/disable_cancel_on_disconnect` | +| [getCancelOnDisconnect()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1748) | :closed_lock_with_key: | POST | `/api/v2/private/get_cancel_on_disconnect` | +| [createCombo()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1767) | :closed_lock_with_key: | POST | `/api/v2/private/create_combo` | +| [getLegPrices()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1784) | :closed_lock_with_key: | POST | `/api/v2/private/get_leg_prices` | +| [createBlockRfq()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1799) | :closed_lock_with_key: | POST | `/api/v2/private/create_block_rfq` | +| [cancelBlockRfq()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1817) | :closed_lock_with_key: | POST | `/api/v2/private/cancel_block_rfq` | +| [acceptBlockRfq()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1832) | :closed_lock_with_key: | POST | `/api/v2/private/accept_block_rfq` | +| [cancelBlockRfqTrigger()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1847) | :closed_lock_with_key: | POST | `/api/v2/private/cancel_block_rfq_trigger` | +| [getBlockRfqs()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1862) | :closed_lock_with_key: | POST | `/api/v2/private/get_block_rfqs` | +| [addBlockRfqQuote()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1875) | :closed_lock_with_key: | POST | `/api/v2/private/add_block_rfq_quote` | +| [editBlockRfqQuote()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1893) | :closed_lock_with_key: | POST | `/api/v2/private/edit_block_rfq_quote` | +| [cancelBlockRfqQuote()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1908) | :closed_lock_with_key: | POST | `/api/v2/private/cancel_block_rfq_quote` | +| [cancelAllBlockRfqQuotes()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1923) | :closed_lock_with_key: | POST | `/api/v2/private/cancel_all_block_rfq_quotes` | +| [getBlockRfqQuotes()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1938) | :closed_lock_with_key: | POST | `/api/v2/private/get_block_rfq_quotes` | +| [getBlockRfqMakers()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1953) | :closed_lock_with_key: | POST | `/api/v2/private/get_block_rfq_makers` | +| [getBlockRfqUserInfo()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1968) | :closed_lock_with_key: | POST | `/api/v2/private/get_block_rfq_user_info` | +| [executeBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1983) | :closed_lock_with_key: | POST | `/api/v2/private/execute_block_trade` | +| [verifyBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L1998) | :closed_lock_with_key: | POST | `/api/v2/private/verify_block_trade` | +| [approveBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2013) | :closed_lock_with_key: | POST | `/api/v2/private/approve_block_trade` | +| [rejectBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2028) | :closed_lock_with_key: | POST | `/api/v2/private/reject_block_trade` | +| [simulateBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2043) | :closed_lock_with_key: | POST | `/api/v2/private/simulate_block_trade` | +| [invalidateBlockTradeSignature()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2058) | :closed_lock_with_key: | POST | `/api/v2/private/invalidate_block_trade_signature` | +| [getBlockTrade()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2074) | :closed_lock_with_key: | POST | `/api/v2/private/get_block_trade` | +| [getBlockTrades()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2089) | :closed_lock_with_key: | POST | `/api/v2/private/get_block_trades` | +| [getBlockTradeRequests()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2104) | :closed_lock_with_key: | POST | `/api/v2/private/get_block_trade_requests` | +| [getBrokerTrades()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2119) | :closed_lock_with_key: | POST | `/api/v2/private/get_broker_trades` | +| [getBrokerTradeRequests()](https://github.com/sieblyio/coinbase-api/blob/master/src/CBAdvancedTradeGlobalClient.ts#L2134) | :closed_lock_with_key: | POST | `/api/v2/private/get_broker_trade_requests` | # CBAppClient.ts diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/acceptBlockRfq.js b/examples/apidoc/CBAdvancedTradeGlobalClient/acceptBlockRfq.js index 2616be1..ad31731 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/acceptBlockRfq.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/acceptBlockRfq.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/accept_block_rfq +// ENDPOINT: /api/v2/private/accept_block_rfq // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/addBlockRfqQuote.js b/examples/apidoc/CBAdvancedTradeGlobalClient/addBlockRfqQuote.js index 3b9c449..edf4f37 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/addBlockRfqQuote.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/addBlockRfqQuote.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/add_block_rfq_quote +// ENDPOINT: /api/v2/private/add_block_rfq_quote // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/approveBlockTrade.js b/examples/apidoc/CBAdvancedTradeGlobalClient/approveBlockTrade.js index 1502dcf..bf97a65 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/approveBlockTrade.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/approveBlockTrade.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/approve_block_trade +// ENDPOINT: /api/v2/private/approve_block_trade // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/auth.js b/examples/apidoc/CBAdvancedTradeGlobalClient/auth.js index 1630e27..0f845dc 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/auth.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/auth.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/auth +// ENDPOINT: /api/v2/public/auth // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAll.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAll.js index ba1bb79..e36e4ab 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAll.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAll.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel_all +// ENDPOINT: /api/v2/private/cancel_all // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllBlockRfqQuotes.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllBlockRfqQuotes.js index 7bde6d3..4591707 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllBlockRfqQuotes.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllBlockRfqQuotes.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel_all_block_rfq_quotes +// ENDPOINT: /api/v2/private/cancel_all_block_rfq_quotes // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByCurrency.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByCurrency.js index bbbb564..0c8cd97 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByCurrency.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByCurrency.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel_all_by_currency +// ENDPOINT: /api/v2/private/cancel_all_by_currency // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByCurrencyPair.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByCurrencyPair.js index e93d205..1add9ec 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByCurrencyPair.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByCurrencyPair.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel_all_by_currency_pair +// ENDPOINT: /api/v2/private/cancel_all_by_currency_pair // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByInstrument.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByInstrument.js index 23948c0..1189f80 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByInstrument.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByInstrument.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel_all_by_instrument +// ENDPOINT: /api/v2/private/cancel_all_by_instrument // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByKindOrType.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByKindOrType.js index e58cfc4..3ad2efa 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByKindOrType.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelAllByKindOrType.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel_all_by_kind_or_type +// ENDPOINT: /api/v2/private/cancel_all_by_kind_or_type // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfq.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfq.js index b496bac..1dedf86 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfq.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfq.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel_block_rfq +// ENDPOINT: /api/v2/private/cancel_block_rfq // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfqQuote.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfqQuote.js index 90ced8f..4e98d3c 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfqQuote.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfqQuote.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel_block_rfq_quote +// ENDPOINT: /api/v2/private/cancel_block_rfq_quote // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfqTrigger.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfqTrigger.js index fb34755..449e95c 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfqTrigger.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelBlockRfqTrigger.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel_block_rfq_trigger +// ENDPOINT: /api/v2/private/cancel_block_rfq_trigger // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelByLabel.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelByLabel.js index 2ce0cfd..7084e78 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelByLabel.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelByLabel.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel_by_label +// ENDPOINT: /api/v2/private/cancel_by_label // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelOrder.js b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelOrder.js index c8bdbe2..d19c044 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/cancelOrder.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/cancelOrder.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/cancel +// ENDPOINT: /api/v2/private/cancel // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/changeMarginModel.js b/examples/apidoc/CBAdvancedTradeGlobalClient/changeMarginModel.js index ffea93f..d10b99e 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/changeMarginModel.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/changeMarginModel.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/change_margin_model +// ENDPOINT: /api/v2/private/change_margin_model // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/closePosition.js b/examples/apidoc/CBAdvancedTradeGlobalClient/closePosition.js index 96d484c..ea0d24b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/closePosition.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/closePosition.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/close_position +// ENDPOINT: /api/v2/private/close_position // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/createBlockRfq.js b/examples/apidoc/CBAdvancedTradeGlobalClient/createBlockRfq.js index 7b15d70..aea59ad 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/createBlockRfq.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/createBlockRfq.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/create_block_rfq +// ENDPOINT: /api/v2/private/create_block_rfq // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/createCombo.js b/examples/apidoc/CBAdvancedTradeGlobalClient/createCombo.js index 369396e..143f934 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/createCombo.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/createCombo.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/create_combo +// ENDPOINT: /api/v2/private/create_combo // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/disableCancelOnDisconnect.js b/examples/apidoc/CBAdvancedTradeGlobalClient/disableCancelOnDisconnect.js index 2a9d17b..8493751 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/disableCancelOnDisconnect.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/disableCancelOnDisconnect.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/disable_cancel_on_disconnect +// ENDPOINT: /api/v2/private/disable_cancel_on_disconnect // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/editBlockRfqQuote.js b/examples/apidoc/CBAdvancedTradeGlobalClient/editBlockRfqQuote.js index f87acf2..9fe84c9 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/editBlockRfqQuote.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/editBlockRfqQuote.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/edit_block_rfq_quote +// ENDPOINT: /api/v2/private/edit_block_rfq_quote // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/enableCancelOnDisconnect.js b/examples/apidoc/CBAdvancedTradeGlobalClient/enableCancelOnDisconnect.js index c872fe8..4504292 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/enableCancelOnDisconnect.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/enableCancelOnDisconnect.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/enable_cancel_on_disconnect +// ENDPOINT: /api/v2/private/enable_cancel_on_disconnect // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/executeBlockTrade.js b/examples/apidoc/CBAdvancedTradeGlobalClient/executeBlockTrade.js index 537d1d5..68174c3 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/executeBlockTrade.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/executeBlockTrade.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/execute_block_trade +// ENDPOINT: /api/v2/private/execute_block_trade // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getAccessLog.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getAccessLog.js index f7bc09c..e3aa85b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getAccessLog.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getAccessLog.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_access_log +// ENDPOINT: /api/v2/private/get_access_log // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getAccountSummaries.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getAccountSummaries.js index a143111..59bd38e 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getAccountSummaries.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getAccountSummaries.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_account_summaries +// ENDPOINT: /api/v2/private/get_account_summaries // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getAccountSummary.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getAccountSummary.js index 57e440b..898f811 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getAccountSummary.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getAccountSummary.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_account_summary +// ENDPOINT: /api/v2/private/get_account_summary // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getAnnouncements.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getAnnouncements.js index c924d9e..21a9f50 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getAnnouncements.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getAnnouncements.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_announcements +// ENDPOINT: /api/v2/public/get_announcements // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqMakers.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqMakers.js index 67ac4c4..990d92c 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqMakers.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqMakers.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_block_rfq_makers +// ENDPOINT: /api/v2/private/get_block_rfq_makers // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqQuotes.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqQuotes.js index 64a8d1c..6245785 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqQuotes.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqQuotes.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_block_rfq_quotes +// ENDPOINT: /api/v2/private/get_block_rfq_quotes // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqTrades.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqTrades.js index 151b690..36c68e0 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqTrades.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqTrades.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_block_rfq_trades +// ENDPOINT: /api/v2/public/get_block_rfq_trades // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqUserInfo.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqUserInfo.js index 44b8457..88d8ac5 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqUserInfo.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqUserInfo.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_block_rfq_user_info +// ENDPOINT: /api/v2/private/get_block_rfq_user_info // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqs.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqs.js index 813fd8b..49ecb0b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqs.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockRfqs.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_block_rfqs +// ENDPOINT: /api/v2/private/get_block_rfqs // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTrade.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTrade.js index 4c7df22..e3d3d2b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTrade.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTrade.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_block_trade +// ENDPOINT: /api/v2/private/get_block_trade // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTradeRequests.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTradeRequests.js index e580e58..6b992d2 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTradeRequests.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTradeRequests.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_block_trade_requests +// ENDPOINT: /api/v2/private/get_block_trade_requests // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTrades.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTrades.js index 0fd33d1..42ff143 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTrades.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBlockTrades.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_block_trades +// ENDPOINT: /api/v2/private/get_block_trades // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBookSummaryByCurrency.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBookSummaryByCurrency.js index 3a8c684..33c9010 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBookSummaryByCurrency.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBookSummaryByCurrency.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_book_summary_by_currency +// ENDPOINT: /api/v2/public/get_book_summary_by_currency // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBookSummaryByInstrument.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBookSummaryByInstrument.js index 0d47dbb..324e7bc 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBookSummaryByInstrument.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBookSummaryByInstrument.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_book_summary_by_instrument +// ENDPOINT: /api/v2/public/get_book_summary_by_instrument // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBrokerTradeRequests.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBrokerTradeRequests.js index d2540a0..c7b993d 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBrokerTradeRequests.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBrokerTradeRequests.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_broker_trade_requests +// ENDPOINT: /api/v2/private/get_broker_trade_requests // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getBrokerTrades.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getBrokerTrades.js index 5405189..a93997f 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getBrokerTrades.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getBrokerTrades.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_broker_trades +// ENDPOINT: /api/v2/private/get_broker_trades // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getCancelOnDisconnect.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getCancelOnDisconnect.js index 1b3958d..7f1e18f 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getCancelOnDisconnect.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getCancelOnDisconnect.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_cancel_on_disconnect +// ENDPOINT: /api/v2/private/get_cancel_on_disconnect // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getComboDetails.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getComboDetails.js index 711309d..9aa5aea 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getComboDetails.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getComboDetails.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_combo_details +// ENDPOINT: /api/v2/public/get_combo_details // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getComboIds.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getComboIds.js index 61befae..d4ef6c6 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getComboIds.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getComboIds.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_combo_ids +// ENDPOINT: /api/v2/public/get_combo_ids // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getCombos.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getCombos.js index 35406fe..421c5a9 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getCombos.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getCombos.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_combos +// ENDPOINT: /api/v2/public/get_combos // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getContractSize.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getContractSize.js index fee54e3..a96ce7e 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getContractSize.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getContractSize.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_contract_size +// ENDPOINT: /api/v2/public/get_contract_size // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getCurrencies.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getCurrencies.js index 15f4246..b8c690b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getCurrencies.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getCurrencies.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_currencies +// ENDPOINT: /api/v2/public/get_currencies // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getDeliveryPrices.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getDeliveryPrices.js index 7141e60..21bbcce 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getDeliveryPrices.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getDeliveryPrices.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_delivery_prices +// ENDPOINT: /api/v2/public/get_delivery_prices // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getExpirations.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getExpirations.js index d893f0d..27ae693 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getExpirations.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getExpirations.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_expirations +// ENDPOINT: /api/v2/public/get_expirations // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingChartData.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingChartData.js index 10a57c4..a67c25c 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingChartData.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingChartData.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_funding_chart_data +// ENDPOINT: /api/v2/public/get_funding_chart_data // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingRateHistory.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingRateHistory.js index 93f63dc..ca9ef77 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingRateHistory.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingRateHistory.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_funding_rate_history +// ENDPOINT: /api/v2/public/get_funding_rate_history // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingRateValue.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingRateValue.js index 4c6da94..79b6b5a 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingRateValue.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getFundingRateValue.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_funding_rate_value +// ENDPOINT: /api/v2/public/get_funding_rate_value // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getHistoricalVolatility.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getHistoricalVolatility.js index 503131d..968371c 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getHistoricalVolatility.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getHistoricalVolatility.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_historical_volatility +// ENDPOINT: /api/v2/public/get_historical_volatility // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexChartData.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexChartData.js index a8463e7..a75bd02 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexChartData.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexChartData.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_index_chart_data +// ENDPOINT: /api/v2/public/get_index_chart_data // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexPrice.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexPrice.js index feeff75..10ada9b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexPrice.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexPrice.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_index_price +// ENDPOINT: /api/v2/public/get_index_price // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexPriceNames.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexPriceNames.js index c5be66f..656b306 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexPriceNames.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getIndexPriceNames.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_index_price_names +// ENDPOINT: /api/v2/public/get_index_price_names // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getInstrument.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getInstrument.js index b0365dd..498e265 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getInstrument.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getInstrument.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_instrument +// ENDPOINT: /api/v2/public/get_instrument // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getInstruments.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getInstruments.js index 907d0ca..a7cd1cb 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getInstruments.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getInstruments.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_instruments +// ENDPOINT: /api/v2/public/get_instruments // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastSettlementsByCurrency.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastSettlementsByCurrency.js index 444b3d6..5ade862 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastSettlementsByCurrency.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastSettlementsByCurrency.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_last_settlements_by_currency +// ENDPOINT: /api/v2/public/get_last_settlements_by_currency // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastSettlementsByInstrument.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastSettlementsByInstrument.js index 978e1ad..0284d31 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastSettlementsByInstrument.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastSettlementsByInstrument.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_last_settlements_by_instrument +// ENDPOINT: /api/v2/public/get_last_settlements_by_instrument // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByCurrency.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByCurrency.js index 3697eec..7eb91be 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByCurrency.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByCurrency.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_last_trades_by_currency +// ENDPOINT: /api/v2/public/get_last_trades_by_currency // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByCurrencyAndTime.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByCurrencyAndTime.js index 757aa4f..edb6f5b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByCurrencyAndTime.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByCurrencyAndTime.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_last_trades_by_currency_and_time +// ENDPOINT: /api/v2/public/get_last_trades_by_currency_and_time // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByInstrument.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByInstrument.js index c7b1cab..6359a38 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByInstrument.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByInstrument.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_last_trades_by_instrument +// ENDPOINT: /api/v2/public/get_last_trades_by_instrument // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByInstrumentAndTime.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByInstrumentAndTime.js index bcb4839..bb7743d 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByInstrumentAndTime.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getLastTradesByInstrumentAndTime.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_last_trades_by_instrument_and_time +// ENDPOINT: /api/v2/public/get_last_trades_by_instrument_and_time // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getLegPrices.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getLegPrices.js index b5fc7ec..222ca1b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getLegPrices.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getLegPrices.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_leg_prices +// ENDPOINT: /api/v2/private/get_leg_prices // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getMargins.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getMargins.js index c1bee76..7c9799f 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getMargins.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getMargins.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_margins +// ENDPOINT: /api/v2/private/get_margins // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getMarkPriceHistory.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getMarkPriceHistory.js index 4656dd5..b31dbdb 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getMarkPriceHistory.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getMarkPriceHistory.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_mark_price_history +// ENDPOINT: /api/v2/public/get_mark_price_history // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrders.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrders.js index 1c9f89a..6687da8 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrders.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrders.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_open_orders +// ENDPOINT: /api/v2/private/get_open_orders // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByCurrency.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByCurrency.js index 9677112..a26f711 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByCurrency.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByCurrency.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_open_orders_by_currency +// ENDPOINT: /api/v2/private/get_open_orders_by_currency // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByInstrument.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByInstrument.js index 44005b7..e50d636 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByInstrument.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByInstrument.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_open_orders_by_instrument +// ENDPOINT: /api/v2/private/get_open_orders_by_instrument // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByLabel.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByLabel.js index e5ced8b..03d90bc 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByLabel.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOpenOrdersByLabel.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_open_orders_by_label +// ENDPOINT: /api/v2/private/get_open_orders_by_label // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderBook.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderBook.js index 7f2b615..927de7b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderBook.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderBook.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_order_book +// ENDPOINT: /api/v2/public/get_order_book // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderBookByInstrumentId.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderBookByInstrumentId.js index 5b3027a..63a9b6d 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderBookByInstrumentId.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderBookByInstrumentId.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_order_book_by_instrument_id +// ENDPOINT: /api/v2/public/get_order_book_by_instrument_id // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderHistoryByCurrency.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderHistoryByCurrency.js index 1ab477a..1f85fa3 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderHistoryByCurrency.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderHistoryByCurrency.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_order_history_by_currency +// ENDPOINT: /api/v2/private/get_order_history_by_currency // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderHistoryByInstrument.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderHistoryByInstrument.js index 5b25da5..ce77d2b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderHistoryByInstrument.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderHistoryByInstrument.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_order_history_by_instrument +// ENDPOINT: /api/v2/private/get_order_history_by_instrument // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderMarginByIds.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderMarginByIds.js index e69ef8b..788d4ba 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderMarginByIds.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderMarginByIds.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_order_margin_by_ids +// ENDPOINT: /api/v2/private/get_order_margin_by_ids // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderState.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderState.js index 0ab8e9d..7830198 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderState.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderState.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_order_state +// ENDPOINT: /api/v2/private/get_order_state // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderStateByLabel.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderStateByLabel.js index 02c00a2..8393b5b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderStateByLabel.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getOrderStateByLabel.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_order_state_by_label +// ENDPOINT: /api/v2/private/get_order_state_by_label // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getPosition.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getPosition.js index a370d2d..323533e 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getPosition.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getPosition.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_position +// ENDPOINT: /api/v2/private/get_position // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getPositions.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getPositions.js index 26770de..304bca0 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getPositions.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getPositions.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_positions +// ENDPOINT: /api/v2/private/get_positions // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getSettlementHistoryByCurrency.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getSettlementHistoryByCurrency.js index dd64a57..b52d8bd 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getSettlementHistoryByCurrency.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getSettlementHistoryByCurrency.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_settlement_history_by_currency +// ENDPOINT: /api/v2/private/get_settlement_history_by_currency // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getSettlementHistoryByInstrument.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getSettlementHistoryByInstrument.js index 79bbcc2..7f5de33 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getSettlementHistoryByInstrument.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getSettlementHistoryByInstrument.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_settlement_history_by_instrument +// ENDPOINT: /api/v2/private/get_settlement_history_by_instrument // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getStatus.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getStatus.js index 53a6e1e..29b41fc 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getStatus.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getStatus.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/status +// ENDPOINT: /api/v2/public/status // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getSupportedIndexNames.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getSupportedIndexNames.js index 342685f..a2e405e 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getSupportedIndexNames.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getSupportedIndexNames.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_supported_index_names +// ENDPOINT: /api/v2/public/get_supported_index_names // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getTicker.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getTicker.js index 4b4c3e5..1fb471c 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getTicker.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getTicker.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/ticker +// ENDPOINT: /api/v2/public/ticker // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getTime.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getTime.js index b1861d3..96af50b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getTime.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getTime.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_time +// ENDPOINT: /api/v2/public/get_time // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getTradeVolumes.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getTradeVolumes.js index 935e382..e79a35e 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getTradeVolumes.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getTradeVolumes.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_trade_volumes +// ENDPOINT: /api/v2/public/get_trade_volumes // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getTradingviewChartData.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getTradingviewChartData.js index b6127f1..2e20ce1 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getTradingviewChartData.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getTradingviewChartData.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_tradingview_chart_data +// ENDPOINT: /api/v2/public/get_tradingview_chart_data // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getTransactionLog.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getTransactionLog.js index c641e9e..66104e2 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getTransactionLog.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getTransactionLog.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_transaction_log +// ENDPOINT: /api/v2/private/get_transaction_log // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getTriggerOrderHistory.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getTriggerOrderHistory.js index 5009b75..c50310c 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getTriggerOrderHistory.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getTriggerOrderHistory.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_trigger_order_history +// ENDPOINT: /api/v2/private/get_trigger_order_history // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByCurrency.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByCurrency.js index 6493efa..bcd9408 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByCurrency.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByCurrency.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_user_trades_by_currency +// ENDPOINT: /api/v2/private/get_user_trades_by_currency // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByCurrencyAndTime.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByCurrencyAndTime.js index 99d9144..f444029 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByCurrencyAndTime.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByCurrencyAndTime.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_user_trades_by_currency_and_time +// ENDPOINT: /api/v2/private/get_user_trades_by_currency_and_time // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByInstrument.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByInstrument.js index 310cf3d..1797ba5 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByInstrument.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByInstrument.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_user_trades_by_instrument +// ENDPOINT: /api/v2/private/get_user_trades_by_instrument // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByInstrumentAndTime.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByInstrumentAndTime.js index 4263682..bfe147e 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByInstrumentAndTime.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByInstrumentAndTime.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_user_trades_by_instrument_and_time +// ENDPOINT: /api/v2/private/get_user_trades_by_instrument_and_time // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByOrder.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByOrder.js index 3aa421d..cc6e189 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByOrder.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getUserTradesByOrder.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/get_user_trades_by_order +// ENDPOINT: /api/v2/private/get_user_trades_by_order // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/getVolatilityIndexData.js b/examples/apidoc/CBAdvancedTradeGlobalClient/getVolatilityIndexData.js index c1a13d4..ea0bcda 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/getVolatilityIndexData.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/getVolatilityIndexData.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/get_volatility_index_data +// ENDPOINT: /api/v2/public/get_volatility_index_data // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/invalidateBlockTradeSignature.js b/examples/apidoc/CBAdvancedTradeGlobalClient/invalidateBlockTradeSignature.js index 7d045e4..125da59 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/invalidateBlockTradeSignature.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/invalidateBlockTradeSignature.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/invalidate_block_trade_signature +// ENDPOINT: /api/v2/private/invalidate_block_trade_signature // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/rejectBlockTrade.js b/examples/apidoc/CBAdvancedTradeGlobalClient/rejectBlockTrade.js index 07b30cb..41b50e3 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/rejectBlockTrade.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/rejectBlockTrade.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/reject_block_trade +// ENDPOINT: /api/v2/private/reject_block_trade // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/simulateBlockTrade.js b/examples/apidoc/CBAdvancedTradeGlobalClient/simulateBlockTrade.js index eec0e5c..32180a9 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/simulateBlockTrade.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/simulateBlockTrade.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/simulate_block_trade +// ENDPOINT: /api/v2/private/simulate_block_trade // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/simulatePme.js b/examples/apidoc/CBAdvancedTradeGlobalClient/simulatePme.js index 4d0e88a..e6c115d 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/simulatePme.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/simulatePme.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/pme/simulate +// ENDPOINT: /api/v2/private/pme/simulate // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/simulatePortfolio.js b/examples/apidoc/CBAdvancedTradeGlobalClient/simulatePortfolio.js index 94a7d0f..1df4fad 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/simulatePortfolio.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/simulatePortfolio.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/simulate_portfolio +// ENDPOINT: /api/v2/private/simulate_portfolio // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/submitBuy.js b/examples/apidoc/CBAdvancedTradeGlobalClient/submitBuy.js index df94560..98a8eb3 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/submitBuy.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/submitBuy.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/buy +// ENDPOINT: /api/v2/private/buy // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/submitSell.js b/examples/apidoc/CBAdvancedTradeGlobalClient/submitSell.js index 6273056..bfa877e 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/submitSell.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/submitSell.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/sell +// ENDPOINT: /api/v2/private/sell // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/testConnection.js b/examples/apidoc/CBAdvancedTradeGlobalClient/testConnection.js index edab355..17e9ea3 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/testConnection.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/testConnection.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 public/test +// ENDPOINT: /api/v2/public/test // METHOD: POST // PUBLIC: YES diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/updateOrder.js b/examples/apidoc/CBAdvancedTradeGlobalClient/updateOrder.js index 7b108d6..3c79236 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/updateOrder.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/updateOrder.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/edit +// ENDPOINT: /api/v2/private/edit // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/updateOrderByLabel.js b/examples/apidoc/CBAdvancedTradeGlobalClient/updateOrderByLabel.js index d5805fd..f76ef6b 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/updateOrderByLabel.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/updateOrderByLabel.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/edit_by_label +// ENDPOINT: /api/v2/private/edit_by_label // METHOD: POST // PUBLIC: NO diff --git a/examples/apidoc/CBAdvancedTradeGlobalClient/verifyBlockTrade.js b/examples/apidoc/CBAdvancedTradeGlobalClient/verifyBlockTrade.js index 1673e43..b6b67ae 100644 --- a/examples/apidoc/CBAdvancedTradeGlobalClient/verifyBlockTrade.js +++ b/examples/apidoc/CBAdvancedTradeGlobalClient/verifyBlockTrade.js @@ -4,7 +4,7 @@ import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; // This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange // This coinbase API SDK is available on npm via "npm install coinbase-api" -// ENDPOINT: /api/v2 private/verify_block_trade +// ENDPOINT: /api/v2/private/verify_block_trade // METHOD: POST // PUBLIC: NO diff --git a/llms.txt b/llms.txt index 50d5b5e..b4aaf3d 100644 --- a/llms.txt +++ b/llms.txt @@ -63,6 +63,14 @@ examples/ WebSockets/ privateWs.ts publicWs.ts + AdvancedTradeGlobal/ + WebSockets/ + privateWs.ts + publicWs.ts + wsApi.ts + CBInternationalExchange/ + WebSockets/ + privateWs.ts CoinbaseApp/ Private/ cb-app-private.ts @@ -92,6 +100,7 @@ src/ websocket-util.ts WsStore.ts WsStore.types.ts + AdvancedTradeGlobalAuth.ts BaseRestClient.ts BaseWSClient.ts jwtNode.ts @@ -115,6 +124,7 @@ src/ coinbase-prime.ts ws.ts websockets/ + advanced-trade-global.ts client.ts events.ts requests.ts @@ -128,6 +138,7 @@ src/ CBInternationalClient.ts CBPrimeClient.ts index.ts + WebsocketAPIClient.ts WebsocketClient.ts webpack/ webpack.config.cjs @@ -136,8 +147,6 @@ webpack/ .npmrc .nvmrc .prettierrc -adv-starbase-openapi.json -advanced-trade-spec.yaml index.js jest.config.ts LICENSE.md @@ -208,44 +217,6 @@ async function closePosition() ⋮---- // -================ -File: examples/AdvancedTrade/Private/getAccounts.ts -================ -import { CBAdvancedTradeClient } from '../../../src/index.js'; -⋮---- -/** - * import { CBAdvancedTradeClient } from 'coinbase-api'; - * const { CBAdvancedTradeClient } = require('coinbase-api'); - */ -⋮---- -// initialise the client -/** - * - * You can add both ED25519 and ECDSA keys, client will recognize both types of keys - * - * ECDSA: - * - * { - * apiKey: 'organizations/your_org_id/apiKeys/your_api_key_id', - * apiSecret: - * '-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIPT/TTZPxw0kDGvpuCENJp9A4/2INAt9/QKKfyidTWM8oAoGCCqGSM49\nAwEHoUQDQgAEd+cnxrKl536ly5eYBi+8dvXt1MJXYRo+/v38h9HrFKVGBRndU9DY\npV357xIfqeJEzb/MBuk3EW8cG9RTrYBwjg==\n-----END EC PRIVATE KEY-----\n', - * } - * - * ED25519: - * { - * apiKey: 'your-api-key-id', - * apiSecret: 'yourExampleApiSecretEd25519Version==', - * } - * - * - */ -⋮---- -async function getAccounts() -⋮---- -// Get all accounts -⋮---- -// Get specific account details - ================ File: examples/AdvancedTrade/Private/getOrders.ts ================ @@ -919,176 +890,6 @@ export function isCBPrimeWSRequestOperation( wsKey: WsKey, ): evt is WsPrimeRequestOperation -================ -File: src/lib/websocket/websocket-util.ts -================ -import WebSocket from 'isomorphic-ws'; -⋮---- -import { - WsExchangeRequestOperation, - WsInternationalRequestOperation, -} from '../../types/websockets/requests.js'; -import { signMessage } from '../webCryptoAPI.js'; -⋮---- -/** - * Each websocket URL (domain + endpoint) is represented as a "WS Key". Authentication is handled automatically if required. - */ -⋮---- -/** - * Market Data is the traditional feed that provides updates for both orders and trades. - * Most channels are now available without authentication. - * - * https://docs.cdp.coinbase.com/advanced-trade/docs/ws-overview - */ -⋮---- -/** - * User Order Data provides updates for the orders of the user. - * - * https://docs.cdp.coinbase.com/advanced-trade/docs/ws-overview - */ -⋮---- -/** - * Coinbase Market Data (part of Coinbase Exchange API) is the traditional feed which is available without authentication. - * - * https://docs.cdp.coinbase.com/exchange/docs/websocket-overview - */ -⋮---- -/** - * Coinbase Direct Market Data has direct access to Coinbase Exchange servers and requires Authentication. - * - * https://docs.cdp.coinbase.com/exchange/docs/websocket-overview - */ -⋮---- -/** - * The INTX WebSocket feed is publicly available and provides real-time market data updates for orders and trades. - * The SDK must authenticate when subscribing to the WebSocket Feed the very first time. - * - * https://docs.cdp.coinbase.com/intx/docs/websocket-overview - */ -⋮---- -/** - * The Prime WebSocket feed provides real-time market data updates for orders and trades. To begin - * receiving feed messages, you must send a signed subscribe message to the server indicating - * which channels and products to receive. The SDK will handle this automatically. - * - * https://docs.cdp.coinbase.com/prime/docs/websocket-feed - */ -⋮---- -/** This is used to differentiate between each of the available websocket streams */ -export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; -⋮---- -/** - * Normalised internal format for a request (subscribe/unsubscribe/etc) on a topic, with optional parameters. - * - * - Topic: the topic this event is for - * - Payload: the parameters to include, optional. E.g. auth requires key + sign. Some topics allow configurable parameters. - */ -export interface WsTopicRequest< - TWSTopic extends string = string, - TWSPayload = any, -> { - topic: TWSTopic; - /** - * Any parameters to include with the request. These are automatically merged into the request. - */ - payload?: TWSPayload; -} -⋮---- -/** - * Any parameters to include with the request. These are automatically merged into the request. - */ -⋮---- -/** - * Conveniently allow users to request a topic either as string topics or objects (containing string topic + params) - */ -export type WsTopicRequestOrStringTopic< - TWSTopic extends string, - TWSPayload = any, -> = WsTopicRequest | string; -⋮---- -export interface MessageEventLike { - target: WebSocket; - type: 'message'; - data: string; -} -⋮---- -export function isMessageEvent(msg: unknown): msg is MessageEventLike -⋮---- -/** - * Some exchanges have two livenet environments, some have test environments, some dont. This allows easy flexibility for different exchanges. - * Examples: - * - One livenet and one testnet: NetworkMap<'livenet' | 'testnet'> - * - One livenet, sometimes two, one testnet: NetworkMap<'livenet' | 'testnet', 'livenet2'> - * - Only one livenet, no other networks: NetworkMap<'livenet'> - */ -type NetworkMap< - TRequiredKeys extends string, - TOptionalKeys extends string | undefined = undefined, -> = Record & - (TOptionalKeys extends string - ? Record - : Record); -⋮---- -/** - * Merge one or more WS Request operations (e.g. subscribe request) for - * CB Exchange into one, allowing them to be sent as one request - */ -export function getMergedCBExchangeWSRequestOperations< - TWSTopic extends string = string, ->(operations: WsExchangeRequestOperation[]) -⋮---- -// The CB Exchange WS supports sending multiple topics in one request. -// Merge all requests into one -⋮---- -/** - * Merge one or more WS Request operations (e.g. subscribe request) for - * CB Exchange into one, allowing them to be sent as one request - */ -export function getMergedCBINTXRequestOperations< - TWSTopic extends string = string, ->(operations: WsInternationalRequestOperation[]) -⋮---- -// The CB Exchange WS supports sending multiple topics in one request. -// Merge all requests into one -⋮---- -/** - * Return sign used to authenticate CB Exchange WS requests - */ -export async function getCBExchangeWSSign(apiSecret: string): Promise< -⋮---- -/** - * Return sign used to authenticate CB INTX WS requests - */ -export async function getCBInternationalWSSign( - apiKey: string, - apiSecret: string, - apiPassphrase: string, -): Promise< -⋮---- -/** - * Return sign used to authenticate CB Prime WS requests - */ -export async function getCBPrimeWSSign(params: { - channelName: string; - svcAccountId: string; - portfolioId: string; - apiKey: string; - apiSecret: string; - product_ids?: string[]; -}): Promise< -⋮---- -// channelName + accessKey + svcAccountId + timestamp + portfolioId + products -⋮---- -/** - * ws.terminate() is undefined in browsers. - * This only works in node.js, not in browsers. - * Does nothing if `ws` is undefined. Does nothing in browsers. - */ -export function safeTerminateWs( - ws?: WebSocket | any, - fallbackToClose?: boolean, -): boolean - ================ File: src/lib/websocket/WsStore.types.ts ================ @@ -1653,21 +1454,6 @@ export type CBExchangeSubscriptionsEvent = CBExchangeBaseEvent & { channels?: { name: string; product_ids: string[]; account_ids: null }[]; }; -================ -File: src/types/websockets/wsAPI.ts -================ -export interface WsAPIWsKeyTopicMap { - [k: string]: never; -} -⋮---- -export interface WsAPITopicRequestParamMap { - [k: string]: never; -} -⋮---- -export interface WsAPITopicResponseMap { - [k: string]: never; -} - ================ File: src/CBCommerceClient.ts ================ @@ -2368,33329 +2154,178 @@ withdrawToCounterpartyId( getFeeRateTiers(): Promise ================ -File: src/WebsocketClient.ts +File: .eslintrc.cjs +================ +// 'no-unused-vars': ['warn'], + +================ +File: .prettierrc +================ +{ + "tabWidth": 2, + "singleQuote": true, + "trailingComma": "all" +} + +================ +File: index.js +================ + + +================ +File: jest.config.ts ================ -import { BaseWebsocketClient, EmittableEvent } from './lib/BaseWSClient.js'; -import { signWSJWT } from './lib/jwtNode.js'; -import { neverGuard } from './lib/misc-util.js'; -import { - isCBAdvancedTradeErrorEvent, - isCBAdvancedTradeWSEvent, - isCBExchangeWSEvent, - isCBExchangeWSRequestOperation, - isCBINTXWSRequestOperation, - isCBPrimeWSRequestOperation, -} from './lib/websocket/typeGuards.js'; -import { - getCBExchangeWSSign, - getCBInternationalWSSign, - getCBPrimeWSSign, - getMergedCBExchangeWSRequestOperations, - MessageEventLike, - WS_KEY_MAP, - WS_URL_MAP, - WsKey, - WsTopicRequest, -} from './lib/websocket/websocket-util.js'; -import { WSConnectedResult } from './lib/websocket/WsStore.types.js'; -import { WsMarket } from './types/websockets/client.js'; -import { - WsAdvTradeRequestOperation, - WsExchangeAuthenticatedRequestOperation, - WsExchangeRequestOperation, - WsInternationalAuthenticatedRequestOperation, - WsInternationalRequestOperation, - WsOperation, - WsPrimeAuthenticatedRequestOperation, - WsPrimeRequestOperation, -} from './types/websockets/requests.js'; -import { - WsAPITopicRequestParamMap, - WsAPITopicResponseMap, - WsAPIWsKeyTopicMap, -} from './types/websockets/wsAPI.js'; -⋮---- /** - * Any WS keys in this list will trigger automatic auth as required, if credentials are available + * For a detailed explanation regarding each configuration property, visit: + * https://jestjs.io/docs/configuration */ ⋮---- -// Account data (fills), requires auth. -⋮---- -// Coinbase Direct Market Data has direct access to Coinbase Exchange servers and requires auth. +import type { Config } from 'jest'; ⋮---- -// The INTX feed always requires auth. +// All imported modules in your tests should be mocked automatically +// automock: false, ⋮---- -// The Prime feed always requires auth. +// Stop running tests after `n` failures +// bail: 0, +bail: false, // enable to stop test when an error occur, ⋮---- -/** - * Any WS keys in this list will ALWAYS skip the authentication process, even if credentials are available - */ +// The directory where Jest should store its cached dependency information +// cacheDirectory: "/private/var/folders/kf/2k3sz4px6c9cbyzj1h_b192h0000gn/T/jest_dx", ⋮---- -/** - * WS topics are always a string for this exchange. Some exchanges use complex objects. - */ -type WsTopic = string; +// Automatically clear mock calls, instances, contexts and results before every test ⋮---- -export class WebsocketClient extends BaseWebsocketClient +// Indicates whether the coverage information should be collected while executing the test ⋮---- -/** - * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library - */ -public connectAll(): Promise<(WSConnectedResult | undefined)[]> +// An array of glob patterns indicating a set of files for which coverage information should be collected ⋮---- -/** - * Request subscription to one or more topics. Pass topics as either an array of strings, or array of objects (if the topic has parameters). - * Objects should be formatted as {topic: string, params: object}. - * - * - Subscriptions are automatically routed to the correct websocket connection. - * - Authentication/connection is automatic. - * - Resubscribe after network issues is automatic. - * - * Call `unsubscribe(topics)` to remove topics - */ -public subscribe( - requests: - | (WsTopicRequest | WsTopic) - | (WsTopicRequest | WsTopic)[], - wsKey: WsKey, -) +// The directory where Jest should output its coverage files ⋮---- -/** - * Unsubscribe from one or more topics. Similar to subscribe() but in reverse. - * - * - Requests are automatically routed to the correct websocket connection. - * - These topics will be removed from the topic cache, so they won't be subscribed to again. - */ -public unsubscribe( - requests: - | (WsTopicRequest | WsTopic) - | (WsTopicRequest | WsTopic)[], - wsKey: WsKey, -) +// An array of regexp pattern strings used to skip coverage collection +// coveragePathIgnorePatterns: [ +// "/node_modules/" +// ], ⋮---- -/** - * Not supported by this exchange, do not use - */ +// Indicates which provider should be used to instrument code for coverage ⋮---- -// This overload allows the caller to omit the 3rd param, if it isn't required (e.g. for the login call) -async sendWSAPIRequest< - TWSKey extends keyof WsAPIWsKeyTopicMap, - TWSChannel extends WsAPIWsKeyTopicMap[TWSKey] = WsAPIWsKeyTopicMap[TWSKey], - TWSParams extends - WsAPITopicRequestParamMap[TWSChannel] = WsAPITopicRequestParamMap[TWSChannel], - TWSAPIResponse extends - | WsAPITopicResponseMap[TWSChannel] - | object = WsAPITopicResponseMap[TWSChannel], - >( - wsKey: TWSKey, - channel: TWSChannel, - ...params: TWSParams extends undefined ? [] : [TWSParams] - ): Promise; -⋮---- -async sendWSAPIRequest< - TWSKey extends keyof WsAPIWsKeyTopicMap = keyof WsAPIWsKeyTopicMap, - TWSChannel extends WsAPIWsKeyTopicMap[TWSKey] = WsAPIWsKeyTopicMap[TWSKey], - TWSParams extends - WsAPITopicRequestParamMap[TWSChannel] = WsAPITopicRequestParamMap[TWSChannel], - >( - wsKey: TWSKey, - channel: TWSChannel, - params?: TWSParams, -): Promise +// A list of reporter names that Jest uses when writing coverage reports +// coverageReporters: [ +// "json", +// "text", +// "lcov", +// "clover" +// ], ⋮---- -/** - * - * Internal methods - * - */ +// An object that configures minimum threshold enforcement for coverage results +// coverageThreshold: undefined, ⋮---- -/** - * Return a websocket URL, which is connected to as-is. - * If a token or anything else is needed in the URL, this is a good place to add it. - */ -protected async getWsUrl(wsKey: WsKey): Promise +// A path to a custom dependency extractor +// dependencyExtractor: undefined, ⋮---- -protected sendPingEvent(wsKey: WsKey) +// Make calling deprecated APIs throw helpful error messages +// errorOnDeprecated: false, ⋮---- -protected sendPongEvent(wsKey: WsKey) +// The default configuration for fake timers +// fakeTimers: { +// "enableGlobally": false +// }, ⋮---- -// Send a protocol layer pong +// Force coverage collection from ignored files using an array of glob patterns +// forceCoverageMatch: [], ⋮---- -protected isWsPing(msg: any): boolean +// A path to a module which exports an async function that is triggered once before all test suites +// globalSetup: undefined, ⋮---- -protected isWsPong(msg: any): boolean +// A path to a module which exports an async function that is triggered once after all test suites +// globalTeardown: undefined, ⋮---- -// this.logger.info(`Not a pong: `, msg); +// A set of global variables that need to be available in all test environments +// globals: {}, ⋮---- -protected resolveEmittableEvents( - wsKey: WsKey, - event: MessageEventLike, -): EmittableEvent[] +// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. +// maxWorkers: "50%", ⋮---- -// E.g. {"type":"error","message":"rate limit exceeded","wsKey":"advTradeMarketData"} +// An array of directory names to be searched recursively up from the requiring module's location +// moduleDirectories: [ +// "node_modules" +// ], ⋮---- -// Parse Advanced Trade WS events (update & response) +// An array of file extensions your modules use ⋮---- -// These are request/reply pattern events (e.g. after subscribing to topics or authenticating) +// modulePaths: ['src'], ⋮---- -// Generic data for a channel +// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module +// moduleNameMapper: {}, ⋮---- -// Parse CB Exchange WS events +// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader +// modulePathIgnorePatterns: [], ⋮---- -// Generic data for a channel +// Activates notifications for test results +// notify: false, ⋮---- -/** - * Determines if a topic is for a private channel, using a hardcoded list of strings - */ -protected isPrivateTopicRequest( - request: WsTopicRequest, - wsKey: WsKey, -): boolean +// An enum that specifies notification mode. Requires { notify: true } +// notifyMode: "failure-change", ⋮---- -protected getWsKeyForMarket(market: WsMarket, isPrivate: boolean): WsKey +// A preset that is used as a base for Jest's configuration +// preset: undefined, ⋮---- -protected getWsMarketForWsKey(wsKey: WsKey): WsMarket +// Run tests from one or more projects +// projects: undefined, ⋮---- -protected getPrivateWSKeys(): WsKey[] +// Use this configuration option to add custom reporters to Jest +// reporters: undefined, ⋮---- -/** Force subscription requests to be sent in smaller batches, if a number is returned */ -protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null +// Automatically reset mock state before every test +// resetMocks: false, ⋮---- -// Technically, INTX supports request batching but not with nested parameters, so we'll send one at a time +// Reset the module registry before running each individual test +// resetModules: false, ⋮---- -// Exchange supports request batching, no known limit to max topics per request +// A path to a custom resolver +// resolver: undefined, ⋮---- -/** - * Map one or more topics into fully prepared "subscribe request" events (already stringified and ready to send) - */ -protected async getWsOperationEventsForTopics( - topicRequests: WsTopicRequest[], - wsKey: WsKey, - operation: WsOperation, -): Promise +// Automatically restore mock state and implementation before every test +// restoreMocks: false, ⋮---- -/** - * Operations need to be structured in a way that this exchange understands. - * Parse the internal format into the format expected by the exchange. One request per operation. - */ +// The root directory that Jest should scan for tests and modules within +// rootDir: undefined, ⋮---- -// In case there's ever more operation types than "subscribe" and "unsubscribe" +// A list of paths to directories that Jest should use to search for files in +// roots: [ +// "" +// ], ⋮---- -// As of Sep 2024, parameters (such as product_id[]) cannot be nested with the channels array +// Allows you to use a custom runner instead of Jest's default test runner +// runner: "jest-runner", ⋮---- -// This merges parametrs (such as product_id[]) into the top level request object +// The paths to modules that run some code to configure or set up the testing environment before each test +// setupFiles: [], ⋮---- -/** - * - Merge commands into one if the exchange supports batch requests, - * - Apply auth/sign, if needed, - * - Apply any final formatting to return a string array, ready to be sent upstream. - */ +// A list of paths to modules that run some code to configure or set up the testing framework before each test +// setupFilesAfterEnv: [], ⋮---- -// Events that are ready to send (usually stringified JSON) -// ADV trade only supports sending one at a time, so we don't try to merge them -// These are already signed, if needed. +// The number of seconds after which a test is considered as slow and reported as such in the results. +// slowTestThreshold: 5, ⋮---- -/** - * No batching is supported for this product group, so we can already - * handle sign here and return it as is - */ +// A list of paths to snapshot serializer modules Jest should use for snapshot testing +// snapshotSerializers: [], ⋮---- -// Don't expect this to ever happen, but just to please typescript... +// The test environment that will be used for testing +// testEnvironment: "jest-environment-node", ⋮---- -// We're under the max topics per request limit. -// Send operation requests as one merged request +// Options that will be passed to the testEnvironment +// testEnvironmentOptions: {}, ⋮---- -// We're over the max topics per request limit. Break into batches. +// Adds a location field to test results +// testLocationInResults: false, ⋮---- -// Don't expect this to ever happen, but just to please typescript... +// The glob patterns Jest uses to detect test files ⋮---- -// We're over the max topics per request limit. Break into batches. +// "**/__tests__/**/*.[jt]s?(x)", ⋮---- -// throw new Error( -// 'CB INTX is not fully implemented yet - awaiting test environment... if you need this, please get in touch.', -// ); -⋮---- -// Don't expect this to ever happen, but just to please typescript... -⋮---- -// throw new Error( -// 'CB Prime is not fully implemented yet - awaiting test environment... if you need this, please get in touch.', -// ); -⋮---- -// throw new Error(`Not implemented for "${wsKey}" yet`); -⋮---- -/** - * Events are signed per-request, so this function isn't needed for Coinbase. - */ -protected async getWsAuthRequestEvent(wsKey: WsKey): Promise - -================ -File: .eslintrc.cjs -================ -// 'no-unused-vars': ['warn'], - -================ -File: .prettierrc -================ -{ - "tabWidth": 2, - "singleQuote": true, - "trailingComma": "all" -} - -================ -File: adv-starbase-openapi.json -================ -{ - "openapi": "3.1.0", - "info": { - "description": "Coinbase Retail Advanced Trade API for derivatives trading.", - "title": "Coinbase Retail Advanced Trade (Deribit) API", - "version": "2.1.1" - }, - "servers": [ - { - "url": "https://drb.coinbase.com/api/v2" - } - ], - "paths": { - "/private/buy": { - "get": { - "description": "Places a buy order for an instrument. Supports various order types including limit, market, stop, and advanced order types (stop-limit, take-profit, take-profit-limit, trailing-stop, etc.).\n\nYou can specify order parameters such as price, quantity, time-in-force, post-only, reduce-only, and trigger conditions. Orders can be labeled for easier management and tracking.\n\n**Note:** For spot orders routed to Coinbase Exchange, fills come back asynchronously. It is recommended to receive fills from the `user.trades` channel.\n\n**📖 Related Article:** [Order Management Best Practices](https://docs.deribit.com/articles/order-management-best-practices)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fbuy)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "amount", - "in": "query", - "description": "It represents the requested order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin. The `amount` is a mandatory parameter if `contracts` parameter is missing. If both `contracts` and `amount` parameter are passed they must match each other otherwise error is returned.", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "contracts", - "in": "query", - "description": "It represents the requested order size in contract units and can be passed instead of `amount`. The `contracts` is a mandatory parameter if `amount` parameter is missing. If both `contracts` and `amount` parameter are passed they must match each other otherwise error is returned.", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "type", - "in": "query", - "description": "The order type, default: `\"limit\"`\n\n`stop_limit`, `stop_market`, `take_limit`, `take_market`, and `trailing_stop` (trigger/algo order types) are not supported for `option` and `option_combo` instruments.\n\nFor spot trading routed to Coinbase Exchange, only `\"market\"`, `\"limit\"` and `\"stop_limit\"` orders are supported. Other order types will be rejected.\n", - "required": false, - "schema": { - "type": "string", - "enum": [ - "limit", - "stop_limit", - "take_limit", - "market", - "stop_market", - "take_market", - "market_limit", - "trailing_stop" - ] - } - }, - { - "name": "label", - "in": "query", - "description": "user defined label for the order (maximum 64 characters)", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "price", - "in": "query", - "description": "

The order price in base currency (Only for limit and stop_limit orders)

When adding an order with advanced=usd, the field price should be the option price value in USD.

When adding an order with advanced=implv, the field price should be a value of implied volatility in percentages. For example, price=100, means implied volatility of 100%

", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "time_in_force", - "in": "query", - "description": "

Specifies how long the order remains in effect. Default `\"good_til_cancelled\"`

  • `\"good_til_cancelled\"` - unfilled order remains in order book until cancelled
  • `\"good_til_day\"` - unfilled order remains in order book till the end of the trading session
  • `\"fill_or_kill\"` - execute a transaction immediately and completely or not at all
  • `\"immediate_or_cancel\"` - execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled

For spot trading, only `\"good_til_cancelled\"`, `\"immediate_or_cancel\"` and `\"fill_or_kill\"` are supported. `\"good_til_day\"` is not supported and will be rejected.

", - "required": false, - "schema": { - "type": "string", - "default": "good_til_cancelled", - "enum": [ - "good_til_cancelled", - "good_til_day", - "fill_or_kill", - "immediate_or_cancel" - ] - } - }, - { - "name": "display_amount", - "in": "query", - "description": "Initial display amount for iceberg order. Has to be at least 100 times minimum amount for instrument and ratio of hidden part vs visible part has to be less than 100 as well.", - "required": false, - "schema": { - "type": "number", - "default": 1 - } - }, - { - "name": "post_only", - "in": "query", - "description": "

If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below the spread.

Only valid in combination with time_in_force=`\"good_til_cancelled\"`

For spot trading routed to Coinbase Exchange, the price is never adjusted: `\"post_only\"` must be combined with `\"reject_post_only\"` set to true, and the order is rejected if it would be matched instantly.

", - "required": false, - "schema": { - "type": "boolean", - "default": true - } - }, - { - "name": "reject_post_only", - "in": "query", - "description": "

If an order is considered post-only and this field is set to true then the order is put to the order book unmodified or the request is rejected.

Only valid in combination with `\"post_only\"` set to true

For spot trading routed to Coinbase Exchange, this must be set to true whenever `\"post_only\"` is true; otherwise the request is rejected with `post_only_not_allowed`.

", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "reduce_only", - "in": "query", - "description": "If `true`, the order is considered reduce-only which is intended to only reduce a current position", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "trigger_price", - "in": "query", - "description": "Trigger price, required for trigger orders only (Stop-loss or Take-profit orders)", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "trigger_offset", - "in": "query", - "description": "The maximum deviation from the price peak beyond which the order will be triggered", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "trigger", - "in": "query", - "description": "

Defines the trigger type. Required for `\"Stop-Loss\"`, `\"Take-Profit\"` and `\"Trailing\"` trigger orders

For stop-limit orders routed to Coinbase Exchange, only `\"last_price\"` is allowed.

", - "required": false, - "schema": { - "$ref": "#/components/schemas/trigger" - } - }, - { - "name": "advanced", - "in": "query", - "description": "Advanced option order type. (Only for options. Advanced USD orders are not supported for linear options.)", - "required": false, - "schema": { - "$ref": "#/components/schemas/advanced" - } - }, - { - "name": "mmp", - "in": "query", - "description": "Order MMP flag, only for order_type 'limit'", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "valid_until", - "in": "query", - "description": "Timestamp, when provided server will start processing request in Matching Engine only before given timestamp, in other cases `timed_out` error will be responded. Remember that the given timestamp should be consistent with the server's time, use /public/time method to obtain current server time.", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "linked_order_type", - "in": "query", - "description": "

The type of the linked order.

  • `\"one_triggers_other\"` - Execution of primary order triggers the placement of one or more secondary orders.
  • `\"one_cancels_other\"` - The execution of one order in a pair automatically cancels the other, typically used to set a stop-loss and take-profit simultaneously.
  • `\"one_triggers_one_cancels_other\"` - The execution of a primary order triggers two secondary orders (a stop-loss and take-profit pair), where the execution of one secondary order cancels the other.
", - "required": false, - "schema": { - "type": "string", - "enum": [ - "one_triggers_other", - "one_cancels_other", - "one_triggers_one_cancels_other" - ] - } - }, - { - "name": "trigger_fill_condition", - "in": "query", - "description": "

The fill condition of the linked order (Only for linked order types), default: `first_hit`.

  • `\"first_hit\"` - any execution of the primary order will fully cancel/place all secondary orders.
  • `\"complete_fill\"` - a complete execution (meaning the primary order no longer exists) will cancel/place the secondary orders.
  • `\"incremental\"` - any fill of the primary order will cause proportional partial cancellation/placement of the secondary order. The amount that will be subtracted/added to the secondary order will be rounded down to the contract size.
", - "required": false, - "schema": { - "type": "string", - "default": "first_hit", - "enum": [ - "first_hit", - "complete_fill", - "incremental" - ] - } - }, - { - "name": "otoco_config", - "in": "query", - "description": "List of secondary orders to place or cancel when the primary order is filled. Each entry in the array defines one secondary order. `amount` and `direction` are required; all other fields are optional.", - "required": false, - "schema": { - "type": "array", - "items": { - "properties": { - "amount": { - "description": "**Required.** The secondary order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "type": "number" - }, - "direction": { - "description": "**Required.** Direction of the secondary order.", - "type": "string", - "enum": [ - "buy", - "sell" - ] - }, - "label": { - "description": "User defined label for the order (maximum 64 characters).", - "type": "string" - }, - "post_only": { - "description": "If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below or above the spread (according to the direction of the order).", - "type": "boolean", - "default": false - }, - "price": { - "description": "The order price in base currency. Required for limit and stop_limit orders.", - "type": "number" - }, - "reduce_only": { - "description": "If true, the order is considered reduce-only which is intended to only reduce a current position.", - "type": "boolean", - "default": false - }, - "reject_post_only": { - "description": "If an order is considered post-only and this field is set to true then the order is put to the order book unmodified or the request is rejected.", - "type": "boolean", - "default": false - }, - "time_in_force": { - "description": "Specifies how long the order remains in effect. Default `\"good_til_cancelled\"`.", - "type": "string", - "default": "good_til_cancelled", - "enum": [ - "good_til_cancelled", - "good_til_day", - "fill_or_kill", - "immediate_or_cancel" - ] - }, - "trigger": { - "description": "Defines the trigger type. Required for stop-loss, take-profit, and trailing stop orders.", - "type": "string", - "enum": [ - "index_price", - "mark_price", - "last_price" - ] - }, - "trigger_offset": { - "description": "The maximum deviation from the price peak beyond which the order will be triggered. Used for trailing stop orders.", - "type": "number" - }, - "trigger_price": { - "description": "Trigger price. Required for trigger orders (stop-loss or take-profit orders).", - "type": "number" - }, - "type": { - "description": "The order type, default: `\"limit\"`", - "type": "string", - "enum": [ - "limit", - "stop_limit", - "take_limit", - "market", - "stop_market", - "take_market", - "market_limit", - "trailing_stop" - ] - } - }, - "type": "object" - } - }, - "explode": true, - "style": "form" - }, - { - "name": "isolated", - "in": "query", - "description": "If true, places the order under isolated margin mode. A managed subaccount is claimed or provisioned and bound to the instrument. Available to main accounts for futures orders only; not supported for algo, advanced, or linked orders. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "allocated_margin", - "in": "query", - "description": "Optional initial margin amount transferred from the main account to the isolated subaccount for this order. Only applicable when `isolated = true`. On risk-increasing orders, must meet the required minimum margin or placement fails with error `14033` (`isolated_allocated_too_low`).", - "required": false, - "schema": { - "type": "number" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 5275, - "jsonrpc": "2.0", - "method": "private/buy", - "params": { - "amount": 40, - "instrument_name": "ETH-PERPETUAL", - "label": "market0000234", - "type": "market" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateBuyAndSellResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-buy", - "metadata": { - "keywords": [ - "private/buy", - "instrument_name", - "amount", - "contracts", - "type", - "label", - "price", - "time_in_force", - "display_amount", - "post_only", - "reject_post_only", - "reduce_only", - "trigger_price", - "trigger_offset", - "trigger", - "advanced", - "mmp", - "valid_until", - "linked_order_type", - "trigger_fill_condition", - "otoco_config", - "order", - "trades", - "order_id", - "order_state", - "order_type", - "original_order_type", - "is_rebalance", - "is_liquidation", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "api", - "web", - "mobile", - "refresh_amount", - "filled_amount", - "average_price", - "implv", - "usd", - "triggered", - "trigger_reference_price", - "block_trade", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco", - "trade_id", - "trade_seq", - "timestamp", - "starbase_timestamp", - "matching_id", - "tick_direction", - "index_price", - "iv", - "underlying_price", - "liquidation", - "liquidity", - "fee", - "fee_currency", - "state", - "block_trade_id", - "block_trade_leg_count", - "block_rfq_id", - "block_rfq_quote_id", - "profit_loss", - "mark_price", - "legs", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "trade_allocations", - "user_id", - "client_info", - "client_id", - "client_link_id", - "name" - ], - "og:title": "private/buy", - "title": "private/buy" - } - } - } - }, - "/private/cancel": { - "get": { - "description": "Cancels a specific order identified by its order ID. The order must be open (not yet filled or cancelled) to be cancelled successfully.\n\nOnce cancelled, the order is removed from the order book and cannot be restored. Any unfilled portion of the order will be cancelled.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fcancel)\n\n", - "parameters": [ - { - "name": "order_id", - "in": "query", - "description": "The order id", - "required": true, - "schema": { - "$ref": "#/components/schemas/order_id" - } - }, - { - "name": "isolated", - "in": "query", - "description": "If true, routes the order cancellation to the isolated margin subaccount that owns the order. Omitting this flag searches only the main account and returns `order_not_found` or `not_owner_of_order` for isolated orders. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 4214, - "jsonrpc": "2.0", - "method": "private/cancel", - "params": { - "order_id": "ETH-SLIS-12" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateCancelResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-cancel", - "metadata": { - "keywords": [ - "private/cancel", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "instrument_name", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "price", - "label", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "average_price", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco" - ], - "og:title": "private/cancel", - "title": "private/cancel" - } - } - } - }, - "/private/cancel_all": { - "get": { - "description": "Cancels all open orders and trigger orders for the authenticated account across all currencies and instrument kinds. This is a bulk cancellation operation useful for quickly clearing all active orders.\n\nUse the `detailed` parameter to receive a list of all cancelled orders. The `freeze_quotes` parameter can be used to freeze quotes instead of cancelling them.\n\n**Note:** This operation cannot be undone. All open orders will be permanently cancelled.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fcancel_all)\n\n", - "parameters": [ - { - "name": "detailed", - "in": "query", - "description": "When `detailed` is set to `true`, the output format is changed to include a list of all cancelled orders.\n\n**📖 Related Article:** [Detailed Response for Cancel Methods](https://docs.deribit.com/articles/json-rpc-overview#detailed-response-for-cancel-methods)\n\nDefault: `false`\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "freeze_quotes", - "in": "query", - "description": "Whether or not to reject incoming quotes for 1 second after cancelling (`false` by default). Related to `private/mass_quote` request.", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, extends mass cancellation to include open orders across active isolated-margin subaccounts. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 8748, - "jsonrpc": "2.0", - "method": "private/cancel_all", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateCancelAllResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-cancel_all", - "metadata": { - "keywords": [ - "private/cancel_all", - "detailed", - "freeze_quotes" - ], - "og:title": "private/cancel_all", - "title": "private/cancel_all" - } - } - } - }, - "/private/cancel_all_by_currency": { - "get": { - "description": "Cancels all open orders for a specific currency. This is useful for quickly clearing all orders across multiple instruments in a currency.\n\nOrders can be optionally filtered by instrument kind (future, option, etc.) and/or order type (limit, market, stop, etc.). Use the `detailed` parameter to receive a list of all cancelled orders.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fcancel_all_by_currency)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, `\"combo\"` for any combo or `\"any\"` for all. If not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind_with_combo_all" - } - }, - { - "name": "type", - "in": "query", - "description": "Order type - `limit`, `stop`, `take`, `trigger_all` or `all`, default - `all`", - "required": false, - "schema": { - "$ref": "#/components/schemas/simple_order_type" - } - }, - { - "name": "detailed", - "in": "query", - "description": "When `detailed` is set to `true`, the output format is changed to include a list of all cancelled orders.\n\n**📖 Related Article:** [Detailed Response for Cancel Methods](https://docs.deribit.com/articles/json-rpc-overview#detailed-response-for-cancel-methods)\n\nDefault: `false`\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "freeze_quotes", - "in": "query", - "description": "Whether or not to reject incoming quotes for 1 second after cancelling (`false` by default). Related to `private/mass_quote` request.", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, extends currency mass cancellation to include open orders across active isolated-margin subaccounts. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 5663, - "jsonrpc": "2.0", - "method": "private/cancel_all_by_currency", - "params": { - "currency": "BTC", - "kind": "option" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateCancelAllResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-cancel_all_by_currency", - "metadata": { - "keywords": [ - "private/cancel_all_by_currency", - "currency", - "kind", - "type", - "detailed", - "freeze_quotes" - ], - "og:title": "private/cancel_all_by_currency", - "title": "private/cancel_all_by_currency" - } - } - } - }, - "/private/cancel_all_by_currency_pair": { - "get": { - "description": "Cancels all open orders for a specific currency pair. This is useful for quickly clearing all orders across instruments in a currency pair.\n\nOrders can be optionally filtered by instrument kind (future, option, etc.) and/or order type (limit, market, stop, etc.). Use the `detailed` parameter to receive a list of all cancelled orders.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fcancel_all_by_currency_pair)\n\n", - "parameters": [ - { - "name": "currency_pair", - "in": "query", - "description": "The currency pair symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/index_name" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, `\"combo\"` for any combo or `\"any\"` for all. If not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind_with_combo_all" - } - }, - { - "name": "type", - "in": "query", - "description": "Order type - `limit`, `stop`, `take`, `trigger_all` or `all`, default - `all`", - "required": false, - "schema": { - "$ref": "#/components/schemas/simple_order_type" - } - }, - { - "name": "detailed", - "in": "query", - "description": "When `detailed` is set to `true`, the output format is changed to include a list of all cancelled orders.\n\n**📖 Related Article:** [Detailed Response for Cancel Methods](https://docs.deribit.com/articles/json-rpc-overview#detailed-response-for-cancel-methods)\n\nDefault: `false`\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "freeze_quotes", - "in": "query", - "description": "Whether or not to reject incoming quotes for 1 second after cancelling (`false` by default). Related to `private/mass_quote` request.", - "required": false, - "schema": { - "type": "boolean" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 5663, - "jsonrpc": "2.0", - "method": "private/cancel_all_by_currency_pair", - "params": { - "currency_pair": "BTC_USD", - "kind": "option" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateCancelAllResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-cancel_all_by_currency_pair", - "metadata": { - "keywords": [ - "private/cancel_all_by_currency_pair", - "currency_pair", - "kind", - "type", - "detailed", - "freeze_quotes" - ], - "og:title": "private/cancel_all_by_currency_pair", - "title": "private/cancel_all_by_currency_pair" - } - } - } - }, - "/private/cancel_all_by_instrument": { - "get": { - "description": "Cancels all open orders for a specific instrument. This is useful for quickly clearing all orders for a single instrument.\n\nOrders can be optionally filtered by order type (limit, market, stop, etc.). Use the `detailed` parameter to receive a list of all cancelled orders. The `include_combos` parameter can be used to include combo orders in the cancellation.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fcancel_all_by_instrument)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "type", - "in": "query", - "description": "Order type - `limit`, `stop`, `take`, `trigger_all` or `all`, default - `all`", - "required": false, - "schema": { - "$ref": "#/components/schemas/simple_order_type" - } - }, - { - "name": "detailed", - "in": "query", - "description": "When `detailed` is set to `true`, the output format is changed to include a list of all cancelled orders.\n\n**📖 Related Article:** [Detailed Response for Cancel Methods](https://docs.deribit.com/articles/json-rpc-overview#detailed-response-for-cancel-methods)\n\nDefault: `false`\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "include_combos", - "in": "query", - "description": "When set to `true` orders in combo instruments affecting a given position will also be cancelled. Default: `false`", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "freeze_quotes", - "in": "query", - "description": "Whether or not to reject incoming quotes for 1 second after cancelling (`false` by default). Related to `private/mass_quote` request.", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, extends instrument mass cancellation to include open orders across active isolated-margin subaccounts. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 4122, - "jsonrpc": "2.0", - "method": "private/cancel_all_by_instrument", - "params": { - "instrument_name": "ETH-22FEB19-120-P", - "type": "all" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateCancelAllResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-cancel_all_by_instrument", - "metadata": { - "keywords": [ - "private/cancel_all_by_instrument", - "instrument_name", - "type", - "detailed", - "include_combos", - "freeze_quotes" - ], - "og:title": "private/cancel_all_by_instrument", - "title": "private/cancel_all_by_instrument" - } - } - } - }, - "/private/cancel_all_by_kind_or_type": { - "get": { - "description": "Cancels all open orders in one or more currencies, optionally filtered by instrument kind and/or order type. This provides flexible bulk cancellation across multiple currencies.\n\nSpecify one or more currencies, and optionally filter by instrument kind (future, option, etc.) and/or order type (limit, market, stop, etc.). Use the `detailed` parameter to receive a list of all cancelled orders.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fcancel_all_by_kind_or_type)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol, list of currency symbols or `\"any\"` for all", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency_with_any_and_list" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, `\"combo\"` for any combo or `\"any\"` for all. If not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind_with_combo_all" - } - }, - { - "name": "type", - "in": "query", - "description": "Order type - `limit`, `stop`, `take`, `trigger_all` or `all`, default - `all`", - "required": false, - "schema": { - "$ref": "#/components/schemas/simple_order_type" - } - }, - { - "name": "detailed", - "in": "query", - "description": "When `detailed` is set to `true`, the output format is changed to include a list of all cancelled orders.\n\n**📖 Related Article:** [Detailed Response for Cancel Methods](https://docs.deribit.com/articles/json-rpc-overview#detailed-response-for-cancel-methods)\n\nDefault: `false`\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "freeze_quotes", - "in": "query", - "description": "Whether or not to reject incoming quotes for 1 second after cancelling (`false` by default). Related to `private/mass_quote` request.", - "required": false, - "schema": { - "type": "boolean" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2, - "jsonrpc": "2.0", - "method": "private/cancel_all_by_kind_or_type", - "params": { - "currency": [ - "BTC", - "ETH" - ], - "kind": "future" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateCancelAllResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-cancel_all_by_kind_or_type", - "metadata": { - "keywords": [ - "private/cancel_all_by_kind_or_type", - "currency", - "kind", - "type", - "detailed", - "freeze_quotes" - ], - "og:title": "private/cancel_all_by_kind_or_type", - "title": "private/cancel_all_by_kind_or_type" - } - } - } - }, - "/private/cancel_by_label": { - "get": { - "description": "Cancels all orders (including trigger orders) that have a specific label. This is useful for managing groups of related orders that share the same label.\n\nOrders can be cancelled across all currencies or filtered to a specific currency. When cancelling by currency, the currency queue is used for processing.\n\n**Rate Limits:** When called without the `currency` parameter, this method is subject to `cancel_all` rate limits. Different rate limit values may apply for per-currency cancels versus calls without providing the currency parameter.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fcancel_by_label)\n\n", - "parameters": [ - { - "name": "label", - "in": "query", - "description": "user defined label for the order (maximum 64 characters)", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": false, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, extends label cancellation to include matching open orders across active isolated-margin subaccounts. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 47, - "jsonrpc": "2.0", - "method": "private/cancel_by_label", - "params": { - "label": "label" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateCancelAllResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-cancel_by_label", - "metadata": { - "keywords": [ - "private/cancel_by_label", - "label", - "currency" - ], - "og:title": "private/cancel_by_label", - "title": "private/cancel_by_label" - } - } - } - }, - "/private/change_margin_model": { - "get": { - "description": "Changes the margin model for the authenticated account or a specified subaccount. Margin models determine how margin requirements are calculated (e.g., Standard Margin vs. Portfolio Margin).\n\nChanging the margin model may affect margin requirements, available funds, and trading capabilities. Use the `dry_run` parameter to preview the impact of the change before applying it.\n\n**📖 Related Article:** [Margin types and usage](https://support.deribit.com/hc/en-us/articles/25944811317149-Margin-types-and-usage)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fchange_margin_model)\n\n", - "parameters": [ - { - "name": "user_id", - "in": "query", - "description": "Id of a (sub)account - by default current user id is used", - "required": false, - "schema": { - "type": "integer", - "example": 1 - } - }, - { - "name": "margin_model", - "in": "query", - "description": "Margin model", - "required": true, - "schema": { - "type": "string", - "enum": [ - "cross_pm", - "cross_sm", - "segregated_pm", - "segregated_sm" - ] - } - }, - { - "name": "dry_run", - "in": "query", - "description": "If `true` request returns the result without switching the margining model. Default: `false`", - "required": false, - "schema": { - "type": "boolean", - "example": true - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "private/change_margin_model", - "params": { - "margin_model": "cross_pm", - "user_id": 3 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateChangeMarginModelResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:user:update" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-change_margin_model", - "metadata": { - "keywords": [ - "private/change_margin_model", - "user_id", - "margin_model", - "dry_run", - "old_state", - "new_state", - "currency", - "maintenance_margin_rate", - "initial_margin_rate", - "available_balance" - ], - "og:title": "private/change_margin_model", - "title": "private/change_margin_model" - } - } - } - }, - "/private/close_position": { - "get": { - "description": "Places a reduce-only order to close an existing position. Reduce-only orders can only reduce or close a position; they cannot open a new position or increase an existing one.\n\nYou can specify whether to use a market or limit order. If using a limit order, provide the price. The order will automatically be set to reduce-only to ensure it only closes the position.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fclose_position)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "type", - "in": "query", - "description": "The order type", - "required": true, - "schema": { - "type": "string", - "enum": [ - "limit", - "market" - ] - } - }, - { - "name": "price", - "in": "query", - "description": "Optional price for limit order.", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "isolated", - "in": "query", - "description": "If true, resolves the isolated subaccount bound to the instrument and submits an opposite-side reduce-only order for the full position size. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 6130, - "jsonrpc": "2.0", - "method": "private/close_position", - "params": { - "instrument_name": "ETH-PERPETUAL", - "price": 145.17, - "type": "limit" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateBuyAndSellResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-close_position", - "metadata": { - "keywords": [ - "private/close_position", - "instrument_name", - "type", - "price", - "order", - "trades", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "label", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "average_price", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco", - "trade_id", - "trade_seq", - "timestamp", - "starbase_timestamp", - "matching_id", - "tick_direction", - "index_price", - "iv", - "underlying_price", - "liquidation", - "liquidity", - "fee", - "fee_currency", - "state", - "block_trade_id", - "block_trade_leg_count", - "block_rfq_id", - "block_rfq_quote_id", - "profit_loss", - "mark_price", - "legs", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "trade_allocations", - "user_id", - "client_info", - "client_id", - "client_link_id", - "name" - ], - "og:title": "private/close_position", - "title": "private/close_position" - } - } - } - }, - "/private/create_combo": { - "get": { - "description": "Verifies and creates a combo book or returns an existing combo matching the given trades. Combos allow trading on multiple instruments (futures and options) simultaneously as a single strategy.\n\nIf a combo matching the provided trades already exists, this method returns the existing combo. Otherwise, it creates a new combo book with the specified leg structure.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fcreate_combo)\n\n", - "parameters": [ - { - "name": "trades", - "in": "query", - "description": "List of trades used to create a combo", - "required": true, - "schema": { - "type": "array", - "items": { - "properties": { - "amount": { - "$ref": "#/components/schemas/amount" - }, - "direction": { - "$ref": "#/components/schemas/direction" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - } - }, - "type": "object" - } - }, - "explode": true, - "style": "form" - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 6, - "jsonrpc": "2.0", - "method": "private/create_combo", - "params": { - "trades": [ - { - "amount": "1", - "direction": "buy", - "instrument_name": "BTC-29APR22-37500-C" - }, - { - "amount": "1", - "direction": "sell", - "instrument_name": "BTC-29APR22-37500-P" - } - ] - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateCreateComboResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Combo Books", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/combo-books/private-create_combo", - "metadata": { - "keywords": [ - "private/create_combo", - "trades", - "instrument_id", - "state", - "state_timestamp", - "creation_timestamp", - "legs", - "instrument_name", - "amount" - ], - "og:title": "private/create_combo", - "title": "private/create_combo" - } - } - } - }, - "/private/disable_cancel_on_disconnect": { - "get": { - "description": "Disable Cancel On Disconnect for the connection.\n\nWhen change is applied for the account, then every newly opened connection will start with **inactive** Cancel on Disconnect.\n\n**WebSocket Only:** This method is designed exclusively for WebSocket connections. Attempting to use it via REST/HTTP will result in an error response.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fdisable_cancel_on_disconnect)\n\n", - "parameters": [ - { - "name": "scope", - "in": "query", - "description": "Specifies if Cancel On Disconnect change should be applied/checked for the current connection or the account (default - `connection`)

**NOTICE:** Scope `connection` can be used only when working via Websocket.", - "required": false, - "schema": { - "type": "string", - "enum": [ - "connection", - "account" - ] - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1569, - "jsonrpc": "2.0", - "method": "private/disable_cancel_on_disconnect", - "params": { - "scope": "account" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/OkResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Session Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/session-management/private-disable_cancel_on_disconnect", - "metadata": { - "keywords": [ - "private/disable_cancel_on_disconnect", - "scope" - ], - "og:title": "private/disable_cancel_on_disconnect", - "title": "private/disable_cancel_on_disconnect" - } - } - } - }, - "/private/edit": { - "get": { - "description": "Modifies an existing order by changing its price, amount, and/or other properties such as time-in-force, post-only, reduce-only, trigger conditions, or advanced order type.\n\nThe order is identified by its order ID. Only open orders can be edited. Changes take effect immediately and may result in the order being filled if the new price matches the market.\n\n**Note:** For spot orders routed to Coinbase Exchange, fills come back asynchronously. It is recommended to receive fills from the `user.trades` channel.\n\n**📖 Related Article:** [Order Management Best Practices](https://docs.deribit.com/articles/order-management-best-practices)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fedit)\n\n", - "parameters": [ - { - "name": "order_id", - "in": "query", - "description": "The order id", - "required": true, - "schema": { - "$ref": "#/components/schemas/order_id" - } - }, - { - "name": "amount", - "in": "query", - "description": "It represents the requested order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin. The `amount` is a mandatory parameter if `contracts` parameter is missing. If both `contracts` and `amount` parameter are passed they must match each other otherwise error is returned.", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "contracts", - "in": "query", - "description": "It represents the requested order size in contract units and can be passed instead of `amount`. The `contracts` is a mandatory parameter if `amount` parameter is missing. If both `contracts` and `amount` parameter are passed they must match each other otherwise error is returned.", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "price", - "in": "query", - "description": "

The order price in base currency.

When editing an option order with advanced=usd, the field price should be the option price value in USD.

When editing an option order with advanced=implv, the field price should be a value of implied volatility in percentages. For example, price=100, means implied volatility of 100%

", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "post_only", - "in": "query", - "description": "

If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below or above the spread (accordingly to the original order type).

Only valid in combination with time_in_force=`\"good_til_cancelled\"`

For spot trading routed to Coinbase Exchange, the price is never adjusted: `\"post_only\"` must be combined with `\"reject_post_only\"` set to true, and the order is rejected if it would be matched instantly.

", - "required": false, - "schema": { - "type": "boolean", - "default": true - } - }, - { - "name": "reduce_only", - "in": "query", - "description": "If `true`, the order is considered reduce-only which is intended to only reduce a current position", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "reject_post_only", - "in": "query", - "description": "

If an order is considered post-only and this field is set to true then the order is put to the order book unmodified or the request is rejected.

Only valid in combination with `\"post_only\"` set to true

For spot trading routed to Coinbase Exchange, this must be set to true whenever `\"post_only\"` is true; otherwise the request is rejected with `post_only_not_allowed`.

", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "advanced", - "in": "query", - "description": "Advanced option order type. If you have posted an advanced option order, it is necessary to re-supply this parameter when editing it (Only for options)", - "required": false, - "schema": { - "$ref": "#/components/schemas/advanced" - } - }, - { - "name": "trigger_price", - "in": "query", - "description": "Trigger price, required for trigger orders only (Stop-loss or Take-profit orders)", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "trigger_offset", - "in": "query", - "description": "The maximum deviation from the price peak beyond which the order will be triggered", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "mmp", - "in": "query", - "description": "Order MMP flag, only for order_type 'limit'", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "valid_until", - "in": "query", - "description": "Timestamp, when provided server will start processing request in Matching Engine only before given timestamp, in other cases `timed_out` error will be responded. Remember that the given timestamp should be consistent with the server's time, use /public/time method to obtain current server time.", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "display_amount", - "in": "query", - "description": "Initial display amount for iceberg order. Has to be at least 100 times minimum amount for instrument and ratio of hidden part vs visible part has to be less than 100 as well.", - "required": false, - "schema": { - "type": "number", - "default": 1 - } - }, - { - "name": "isolated", - "in": "query", - "description": "If true, routes the edit request to the isolated margin subaccount that owns the order. Must be sent from the main account. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "allocated_margin", - "in": "query", - "description": "Optional additional margin amount transferred from the main account to the isolated subaccount when editing an order to increase risk.", - "required": false, - "schema": { - "type": "number" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 3725, - "jsonrpc": "2.0", - "method": "private/edit", - "params": { - "advanced": "implv", - "amount": 4, - "order_id": "438994", - "price": 222 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateEditResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-edit", - "metadata": { - "keywords": [ - "private/edit", - "order_id", - "amount", - "contracts", - "price", - "post_only", - "reduce_only", - "reject_post_only", - "advanced", - "trigger_price", - "trigger_offset", - "mmp", - "valid_until", - "display_amount", - "order", - "trades", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "instrument_name", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "label", - "api", - "web", - "mobile", - "refresh_amount", - "filled_amount", - "average_price", - "implv", - "usd", - "triggered", - "trigger", - "trigger_reference_price", - "block_trade", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco", - "trade_id", - "trade_seq", - "timestamp", - "starbase_timestamp", - "matching_id", - "tick_direction", - "index_price", - "iv", - "underlying_price", - "liquidation", - "liquidity", - "fee", - "fee_currency", - "state", - "block_trade_id", - "block_trade_leg_count", - "block_rfq_id", - "block_rfq_quote_id", - "profit_loss", - "mark_price", - "legs", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "trade_allocations", - "user_id", - "client_info", - "client_id", - "client_link_id", - "name" - ], - "og:title": "private/edit", - "title": "private/edit" - } - } - } - }, - "/private/edit_by_label": { - "get": { - "description": "Modifies an order identified by its label. This method works only when there is exactly one open order with the specified label.\n\nYou can change the order's price, amount, and/or other properties such as time-in-force, post-only, reduce-only, trigger conditions, or advanced order type. Changes take effect immediately.\n\n**Note:** For spot orders routed to Coinbase Exchange, fills come back asynchronously. It is recommended to receive fills from the `user.trades` channel.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fedit_by_label)\n\n", - "parameters": [ - { - "name": "label", - "in": "query", - "description": "user defined label for the order (maximum 64 characters)", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "amount", - "in": "query", - "description": "It represents the requested order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin. The `amount` is a mandatory parameter if `contracts` parameter is missing. If both `contracts` and `amount` parameter are passed they must match each other otherwise error is returned.", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "contracts", - "in": "query", - "description": "It represents the requested order size in contract units and can be passed instead of `amount`. The `contracts` is a mandatory parameter if `amount` parameter is missing. If both `contracts` and `amount` parameter are passed they must match each other otherwise error is returned.", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "price", - "in": "query", - "description": "

The order price in base currency.

When editing an option order with advanced=usd, the field price should be the option price value in USD.

When editing an option order with advanced=implv, the field price should be a value of implied volatility in percentages. For example, price=100, means implied volatility of 100%

", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "post_only", - "in": "query", - "description": "

If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below or above the spread (accordingly to the original order type).

Only valid in combination with time_in_force=`\"good_til_cancelled\"`

For spot trading routed to Coinbase Exchange, the price is never adjusted: `\"post_only\"` must be combined with `\"reject_post_only\"` set to true, and the order is rejected if it would be matched instantly.

", - "required": false, - "schema": { - "type": "boolean", - "default": true - } - }, - { - "name": "reduce_only", - "in": "query", - "description": "If `true`, the order is considered reduce-only which is intended to only reduce a current position", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "reject_post_only", - "in": "query", - "description": "

If an order is considered post-only and this field is set to true then the order is put to the order book unmodified or the request is rejected.

Only valid in combination with `\"post_only\"` set to true

For spot trading routed to Coinbase Exchange, this must be set to true whenever `\"post_only\"` is true; otherwise the request is rejected with `post_only_not_allowed`.

", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "advanced", - "in": "query", - "description": "Advanced option order type. If you have posted an advanced option order, it is necessary to re-supply this parameter when editing it (Only for options)", - "required": false, - "schema": { - "$ref": "#/components/schemas/advanced" - } - }, - { - "name": "trigger_price", - "in": "query", - "description": "Trigger price, required for trigger orders only (Stop-loss or Take-profit orders)", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "mmp", - "in": "query", - "description": "Order MMP flag, only for order_type 'limit'", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "valid_until", - "in": "query", - "description": "Timestamp, when provided server will start processing request in Matching Engine only before given timestamp, in other cases `timed_out` error will be responded. Remember that the given timestamp should be consistent with the server's time, use /public/time method to obtain current server time.", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "isolated", - "in": "query", - "description": "If true, routes the edit by label request to the isolated margin subaccount that owns the order. Must be sent from the main account. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "allocated_margin", - "in": "query", - "description": "Optional additional margin amount transferred from the main account to the isolated subaccount when editing an order to increase risk.", - "required": false, - "schema": { - "type": "number" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 9, - "jsonrpc": "2.0", - "method": "private/edit_by_label", - "params": { - "amount": 150, - "instrument_name": "BTC-PERPETUAL", - "label": "i_love_deribit", - "price": 50111 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateEditResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-edit_by_label", - "metadata": { - "keywords": [ - "private/edit_by_label", - "label", - "instrument_name", - "amount", - "contracts", - "price", - "post_only", - "reduce_only", - "reject_post_only", - "advanced", - "trigger_price", - "mmp", - "valid_until", - "order", - "trades", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "filled_amount", - "average_price", - "implv", - "usd", - "triggered", - "trigger", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco", - "trade_id", - "trade_seq", - "timestamp", - "starbase_timestamp", - "matching_id", - "tick_direction", - "index_price", - "iv", - "underlying_price", - "liquidation", - "liquidity", - "fee", - "fee_currency", - "state", - "block_trade_id", - "block_trade_leg_count", - "block_rfq_id", - "block_rfq_quote_id", - "profit_loss", - "mark_price", - "legs", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "trade_allocations", - "user_id", - "client_info", - "client_id", - "client_link_id", - "name" - ], - "og:title": "private/edit_by_label", - "title": "private/edit_by_label" - } - } - } - }, - "/private/enable_cancel_on_disconnect": { - "get": { - "description": "Enable Cancel On Disconnect for the connection. After enabling, all orders created via this connection will be automatically cancelled when the connection is closed.\n\nCancel is triggered in the following cases: when the TCP connection is properly terminated, when the connection is closed due to 10 minutes of inactivity, or when a heartbeat detects a disconnection. To reduce the inactivity timeout, consider using [public/set_heartbeat](https://docs.deribit.com/api-reference/session-management/public-set_heartbeat).\n\n**Note:** If the connection is gracefully closed using [private/logout](https://docs.deribit.com/api-reference/authentication/private-logout), cancel-on-disconnect will **not** be triggered.\n\n**Notice:** Cancel-on-Disconnect does not affect orders created by other connections - they will remain active! When change is applied on the `account` scope, then every newly opened connection will start with **active** Cancel on Disconnect.\n\n**WebSocket Only:** This method is designed exclusively for WebSocket connections. Attempting to use it via REST/HTTP will result in an error response.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fenable_cancel_on_disconnect)\n\n", - "parameters": [ - { - "name": "scope", - "in": "query", - "description": "Specifies if Cancel On Disconnect change should be applied/checked for the current connection or the account (default - `connection`)

**NOTICE:** Scope `connection` can be used only when working via Websocket.", - "required": false, - "schema": { - "type": "string", - "enum": [ - "connection", - "account" - ] - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 7859, - "jsonrpc": "2.0", - "method": "private/enable_cancel_on_disconnect", - "params": { - "scope": "account" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/OkResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Session Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/session-management/private-enable_cancel_on_disconnect", - "metadata": { - "keywords": [ - "private/enable_cancel_on_disconnect", - "scope" - ], - "og:title": "private/enable_cancel_on_disconnect", - "title": "private/enable_cancel_on_disconnect" - } - } - } - }, - "/private/get_access_log": { - "get": { - "description": "Retrieves a log of API access attempts and authentication events for the authenticated account. The log includes information such as IP addresses, timestamps, API methods called, and authentication status.\n\nUse this method to monitor account security, review API usage patterns, and identify unauthorized access attempts. Results can be paginated using the `offset` and `count` parameters.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_access_log)\n\n", - "parameters": [ - { - "name": "offset", - "in": "query", - "description": "The offset for pagination, default - `0`", - "required": false, - "schema": { - "type": "integer", - "example": 10 - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `10`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "private/get_access_log", - "params": { - "count": 3, - "offset": 0 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetAccessLogResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:user:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_access_log", - "metadata": { - "keywords": [ - "private/get_access_log", - "offset", - "count", - "ip", - "timestamp", - "country", - "city", - "log", - "data" - ], - "og:title": "private/get_access_log", - "title": "private/get_access_log" - } - } - } - }, - "/private/get_account_summaries": { - "get": { - "description": "Retrieves a per-currency list of account summaries for the authenticated user. Each summary includes balance, equity, available funds, and margin information for each currency.\n\nTo retrieve summaries for a specific subaccount, use the `subaccount_id` parameter. When the `extended` parameter is set to `true`, additional account details such as account ID, username, email, and account type are included.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_account_summaries)\n\n\n\nNote: This method does not accept a singular `currency` parameter; summaries for all portfolio currencies are always returned for both main and isolated subaccounts.", - "parameters": [ - { - "name": "subaccount_id", - "in": "query", - "description": "The user id for the subaccount", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "extended", - "in": "query", - "description": "Include additional fields", - "required": false, - "schema": { - "type": "boolean", - "example": true - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, includes `isolated_account_summaries` in the response containing account summaries for active isolated margin subaccounts. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2515, - "jsonrpc": "2.0", - "method": "private/get_account_summaries", - "params": { - "extended": true - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateAccountSummariesResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_account_summaries", - "metadata": { - "keywords": [ - "private/get_account_summaries", - "subaccount_id", - "extended", - "system_name", - "username", - "type", - "login_enabled", - "email", - "security_keys_enabled", - "mmp_enabled", - "interuser_transfers_enabled", - "referrer_id", - "creation_timestamp", - "self_trading_reject_mode", - "self_trading_extended_to_subaccounts", - "block_rfq_self_match_prevention", - "affiliate_promotion_fee", - "trading_products_details", - "receive_notifications", - "summaries", - "total_pl", - "session_rpl", - "session_upl", - "available_funds", - "available_withdrawal_funds", - "margin_balance", - "balance", - "spot_reserve", - "locked_balance", - "additional_reserve", - "fee_balance", - "fee_group", - "currency", - "delta_total", - "projected_delta_total", - "delta_total_map", - "deposit_address", - "equity", - "futures_pl", - "futures_session_rpl", - "futures_session_upl", - "initial_margin", - "maintenance_margin", - "options_delta", - "options_gamma", - "options_pl", - "options_session_rpl", - "options_session_upl", - "options_theta", - "options_value", - "options_vega", - "options_gamma_map", - "options_theta_map", - "options_vega_map", - "projected_initial_margin", - "projected_maintenance_margin", - "close_out_margin", - "projected_close_out_margin", - "portfolio_margining_enabled", - "cross_collateral_enabled", - "margin_model", - "total_equity_usd", - "total_initial_margin_usd", - "total_maintenance_margin_usd", - "total_margin_balance_usd", - "total_delta_total_usd", - "limits", - "has_non_block_chain_equity", - "fees" - ], - "og:title": "private/get_account_summaries", - "title": "private/get_account_summaries" - } - } - } - }, - "/private/get_account_summary": { - "get": { - "description": "Retrieves the account summary for a specific currency. The summary includes cash `balance`, `equity`, `margin_balance`, `available_funds`, `available_withdrawal_funds`, initial/maintenance margin, session and total PnL, options greeks, and related fields.\n\nKey relationships (standard margin): `equity = balance + futures session PnL + options_value`, `margin_balance = equity - options_value`, `available_funds = max(0, margin_balance - initial_margin)`. Under portfolio margin, `margin_balance` equals `equity`. Session PnL fields reset at daily settlement; `total_pl` does not.\n\nTo retrieve the summary for a specific subaccount, use the `subaccount_id` parameter. When the `extended` parameter is set to `true`, additional account details such as account ID, username, email, and account type are included.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_account_summary)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/wallet_currency" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "The user id for the subaccount", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "extended", - "in": "query", - "description": "Include additional fields", - "required": false, - "schema": { - "type": "boolean", - "example": true - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2515, - "jsonrpc": "2.0", - "method": "private/get_account_summary", - "params": { - "currency": "BTC", - "extended": true - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateAccountResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_account_summary", - "metadata": { - "keywords": [ - "private/get_account_summary", - "currency", - "subaccount_id", - "extended", - "total_pl", - "session_rpl", - "session_upl", - "available_funds", - "available_withdrawal_funds", - "margin_balance", - "balance", - "spot_reserve", - "locked_balance", - "additional_reserve", - "fee_balance", - "fee_group", - "delta_total", - "projected_delta_total", - "delta_total_map", - "deposit_address", - "email", - "equity", - "futures_pl", - "futures_session_rpl", - "futures_session_upl", - "initial_margin", - "maintenance_margin", - "system_name", - "options_delta", - "options_gamma", - "options_pl", - "options_session_rpl", - "options_session_upl", - "options_theta", - "options_value", - "options_vega", - "options_gamma_map", - "options_theta_map", - "options_vega_map", - "security_keys_enabled", - "mmp_enabled", - "projected_initial_margin", - "projected_maintenance_margin", - "close_out_margin", - "projected_close_out_margin", - "username", - "type", - "login_enabled", - "portfolio_margining_enabled", - "cross_collateral_enabled", - "margin_model", - "total_equity_usd", - "total_initial_margin_usd", - "total_maintenance_margin_usd", - "total_margin_balance_usd", - "total_delta_total_usd", - "interuser_transfers_enabled", - "referrer_id", - "limits", - "creation_timestamp", - "has_non_block_chain_equity", - "self_trading_reject_mode", - "self_trading_extended_to_subaccounts", - "block_rfq_self_match_prevention", - "fees", - "affiliate_promotion_fee", - "trading_products_details", - "receive_notifications", - "is_direct_access_allowed" - ], - "og:title": "private/get_account_summary", - "title": "private/get_account_summary" - } - } - } - }, - "/private/get_cancel_on_disconnect": { - "get": { - "description": "Read current Cancel On Disconnect configuration for the account.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_cancel_on_disconnect)\n\n", - "parameters": [ - { - "name": "scope", - "in": "query", - "description": "Specifies if Cancel On Disconnect change should be applied/checked for the current connection or the account (default - `connection`)

**NOTICE:** Scope `connection` can be used only when working via Websocket.", - "required": false, - "schema": { - "type": "string", - "enum": [ - "connection", - "account" - ] - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 220, - "jsonrpc": "2.0", - "method": "private/get_cancel_on_disconnect", - "params": { - "scope": "account" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetCancelOnDisconnectResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:user:read" - ] - } - ], - "tags": [ - "Session Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/session-management/private-get_cancel_on_disconnect", - "metadata": { - "keywords": [ - "private/get_cancel_on_disconnect", - "scope", - "enabled" - ], - "og:title": "private/get_cancel_on_disconnect", - "title": "private/get_cancel_on_disconnect" - } - } - } - }, - "/private/get_leg_prices": { - "get": { - "description": "Returns individual leg prices for a given combo structure based on an aggregated price of the strategy and the mark prices of the individual legs.\n\n**Note:** Leg prices change dynamically with mark price fluctuations, and the algorithm is calibrated only for conventional option structures and future spreads. This method supports both inverse strategies and known linear structures within a single currency pair.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_leg_prices)\n\n", - "parameters": [ - { - "name": "legs", - "in": "query", - "description": "List of legs for which the prices will be calculated", - "required": true, - "schema": { - "type": "array", - "items": { - "properties": { - "amount": { - "description": "It represents the requested trade size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "$ref": "#/components/schemas/amount" - }, - "direction": { - "description": "Direction of selected leg", - "$ref": "#/components/schemas/direction" - }, - "instrument_name": { - "description": "Instrument name", - "$ref": "#/components/schemas/instrument_name" - } - }, - "type": "object" - } - }, - "explode": true, - "style": "form" - }, - { - "name": "price", - "in": "query", - "description": "Price for the whole leg structure", - "required": true, - "schema": { - "type": "number" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "private/get_leg_prices", - "params": { - "legs": [ - { - "amount": 2, - "direction": "buy", - "instrument_name": "BTC-1NOV24-67000-C" - }, - { - "amount": 2, - "direction": "sell", - "instrument_name": "BTC-1NOV24-66000-C" - } - ], - "price": 0.6 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetLegPricesResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:user:read" - ] - } - ], - "tags": [ - "Combo Books", - "Private" - ], - "x-mint": { - "href": "/api-reference/combo-books/private-get_leg_prices", - "metadata": { - "keywords": [ - "private/get_leg_prices", - "legs", - "price", - "amount", - "ratio", - "instrument_name", - "direction" - ], - "og:title": "private/get_leg_prices", - "title": "private/get_leg_prices" - } - } - } - }, - "/private/get_leverage": { - "get": { - "description": "Retrieves the current user-configured custom leverage and effective maximum leverage for a specified active future instrument.\n\nWhen `instrument_name` is supplied, returns a single leverage details object. When omitted, returns leverage details only for futures with a stored custom leverage override; instruments using the default maximum leverage are omitted. For `isolated=true`, regular subaccounts receive an empty object or array because isolated leverage configuration is visible only to the main account.\n\n \n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_leverage)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": false, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "The user id for the subaccount. Available to retail-broker callers; defaults to the authenticated account.", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "isolated", - "in": "query", - "description": "If true, returns leverage settings for isolated margin mode (main accounts only).", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "private/get_leverage", - "params": { - "instrument_name": "BTC-PERPETUAL" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetLeverageResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_leverage", - "metadata": { - "keywords": [ - "private/get_leverage", - "instrument_name", - "subaccount_id", - "isolated" - ], - "og:title": "private/get_leverage", - "title": "private/get_leverage" - } - } - } - }, - "/private/get_margins": { - "get": { - "description": "Calculates margin requirements for a hypothetical order on a given instrument. Returns initial margin and maintenance margin for the specified instrument, quantity, and price.\n\nThis method is useful for estimating margin requirements before placing an order, helping to ensure sufficient funds are available and understanding the margin impact of potential trades.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_margins)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "amount", - "in": "query", - "description": "It represents the requested order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "required": true, - "schema": { - "type": "number" - } - }, - { - "name": "price", - "in": "query", - "description": "Price", - "required": true, - "schema": { - "type": "number", - "example": 3725 - } - }, - { - "name": "isolated", - "in": "query", - "description": "If true, calculates margin requirements and estimated fees under isolated margin scope instead of cross margin. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 7, - "jsonrpc": "2.0", - "method": "private/get_margins", - "params": { - "amount": 10000, - "instrument_name": "BTC-PERPETUAL", - "price": 3725 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetMarginsResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_margins", - "metadata": { - "keywords": [ - "private/get_margins", - "instrument_name", - "amount", - "price", - "buy", - "sell", - "buy_taker_fee", - "buy_maker_fee", - "sell_taker_fee", - "sell_maker_fee", - "min_price", - "max_price" - ], - "og:title": "private/get_margins", - "title": "private/get_margins" - } - } - } - }, - "/private/get_max_order_size": { - "get": { - "description": "Calculates maximum tradable order sizes (buy, sell, and reduce-only) for a future instrument based on current account available funds, position, and open orders.\n\nSupports hypothetical parameters (`leverage`, `price`, `taker_fee_rate`) to simulate order size capacity under target trading conditions. Requires Standard Margin model.\n\n \n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_max_order_size)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "The user id for the subaccount. Available to retail-broker callers; defaults to the authenticated account.", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "isolated", - "in": "query", - "description": "If true, evaluates maximum order size under isolated margin scope.", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "leverage", - "in": "query", - "description": "Custom hypothetical leverage to evaluate order size limits against. Must be between 1 and the account's effective maximum leverage.", - "required": false, - "schema": { - "type": "number", - "minimum": 1 - } - }, - { - "name": "taker_fee_rate", - "in": "query", - "description": "Hypothetical non-negative taker fee rate override. Explicit overrides require fee-rate override authorization.", - "required": false, - "schema": { - "type": "number", - "minimum": 0 - } - }, - { - "name": "price", - "in": "query", - "description": "Positive hypothetical order price. Uses current book and mark prices if omitted.", - "required": false, - "schema": { - "type": "number", - "exclusiveMinimum": 0 - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "private/get_max_order_size", - "params": { - "instrument_name": "BTC-PERPETUAL", - "price": 65000 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetMaxOrderSizeResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_max_order_size", - "metadata": { - "keywords": [ - "private/get_max_order_size", - "instrument_name", - "subaccount_id", - "isolated", - "leverage", - "taker_fee_rate", - "price" - ], - "og:title": "private/get_max_order_size", - "title": "private/get_max_order_size" - } - } - } - }, - "/private/get_open_orders": { - "get": { - "description": "Retrieves a list of all open orders for the authenticated account across all currencies. Open orders are orders that have been placed but not yet filled or cancelled.\n\nResults can be filtered by instrument kind and order type. This method provides a comprehensive view of all active orders.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_open_orders)\n\n", - "parameters": [ - { - "name": "kind", - "in": "query", - "description": "Instrument kind, if not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind" - } - }, - { - "name": "type", - "in": "query", - "description": "Order type, default - `all`", - "required": false, - "schema": { - "$ref": "#/components/schemas/order_type2" - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, widens the open orders query to include orders owned by hidden isolated-margin subaccounts. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "The user id for the subaccount. Main accounts can specify an isolated subaccount ID to query its open orders directly.", - "required": false, - "schema": { - "type": "integer" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1953, - "jsonrpc": "2.0", - "method": "private/get_open_orders", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetOpenOrdersResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_open_orders", - "metadata": { - "keywords": [ - "private/get_open_orders", - "kind", - "type", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "instrument_name", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "price", - "label", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "average_price", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco" - ], - "og:title": "private/get_open_orders", - "title": "private/get_open_orders" - } - } - } - }, - "/private/get_open_orders_by_currency": { - "get": { - "description": "Retrieves a list of all open orders for a specific currency. Open orders are orders that have been placed but not yet filled or cancelled.\n\nResults can be filtered by instrument kind and order type. This method provides a view of all active orders within a currency.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_open_orders_by_currency)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, if not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind" - } - }, - { - "name": "type", - "in": "query", - "description": "Order type, default - `all`", - "required": false, - "schema": { - "$ref": "#/components/schemas/order_type2" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1953, - "jsonrpc": "2.0", - "method": "private/get_open_orders_by_currency", - "params": { - "currency": "BTC" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetOpenOrdersResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_open_orders_by_currency", - "metadata": { - "keywords": [ - "private/get_open_orders_by_currency", - "currency", - "kind", - "type", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "instrument_name", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "price", - "label", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "average_price", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco" - ], - "og:title": "private/get_open_orders_by_currency", - "title": "private/get_open_orders_by_currency" - } - } - } - }, - "/private/get_open_orders_by_instrument": { - "get": { - "description": "Retrieves a list of all open orders for a specific instrument. Open orders are orders that have been placed but not yet filled or cancelled.\n\nResults can be filtered by order type. This method is useful for checking active orders for a particular instrument.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_open_orders_by_instrument)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "type", - "in": "query", - "description": "Order type, default - `all`", - "required": false, - "schema": { - "$ref": "#/components/schemas/order_type2" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 8442, - "jsonrpc": "2.0", - "method": "private/get_open_orders_by_instrument", - "params": { - "instrument_name": "ETH-22FEB19-120-C" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetOpenOrdersResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_open_orders_by_instrument", - "metadata": { - "keywords": [ - "private/get_open_orders_by_instrument", - "instrument_name", - "type", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "price", - "label", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "average_price", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco" - ], - "og:title": "private/get_open_orders_by_instrument", - "title": "private/get_open_orders_by_instrument" - } - } - } - }, - "/private/get_open_orders_by_label": { - "get": { - "description": "Retrieves a list of all open orders that have a specific label within a given currency. This is useful for tracking and managing groups of related orders that share the same label.\n\nOpen orders are orders that have been placed but not yet filled or cancelled. The label helps organize and identify related orders.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_open_orders_by_label)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "label", - "in": "query", - "description": "user defined label for the order (maximum 64 characters)", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1953, - "jsonrpc": "2.0", - "method": "private/get_open_orders_by_label", - "params": { - "currency": "BTC", - "label": "fooBar" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetOpenOrdersResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_open_orders_by_label", - "metadata": { - "keywords": [ - "private/get_open_orders_by_label", - "currency", - "label", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "instrument_name", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "price", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "average_price", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco" - ], - "og:title": "private/get_open_orders_by_label", - "title": "private/get_open_orders_by_label" - } - } - } - }, - "/private/get_order_history_by_currency": { - "get": { - "description": "Retrieves the order history for a specific currency. The history includes orders that have been partially or fully filled, as well as cancelled orders (if `include_unfilled_orders` is set to true).\n\nResults can be filtered by instrument kind and paginated using `offset` and `count` parameters, or using continuation tokens. Use `include_old_orders` to include orders from before a certain date, and `historical` to retrieve historical order data.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_order_history_by_currency)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, `\"combo\"` for any combo or `\"any\"` for all. If not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind_with_combo_all" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `20`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "offset", - "in": "query", - "description": "The offset for pagination, default - `0`", - "required": false, - "schema": { - "type": "integer", - "example": 10 - } - }, - { - "name": "include_old", - "in": "query", - "description": "Include in result orders older than 2 days, default - `false`", - "required": false, - "schema": { - "type": "boolean", - "example": false - } - }, - { - "name": "include_unfilled", - "in": "query", - "description": "Include in result fully unfilled closed orders, default - `false`", - "required": false, - "schema": { - "type": "boolean", - "example": false - } - }, - { - "name": "with_continuation", - "in": "query", - "description": "When set to true, the API response format changes from a simple list of orders to an object containing the orders and a continuation token.", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "continuation", - "in": "query", - "description": "Continuation token for pagination", - "required": false, - "schema": { - "type": "string", - "example": "xY7T6cutS3t2B9YtaDkE6TS379oKnkzTvmEDUnEUP2Msa9xKWNNaT" - } - }, - { - "name": "historical", - "in": "query", - "description": "Determines whether historical trade and order records should be retrieved.\n\n- `false` (default): Returns recent records: orders for 30 min, trades for 24h.\n- `true`: Fetches historical records, available after a short delay due to indexing. Recent data is not included.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "The user id for the subaccount. Required to query order history for an isolated margin subaccount; history queries for isolated subaccounts do not aggregate with `include_isolated`.", - "required": false, - "schema": { - "type": "integer" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 9305, - "jsonrpc": "2.0", - "method": "private/get_order_history_by_currency", - "params": { - "count": 1, - "currency": "BTC", - "kind": "future" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetOrderHistoryResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_order_history_by_currency", - "metadata": { - "keywords": [ - "private/get_order_history_by_currency", - "currency", - "kind", - "count", - "offset", - "include_old", - "include_unfilled", - "with_continuation", - "continuation", - "historical", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "instrument_name", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "price", - "label", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "average_price", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco" - ], - "og:title": "private/get_order_history_by_currency", - "title": "private/get_order_history_by_currency" - } - } - } - }, - "/private/get_order_history_by_instrument": { - "get": { - "description": "Retrieves the order history for a specific instrument. The history includes orders that have been partially or fully filled, as well as cancelled orders (if `include_unfilled_orders` is set to true).\n\nResults can be paginated using `offset` and `count` parameters, or using continuation tokens. Use `include_old_orders` to include orders from before a certain date, and `historical` to retrieve historical order data.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_order_history_by_instrument)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `20`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "offset", - "in": "query", - "description": "The offset for pagination, default - `0`", - "required": false, - "schema": { - "type": "integer", - "example": 10 - } - }, - { - "name": "include_old", - "in": "query", - "description": "Include in result orders older than 2 days, default - `false`", - "required": false, - "schema": { - "type": "boolean", - "example": false - } - }, - { - "name": "include_unfilled", - "in": "query", - "description": "Include in result fully unfilled closed orders, default - `false`", - "required": false, - "schema": { - "type": "boolean", - "example": false - } - }, - { - "name": "with_continuation", - "in": "query", - "description": "When set to true, the API response format changes from a simple list of orders to an object containing the orders and a continuation token.", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "continuation", - "in": "query", - "description": "Continuation token for pagination", - "required": false, - "schema": { - "type": "string", - "example": "xY7T6cutS3t2B9YtaDkE6TS379oKnkzTvmEDUnEUP2Msa9xKWNNaT" - } - }, - { - "name": "historical", - "in": "query", - "description": "Determines whether historical trade and order records should be retrieved.\n\n- `false` (default): Returns recent records: orders for 30 min, trades for 24h.\n- `true`: Fetches historical records, available after a short delay due to indexing. Recent data is not included.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n", - "required": false, - "schema": { - "type": "boolean" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1032, - "jsonrpc": "2.0", - "method": "private/get_order_history_by_instrument", - "params": { - "count": 1, - "instrument_name": "BTC-PERPETUAL" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetOrderHistoryResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_order_history_by_instrument", - "metadata": { - "keywords": [ - "private/get_order_history_by_instrument", - "instrument_name", - "count", - "offset", - "include_old", - "include_unfilled", - "with_continuation", - "continuation", - "historical", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "price", - "label", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "average_price", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco" - ], - "og:title": "private/get_order_history_by_instrument", - "title": "private/get_order_history_by_instrument" - } - } - } - }, - "/private/get_order_margin_by_ids": { - "get": { - "description": "Retrieves the initial margin requirements for one or more orders identified by their order IDs. Initial margin is the amount of funds required to open a position with these orders.\n\nThis method is useful for calculating margin requirements before placing orders, helping to ensure sufficient funds are available.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_order_margin_by_ids)\n\n", - "parameters": [ - { - "name": "ids", - "in": "query", - "description": "Ids of orders", - "required": true, - "schema": { - "type": "array", - "items": { - "example": "123456", - "type": "string" - }, - "example": [ - "ETH-349280", - "ETH-349279", - "ETH-349278" - ] - }, - "explode": true, - "style": "form" - }, - { - "name": "isolated", - "in": "query", - "description": "If true, calculates initial margin requirements under isolated margin scope. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 5625, - "jsonrpc": "2.0", - "method": "private/get_order_margin_by_ids", - "params": { - "ids": [ - "ETH-349280", - "ETH-349279", - "ETH-349278" - ] - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetOrderMarginByIdsResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_order_margin_by_ids", - "metadata": { - "keywords": [ - "private/get_order_margin_by_ids", - "ids", - "order_id", - "initial_margin", - "initial_margin_currency" - ], - "og:title": "private/get_order_margin_by_ids", - "title": "private/get_order_margin_by_ids" - } - } - } - }, - "/private/get_order_state": { - "get": { - "description": "Retrieves the current state of an order identified by its order ID. The response includes order details such as status (open, filled, cancelled), filled amount, remaining amount, price, and other order properties.\n\n**Important Note for Mass Quotes:** Quote orders are order-like structures that don't fully translate to normal orders. When checking order state for quotes, the `amount` field represents the remaining amount, not the original order amount.\n\n**Note:** This method does not support the `historical` flag and only returns an order that closed within the last 30 minutes (same recency window as `historical=false`). For orders older than that, use [`private/get_order_history_by_currency`](#private-get_order_history_by_currency) or [`private/get_order_history_by_instrument`](#private-get_order_history_by_instrument) with `historical=true`.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_order_state)\n\n", - "parameters": [ - { - "name": "order_id", - "in": "query", - "description": "The order id", - "required": true, - "schema": { - "$ref": "#/components/schemas/order_id" - } - }, - { - "name": "isolated", - "in": "query", - "description": "If true, retrieves order state for an order owned by an isolated margin subaccount. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 4316, - "jsonrpc": "2.0", - "method": "private/get_order_state", - "params": { - "order_id": "ETH-331562" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetOrderStateResponse" - }, - "400": { - "$ref": "#/components/responses/ErrorMessageResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_order_state", - "metadata": { - "keywords": [ - "private/get_order_state", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "instrument_name", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "price", - "label", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "average_price", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco" - ], - "og:title": "private/get_order_state", - "title": "private/get_order_state" - } - } - } - }, - "/private/get_order_state_by_label": { - "get": { - "description": "Retrieves the state of recent orders that have a specific label. This is useful for tracking orders that share the same label, which is helpful for managing related orders.\n\nResults are filtered by currency and label. The response includes order details such as status, filled amount, remaining amount, and other order properties for all orders with the specified label.\n\n**Note:** This method does not support the `historical` flag and only returns orders that closed within the last 30 minutes (same recency window as `historical=false`). This also applies to a trigger order and the order it creates upon triggering — once either has been closed for more than 30 minutes, it will no longer appear here, even though the same `label` was carried over between them. For orders older than that, use [`private/get_order_history_by_currency`](#private-get_order_history_by_currency) or [`private/get_order_history_by_instrument`](#private-get_order_history_by_instrument) with `historical=true`.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_order_state_by_label)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "label", - "in": "query", - "description": "user defined label for the order (maximum 64 characters)", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, searches open orders across hidden isolated-margin subaccounts as well as the main account. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 4316, - "jsonrpc": "2.0", - "method": "private/get_order_state_by_label", - "params": { - "currency": "ETH", - "label": "fooBar" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetOrderStateByLabelResponse" - }, - "400": { - "$ref": "#/components/responses/ErrorMessageResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_order_state_by_label", - "metadata": { - "keywords": [ - "private/get_order_state_by_label", - "currency", - "label", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "instrument_name", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "price", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "average_price", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco" - ], - "og:title": "private/get_order_state_by_label", - "title": "private/get_order_state_by_label" - } - } - } - }, - "/private/get_pme_params": { - "get": { - "description": "Retrieves Portfolio Margin (PM) open-order restrictions and risk limits for the specified currency.\n\nWhen Portfolio Margin is enabled, the response includes maximum order counts, aggregate futures and options order sizes, and the risk-reducing order limit. When Portfolio Margin is disabled, the response contains only `enabled: false`.\n\n**📖 Related Article:** [Portfolio Margin](https://support.deribit.com/hc/en-us/articles/25944756247837-Portfolio-Margin)\n\n \n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_pme_params)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "private/get_pme_params", - "params": { - "currency": "BTC" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivatePmeParamsResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_pme_params", - "metadata": { - "keywords": [ - "private/get_pme_params", - "currency" - ], - "og:title": "private/get_pme_params", - "title": "private/get_pme_params" - } - } - } - }, - "/private/get_position": { - "get": { - "description": "Retrieves the open position for a specific instrument. Returns detailed position information including size, average entry price, mark price, unrealized P&L, initial margin, maintenance margin, and other position-related metrics.\n\nIf no position exists for the specified instrument, the response will indicate a zero position.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_position)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, retrieves the position from a bound isolated margin subaccount for the instrument. Omit to read the main account cross position. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 404, - "jsonrpc": "2.0", - "method": "private/get_position", - "params": { - "instrument_name": "BTC-PERPETUAL" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetPositionResponse" - }, - "400": { - "$ref": "#/components/responses/ErrorMessageResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_position", - "metadata": { - "keywords": [ - "private/get_position", - "instrument_name", - "kind", - "user_id", - "average_price", - "direction", - "mark_price", - "delta", - "gamma", - "vega", - "theta", - "index_price", - "initial_margin", - "maintenance_margin", - "settlement_price", - "total_profit_loss", - "floating_profit_loss", - "realized_profit_loss", - "size", - "size_currency", - "average_price_usd", - "floating_profit_loss_usd", - "leverage", - "realized_funding", - "interest_value", - "estimated_liquidation_price", - "open_orders_margin" - ], - "og:title": "private/get_position", - "title": "private/get_position" - } - } - } - }, - "/private/get_positions": { - "get": { - "description": "Retrieves all open positions for the authenticated account. Returns position details including size, average entry price, mark price, unrealized P&L, initial margin, maintenance margin, and other position-related information.\n\nResults can be filtered by currency and instrument kind (future, option, etc.). To retrieve positions for a specific subaccount, use the `subaccount_id` parameter.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_positions)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "required": false, - "schema": { - "example": "BTC", - "$ref": "#/components/schemas/currency_with_any" - } - }, - { - "name": "kind", - "in": "query", - "description": "Kind filter on positions", - "required": false, - "schema": { - "example": "future", - "$ref": "#/components/schemas/kind_without_spot" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "The user id for the subaccount", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, widens the positions query to include positions owned by hidden isolated-margin subaccounts. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2236, - "jsonrpc": "2.0", - "method": "private/get_positions", - "params": { - "currency": "BTC", - "kind": "future" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetPositionsResponse" - }, - "400": { - "$ref": "#/components/responses/ErrorMessageResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_positions", - "metadata": { - "keywords": [ - "private/get_positions", - "currency", - "kind", - "subaccount_id", - "instrument_name", - "user_id", - "average_price", - "direction", - "mark_price", - "delta", - "gamma", - "vega", - "theta", - "index_price", - "initial_margin", - "maintenance_margin", - "settlement_price", - "total_profit_loss", - "floating_profit_loss", - "realized_profit_loss", - "size", - "size_currency", - "average_price_usd", - "floating_profit_loss_usd", - "leverage", - "realized_funding", - "interest_value", - "estimated_liquidation_price", - "open_orders_margin" - ], - "og:title": "private/get_positions", - "title": "private/get_positions" - } - } - } - }, - "/private/get_risk_profile": { - "get": { - "description": "Retrieves risk profile permissions and constraints assigned to the authenticated user account.\n\nIncludes flags for Portfolio Margining eligibility, short option trading authorization, and maximum risk-profile leverage ceiling.\n\n \n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_risk_profile)\n\n", - "parameters": [], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "private/get_risk_profile", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetRiskProfileResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_risk_profile", - "metadata": { - "keywords": [ - "private/get_risk_profile", - "portfolio_margining_allowed", - "short_option_allowed", - "max_leverage" - ], - "og:title": "private/get_risk_profile", - "title": "private/get_risk_profile" - } - } - } - }, - "/private/get_settlement_history_by_currency": { - "get": { - "description": "Retrieves settlement, delivery, and bankruptcy events that have affected your account for a specific currency.\n\n**Settlement vs. delivery:** Settlement is a daily event (at 08:00 UTC) for futures and perpetual positions that converts unrealized profit and loss into realized profit and loss. Option positions do not settle. Delivery is a one-time event that occurs when a futures or options contract expires — any remaining open position is closed at the delivery price. Delivery does not apply to perpetual or spot instruments. Both events take place at 08:00 UTC, which is why they are sometimes conflated.\n\nResults can be filtered by settlement type and timestamp. Use pagination parameters (`count` and `continuation`) to retrieve large settlement histories. This data is useful for tracking account-affecting settlement events and understanding how contract expirations impact your account.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_settlement_history_by_currency)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "type", - "in": "query", - "description": "Settlement type", - "required": false, - "schema": { - "$ref": "#/components/schemas/settlement_type" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `20`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "continuation", - "in": "query", - "description": "Continuation token for pagination", - "required": false, - "schema": { - "type": "string", - "example": "xY7T6cutS3t2B9YtaDkE6TS379oKnkzTvmEDUnEUP2Msa9xKWNNaT" - } - }, - { - "name": "search_start_timestamp", - "in": "query", - "description": "The latest timestamp to return result from (milliseconds since the UNIX epoch)", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "The user id for the subaccount. Isolated perpetual settlements are recorded per subaccount and only visible when targeting the subaccount directly.", - "required": false, - "schema": { - "type": "integer" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 8304, - "jsonrpc": "2.0", - "method": "private/get_settlement_history_by_currency", - "params": { - "count": 1, - "currency": "BTC", - "type": "delivery" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateSettlementResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_settlement_history_by_currency", - "metadata": { - "keywords": [ - "private/get_settlement_history_by_currency", - "currency", - "type", - "count", - "continuation", - "search_start_timestamp", - "settlements", - "funding", - "funded", - "index_price", - "instrument_name", - "mark_price", - "position", - "profit_loss", - "session_bankruptcy", - "session_profit_loss", - "session_tax", - "session_tax_rate", - "socialized", - "timestamp" - ], - "og:title": "private/get_settlement_history_by_currency", - "title": "private/get_settlement_history_by_currency" - } - } - } - }, - "/private/get_settlement_history_by_instrument": { - "get": { - "description": "Retrieves settlement, delivery, and bankruptcy events for a specific instrument that have affected your account.\n\n**Settlement vs. delivery:** Settlement is a daily event (at 08:00 UTC) for futures and perpetual positions that converts unrealized profit and loss into realized profit and loss. Option positions do not settle. Delivery is a one-time event that occurs when a futures or options contract expires — any remaining open position is closed at the delivery price. Delivery does not apply to perpetual or spot instruments. Both events take place at 08:00 UTC, which is why they are sometimes conflated.\n\nResults can be filtered by settlement type and timestamp. Use pagination parameters (`count` and `continuation`) to retrieve large settlement histories. This method is useful for tracking settlement events for a specific instrument.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_settlement_history_by_instrument)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "type", - "in": "query", - "description": "Settlement type", - "required": false, - "schema": { - "$ref": "#/components/schemas/settlement_type" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `20`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "continuation", - "in": "query", - "description": "Continuation token for pagination", - "required": false, - "schema": { - "type": "string", - "example": "xY7T6cutS3t2B9YtaDkE6TS379oKnkzTvmEDUnEUP2Msa9xKWNNaT" - } - }, - { - "name": "search_start_timestamp", - "in": "query", - "description": "The latest timestamp to return result from (milliseconds since the UNIX epoch)", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2192, - "jsonrpc": "2.0", - "method": "private/get_settlement_history_by_instrument", - "params": { - "count": 1, - "instrument_name": "ETH-22FEB19", - "type": "settlement" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateSettlementResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_settlement_history_by_instrument", - "metadata": { - "keywords": [ - "private/get_settlement_history_by_instrument", - "instrument_name", - "type", - "count", - "continuation", - "search_start_timestamp", - "settlements", - "funding", - "funded", - "index_price", - "mark_price", - "position", - "profit_loss", - "session_bankruptcy", - "session_profit_loss", - "session_tax", - "session_tax_rate", - "socialized", - "timestamp" - ], - "og:title": "private/get_settlement_history_by_instrument", - "title": "private/get_settlement_history_by_instrument" - } - } - } - }, - "/private/get_subaccounts": { - "get": { - "description": "Retrieves information about all subaccounts associated with the main account. Returns details such as subaccount IDs, names, and status.\n\nWhen called from a subaccount, the response includes limited details for the main account and full details for the subaccount initiating the request.\n\nSet the `with_portfolio` parameter to `true` to include portfolio information (balances, positions, etc.) in the response. By default, only subaccount metadata is returned.\n\n**📖 Related Article:** [Managing Subaccounts](https://docs.deribit.com/articles/managing-subaccounts-api)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_subaccounts)\n\n", - "parameters": [ - { - "name": "with_portfolio", - "in": "query", - "description": "Portfolio flag: `true` for portfolio information, `false` for subaccount information only. `false` by default", - "required": false, - "schema": { - "type": "boolean", - "example": true - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, includes hidden managed isolated-margin subaccounts in the response. Isolated subaccount entries include `isolated: true` and `isolated_margin_instrument`. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 4947, - "jsonrpc": "2.0", - "method": "private/get_subaccounts", - "params": { - "with_portfolio": true - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetSubaccountsResponse" - }, - "401": { - "$ref": "#/components/responses/ErrorMessageResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_subaccounts", - "metadata": { - "keywords": [ - "private/get_subaccounts", - "with_portfolio", - "username", - "type", - "email", - "not_confirmed_email", - "security_keys_enabled", - "security_keys_assignments", - "system_name", - "receive_notifications", - "is_password", - "margin_model", - "proof_id", - "proof_id_signature", - "login_enabled", - "portfolio", - "btc(example)", - "margin_balance", - "currency", - "maintenance_margin", - "initial_margin", - "equity", - "balance", - "available_withdrawal_funds", - "available_funds", - "additional_reserve", - "spot_reserve" - ], - "og:title": "private/get_subaccounts", - "title": "private/get_subaccounts" - } - } - } - }, - "/private/get_subaccounts_details": { - "get": { - "description": "Retrieves position details for all subaccounts for a specific currency. Returns positions aggregated across all subaccounts, including size, average entry price, mark price, and P&L information.\n\nOptionally include open orders for each subaccount by setting the `with_open_orders` parameter to `true`.\n\n**📖 Related Article:** [Managing Subaccounts](https://docs.deribit.com/articles/managing-subaccounts-api)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_subaccounts_details)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "with_open_orders", - "in": "query", - "description": "Optional parameter to ask for open orders list, default: `false`", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "include_isolated", - "in": "query", - "description": "If true, includes positions and open orders for hidden isolated-margin subaccounts. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "private/get_subaccounts_details", - "params": { - "currency": "BTC" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetSubaccountsDetailsResponse" - }, - "401": { - "$ref": "#/components/responses/ErrorMessageResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_subaccounts_details", - "metadata": { - "keywords": [ - "private/get_subaccounts_details", - "currency", - "with_open_orders", - "uid", - "positions", - "open_orders", - "instrument_name", - "kind", - "user_id", - "average_price", - "direction", - "mark_price", - "delta", - "gamma", - "vega", - "theta", - "index_price", - "initial_margin", - "maintenance_margin", - "settlement_price", - "total_profit_loss", - "floating_profit_loss", - "realized_profit_loss", - "size", - "size_currency", - "average_price_usd", - "floating_profit_loss_usd", - "leverage", - "realized_funding", - "interest_value", - "order_id", - "order_state", - "order_type", - "original_order_type", - "time_in_force", - "is_rebalance", - "is_liquidation", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "price", - "label", - "post_only", - "reject_post_only", - "reduce_only", - "api", - "web", - "mobile", - "refresh_amount", - "display_amount", - "amount", - "contracts", - "filled_amount", - "advanced", - "implv", - "usd", - "triggered", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_reference_price", - "block_trade", - "mmp", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "trigger_fill_condition", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco" - ], - "og:title": "private/get_subaccounts_details", - "title": "private/get_subaccounts_details" - } - } - } - }, - "/private/get_trading_limits": { - "get": { - "description": "Retrieves trading limits and open order thresholds for a given currency and margin model.\n\nReturns limits on open order count per instrument, total open order count, maximum future position sizes, and options constraints.\n\n \n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_trading_limits)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "private/get_trading_limits", - "params": { - "currency": "BTC" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetTradingLimitsResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_trading_limits", - "metadata": { - "keywords": [ - "private/get_trading_limits", - "currency" - ], - "og:title": "private/get_trading_limits", - "title": "private/get_trading_limits" - } - } - } - }, - "/private/get_transaction_log": { - "get": { - "description": "Retrieves a detailed transaction log for the authenticated account. The log includes all account activities such as trades, deposits, withdrawals, transfers, fees, and other balance-affecting operations.\n\nResults can be filtered by currency, time range, and transaction type. Use the `continuation` parameter for pagination when retrieving large transaction histories. To retrieve transactions for a specific subaccount, use the `subaccount_id` parameter.\n\nTrade entries executed in Starbase include `starbase_match_id`, `starbase_order_id`, and `starbase_timestamp`.\n\nWhen an option expires out of the money, the transaction log type is `expiry`. As there is nothing to settle into futures in this case, this remains the only entry in the transaction log for that expiration.\n\n**History Limit:** This API method has **no time limit** - users can query transaction history back to account creation. Note that the CSV export feature available on the website is year-limited to 2023. \n\n**Note - This method has distinct API rate limiting requirements:** Sustained rate: 1 request/second. For more information, see [Rate Limits](https://support.deribit.com/hc/en-us/articles/25944617523357-Rate-Limits).\n\n**📖 Related Support Article:** [Transaction log](https://support.deribit.com/hc/en-us/articles/25944587269021-Transaction-log)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_transaction_log)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/wallet_currency" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "query", - "in": "query", - "description": "The following keywords can be used to filter the results: `trade`, `maker`, `taker`, `open`, `close`, `liquidation`, `buy`, `sell`, `withdrawal`, `delivery`, `settlement`, `deposit`, `transfer`, `option`, `future`, `correction`, `block_trade`, `swap`, `expiry`. Plus withdrawal or transfer addresses", - "required": false, - "schema": { - "type": "string", - "example": "settlement" - } - }, - { - "name": "count", - "in": "query", - "description": "Count of transaction log entries returned, default - `100`, maximum - `250`", - "required": false, - "schema": { - "type": "integer", - "maximum": 250, - "minimum": 1 - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "Id of a subaccount", - "required": false, - "schema": { - "type": "integer", - "example": 9 - } - }, - { - "name": "continuation", - "in": "query", - "description": "Continuation token for pagination", - "required": false, - "schema": { - "type": "integer", - "example": 429946 - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 4, - "jsonrpc": "2.0", - "method": "private/get_transaction_log", - "params": { - "count": 5, - "currency": "BTC", - "end_timestamp": "1613660407000", - "start_timestamp": "1613657734000" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetTransactionLogResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_transaction_log", - "metadata": { - "keywords": [ - "private/get_transaction_log", - "currency", - "start_timestamp", - "end_timestamp", - "query", - "count", - "subaccount_id", - "continuation", - "logs", - "timestamp", - "user_id", - "username", - "commission", - "cashflow", - "balance", - "change", - "user_seq", - "type", - "role", - "info", - "equity", - "mark_price", - "settlement_price", - "index_price", - "instrument_name", - "position", - "side", - "amount", - "price", - "price_currency", - "trade_id", - "order_id", - "user_role", - "fee_role", - "profit_as_cashflow", - "interest_pl", - "block_rfq_id", - "ip", - "starbase_match_id", - "starbase_order_id", - "starbase_timestamp", - "session_rpl", - "session_upl", - "total_interest_pl", - "contracts" - ], - "og:title": "private/get_transaction_log", - "title": "private/get_transaction_log" - } - } - } - }, - "/private/get_trigger_order_history": { - "get": { - "description": "Retrieves a detailed log of all trigger orders (stop orders, take-profit orders, etc.) for the authenticated account. The log includes trigger order creation, activation, execution, and cancellation events.\n\nResults can be filtered by currency and instrument name. Use pagination parameters (`count` and `continuation`) to retrieve large trigger order histories. This is useful for tracking trigger order activity and debugging trigger order behavior.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_trigger_order_history)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": false, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `20`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "continuation", - "in": "query", - "description": "Continuation token for pagination", - "required": false, - "schema": { - "type": "string", - "example": "xY7T6cutS3t2B9YtaDkE6TS379oKnkzTvmEDUnEUP2Msa9xKWNNaT" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2552, - "jsonrpc": "2.0", - "method": "private/get_trigger_order_history", - "params": { - "count": 10, - "currency": "ETH" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetTriggerOrderHistoryResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_trigger_order_history", - "metadata": { - "keywords": [ - "private/get_trigger_order_history", - "currency", - "instrument_name", - "count", - "continuation", - "entries", - "timestamp", - "trigger", - "trigger_price", - "trigger_offset", - "trigger_order_id", - "order_id", - "order_state", - "request", - "direction", - "price", - "amount", - "last_update_timestamp", - "reduce_only", - "post_only", - "order_type", - "label", - "is_secondary_oto", - "oco_ref", - "source" - ], - "og:title": "private/get_trigger_order_history", - "title": "private/get_trigger_order_history" - } - } - } - }, - "/private/get_user_locks": { - "get": { - "description": "Retrieves information about any account locks or restrictions currently active on the authenticated account. Account locks may be applied for security reasons, compliance requirements, or administrative purposes.\n\nThe response includes details about the type of lock, reason, and duration (if applicable). Some locks may prevent trading, withdrawals, or other account operations.\n\n**📖 Related Support Article:** [Emergency locking an account](https://support.deribit.com/hc/en-us/articles/25944602715805-Emergency-locking-an-account)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_user_locks)\n\n", - "parameters": [], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 74, - "jsonrpc": "2.0", - "method": "private/get_user_locks", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetUserLocksResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:user:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-get_user_locks", - "metadata": { - "keywords": [ - "private/get_user_locks", - "currency", - "enabled", - "message" - ], - "og:title": "private/get_user_locks", - "title": "private/get_user_locks" - } - } - } - }, - "/private/get_user_trades_by_currency": { - "get": { - "description": "Retrieves the latest user trades that have occurred for instruments in a specific currency. Returns trade details including price, amount, direction, timestamp, trade ID, and order ID for all instruments in the currency.\n\nResults can be filtered by instrument kind, trade ID range, or timestamp range. Use the `count` parameter to limit the number of trades returned, and `sorting` to control the order. To retrieve trades for a specific subaccount, use the `subaccount_id` parameter. Use `historical` to retrieve historical trade data.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_user_trades_by_currency)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, `\"combo\"` for any combo or `\"any\"` for all. If not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind_with_combo_all" - } - }, - { - "name": "start_id", - "in": "query", - "description": "The ID of the first trade to be returned. Number for BTC trades, or hyphen name in ex. `\"ETH-15\"` # `\"ETH_USDC-16\"`", - "required": false, - "schema": { - "$ref": "#/components/schemas/trade_id" - } - }, - { - "name": "end_id", - "in": "query", - "description": "The ID of the last trade to be returned. Number for BTC trades, or hyphen name in ex. `\"ETH-15\"` # `\"ETH_USDC-16\"`", - "required": false, - "schema": { - "$ref": "#/components/schemas/trade_id" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `10`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch). When param is provided trades are returned from the earliest", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch). Only one of params: start_timestamp, end_timestamp is truly required", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "sorting", - "in": "query", - "description": "Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)", - "required": false, - "schema": { - "$ref": "#/components/schemas/sorting" - } - }, - { - "name": "historical", - "in": "query", - "description": "Determines whether historical trade and order records should be retrieved.\n\n- `false` (default): Returns recent records: orders for 30 min, trades for 24h.\n- `true`: Fetches historical records, available after a short delay due to indexing. Recent data is not included.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "The user id for the subaccount", - "required": false, - "schema": { - "type": "integer" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 9367, - "jsonrpc": "2.0", - "method": "private/get_user_trades_by_currency", - "params": { - "count": 2, - "currency": "ETH", - "start_id": "ETH-34066" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetUserTradesHistoryResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_user_trades_by_currency", - "metadata": { - "keywords": [ - "private/get_user_trades_by_currency", - "currency", - "kind", - "start_id", - "end_id", - "count", - "start_timestamp", - "end_timestamp", - "sorting", - "historical", - "subaccount_id", - "trades", - "has_more", - "trade_id", - "trade_seq", - "instrument_name", - "timestamp", - "starbase_timestamp", - "starbase_order_id", - "starbase_client_order_id", - "order_type", - "original_order_type", - "advanced", - "order_id", - "matching_id", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "contracts", - "iv", - "underlying_price", - "liquidation", - "liquidity", - "fee", - "fee_currency", - "label", - "state", - "block_trade_id", - "block_trade_leg_count", - "block_rfq_id", - "block_rfq_quote_id", - "reduce_only", - "post_only", - "mmp", - "risk_reducing", - "api", - "profit_loss", - "mark_price", - "legs", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "quote_set_id", - "quote_id", - "trade_allocations", - "user_id", - "client_info", - "client_id", - "client_link_id", - "name" - ], - "og:title": "private/get_user_trades_by_currency", - "title": "private/get_user_trades_by_currency" - } - } - } - }, - "/private/get_user_trades_by_currency_and_time": { - "get": { - "description": "Retrieves the latest user trades that have occurred for instruments in a specific currency within a specified time range. Returns trade details including price, amount, direction, timestamp, trade ID, and order ID for all instruments in the currency.\n\nResults can be filtered by instrument kind. Use the `count` parameter to limit the number of trades returned, and `sorting` to control the order. Use `historical` to retrieve historical trade data. This method is useful for analyzing trading activity across a currency over specific time periods.\n\nMain accounts may use the `subaccount_id` parameter to retrieve trade data for a specific subaccount (requires `mainaccount` scope).\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_user_trades_by_currency_and_time)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, `\"combo\"` for any combo or `\"any\"` for all. If not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind_with_combo_all" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch). When param is provided trades are returned from the earliest", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch). Only one of params: start_timestamp, end_timestamp is truly required", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `10`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "sorting", - "in": "query", - "description": "Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)", - "required": false, - "schema": { - "$ref": "#/components/schemas/sorting" - } - }, - { - "name": "historical", - "in": "query", - "description": "Determines whether historical trade and order records should be retrieved.\n\n- `false` (default): Returns recent records: orders for 30 min, trades for 24h.\n- `true`: Fetches historical records, available after a short delay due to indexing. Recent data is not included.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "Id of a subaccount", - "required": false, - "schema": { - "type": "integer", - "example": 9 - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 9292, - "jsonrpc": "2.0", - "method": "private/get_user_trades_by_currency_and_time", - "params": { - "count": 2, - "currency": "BTC", - "end_timestamp": 1510480630731, - "start_timestamp": 1590480630731 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetUserTradesHistoryResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_user_trades_by_currency_and_time", - "metadata": { - "keywords": [ - "private/get_user_trades_by_currency_and_time", - "currency", - "kind", - "start_timestamp", - "end_timestamp", - "count", - "sorting", - "historical", - "subaccount_id", - "trades", - "has_more", - "trade_id", - "trade_seq", - "instrument_name", - "timestamp", - "starbase_timestamp", - "starbase_order_id", - "starbase_client_order_id", - "order_type", - "original_order_type", - "advanced", - "order_id", - "matching_id", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "contracts", - "iv", - "underlying_price", - "liquidation", - "liquidity", - "fee", - "fee_currency", - "label", - "state", - "block_trade_id", - "block_trade_leg_count", - "block_rfq_id", - "block_rfq_quote_id", - "reduce_only", - "post_only", - "mmp", - "risk_reducing", - "api", - "profit_loss", - "mark_price", - "legs", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "quote_set_id", - "quote_id", - "trade_allocations", - "user_id", - "client_info", - "client_id", - "client_link_id", - "name" - ], - "og:title": "private/get_user_trades_by_currency_and_time", - "title": "private/get_user_trades_by_currency_and_time" - } - } - } - }, - "/private/get_user_trades_by_instrument": { - "get": { - "description": "Retrieves the latest user trades that have occurred for a specific instrument. Returns trade details including price, amount, direction, timestamp, trade ID, and order ID.\n\nResults can be filtered by sequence number range or timestamp range. Use the `count` parameter to limit the number of trades returned, and `sorting` to control the order (ascending or descending by trade ID). Use `historical` to retrieve historical trade data.\n\nMain accounts may use the `subaccount_id` parameter to retrieve trade data for a specific subaccount (requires `mainaccount` scope).\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_user_trades_by_instrument)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "start_seq", - "in": "query", - "description": "The sequence number of the first trade to be returned", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "end_seq", - "in": "query", - "description": "The sequence number of the last trade to be returned", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `10`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch). When param is provided trades are returned from the earliest", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch). Only one of params: start_timestamp, end_timestamp is truly required", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "historical", - "in": "query", - "description": "Determines whether historical trade and order records should be retrieved.\n\n- `false` (default): Returns recent records: orders for 30 min, trades for 24h.\n- `true`: Fetches historical records, available after a short delay due to indexing. Recent data is not included.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "sorting", - "in": "query", - "description": "Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)", - "required": false, - "schema": { - "$ref": "#/components/schemas/sorting" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "Id of a subaccount", - "required": false, - "schema": { - "type": "integer", - "example": 9 - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 5728, - "jsonrpc": "2.0", - "method": "private/get_user_trades_by_instrument", - "params": { - "count": 2, - "instrument_name": "ETH-PERPETUAL", - "start_seq": 1966042 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetUserTradesHistoryResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_user_trades_by_instrument", - "metadata": { - "keywords": [ - "private/get_user_trades_by_instrument", - "instrument_name", - "start_seq", - "end_seq", - "count", - "start_timestamp", - "end_timestamp", - "historical", - "sorting", - "subaccount_id", - "trades", - "has_more", - "trade_id", - "trade_seq", - "timestamp", - "starbase_timestamp", - "starbase_order_id", - "starbase_client_order_id", - "order_type", - "original_order_type", - "advanced", - "order_id", - "matching_id", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "contracts", - "iv", - "underlying_price", - "liquidation", - "liquidity", - "fee", - "fee_currency", - "label", - "state", - "block_trade_id", - "block_trade_leg_count", - "block_rfq_id", - "block_rfq_quote_id", - "reduce_only", - "post_only", - "mmp", - "risk_reducing", - "api", - "profit_loss", - "mark_price", - "legs", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "quote_set_id", - "quote_id", - "trade_allocations", - "user_id", - "client_info", - "client_id", - "client_link_id", - "name" - ], - "og:title": "private/get_user_trades_by_instrument", - "title": "private/get_user_trades_by_instrument" - } - } - } - }, - "/private/get_user_trades_by_instrument_and_time": { - "get": { - "description": "Retrieves the latest user trades that have occurred for a specific instrument within a specified time range. Returns trade details including price, amount, direction, timestamp, trade ID, and order ID.\n\nUse the `count` parameter to limit the number of trades returned, and `sorting` to control the order (ascending or descending by trade ID). Use `historical` to retrieve historical trade data. This method is useful for analyzing trading activity over specific time periods.\n\nMain accounts may use the `subaccount_id` parameter to retrieve trade data for a specific subaccount (requires `mainaccount` scope).\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_user_trades_by_instrument_and_time)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch). When param is provided trades are returned from the earliest", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch). Only one of params: start_timestamp, end_timestamp is truly required", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `10`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "sorting", - "in": "query", - "description": "Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)", - "required": false, - "schema": { - "$ref": "#/components/schemas/sorting" - } - }, - { - "name": "historical", - "in": "query", - "description": "Determines whether historical trade and order records should be retrieved.\n\n- `false` (default): Returns recent records: orders for 30 min, trades for 24h.\n- `true`: Fetches historical records, available after a short delay due to indexing. Recent data is not included.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "Id of a subaccount", - "required": false, - "schema": { - "type": "integer", - "example": 9 - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 276, - "jsonrpc": "2.0", - "method": "private/get_user_trades_by_instrument_and_time", - "params": { - "count": 2, - "end_timestamp": 1590480872894, - "instrument_name": "BTC-PERPETUAL", - "start_timestamp": 1590470872894 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetUserTradesHistoryResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_user_trades_by_instrument_and_time", - "metadata": { - "keywords": [ - "private/get_user_trades_by_instrument_and_time", - "instrument_name", - "start_timestamp", - "end_timestamp", - "count", - "sorting", - "historical", - "subaccount_id", - "trades", - "has_more", - "trade_id", - "trade_seq", - "timestamp", - "starbase_timestamp", - "starbase_order_id", - "starbase_client_order_id", - "order_type", - "original_order_type", - "advanced", - "order_id", - "matching_id", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "contracts", - "iv", - "underlying_price", - "liquidation", - "liquidity", - "fee", - "fee_currency", - "label", - "state", - "block_trade_id", - "block_trade_leg_count", - "block_rfq_id", - "block_rfq_quote_id", - "reduce_only", - "post_only", - "mmp", - "risk_reducing", - "api", - "profit_loss", - "mark_price", - "legs", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "quote_set_id", - "quote_id", - "trade_allocations", - "user_id", - "client_info", - "client_id", - "client_link_id", - "name" - ], - "og:title": "private/get_user_trades_by_instrument_and_time", - "title": "private/get_user_trades_by_instrument_and_time" - } - } - } - }, - "/private/get_user_trades_by_order": { - "get": { - "description": "Retrieves all trades that were executed from a specific order. When an order is filled, it may result in multiple trades (partial fills). This method returns all trades associated with a given order ID.\n\nResults can be sorted in ascending or descending order by trade ID. Use `historical` to retrieve historical trade data. This is useful for tracking how an order was filled and analyzing execution quality.\n\nMain accounts may use the `subaccount_id` parameter to retrieve trade data for a specific subaccount (requires `mainaccount` scope).\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_user_trades_by_order)\n\n", - "parameters": [ - { - "name": "order_id", - "in": "query", - "description": "The order id", - "required": true, - "schema": { - "$ref": "#/components/schemas/order_id" - } - }, - { - "name": "sorting", - "in": "query", - "description": "Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)", - "required": false, - "schema": { - "$ref": "#/components/schemas/sorting" - } - }, - { - "name": "historical", - "in": "query", - "description": "Determines whether historical trade and order records should be retrieved.\n\n- `false` (default): Returns recent records: orders for 30 min, trades for 24h.\n- `true`: Fetches historical records, available after a short delay due to indexing. Recent data is not included.\n\n**📖 Related Article:** [Accessing Historical Trades and Orders Using API](https://docs.deribit.com/articles/accessing-historical-trades-orders)\n", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "Id of a subaccount", - "required": false, - "schema": { - "type": "integer", - "example": 9 - } - }, - { - "name": "isolated", - "in": "query", - "description": "If true, retrieves trade fills for an order owned by an isolated margin subaccount. Without this flag, isolated order fills read as not found. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 3466, - "jsonrpc": "2.0", - "method": "private/get_user_trades_by_order", - "params": { - "order_id": "ETH-584830574" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateGetUserTradesByOrderResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:transactions:read" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-get_user_trades_by_order", - "metadata": { - "keywords": [ - "private/get_user_trades_by_order", - "order_id", - "sorting", - "historical", - "subaccount_id", - "trade_id", - "trade_seq", - "instrument_name", - "timestamp", - "starbase_timestamp", - "starbase_order_id", - "starbase_client_order_id", - "order_type", - "original_order_type", - "advanced", - "matching_id", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "contracts", - "iv", - "underlying_price", - "liquidation", - "liquidity", - "fee", - "fee_currency", - "label", - "state", - "block_trade_id", - "block_trade_leg_count", - "block_rfq_id", - "block_rfq_quote_id", - "reduce_only", - "post_only", - "mmp", - "risk_reducing", - "api", - "profit_loss", - "mark_price", - "legs", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "quote_set_id", - "quote_id", - "trade_allocations", - "user_id", - "client_info", - "client_id", - "client_link_id", - "name" - ], - "og:title": "private/get_user_trades_by_order", - "title": "private/get_user_trades_by_order" - } - } - } - }, - "/private/logout": { - "get": { - "description": "Gracefully terminate the current WebSocket connection and optionally invalidate all tokens associated with the session.\n\nThis method provides a clean way to close WebSocket connections while preserving active orders when [**Cancel On Disconnect (COD)**](https://docs.deribit.com/api-reference/session-management/private-enable_cancel_on_disconnect) is enabled.\n\n**Use Cases:**\n\n- **Clean Shutdown:** Properly close WebSocket connections during application shutdown or restart\n- **Order Preservation:** Close connections without triggering order cancellations when COD is enabled\n- **Session Management:** Invalidate tokens to ensure security when closing connections\n- **Maintenance Operations:** Temporarily disconnect for system maintenance without affecting trading positions\n\n**Cancel On Disconnect (COD) Behavior:**\n\nWhen Cancel On Disconnect is enabled for your connection, this method provides a safe way to close the connection without triggering automatic order cancellations. This is different from other disconnection scenarios:\n\n- **Graceful logout** (this method): Orders are **NOT cancelled**, even if COD is enabled\n- **Unexpected disconnection:** Orders are **cancelled** if COD is enabled\n- **Inactivity timeout:** Orders are **cancelled** if COD is enabled\n- **Heartbeat failure:** Orders are **cancelled** if COD is enabled\n\nThis distinction allows you to perform planned disconnections (e.g., for maintenance, updates, or reconnection) while preserving your active orders.\n\n**WebSocket Only:**\n\nThis method is designed exclusively for WebSocket connections. Attempting to use it via REST/HTTP will result in a 400 error response.\n\n**Note:** This method has no response. The WebSocket connection is closed immediately after the request is processed.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Flogout)\n\n", - "parameters": [ - { - "name": "invalidate_token", - "in": "query", - "description": "Token Invalidation: By default, all tokens created during the current session are invalidated when you call this method. You can control this behavior using this parameter:
  • invalidate_token=true (default): All session tokens are invalidated, requiring re-authentication for new connections
  • invalidate_token=false: Tokens remain valid, allowing you to reconnect using the same authentication
", - "required": false, - "schema": { - "type": "boolean" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 42, - "jsonrpc": "2.0", - "method": "private/logout", - "params": { - "access_token": "1529453804065.h2QrBgvn.oS36pCOmuK9EX7954lzCSkUioEtTMg7F5ShToM0ZfYlqU05OquXkQIe2_DDEkPhzmoPp1fBp0ycXShR_0jf-SMSXEdVqxLRWuOw-_StG5BMjToiAl27CbHY4P92MPhlMblTOtTImE81-5dFdyDVydpBwmlfKM3OSQ39kulP9bbfw-2jhyegOL0AgqJTY_tj554oHCQFTbq0A0ZWukukmxL2yu6iy34XdzaJB26Igy-3UxGBMwFu53EhjKBweh7xyP2nDm57-wybndJMtSyTGDXH3vjBVclo1iup5yRP", - "invalidate_token": true - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Connection closed" - } - }, - "security": [ - { - "ApiKey": [] - }, - { - "OAuth2": [] - } - ], - "tags": [ - "Authentication", - "WebSocket Only", - "Private" - ], - "x-mint": { - "href": "/api-reference/authentication/private-logout", - "metadata": { - "keywords": [ - "private/logout", - "invalidate_token" - ], - "og:title": "private/logout", - "title": "private/logout" - } - } - } - }, - "/private/pme/simulate": { - "get": { - "description": "Calculates the Extended Risk Matrix (ERM) and detailed margin information for Portfolio Margin accounts. The ERM provides a comprehensive view of portfolio risk across different scenarios and market conditions.\n\nYou can calculate the ERM for a specific currency or for the entire Cross-Collateral portfolio. The response includes margin requirements, risk metrics, and scenario analysis that helps assess portfolio risk under various market conditions.\n\nUse this method to understand margin requirements and risk exposure before making trading decisions in a Portfolio Margin account.\n\n**📖 Related Article:** [Portfolio Margin](https://support.deribit.com/hc/en-us/articles/25944756247837-Portfolio-Margin)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fpme%2Fsimulate)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency for which the Extended Risk Matrix will be calculated. Use `CROSS` for Cross Collateral simulation.", - "required": true, - "schema": { - "example": "BTC", - "$ref": "#/components/schemas/pme_currency" - } - }, - { - "name": "add_positions", - "in": "query", - "description": "If `true`, adds simulated positions to current positions, otherwise uses only simulated positions. By default `true`", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "simulated_positions", - "in": "query", - "description": "Object with positions in following form: `{InstrumentName1: Position1, InstrumentName2: Position2...}`, for example `{\"BTC-PERPETUAL\": -1.0}` (or corresponding URI-encoding for GET). Size in base currency.", - "required": false, - "schema": { - "description": "JSON string containing: object data", - "type": "string" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2255, - "jsonrpc": "2.0", - "method": "private/pme/simulate", - "params": { - "currency": "BTC" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivatePmeSimulateResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-simulate", - "metadata": { - "keywords": [ - "private/pme/simulate", - "currency", - "add_positions", - "simulated_positions" - ], - "og:title": "private/pme/simulate", - "title": "private/pme/simulate" - } - } - } - }, - "/private/sell": { - "get": { - "description": "Places a sell order for an instrument. Supports various order types including limit, market, stop, and advanced order types (stop-limit, take-profit, take-profit-limit, trailing-stop, etc.).\n\nYou can specify order parameters such as price, quantity, time-in-force, post-only, reduce-only, and trigger conditions. Orders can be labeled for easier management and tracking. Market Maker Protection (MMP) can be enabled to prevent excessive quoting.\n\n**Note:** For spot orders routed to Coinbase Exchange, fills come back asynchronously. It is recommended to receive fills from the `user.trades` channel.\n\n**📖 Related Article:** [Order Management Best Practices](https://docs.deribit.com/articles/order-management-best-practices)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fsell)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "amount", - "in": "query", - "description": "It represents the requested order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin. The `amount` is a mandatory parameter if `contracts` parameter is missing. If both `contracts` and `amount` parameter are passed they must match each other otherwise error is returned.", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "contracts", - "in": "query", - "description": "It represents the requested order size in contract units and can be passed instead of `amount`. The `contracts` is a mandatory parameter if `amount` parameter is missing. If both `contracts` and `amount` parameter are passed they must match each other otherwise error is returned.", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "type", - "in": "query", - "description": "The order type, default: `\"limit\"`\n\n`stop_limit`, `stop_market`, `take_limit`, `take_market`, and `trailing_stop` (trigger/algo order types) are not supported for `option` and `option_combo` instruments.\n\nFor spot trading routed to Coinbase Exchange, only `\"market\"`, `\"limit\"` and `\"stop_limit\"` orders are supported. Other order types will be rejected.\n", - "required": false, - "schema": { - "type": "string", - "enum": [ - "limit", - "stop_limit", - "take_limit", - "market", - "stop_market", - "take_market", - "market_limit", - "trailing_stop" - ] - } - }, - { - "name": "label", - "in": "query", - "description": "user defined label for the order (maximum 64 characters)", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "price", - "in": "query", - "description": "

The order price in base currency (Only for limit and stop_limit orders)

When adding an order with advanced=usd, the field price should be the option price value in USD.

When adding an order with advanced=implv, the field price should be a value of implied volatility in percentages. For example, price=100, means implied volatility of 100%

", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "time_in_force", - "in": "query", - "description": "

Specifies how long the order remains in effect. Default `\"good_til_cancelled\"`

  • `\"good_til_cancelled\"` - unfilled order remains in order book until cancelled
  • `\"good_til_day\"` - unfilled order remains in order book till the end of the trading session
  • `\"fill_or_kill\"` - execute a transaction immediately and completely or not at all
  • `\"immediate_or_cancel\"` - execute a transaction immediately, and any portion of the order that cannot be immediately filled is cancelled

For spot trading, only `\"good_til_cancelled\"`, `\"immediate_or_cancel\"` and `\"fill_or_kill\"` are supported. `\"good_til_day\"` is not supported and will be rejected.

", - "required": false, - "schema": { - "type": "string", - "default": "good_til_cancelled", - "enum": [ - "good_til_cancelled", - "good_til_day", - "fill_or_kill", - "immediate_or_cancel" - ] - } - }, - { - "name": "display_amount", - "in": "query", - "description": "Initial display amount for iceberg order. Has to be at least 100 times minimum amount for instrument and ratio of hidden part vs visible part has to be less than 100 as well.", - "required": false, - "schema": { - "type": "number", - "default": 1 - } - }, - { - "name": "post_only", - "in": "query", - "description": "

If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just above the spread.

Only valid in combination with time_in_force=`\"good_til_cancelled\"`

For spot trading routed to Coinbase Exchange, the price is never adjusted: `\"post_only\"` must be combined with `\"reject_post_only\"` set to true, and the order is rejected if it would be matched instantly.

", - "required": false, - "schema": { - "type": "boolean", - "default": true - } - }, - { - "name": "reject_post_only", - "in": "query", - "description": "

If an order is considered post-only and this field is set to true then the order is put to the order book unmodified or the request is rejected.

Only valid in combination with `\"post_only\"` set to true

For spot trading routed to Coinbase Exchange, this must be set to true whenever `\"post_only\"` is true; otherwise the request is rejected with `post_only_not_allowed`.

", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "reduce_only", - "in": "query", - "description": "If `true`, the order is considered reduce-only which is intended to only reduce a current position", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "trigger_price", - "in": "query", - "description": "Trigger price, required for trigger orders only (Stop-loss or Take-profit orders)", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "trigger_offset", - "in": "query", - "description": "The maximum deviation from the price peak beyond which the order will be triggered", - "required": false, - "schema": { - "type": "number" - } - }, - { - "name": "trigger", - "in": "query", - "description": "

Defines the trigger type. Required for `\"Stop-Loss\"`, `\"Take-Profit\"` and `\"Trailing\"` trigger orders

For stop-limit orders routed to Coinbase Exchange, only `\"last_price\"` is allowed.

", - "required": false, - "schema": { - "$ref": "#/components/schemas/trigger" - } - }, - { - "name": "advanced", - "in": "query", - "description": "Advanced option order type. (Only for options. Advanced USD orders are not supported for linear options.)", - "required": false, - "schema": { - "$ref": "#/components/schemas/advanced" - } - }, - { - "name": "mmp", - "in": "query", - "description": "Order MMP flag, only for order_type 'limit'", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "valid_until", - "in": "query", - "description": "Timestamp, when provided server will start processing request in Matching Engine only before given timestamp, in other cases `timed_out` error will be responded. Remember that the given timestamp should be consistent with the server's time, use /public/time method to obtain current server time.", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "linked_order_type", - "in": "query", - "description": "

The type of the linked order.

  • `\"one_triggers_other\"` - Execution of primary order triggers the placement of one or more secondary orders.
  • `\"one_cancels_other\"` - The execution of one order in a pair automatically cancels the other, typically used to set a stop-loss and take-profit simultaneously.
  • `\"one_triggers_one_cancels_other\"` - The execution of a primary order triggers two secondary orders (a stop-loss and take-profit pair), where the execution of one secondary order cancels the other.
", - "required": false, - "schema": { - "type": "string", - "enum": [ - "one_triggers_other", - "one_cancels_other", - "one_triggers_one_cancels_other" - ] - } - }, - { - "name": "trigger_fill_condition", - "in": "query", - "description": "

The fill condition of the linked order (Only for linked order types), default: `first_hit`.

  • `\"first_hit\"` - any execution of the primary order will fully cancel/place all secondary orders.
  • `\"complete_fill\"` - a complete execution (meaning the primary order no longer exists) will cancel/place the secondary orders.
  • `\"incremental\"` - any fill of the primary order will cause proportional partial cancellation/placement of the secondary order. The amount that will be subtracted/added to the secondary order will be rounded down to the contract size.
", - "required": false, - "schema": { - "type": "string", - "default": "first_hit", - "enum": [ - "first_hit", - "complete_fill", - "incremental" - ] - } - }, - { - "name": "otoco_config", - "in": "query", - "description": "List of secondary orders to place or cancel when the primary order is filled. Each entry in the array defines one secondary order. `amount` and `direction` are required; all other fields are optional.", - "required": false, - "schema": { - "type": "array", - "items": { - "properties": { - "amount": { - "description": "**Required.** The secondary order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "type": "number" - }, - "direction": { - "description": "**Required.** Direction of the secondary order.", - "type": "string", - "enum": [ - "buy", - "sell" - ] - }, - "label": { - "description": "User defined label for the order (maximum 64 characters).", - "type": "string" - }, - "post_only": { - "description": "If true, the order is considered post-only. If the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below or above the spread (according to the direction of the order).", - "type": "boolean", - "default": false - }, - "price": { - "description": "The order price in base currency. Required for limit and stop_limit orders.", - "type": "number" - }, - "reduce_only": { - "description": "If true, the order is considered reduce-only which is intended to only reduce a current position.", - "type": "boolean", - "default": false - }, - "reject_post_only": { - "description": "If an order is considered post-only and this field is set to true then the order is put to the order book unmodified or the request is rejected.", - "type": "boolean", - "default": false - }, - "time_in_force": { - "description": "Specifies how long the order remains in effect. Default `\"good_til_cancelled\"`.", - "type": "string", - "default": "good_til_cancelled", - "enum": [ - "good_til_cancelled", - "good_til_day", - "fill_or_kill", - "immediate_or_cancel" - ] - }, - "trigger": { - "description": "Defines the trigger type. Required for stop-loss, take-profit, and trailing stop orders.", - "type": "string", - "enum": [ - "index_price", - "mark_price", - "last_price" - ] - }, - "trigger_offset": { - "description": "The maximum deviation from the price peak beyond which the order will be triggered. Used for trailing stop orders.", - "type": "number" - }, - "trigger_price": { - "description": "Trigger price. Required for trigger orders (stop-loss or take-profit orders).", - "type": "number" - }, - "type": { - "description": "The order type, default: `\"limit\"`", - "type": "string", - "enum": [ - "limit", - "stop_limit", - "take_limit", - "market", - "stop_market", - "take_market", - "market_limit", - "trailing_stop" - ] - } - }, - "type": "object" - } - }, - "explode": true, - "style": "form" - }, - { - "name": "isolated", - "in": "query", - "description": "If true, places the order under isolated margin mode. A managed subaccount is claimed or provisioned and bound to the instrument. Available to main accounts for futures orders only; not supported for algo, advanced, or linked orders. Default - `false`", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "allocated_margin", - "in": "query", - "description": "Optional initial margin amount transferred from the main account to the isolated subaccount for this order. Only applicable when `isolated = true`. On risk-increasing orders, must meet the required minimum margin or placement fails with error `14033` (`isolated_allocated_too_low`).", - "required": false, - "schema": { - "type": "number" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2148, - "jsonrpc": "2.0", - "method": "private/sell", - "params": { - "amount": 123, - "instrument_name": "ETH-PERPETUAL", - "price": 145.61, - "trigger": "last_price", - "trigger_price": 145, - "type": "stop_limit" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateBuyAndSellResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Trading", - "Matching Engine", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-sell", - "metadata": { - "keywords": [ - "private/sell", - "instrument_name", - "amount", - "contracts", - "type", - "label", - "price", - "time_in_force", - "display_amount", - "post_only", - "reject_post_only", - "reduce_only", - "trigger_price", - "trigger_offset", - "trigger", - "advanced", - "mmp", - "valid_until", - "linked_order_type", - "trigger_fill_condition", - "otoco_config", - "order", - "trades", - "order_id", - "order_state", - "order_type", - "original_order_type", - "is_rebalance", - "is_liquidation", - "creation_timestamp", - "last_update_timestamp", - "starbase_last_update_timestamp", - "starbase_client_order_id", - "direction", - "api", - "web", - "mobile", - "refresh_amount", - "filled_amount", - "average_price", - "implv", - "usd", - "triggered", - "trigger_reference_price", - "block_trade", - "risk_reducing", - "replaced", - "auto_replaced", - "quote", - "mmp_group", - "quote_set_id", - "quote_id", - "trigger_order_id", - "combo_order_id", - "starbase_order_id", - "app_name", - "mmp_cancelled", - "cancel_reason", - "oto_order_ids", - "oco_ref", - "primary_order_id", - "is_secondary_oto", - "is_primary_otoco", - "trade_id", - "trade_seq", - "timestamp", - "starbase_timestamp", - "matching_id", - "tick_direction", - "index_price", - "iv", - "underlying_price", - "liquidation", - "liquidity", - "fee", - "fee_currency", - "state", - "block_trade_id", - "block_trade_leg_count", - "block_rfq_id", - "block_rfq_quote_id", - "profit_loss", - "mark_price", - "legs", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "trade_allocations", - "user_id", - "client_info", - "client_id", - "client_link_id", - "name" - ], - "og:title": "private/sell", - "title": "private/sell" - } - } - } - }, - "/private/set_leverage": { - "get": { - "description": "Sets a custom leverage multiplier for a specified future instrument.\n\nCustom leverage cannot exceed the effective `max_leverage` allowed by the account's risk profile. Passing `null` as the leverage value removes the custom leverage setting and restores the default leverage.\n\nCustom leverage setting is disabled for isolated subaccounts. Setting leverage in isolated margin mode is restricted to main accounts.\n\n \n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fset_leverage)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "leverage", - "in": "query", - "description": "Target custom leverage multiplier. Must be between 1 and max_leverage. Pass null to remove custom leverage and restore risk-profile default.", - "required": true, - "schema": { - "type": [ - "number", - "null" - ] - } - }, - { - "name": "subaccount_id", - "in": "query", - "description": "The user id for the subaccount. Available to retail-broker callers; defaults to the authenticated account.", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "isolated", - "in": "query", - "description": "If true, sets leverage for isolated margin scope (main account only).", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "private/set_leverage", - "params": { - "instrument_name": "BTC-PERPETUAL", - "leverage": 50 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateSetLeverageResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:accounts:update" - ] - } - ], - "tags": [ - "Trading", - "Private" - ], - "x-mint": { - "href": "/api-reference/trading/private-set_leverage", - "metadata": { - "keywords": [ - "private/set_leverage", - "instrument_name", - "leverage", - "subaccount_id", - "isolated" - ], - "og:title": "private/set_leverage", - "title": "private/set_leverage" - } - } - } - }, - "/private/simulate_portfolio": { - "get": { - "description": "Calculates portfolio margin requirements and risk metrics for simulated positions or the current portfolio. This method helps you understand margin requirements before opening new positions or assess the impact of potential trades.\n\nYou can simulate adding new positions to the current portfolio or calculate margin for a completely simulated portfolio. The response includes initial margin, maintenance margin, available funds, and other risk metrics.\n\n**Note:** This method has a restricted rate limit of not more than once per second due to the computational complexity of portfolio margin calculations.\n\n**📖 Related Article:** [Portfolio Margin](https://support.deribit.com/hc/en-us/articles/25944756247837-Portfolio-Margin)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fsimulate_portfolio)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "example": "BTC", - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "add_positions", - "in": "query", - "description": "If `true`, adds simulated positions to current positions, otherwise uses only simulated positions. By default `true`", - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "simulated_positions", - "in": "query", - "description": "Object with positions in following form: `{InstrumentName1: Position1, InstrumentName2: Position2...}`, for example `{\"BTC-PERPETUAL\": -1000.0}` (or corresponding URI-encoding for GET). For futures in USD, for options in base currency.", - "required": false, - "schema": { - "description": "JSON string containing: object data", - "type": "string" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 22222, - "jsonrpc": "2.0", - "method": "private/simulate_portfolio", - "params": { - "add_positions": true, - "currency": "BTC", - "simulated_positions": { - "BTC-PERPETUAL": 1 - } - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateSimulatePortfolioResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:accounts:read" - ] - } - ], - "tags": [ - "Account Management", - "Private" - ], - "x-mint": { - "href": "/api-reference/account-management/private-simulate_portfolio", - "metadata": { - "keywords": [ - "private/simulate_portfolio", - "currency", - "add_positions", - "simulated_positions", - "equity", - "balance", - "margin_balance", - "initial_margin", - "maintenance_margin", - "projected_initial_margin", - "projected_maintenance_margin", - "available_funds", - "available_withdrawal_funds", - "available_subaccount_transfer_funds", - "total_pl", - "session_rpl", - "session_upl", - "futures_pl", - "futures_session_rpl", - "futures_session_upl", - "options_pl", - "options_session_rpl", - "options_session_upl", - "options_value", - "options_delta", - "options_gamma", - "options_theta", - "options_vega", - "options_gamma_map", - "options_theta_map", - "options_vega_map", - "delta_total", - "delta_total_map", - "projected_delta_total", - "additional_reserve", - "spot_reserve", - "fee_balance", - "locked_balance", - "margin_model", - "portfolio_margining_enabled", - "cross_collateral_enabled", - "total_equity_usd", - "total_initial_margin_usd", - "total_maintenance_margin_usd", - "total_margin_balance_usd", - "total_delta_total_usd" - ], - "og:title": "private/simulate_portfolio", - "title": "private/simulate_portfolio" - } - } - } - }, - "/private/submit_transfer_between_subaccounts": { - "get": { - "description": "Transfer funds between two subaccounts or between a subaccount and the main account.\n\n**📖 Related Article:** [Managing Transfers](https://docs.deribit.com/articles/managing-transfers-api)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fsubmit_transfer_between_subaccounts)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "amount", - "in": "query", - "description": "Amount of funds to be transferred", - "required": true, - "schema": { - "type": "number" - } - }, - { - "name": "destination", - "in": "query", - "description": "Id of destination subaccount. Can be found in `My Account >> Subaccounts` tab", - "required": true, - "schema": { - "type": "integer", - "example": 1 - } - }, - { - "name": "source", - "in": "query", - "description": "Id of the source (sub)account. Can be found in `My Account >> Subaccounts` tab. By default, it is the Id of the account which made the request. However, if a different \"source\" is specified, the user must possess the mainaccount scope, and only other subaccounts can be designated as the source.", - "required": false, - "schema": { - "type": "integer", - "example": 1 - } - }, - { - "name": "nonce", - "in": "query", - "description": "Optional idempotency nonce. If provided, subsequent requests with the same nonce will return the previously created transaction instead of creating a new one. Must be 8-128 characters. The nonce is persisted on the resulting transaction and returned in the response.", - "required": false, - "schema": { - "$ref": "#/components/schemas/nonce" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 210, - "jsonrpc": "2.0", - "method": "private/submit_transfer_between_subaccounts", - "params": { - "amount": 12.1234, - "currency": "ETH", - "destination": 20, - "source": 10 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateSubmitTransferResponse" - } - }, - "security": [ - { - "ApiKey": [ - "trade" - ] - }, - { - "OAuth2": [ - "wallet:buys:create" - ] - } - ], - "tags": [ - "Wallet", - "Private" - ], - "x-mint": { - "href": "/api-reference/wallet/private-submit_transfer_between_subaccounts", - "metadata": { - "keywords": [ - "private/submit_transfer_between_subaccounts", - "currency", - "amount", - "destination", - "source", - "nonce", - "created_timestamp", - "type", - "other_side", - "state", - "direction", - "updated_timestamp" - ], - "og:title": "private/submit_transfer_between_subaccounts", - "title": "private/submit_transfer_between_subaccounts" - } - } - } - }, - "/private/subscribe": { - "get": { - "description": "Subscribe to one or more channels. The name of the channel determines what information will be provided, and in what form.\n\nFor a complete list of available subscription channels and their notification formats, see [Notifications and Subscriptions](https://docs.deribit.com/articles/notifications).\n\n**Note - This method has distinct API rate limiting requirements:** Sustained rate: ~3.3 requests/second. For more information, see [Rate Limits](https://docs.deribit.com/articles/rate-limits).\n\n**📖 Related Article:** [Market Data Collection Best Practices](https://docs.deribit.com/articles/market-data-collection-best-practices)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fsubscribe)\n\n", - "parameters": [ - { - "name": "channels", - "in": "query", - "description": "A list of channels to subscribe to. See [Notifications and Subscriptions](https://docs.deribit.com/articles/notifications) for all available channels.", - "required": true, - "schema": { - "type": "array", - "items": { - "example": "deribit_price_index.btc_usd", - "type": "string" - }, - "example": [ - "deribit_price_index.btc_usd" - ] - }, - "explode": true, - "style": "form" - }, - { - "name": "label", - "in": "query", - "description": "Optional label which will be added to notifications of private channels (max 16 characters).", - "required": false, - "schema": { - "type": "string", - "example": "TestLabel1" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 4235, - "jsonrpc": "2.0", - "method": "private/subscribe", - "params": { - "channels": [ - "deribit_price_index.btc_usd" - ] - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateSubscribeResponse" - }, - "401": { - "$ref": "#/components/responses/ErrorMessageResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:user:read" - ] - } - ], - "tags": [ - "Subscription Management", - "Private", - "WebSocket Only" - ], - "x-mint": { - "href": "/api-reference/subscription-management/private-subscribe", - "metadata": { - "keywords": [ - "private/subscribe", - "channels", - "label" - ], - "og:title": "private/subscribe", - "title": "private/subscribe" - } - } - } - }, - "/private/unsubscribe": { - "get": { - "description": "Unsubscribe from one or more channels. The response contains only the channels that were successfully unsubscribed in this request.\n\nFor a complete list of available subscription channels and their notification formats, see [Notifications and Subscriptions](https://docs.deribit.com/articles/notifications).\n\n**Note:** The `result` field in the response contains only the channels that were successfully processed and unsubscribed from this specific request. It does not include all previously subscribed topics. If a channel in the request is invalid, not subscribed, or fails validation, it will not appear in the result.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Funsubscribe)\n\n", - "parameters": [ - { - "name": "channels", - "in": "query", - "description": "A list of channels to unsubscribe from. Only successfully unsubscribed channels will be returned in the result. See [Notifications and Subscriptions](https://docs.deribit.com/articles/notifications) for all available channels.", - "required": true, - "schema": { - "type": "array", - "items": { - "example": "deribit_price_index.btc_usd", - "type": "string" - }, - "example": [ - "deribit_price_index.btc_usd" - ] - }, - "explode": true, - "style": "form" - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 3370, - "jsonrpc": "2.0", - "method": "private/unsubscribe", - "params": { - "channels": [ - "deribit_price_index.btc_usd" - ] - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/Getunsubscribe200response" - }, - "401": { - "$ref": "#/components/responses/ErrorMessageResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:user:read" - ] - } - ], - "tags": [ - "Subscription Management", - "Private", - "WebSocket Only" - ], - "x-mint": { - "href": "/api-reference/subscription-management/private-unsubscribe", - "metadata": { - "keywords": [ - "private/unsubscribe", - "channels" - ], - "og:title": "private/unsubscribe", - "title": "private/unsubscribe" - } - } - } - }, - "/private/unsubscribe_all": { - "get": { - "description": "Unsubscribe from all the channels subscribed so far. This method takes no parameters.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Funsubscribe_all)\n\n", - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 154, - "jsonrpc": "2.0", - "method": "private/unsubscribe_all", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/OkResponse" - } - }, - "security": [ - { - "ApiKey": [ - "view" - ] - }, - { - "OAuth2": [ - "wallet:user:read" - ] - } - ], - "tags": [ - "Subscription Management", - "WebSocket Only", - "Private" - ], - "x-mint": { - "href": "/api-reference/subscription-management/private-unsubscribe_all", - "metadata": { - "keywords": [ - "private/unsubscribe_all" - ], - "og:title": "private/unsubscribe_all", - "title": "private/unsubscribe_all" - } - } - } - }, - "/public/auth": { - "post": { - "description": "Authenticate using a Coinbase-issued credential.\n\n**Only `POST` is supported.** Send the JSON-RPC request in the request body; query-string credentials are not accepted.", - "requestBody": { - "description": "JSON-RPC request body", - "required": true, - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "public/auth", - "params": { - "grant_type": "coinbase_cdp", - "token": "..." - } - } - } - }, - "schema": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer", - "example": 1 - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "method": { - "description": "The method name", - "type": "string", - "enum": [ - "public/auth" - ] - }, - "params": { - "type": "object", - "properties": { - "grant_type": { - "description": "Coinbase grant type used to authenticate.", - "type": "string", - "example": "coinbase_cdp", - "enum": [ - "coinbase_cdp", - "coinbase_oauth2" - ] - }, - "token": { - "description": "Coinbase-issued credential matching `grant_type`.", - "type": "string", - "example": "..." - } - }, - "required": [ - "grant_type", - "token" - ] - } - }, - "required": [ - "jsonrpc", - "id", - "method", - "params" - ] - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicAuthResponse" - } - }, - "security": [], - "tags": [ - "Authentication", - "Public" - ], - "x-mint": { - "metadata": { - "keywords": [ - "public/auth", - "grant_type", - "token" - ], - "og:title": "public/auth", - "title": "public/auth" - } - } - } - }, - "/public/disable_heartbeat": { - "get": { - "description": "Stop sending heartbeat messages. This method takes no parameters.\n\n**WebSocket Only:** This method is designed exclusively for WebSocket connections. Attempting to use it via REST/HTTP will result in an error response.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fdisable_heartbeat)\n\n", - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 3562, - "jsonrpc": "2.0", - "method": "public/disable_heartbeat", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/OkResponse" - } - }, - "security": [], - "tags": [ - "Session Management", - "WebSocket Only", - "Public" - ], - "x-mint": { - "href": "/api-reference/session-management/public-disable_heartbeat", - "metadata": { - "keywords": [ - "public/disable_heartbeat" - ], - "og:title": "public/disable_heartbeat", - "title": "public/disable_heartbeat" - } - } - } - }, - "/public/get_announcements": { - "get": { - "description": "Retrieves platform announcements and important notices. Announcements include system updates, maintenance schedules, new features, policy changes, and other important information.\n\nResults are returned in reverse chronological order (newest first). The default `start_timestamp` is the current time, and the `count` parameter must be between 1 and 50 (default is 5).\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_announcements)\n\n", - "parameters": [ - { - "name": "start_timestamp", - "in": "query", - "description": "The most recent timestamp to return the results for (milliseconds since the UNIX epoch)", - "required": false, - "schema": { - "default": "Current time", - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "count", - "in": "query", - "description": "Maximum count of returned announcements, default - `5`, maximum - `50`", - "required": false, - "schema": { - "type": "integer", - "example": 10, - "default": 5, - "maximum": 50, - "minimum": 1 - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 7661, - "jsonrpc": "2.0", - "method": "public/get_announcements", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetAnnouncementsResponse" - } - }, - "security": [], - "tags": [ - "Account Management", - "Public" - ], - "x-mint": { - "href": "/api-reference/account-management/public-get_announcements", - "metadata": { - "keywords": [ - "public/get_announcements", - "start_timestamp", - "count", - "body", - "publication_timestamp", - "important", - "confirmation", - "title" - ], - "og:title": "public/get_announcements", - "title": "public/get_announcements" - } - } - } - }, - "/public/get_book_summary_by_currency": { - "get": { - "description": "Retrieves summary information such as open interest, 24-hour volume, best bid/ask prices, last trade price, and other market statistics for all instruments in a given currency.\n\nResults can be filtered by instrument kind (future, option, etc.). This method provides a quick overview of market activity across all instruments for a currency.\n\n**Note:** For real-time updates, we recommend using the WebSocket subscription to `ticker.{instrument_name}.{interval}` instead of polling this endpoint.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_book_summary_by_currency)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, if not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 9344, - "jsonrpc": "2.0", - "method": "public/get_book_summary_by_currency", - "params": { - "currency": "BTC", - "kind": "future" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetBookSummaryResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_book_summary_by_currency", - "metadata": { - "keywords": [ - "public/get_book_summary_by_currency", - "currency", - "kind", - "instrument_name", - "high", - "low", - "base_currency", - "quote_currency", - "volume", - "bid_price", - "ask_price", - "mid_price", - "mark_price", - "last", - "open_interest", - "creation_timestamp", - "estimated_delivery_price", - "volume_usd", - "volume_notional", - "current_funding", - "funding_8h", - "mark_iv", - "interest_rate", - "underlying_index", - "underlying_price", - "price_change" - ], - "og:title": "public/get_book_summary_by_currency", - "title": "public/get_book_summary_by_currency" - } - } - } - }, - "/public/get_book_summary_by_instrument": { - "get": { - "description": "Retrieves summary information such as open interest, 24-hour volume, best bid/ask prices, last trade price, mark price, and other market statistics for a specific instrument.\n\nThis method provides a quick overview of current market activity and liquidity for a single instrument.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_book_summary_by_instrument)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 3659, - "jsonrpc": "2.0", - "method": "public/get_book_summary_by_instrument", - "params": { - "instrument_name": "ETH-22FEB19-140-P" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetBookSummaryResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_book_summary_by_instrument", - "metadata": { - "keywords": [ - "public/get_book_summary_by_instrument", - "instrument_name", - "high", - "low", - "base_currency", - "quote_currency", - "volume", - "bid_price", - "ask_price", - "mid_price", - "mark_price", - "last", - "open_interest", - "creation_timestamp", - "estimated_delivery_price", - "volume_usd", - "volume_notional", - "current_funding", - "funding_8h", - "mark_iv", - "interest_rate", - "underlying_index", - "underlying_price", - "price_change" - ], - "og:title": "public/get_book_summary_by_instrument", - "title": "public/get_book_summary_by_instrument" - } - } - } - }, - "/public/get_combo_details": { - "get": { - "description": "Retrieves detailed information about a specific combo, including its leg structure, state, and other properties.\n\nUse [public/get_combo_ids](https://docs.deribit.com/api-reference/combo-books/public-get_combo_ids) to get a list of available combo IDs.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_combo_details)\n\n", - "parameters": [ - { - "name": "combo_id", - "in": "query", - "description": "Combo ID", - "required": true, - "schema": { - "$ref": "#/components/schemas/combo_id" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 3, - "jsonrpc": "2.0", - "method": "public/get_combo_details", - "params": { - "combo_id": "BTC-FS-29APR22_PERP" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetComboDetailsResponse" - } - }, - "security": [], - "tags": [ - "Combo Books", - "Public" - ], - "x-mint": { - "href": "/api-reference/combo-books/public-get_combo_details", - "metadata": { - "keywords": [ - "public/get_combo_details", - "combo_id", - "instrument_id", - "state", - "state_timestamp", - "creation_timestamp", - "legs", - "instrument_name", - "amount" - ], - "og:title": "public/get_combo_details", - "title": "public/get_combo_details" - } - } - } - }, - "/public/get_combo_ids": { - "get": { - "description": "Retrieves available combo IDs. This method can be used to get the list of all combos, or only the list of combos in the given state.\n\nUse [public/get_combo_details](https://docs.deribit.com/api-reference/combo-books/public-get_combo_details) to retrieve detailed information about a specific combo.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_combo_ids)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "state", - "in": "query", - "description": "Combo state, if not provided combos of all states are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/combo_state" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "public/get_combo_ids", - "params": { - "currency": "BTC", - "state": "active" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetComboIdsResponse" - } - }, - "security": [], - "tags": [ - "Combo Books", - "Public" - ], - "x-mint": { - "href": "/api-reference/combo-books/public-get_combo_ids", - "metadata": { - "keywords": [ - "public/get_combo_ids", - "currency", - "state" - ], - "og:title": "public/get_combo_ids", - "title": "public/get_combo_ids" - } - } - } - }, - "/public/get_combos": { - "get": { - "description": "Retrieves information about active combos for the specified currency. Returns detailed information including leg structures and combo properties.\n\nFor a list of combo IDs only, use [public/get_combo_ids](https://docs.deribit.com/api-reference/combo-books/public-get_combo_ids). For details about a specific combo, use [public/get_combo_details](https://docs.deribit.com/api-reference/combo-books/public-get_combo_details).\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_combos)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol or `\"any\"` for all", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency_with_any" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2, - "jsonrpc": "2.0", - "method": "public/get_combos", - "params": { - "currency": "BTC" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetCombosResponse" - } - }, - "security": [], - "tags": [ - "Combo Books", - "Public" - ], - "x-mint": { - "href": "/api-reference/combo-books/public-get_combos", - "metadata": { - "keywords": [ - "public/get_combos", - "currency", - "instrument_id", - "state", - "state_timestamp", - "creation_timestamp", - "legs", - "instrument_name", - "amount" - ], - "og:title": "public/get_combos", - "title": "public/get_combos" - } - } - } - }, - "/public/get_contract_size": { - "get": { - "description": "Retrieves the contract size (also known as contract multiplier) for a given instrument. The contract size is the value of one contract, expressed in the same unit as the order amount: USD for inverse (reversed) futures and perpetuals, and the base currency coin for options, spots, and linear futures and perpetuals.\n\nThis value is essential for calculating position values, margin requirements, and P&L calculations. Different instruments may have different contract sizes.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_contract_size)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetContractSizeResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_contract_size", - "metadata": { - "keywords": [ - "public/get_contract_size", - "instrument_name", - "contract_size" - ], - "og:title": "public/get_contract_size", - "title": "public/get_contract_size" - } - } - } - }, - "/public/get_currencies": { - "get": { - "description": "Retrieves all cryptocurrencies supported by the Deribit API. Returns a list of available currencies with their codes and basic information.\n\nThis method takes no parameters and is useful for discovering which currencies are available for trading on the platform.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_currencies)\n\n", - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 7538, - "jsonrpc": "2.0", - "method": "public/get_currencies", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetCurrenciesResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_currencies", - "metadata": { - "keywords": [ - "public/get_currencies", - "withdrawal_fee", - "withdrawal_priorities", - "min_withdrawal_fee", - "currency", - "currency_long", - "min_confirmations", - "coin_type", - "in_cross_collateral_pool", - "apr", - "network_fee", - "network_currency", - "decimals", - "currency_uuid", - "name", - "value" - ], - "og:title": "public/get_currencies", - "title": "public/get_currencies" - } - } - } - }, - "/public/get_delivery_prices": { - "get": { - "description": "Retrieves historical delivery prices for a given index. Delivery prices are the settlement prices used when futures or options contracts expire and are settled.\n\nResults can be paginated using the `offset` and `count` parameters. This method is useful for analyzing historical settlement prices and understanding how contracts have been settled over time.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_delivery_prices)\n\n", - "parameters": [ - { - "name": "index_name", - "in": "query", - "description": "Index identifier, matches (base) cryptocurrency with quote currency", - "required": true, - "schema": { - "$ref": "#/components/schemas/index_name" - } - }, - { - "name": "offset", - "in": "query", - "description": "The offset for pagination, default - `0`", - "required": false, - "schema": { - "type": "integer", - "example": 10 - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `10`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 3601, - "jsonrpc": "2.0", - "method": "public/get_delivery_prices", - "params": { - "count": 5, - "index_name": "btc_usd", - "offset": 0 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetDeliveryPricesResponse" - } - }, - "security": [], - "tags": [ - "Market Data" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_delivery_prices", - "metadata": { - "keywords": [ - "public/get_delivery_prices", - "index_name", - "offset", - "count", - "records_total", - "data", - "date", - "delivery_price" - ], - "og:title": "public/get_delivery_prices", - "title": "public/get_delivery_prices" - } - } - } - }, - "/public/get_expirations": { - "get": { - "description": "Retrieves all available expiration timestamps for instruments. This method can be used to discover which expiration dates are available for trading, which is useful for finding instruments with specific expiration dates.\n\nResults can be filtered by settlement currency, instrument kind (future or option), and currency pair. The response includes expiration timestamps in milliseconds since the UNIX epoch.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_expirations)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol or `\"any\"` for all or '\"grouped\"' for all grouped by currency", - "required": true, - "schema": { - "$ref": "#/components/schemas/settlement_currency_with_any_and_grouped" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, `\"future\"` or `\"option\"` or `\"any\"`", - "required": true, - "schema": { - "$ref": "#/components/schemas/kind_future_or_option_with_any" - } - }, - { - "name": "currency_pair", - "in": "query", - "description": "The currency pair symbol", - "required": false, - "schema": { - "$ref": "#/components/schemas/index_name" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "public/get_expirations", - "params": { - "currency": "any", - "kind": "any" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetExpirationsResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_expirations", - "metadata": { - "keywords": [ - "public/get_expirations", - "currency", - "kind", - "currency_pair" - ], - "og:title": "public/get_expirations", - "title": "public/get_expirations" - } - } - } - }, - "/public/get_funding_chart_data": { - "get": { - "description": "Retrieves funding rate chart data points for a PERPETUAL instrument within a given time period. The data is formatted for use in charting applications and includes funding rate values at regular intervals.\n\nUse the `length` parameter to specify the time period for which to retrieve chart data. This method is useful for visualizing funding rate trends over time.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_funding_chart_data)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "length", - "in": "query", - "description": "Specifies time period. `8h` - 8 hours, `24h` - 24 hours, `1m` - 1 month", - "required": true, - "schema": { - "type": "string", - "enum": [ - "8h", - "24h", - "1m" - ] - } - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetFundingChartDataResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_funding_chart_data", - "metadata": { - "keywords": [ - "public/get_funding_chart_data", - "instrument_name", - "length", - "current_interest", - "interest_8h", - "data", - "timestamp", - "index_price" - ], - "og:title": "public/get_funding_chart_data", - "title": "public/get_funding_chart_data" - } - } - } - }, - "/public/get_funding_rate_history": { - "get": { - "description": "Retrieves hourly historical funding rate (interest rate) data for a PERPETUAL instrument over a specified time period. Funding rates are periodic payments exchanged between long and short positions in perpetual contracts.\n\nThe response includes hourly funding rate values, which can be used to analyze funding rate trends and calculate historical funding costs. This method is applicable only for PERPETUAL instruments.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_funding_rate_history)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 7617, - "jsonrpc": "2.0", - "method": "public/get_funding_rate_history", - "params": { - "end_timestamp": 1569902400000, - "instrument_name": "BTC-PERPETUAL", - "start_timestamp": 1569888000000 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetFundingRateHistoryResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_funding_rate_history", - "metadata": { - "keywords": [ - "public/get_funding_rate_history", - "instrument_name", - "start_timestamp", - "end_timestamp", - "timestamp", - "prev_index_price", - "index_price", - "interest_1h", - "interest_8h" - ], - "og:title": "public/get_funding_rate_history", - "title": "public/get_funding_rate_history" - } - } - } - }, - "/public/get_funding_rate_value": { - "get": { - "description": "Retrieves the funding rate (interest rate) value for a perpetual instrument over a specified time period. Funding rates are periodic payments exchanged between long and short positions in perpetual contracts.\n\nThis method is applicable only for PERPETUAL instruments. The funding rate is typically expressed as a percentage and is used to keep the perpetual contract price aligned with the underlying index price.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_funding_rate_value)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 7617, - "jsonrpc": "2.0", - "method": "public/get_funding_rate_value", - "params": { - "end_timestamp": 1569974400000, - "instrument_name": "BTC-PERPETUAL", - "start_timestamp": 1569888000000 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetFundingRateValueResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_funding_rate_value", - "metadata": { - "keywords": [ - "public/get_funding_rate_value", - "instrument_name", - "start_timestamp", - "end_timestamp" - ], - "og:title": "public/get_funding_rate_value", - "title": "public/get_funding_rate_value" - } - } - } - }, - "/public/get_historical_volatility": { - "get": { - "description": "Provides historical volatility data for a given cryptocurrency. Historical volatility measures the degree of price variation over a past period and is useful for risk assessment and option pricing.\n\nThe response includes volatility statistics calculated from historical price movements. This data can be used for portfolio risk analysis and understanding market conditions.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_historical_volatility)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 8387, - "jsonrpc": "2.0", - "method": "public/get_historical_volatility", - "params": { - "currency": "BTC" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetHistoricalVolatilityResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_historical_volatility", - "metadata": { - "keywords": [ - "public/get_historical_volatility", - "currency", - "timestamp", - "value" - ], - "og:title": "public/get_historical_volatility", - "title": "public/get_historical_volatility" - } - } - } - }, - "/public/get_index_chart_data": { - "get": { - "description": "Returns historical price index chart data for the specified index name and time range. The data is formatted for use in charting applications and shows price index values over time.\n\nUse the `range` parameter to specify the time period for which to retrieve chart data. This method is useful for visualizing price index trends and historical movements.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_index_chart_data)\n\n", - "parameters": [ - { - "name": "index_name", - "in": "query", - "description": "Index identifier, matches (base) cryptocurrency with quote currency", - "required": true, - "schema": { - "$ref": "#/components/schemas/index_name" - } - }, - { - "name": "range", - "in": "query", - "description": "Range of the data to return", - "required": true, - "schema": { - "type": "string", - "enum": [ - "1h", - "1d", - "2d", - "1m", - "1y", - "all" - ] - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "public/get_index_chart_data", - "params": { - "index_name": "btc_usd", - "range": "1m" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetIndexChartDataResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_index_chart_data", - "metadata": { - "keywords": [ - "public/get_index_chart_data", - "index_name", - "range" - ], - "og:title": "public/get_index_chart_data", - "title": "public/get_index_chart_data" - } - } - } - }, - "/public/get_index_price": { - "get": { - "description": "Retrieves the current index price value for a given index name. Index prices are used as reference prices for mark price calculations and settlement.\n\nUse `get_index_price_names` or `get_supported_index_names` to retrieve available index names.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_index_price)\n\n", - "parameters": [ - { - "name": "index_name", - "in": "query", - "description": "Index identifier, matches (base) cryptocurrency with quote currency", - "required": true, - "schema": { - "$ref": "#/components/schemas/index_name" - } - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetIndexPriceResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_index_price", - "metadata": { - "keywords": [ - "public/get_index_price", - "index_name", - "index_price", - "estimated_delivery_price" - ], - "og:title": "public/get_index_price", - "title": "public/get_index_price" - } - } - } - }, - "/public/get_index_price_names": { - "get": { - "description": "Retrieves the identifiers (names) of all supported price indexes. Price indexes are reference prices used for mark price calculations, settlement, and other market operations.\n\nWhen the `extended` parameter is set to `true`, the response includes additional information such as whether future combo creation and option combo creation are enabled for each index.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_index_price_names)\n\n", - "parameters": [ - { - "name": "extended", - "in": "query", - "description": "When set to `true`, returns additional information including `future_combo_creation_enabled` and `option_combo_creation_enabled` for each index", - "required": false, - "schema": { - "type": "boolean", - "example": true, - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "public/get_index_price_names", - "params": { - "extended": true - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetIndexPriceNamesResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_index_price_names", - "metadata": { - "keywords": [ - "public/get_index_price_names", - "extended", - "name", - "future_combo_creation_enabled", - "option_combo_creation_enabled" - ], - "og:title": "public/get_index_price_names", - "title": "public/get_index_price_names" - } - } - } - }, - "/public/get_instrument": { - "get": { - "description": "Retrieves detailed information about a specific instrument, including instrument specifications, contract details, tick size, settlement currency, expiration date (for futures and options), strike price (for options), underlying type, and other instrument parameters.\n\nThis method is useful for obtaining instrument metadata needed for trading operations and calculations.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_instrument)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2, - "jsonrpc": "2.0", - "method": "public/get_instrument", - "params": { - "instrument_name": "BTC-13JAN23-16000-P" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetInstrumentResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_instrument", - "metadata": { - "keywords": [ - "public/get_instrument", - "instrument_name", - "kind", - "settlement_currency", - "counter_currency", - "base_currency", - "quote_currency", - "min_trade_amount", - "instrument_id", - "is_active", - "settlement_period", - "creation_timestamp", - "tick_size", - "tick_size_steps", - "expiration_timestamp", - "strike", - "option_type", - "future_type", - "instrument_type", - "contract_size", - "lot_size", - "maker_commission", - "taker_commission", - "max_liquidation_commission", - "block_trade_commission", - "block_trade_tick_size", - "block_trade_min_trade_amount", - "max_leverage", - "price_index", - "underlying_type", - "state", - "base_currency_uuid", - "quote_currency_uuid", - "qty_tick_size", - "index_id", - "product_group", - "is_csr", - "is_cbe_routed", - "above_price" - ], - "og:title": "public/get_instrument", - "title": "public/get_instrument" - } - } - } - }, - "/public/get_instruments": { - "get": { - "description": "Retrieves available trading instruments. This method can be used to see which instruments are available for trading, or which instruments have recently expired.\n\n**Note - This method has distinct API rate limiting requirements:** Sustained rate: 1 request/second. To avoid rate limits, we recommend using either the REST requests for server-cached data or the WebSocket subscription to [instrument_state.{kind}.{currency}](https://docs.deribit.com/api-reference/subscription-channels/instrument-state-kind-currency) for real-time updates. For more information, see [Rate Limits](https://support.deribit.com/hc/en-us/articles/25944617523357-Rate-Limits).\n\nResults can be filtered by currency and instrument kind (future, option, etc.). Set the `expired` parameter to `true` to retrieve recently expired instruments instead of active ones. Each instrument includes the `underlying_type` field indicating the underlying asset class (such as `crypto`, `equity`, or `commodity`).\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_instruments)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol or `\"any\"` for all", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency_with_any" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, if not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind" - } - }, - { - "name": "expired", - "in": "query", - "description": "Set to true to show recently expired instruments instead of active ones.", - "required": false, - "schema": { - "type": "boolean", - "default": false - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "public/get_instruments", - "params": { - "currency": "BTC", - "kind": "future" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetInstrumentsResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_instruments", - "metadata": { - "keywords": [ - "public/get_instruments", - "currency", - "kind", - "expired", - "settlement_currency", - "counter_currency", - "base_currency", - "quote_currency", - "min_trade_amount", - "instrument_name", - "instrument_id", - "is_active", - "settlement_period", - "creation_timestamp", - "tick_size", - "tick_size_steps", - "expiration_timestamp", - "strike", - "option_type", - "future_type", - "instrument_type", - "contract_size", - "lot_size", - "maker_commission", - "taker_commission", - "max_liquidation_commission", - "block_trade_commission", - "block_trade_tick_size", - "block_trade_min_trade_amount", - "max_leverage", - "price_index", - "underlying_type", - "state", - "base_currency_uuid", - "quote_currency_uuid", - "qty_tick_size", - "index_id", - "product_group", - "is_csr", - "is_cbe_routed", - "above_price" - ], - "og:title": "public/get_instruments", - "title": "public/get_instruments" - } - } - } - }, - "/public/get_last_settlements_by_currency": { - "get": { - "description": "Retrieves historical settlement, delivery, and bankruptcy events from all instruments within a given currency.\n\n**Settlement vs. delivery:** Settlement is a daily event (at 08:00 UTC) for futures and perpetual positions that converts unrealized profit and loss into realized profit and loss. Option positions do not settle. Delivery is a one-time event that occurs when a futures or options contract expires — any remaining open position is closed at the delivery price. Delivery does not apply to perpetual or spot instruments. Both events take place at 08:00 UTC, which is why they are sometimes conflated.\n\nResults can be filtered by settlement type and timestamp. Use pagination parameters (`count` and `continuation`) to retrieve large settlement histories. This data is useful for analyzing historical contract settlements and understanding market events.\n\n**Note on `profit_loss` and `session_profit_loss`:** Because this is a public endpoint, these fields are **platform-wide aggregates**, not per-account values. `profit_loss` is the sum of realized P&L of all position holders at the settlement price. `session_profit_loss` is the sum of each holder's total session P&L (realized + unrealized) across all participants.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_last_settlements_by_currency)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "type", - "in": "query", - "description": "Settlement type", - "required": false, - "schema": { - "$ref": "#/components/schemas/settlement_type" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `20`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "continuation", - "in": "query", - "description": "Continuation token for pagination", - "required": false, - "schema": { - "type": "string", - "example": "xY7T6cutS3t2B9YtaDkE6TS379oKnkzTvmEDUnEUP2Msa9xKWNNaT" - } - }, - { - "name": "search_start_timestamp", - "in": "query", - "description": "The latest timestamp to return result from (milliseconds since the UNIX epoch)", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 4497, - "jsonrpc": "2.0", - "method": "public/get_last_settlements_by_currency", - "params": { - "count": 2, - "currency": "BTC", - "type": "delivery" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicSettlementResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_last_settlements_by_currency", - "metadata": { - "keywords": [ - "public/get_last_settlements_by_currency", - "currency", - "type", - "count", - "continuation", - "search_start_timestamp", - "settlements", - "funding", - "funded", - "index_price", - "instrument_name", - "mark_price", - "position", - "profit_loss", - "session_bankruptcy", - "session_profit_loss", - "session_tax", - "session_tax_rate", - "socialized", - "timestamp" - ], - "og:title": "public/get_last_settlements_by_currency", - "title": "public/get_last_settlements_by_currency" - } - } - } - }, - "/public/get_last_settlements_by_instrument": { - "get": { - "description": "Retrieves historical settlement, delivery, and bankruptcy events for a specific instrument.\n\n**Settlement vs. delivery:** Settlement is a daily event (at 08:00 UTC) for futures and perpetual positions that converts unrealized profit and loss into realized profit and loss. Option positions do not settle. Delivery is a one-time event that occurs when a futures or options contract expires — any remaining open position is closed at the delivery price. Delivery does not apply to perpetual or spot instruments. Both events take place at 08:00 UTC, which is why they are sometimes conflated.\n\nResults can be filtered by settlement type and timestamp. Use pagination parameters (`count` and `continuation`) to retrieve large settlement histories. This method is useful for tracking settlement history for a specific instrument.\n\n**Note on `profit_loss` and `session_profit_loss`:** Because this is a public endpoint, these fields are **platform-wide aggregates**, not per-account values. `profit_loss` is the sum of realized P&L of all position holders at the settlement price. `session_profit_loss` is the sum of each holder's total session P&L (realized + unrealized) across all participants.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_last_settlements_by_instrument)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "type", - "in": "query", - "description": "Settlement type", - "required": false, - "schema": { - "$ref": "#/components/schemas/settlement_type" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `20`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "continuation", - "in": "query", - "description": "Continuation token for pagination", - "required": false, - "schema": { - "type": "string", - "example": "xY7T6cutS3t2B9YtaDkE6TS379oKnkzTvmEDUnEUP2Msa9xKWNNaT" - } - }, - { - "name": "search_start_timestamp", - "in": "query", - "description": "The latest timestamp to return result from (milliseconds since the UNIX epoch)", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 5482, - "jsonrpc": "2.0", - "method": "public/get_last_settlements_by_instrument", - "params": { - "count": 1, - "instrument_name": "BTC-22FEB19", - "type": "settlement" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicSettlementResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_last_settlements_by_instrument", - "metadata": { - "keywords": [ - "public/get_last_settlements_by_instrument", - "instrument_name", - "type", - "count", - "continuation", - "search_start_timestamp", - "settlements", - "funding", - "funded", - "index_price", - "mark_price", - "position", - "profit_loss", - "session_bankruptcy", - "session_profit_loss", - "session_tax", - "session_tax_rate", - "socialized", - "timestamp" - ], - "og:title": "public/get_last_settlements_by_instrument", - "title": "public/get_last_settlements_by_instrument" - } - } - } - }, - "/public/get_last_trades_by_currency": { - "get": { - "description": "Retrieves the latest trades that have occurred for instruments in a specific currency. Returns trade details including price, amount, direction, timestamp, and trade ID for all instruments in the currency.\n\nResults can be filtered by instrument kind and trade ID range or timestamp range. Use the `count` parameter to limit the number of trades returned, and `sorting` to control the order (ascending or descending by trade ID).\n\n**Note:** For currencies with spot instruments routed to Coinbase Exchange, this call is not supported when `kind` is `spot` or `any` — and `any` is the default when `kind` is omitted. A currency counts as routed when it is the base or the quote of a routed pair. Other kinds are unaffected. Use [Get product trades](https://docs.cdp.coinbase.com/api-reference/exchange-api/rest-api/products/get-product-trades) directly for full trade history by instrument.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_last_trades_by_currency)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, `\"combo\"` for any combo or `\"any\"` for all. If not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind_with_combo_all" - } - }, - { - "name": "start_id", - "in": "query", - "description": "The ID of the first trade to be returned. Number for BTC trades, or hyphen name in ex. `\"ETH-15\"` # `\"ETH_USDC-16\"`", - "required": false, - "schema": { - "$ref": "#/components/schemas/trade_id" - } - }, - { - "name": "end_id", - "in": "query", - "description": "The ID of the last trade to be returned. Number for BTC trades, or hyphen name in ex. `\"ETH-15\"` # `\"ETH_USDC-16\"`", - "required": false, - "schema": { - "$ref": "#/components/schemas/trade_id" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch). When param is provided trades are returned from the earliest", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch). Only one of params: start_timestamp, end_timestamp is truly required", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `10`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "sorting", - "in": "query", - "description": "Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)", - "required": false, - "schema": { - "$ref": "#/components/schemas/sorting" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 9290, - "jsonrpc": "2.0", - "method": "public/get_last_trades_by_currency", - "params": { - "count": 3, - "currency": "BTC" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicTradesHistoryResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_last_trades_by_currency", - "metadata": { - "keywords": [ - "public/get_last_trades_by_currency", - "currency", - "kind", - "start_id", - "end_id", - "start_timestamp", - "end_timestamp", - "count", - "sorting", - "trades", - "has_more", - "trade_id", - "trade_seq", - "instrument_name", - "timestamp", - "starbase_timestamp", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "contracts", - "iv", - "liquidation", - "mark_price", - "block_trade_id", - "block_trade_leg_count", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "block_rfq_id" - ], - "og:title": "public/get_last_trades_by_currency", - "title": "public/get_last_trades_by_currency" - } - } - } - }, - "/public/get_last_trades_by_currency_and_time": { - "get": { - "description": "Retrieves the latest trades that have occurred for instruments in a specific currency within a specified time range. Returns trade details including price, amount, direction, timestamp, and trade ID.\n\nResults can be filtered by instrument kind. Use the `count` parameter to limit the number of trades returned, and `sorting` to control the order (ascending or descending by trade ID).\n\n**Note:** For currencies with spot instruments routed to Coinbase Exchange, this call is not supported when `kind` is `spot` or `any` — and `any` is the default when `kind` is omitted. A currency counts as routed when it is the base or the quote of a routed pair. Other kinds are unaffected. Use [Get product trades](https://docs.cdp.coinbase.com/api-reference/exchange-api/rest-api/products/get-product-trades) directly for full trade history by instrument.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_last_trades_by_currency_and_time)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind, `\"combo\"` for any combo or `\"any\"` for all. If not provided instruments of all kinds are considered", - "required": false, - "schema": { - "$ref": "#/components/schemas/kind_with_combo_all" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch). When param is provided trades are returned from the earliest", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch). Only one of params: start_timestamp, end_timestamp is truly required", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `10`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "sorting", - "in": "query", - "description": "Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)", - "required": false, - "schema": { - "$ref": "#/components/schemas/sorting" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1469, - "jsonrpc": "2.0", - "method": "public/get_last_trades_by_currency_and_time", - "params": { - "count": 1, - "currency": "BTC", - "end_timestamp": 1590480022768, - "start_timestamp": 1590470022768 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicTradesHistoryResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_last_trades_by_currency_and_time", - "metadata": { - "keywords": [ - "public/get_last_trades_by_currency_and_time", - "currency", - "kind", - "start_timestamp", - "end_timestamp", - "count", - "sorting", - "trades", - "has_more", - "trade_id", - "trade_seq", - "instrument_name", - "timestamp", - "starbase_timestamp", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "contracts", - "iv", - "liquidation", - "mark_price", - "block_trade_id", - "block_trade_leg_count", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "block_rfq_id" - ], - "og:title": "public/get_last_trades_by_currency_and_time", - "title": "public/get_last_trades_by_currency_and_time" - } - } - } - }, - "/public/get_last_trades_by_instrument": { - "get": { - "description": "Retrieves the latest trades that have occurred for a specific instrument. Returns trade details including price, amount, direction, timestamp, and trade ID.\n\nResults can be filtered by sequence number range or timestamp range. Use the `count` parameter to limit the number of trades returned, and `sorting` to control the order (ascending or descending by trade ID).\n\n**Note:** For spot instruments routed to Coinbase Exchange, this call is not supported. Use [Get product trades](https://docs.cdp.coinbase.com/api-reference/exchange-api/rest-api/products/get-product-trades) directly for full trade history.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_last_trades_by_instrument)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "start_seq", - "in": "query", - "description": "The sequence number of the first trade to be returned", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "end_seq", - "in": "query", - "description": "The sequence number of the last trade to be returned", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch). When param is provided trades are returned from the earliest", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch). Only one of params: start_timestamp, end_timestamp is truly required", - "required": false, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `10`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "sorting", - "in": "query", - "description": "Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)", - "required": false, - "schema": { - "$ref": "#/components/schemas/sorting" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 9267, - "jsonrpc": "2.0", - "method": "public/get_last_trades_by_instrument", - "params": { - "count": 1, - "instrument_name": "BTC-PERPETUAL" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicTradesHistoryResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_last_trades_by_instrument", - "metadata": { - "keywords": [ - "public/get_last_trades_by_instrument", - "instrument_name", - "start_seq", - "end_seq", - "start_timestamp", - "end_timestamp", - "count", - "sorting", - "trades", - "has_more", - "trade_id", - "trade_seq", - "timestamp", - "starbase_timestamp", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "contracts", - "iv", - "liquidation", - "mark_price", - "block_trade_id", - "block_trade_leg_count", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "block_rfq_id" - ], - "og:title": "public/get_last_trades_by_instrument", - "title": "public/get_last_trades_by_instrument" - } - } - } - }, - "/public/get_last_trades_by_instrument_and_time": { - "get": { - "description": "Retrieves the latest trades that have occurred for a specific instrument within a specified time range. Returns trade details including price, amount, direction, timestamp, and trade ID.\n\nUse the `count` parameter to limit the number of trades returned, and `sorting` to control the order (ascending or descending by trade ID). This method is useful for analyzing trading activity over specific time periods.\n\n**Note:** For spot instruments routed to Coinbase Exchange, this call is not supported. Use [Get product trades](https://docs.cdp.coinbase.com/api-reference/exchange-api/rest-api/products/get-product-trades) directly for full trade history.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_last_trades_by_instrument_and_time)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch). When param is provided trades are returned from the earliest", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch). Only one of params: start_timestamp, end_timestamp is truly required", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "count", - "in": "query", - "description": "Number of requested items, default - `10`, maximum - `1000`", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1 - } - }, - { - "name": "sorting", - "in": "query", - "description": "Direction of results sorting (`default` value means no sorting, results will be returned in order in which they left the database)", - "required": false, - "schema": { - "$ref": "#/components/schemas/sorting" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 3983, - "jsonrpc": "2.0", - "method": "public/get_last_trades_by_instrument_and_time", - "params": { - "count": 1, - "end_timestamp": 1590480022768, - "instrument_name": "ETH-PERPETUAL" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicTradesHistoryResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_last_trades_by_instrument_and_time", - "metadata": { - "keywords": [ - "public/get_last_trades_by_instrument_and_time", - "instrument_name", - "start_timestamp", - "end_timestamp", - "count", - "sorting", - "trades", - "has_more", - "trade_id", - "trade_seq", - "timestamp", - "starbase_timestamp", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "contracts", - "iv", - "liquidation", - "mark_price", - "block_trade_id", - "block_trade_leg_count", - "combo_id", - "combo_trade_id", - "starbase_match_id", - "block_rfq_id" - ], - "og:title": "public/get_last_trades_by_instrument_and_time", - "title": "public/get_last_trades_by_instrument_and_time" - } - } - } - }, - "/public/get_mark_price_history": { - "get": { - "description": "Retrieves 5-minute historical mark price data for an instrument. Mark prices are used for margin calculations and position valuations.\n\n**Note:** Currently, mark price history is available only for a subset of options that participate in volatility index calculations. All other instruments, including futures and perpetuals, will return an empty list.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_mark_price_history)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "public/get_mark_price_history", - "params": { - "end_timestamp": 1609376810000, - "instrument_name": "BTC-25JUN21-50000-C", - "start_timestamp": 1609376800000 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetMarkPriceHistoryResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Mark Price", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_mark_price_history", - "metadata": { - "keywords": [ - "public/get_mark_price_history", - "instrument_name", - "start_timestamp", - "end_timestamp" - ], - "og:title": "public/get_mark_price_history", - "title": "public/get_mark_price_history" - } - } - } - }, - "/public/get_order_book": { - "get": { - "description": "Retrieves the order book (bids and asks) for a given instrument, along with other market values such as best bid/ask prices, last trade price, mark price, and index price.\n\nThe order book depth can be controlled using the `depth` parameter, which accepts values from 1 to 10000. The response includes price levels sorted by price (bids descending, asks ascending).\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_order_book)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "The instrument name for which to retrieve the order book, see [`public/get_instruments`](#public-get_instruments) to obtain instrument names.", - "required": true, - "schema": { - "type": "string", - "example": "BTC-PERPETUAL" - } - }, - { - "name": "depth", - "in": "query", - "description": "The number of entries to return for bids and asks, maximum - `10000`.", - "required": false, - "schema": { - "type": "integer", - "example": 5, - "enum": [ - 1, - 5, - 10, - 20, - 50, - 100, - 1000, - 10000 - ] - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 8772, - "jsonrpc": "2.0", - "method": "public/get_order_book", - "params": { - "depth": 5, - "instrument_name": "BTC-PERPETUAL" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetOrderBookResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_order_book", - "metadata": { - "keywords": [ - "public/get_order_book", - "instrument_name", - "depth", - "timestamp", - "state", - "stats", - "open_interest", - "best_bid_price", - "best_bid_amount", - "best_ask_price", - "best_ask_amount", - "index_price", - "min_price", - "max_price", - "mark_price", - "last_price", - "underlying_price", - "underlying_index", - "interest_rate", - "bid_iv", - "ask_iv", - "mark_iv", - "greeks", - "funding_8h", - "current_funding", - "delivery_price", - "settlement_price", - "bids", - "asks", - "volume", - "low", - "high", - "price_change", - "volume_usd", - "delta", - "gamma", - "rho", - "theta", - "vega" - ], - "og:title": "public/get_order_book", - "title": "public/get_order_book" - } - } - } - }, - "/public/get_order_book_by_instrument_id": { - "get": { - "description": "Retrieves the order book (bids and asks) for a given instrument ID, along with other market values such as best bid/ask prices, last trade price, mark price, and index price.\n\nThis method is similar to `get_order_book` but uses instrument ID instead of instrument name. The order book depth can be controlled using the `depth` parameter, which accepts values from 1 to 10000.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_order_book_by_instrument_id)\n\n", - "parameters": [ - { - "name": "instrument_id", - "in": "query", - "description": "The instrument ID for which to retrieve the order book, see [`public/get_instruments`](#public-get_instruments) to obtain instrument IDs.", - "required": true, - "schema": { - "type": "integer" - } - }, - { - "name": "depth", - "in": "query", - "description": "The number of entries to return for bids and asks, maximum - `10000`.", - "required": false, - "schema": { - "type": "integer", - "enum": [ - 1, - 5, - 10, - 20, - 50, - 100, - 1000, - 10000 - ] - } - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetOrderBookResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_order_book_by_instrument_id", - "metadata": { - "keywords": [ - "public/get_order_book_by_instrument_id", - "instrument_id", - "depth", - "instrument_name", - "timestamp", - "state", - "stats", - "open_interest", - "best_bid_price", - "best_bid_amount", - "best_ask_price", - "best_ask_amount", - "index_price", - "min_price", - "max_price", - "mark_price", - "last_price", - "underlying_price", - "underlying_index", - "interest_rate", - "bid_iv", - "ask_iv", - "mark_iv", - "greeks", - "funding_8h", - "current_funding", - "delivery_price", - "settlement_price", - "bids", - "asks", - "volume", - "low", - "high", - "price_change", - "volume_usd", - "delta", - "gamma", - "rho", - "theta", - "vega" - ], - "og:title": "public/get_order_book_by_instrument_id", - "title": "public/get_order_book_by_instrument_id" - } - } - } - }, - "/public/get_supported_index_names": { - "get": { - "description": "Retrieves the identifiers (names) of all supported price indexes, optionally filtered by index type. Price indexes are reference prices used for mark price calculations, settlement, and other market operations.\n\nUse the `type` parameter to filter indexes by type (e.g., spot, futures, etc.). This method helps discover available indexes for use with other API methods.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_supported_index_names)\n\n", - "parameters": [ - { - "name": "type", - "in": "query", - "description": "Type of a cryptocurrency price index", - "required": false, - "schema": { - "type": "string", - "enum": [ - "all", - "spot", - "derivative" - ] - } - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetIndexPriceNamesResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_supported_index_names", - "metadata": { - "keywords": [ - "public/get_supported_index_names", - "type", - "name", - "future_combo_creation_enabled", - "option_combo_creation_enabled" - ], - "og:title": "public/get_supported_index_names", - "title": "public/get_supported_index_names" - } - } - } - }, - "/public/get_time": { - "get": { - "description": "Retrieves the current time (in milliseconds). This API endpoint can be used to check the clock skew between your software and Deribit's systems.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_time)\n\n", - "parameters": [], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 7365, - "jsonrpc": "2.0", - "method": "public/get_time", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetTimeResponse" - } - }, - "security": [], - "tags": [ - "Supporting", - "Public" - ], - "x-mint": { - "href": "/api-reference/supporting/public-get_time", - "metadata": { - "keywords": [ - "public/get_time" - ], - "og:title": "public/get_time", - "title": "public/get_time" - } - } - } - }, - "/public/get_trade_volumes": { - "get": { - "description": "Retrieves aggregated 24-hour trade volumes for different instrument types and currencies. The volume statistics include all executed trades across the platform.\n\n**Note:** Position moves are not included in this volume. Block trades and Block RFQ trades are included in the volume calculations.\n\nUse the `extended` parameter to include additional volume statistics and breakdowns.\n\n**Note:** For currencies with spot instruments routed to Coinbase Exchange, `spot_volume` is omitted, as are `spot_volume_7d` and `spot_volume_30d` when `extended` is used. Use [Get all product volume](https://docs.cdp.coinbase.com/api-reference/exchange-api/rest-api/products/get-all-product-volume) for venue spot volume.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_trade_volumes)\n\n", - "parameters": [ - { - "name": "extended", - "in": "query", - "description": "Request for extended statistics. Including also 7 and 30 days volumes (default false)", - "required": false, - "schema": { - "type": "boolean" - } - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetTradesVolumesResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_trade_volumes", - "metadata": { - "keywords": [ - "public/get_trade_volumes", - "extended", - "currency", - "calls_volume", - "puts_volume", - "futures_volume", - "spot_volume", - "calls_volume_7d", - "puts_volume_7d", - "futures_volume_7d", - "spot_volume_7d", - "calls_volume_30d", - "puts_volume_30d", - "futures_volume_30d", - "spot_volume_30d" - ], - "og:title": "public/get_trade_volumes", - "title": "public/get_trade_volumes" - } - } - } - }, - "/public/get_tradingview_chart_data": { - "get": { - "description": "Retrieves publicly available market data formatted for generating TradingView-compatible candle charts. The data includes open, high, low, close (OHLC) prices and volume for specified time intervals.\n\nUse the `chart_resolution` parameter to specify the candle interval (e.g., 1m, 5m, 1h, 1d). This method provides the standard format used by TradingView and other charting platforms.\n\n**Note:** For spot instruments routed to Coinbase Exchange, this call is not supported. Use [Get product candles](https://docs.cdp.coinbase.com/api-reference/exchange-api/rest-api/products/get-product-candles) instead.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_tradingview_chart_data)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "resolution", - "in": "query", - "description": "Chart bars resolution given in full minutes or keyword `1D` (only some specific resolutions are supported)", - "required": true, - "schema": { - "type": "string", - "enum": [ - 1, - 3, - 5, - 10, - 15, - 30, - 60, - 120, - 180, - 360, - 720, - "1D" - ] - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 833, - "jsonrpc": "2.0", - "method": "public/get_tradingview_chart_data", - "params": { - "end_timestamp": 1554376800000, - "instrument_name": "BTC-5APR19", - "resolution": "30", - "start_timestamp": 1554373800000 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetTradingviewChartDataResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_tradingview_chart_data", - "metadata": { - "keywords": [ - "public/get_tradingview_chart_data", - "instrument_name", - "start_timestamp", - "end_timestamp", - "resolution", - "status", - "ticks", - "volume", - "cost", - "open", - "close", - "high", - "low" - ], - "og:title": "public/get_tradingview_chart_data", - "title": "public/get_tradingview_chart_data" - } - } - } - }, - "/public/get_volatility_index_data": { - "get": { - "description": "Retrieves volatility index (VIX) chart data formatted as candles. Volatility indexes measure market expectations of future volatility and are useful for risk assessment and trading strategies.\n\nUse the `vix_resolution` parameter to specify the candle interval. The data shows historical volatility index values over time and is formatted for use in charting applications.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fget_volatility_index_data)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": "The earliest timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": "The most recent timestamp to return result from (milliseconds since the UNIX epoch)", - "required": true, - "schema": { - "$ref": "#/components/schemas/timestamp" - } - }, - { - "name": "resolution", - "in": "query", - "description": "Time resolution given in full seconds or keyword `1D` (only some specific resolutions are supported)", - "required": true, - "schema": { - "type": "string", - "enum": [ - 1, - 60, - 3600, - 43200, - "1D" - ] - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 833, - "jsonrpc": "2.0", - "method": "public/get_volatility_index_data", - "params": { - "currency": "BTC", - "end_timestamp": 1599376800000, - "resolution": "60", - "start_timestamp": 1599373800000 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicGetVolatilityIndexDataResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-get_volatility_index_data", - "metadata": { - "keywords": [ - "public/get_volatility_index_data", - "currency", - "start_timestamp", - "end_timestamp", - "resolution", - "data", - "continuation" - ], - "og:title": "public/get_volatility_index_data", - "title": "public/get_volatility_index_data" - } - } - } - }, - "/public/hello": { - "get": { - "description": "Method used to introduce the client software connected to Deribit platform over websocket. Provided data may have an impact on the maintained connection and will be collected for internal statistical purposes. In response, Deribit will also introduce itself.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fhello)\n\n", - "parameters": [ - { - "name": "client_name", - "in": "query", - "description": "Client software name", - "required": true, - "schema": { - "type": "string", - "example": "My Trading Software" - } - }, - { - "name": "client_version", - "in": "query", - "description": "Client software version", - "required": true, - "schema": { - "type": "string", - "example": "1.0.2" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 2841, - "jsonrpc": "2.0", - "method": "public/hello", - "params": { - "client_name": "My Trading Software", - "client_version": "1.0.2" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicTestResponse" - } - }, - "security": [], - "tags": [ - "Supporting", - "Public", - "WebSocket Only" - ], - "x-mint": { - "href": "/api-reference/supporting/public-hello", - "metadata": { - "keywords": [ - "public/hello", - "client_name", - "client_version", - "version" - ], - "og:title": "public/hello", - "title": "public/hello" - } - } - } - }, - "/public/set_heartbeat": { - "get": { - "description": "Signals the WebSocket connection to send and request heartbeats. Heartbeats can be used to detect stale connections.\n\nWhen heartbeats have been set up, the API server will send `heartbeat` messages and `test_request` messages. Your software should respond to `test_request` messages by sending a `/api/v2/public/test` request. If your software fails to do so, the API server will immediately close the connection. If your account is configured to cancel on disconnect, any orders opened over the connection will be cancelled.\n\n**WebSocket Only:** This method is designed exclusively for WebSocket connections. Attempting to use it via REST/HTTP will result in an error response.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fset_heartbeat)\n\n", - "parameters": [ - { - "name": "interval", - "in": "query", - "description": "The heartbeat interval in seconds, but not less than 10", - "required": true, - "schema": { - "type": "number", - "example": 30 - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 9098, - "jsonrpc": "2.0", - "method": "public/set_heartbeat", - "params": { - "interval": 30 - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/OkResponse" - } - }, - "security": [], - "tags": [ - "Session Management", - "Public", - "WebSocket Only" - ], - "x-mint": { - "href": "/api-reference/session-management/public-set_heartbeat", - "metadata": { - "keywords": [ - "public/set_heartbeat", - "interval" - ], - "og:title": "public/set_heartbeat", - "title": "public/set_heartbeat" - } - } - } - }, - "/public/status": { - "get": { - "description": "Method used to get information about locked currencies\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fstatus)\n\n", - "parameters": [], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 55, - "jsonrpc": "2.0", - "method": "public/status", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicStatusResponse" - } - }, - "security": [], - "tags": [ - "Supporting", - "Public" - ], - "x-mint": { - "href": "/api-reference/supporting/public-status", - "metadata": { - "keywords": [ - "public/status", - "locked", - "locked_indices" - ], - "og:title": "public/status", - "title": "public/status" - } - } - } - }, - "/public/subscribe": { - "get": { - "description": "Subscribe to one or more channels. This is the same method as `/private/subscribe`, but it can only be used for 'public' channels.\n\nFor a complete list of available subscription channels and their notification formats, see [Notifications and Subscriptions](https://docs.deribit.com/articles/notifications).\n\n**Note - This method has distinct API rate limiting requirements:** Sustained rate: ~3.3 requests/second. For more information, see [Rate Limits](https://docs.deribit.com/articles/rate-limits).\n\n**📖 Related Article:** [Market Data Collection Best Practices](https://docs.deribit.com/articles/market-data-collection-best-practices)\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fsubscribe)\n\n", - "parameters": [ - { - "name": "channels", - "in": "query", - "description": "A list of channels to subscribe to. See [Notifications and Subscriptions](https://docs.deribit.com/articles/notifications) for all available channels.", - "required": true, - "schema": { - "type": "array", - "items": { - "example": "deribit_price_index.btc_usd", - "type": "string" - }, - "example": [ - "deribit_price_index.btc_usd" - ] - }, - "explode": true, - "style": "form" - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 3600, - "jsonrpc": "2.0", - "method": "public/subscribe", - "params": { - "channels": [ - "deribit_price_index.btc_usd" - ] - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PrivateSubscribeResponse" - }, - "401": { - "$ref": "#/components/responses/ErrorMessageResponse" - } - }, - "security": [], - "tags": [ - "Subscription Management", - "Public", - "WebSocket Only" - ], - "x-mint": { - "href": "/api-reference/subscription-management/public-subscribe", - "metadata": { - "keywords": [ - "public/subscribe", - "channels" - ], - "og:title": "public/subscribe", - "title": "public/subscribe" - } - } - } - }, - "/public/test": { - "get": { - "description": "Tests the connection to the API server, and returns its version. You can use this to make sure the API is reachable, and matches the expected version.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Ftest)\n\n", - "parameters": [ - { - "name": "expected_result", - "in": "query", - "description": "The value \"exception\" will trigger an error response. This may be useful for testing wrapper libraries.", - "required": false, - "schema": { - "type": "string", - "enum": [ - "exception" - ] - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 8212, - "jsonrpc": "2.0", - "method": "public/test", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicTestResponse" - } - }, - "security": [], - "tags": [ - "Supporting", - "Public" - ], - "x-mint": { - "href": "/api-reference/supporting/public-test", - "metadata": { - "keywords": [ - "public/test", - "expected_result", - "version" - ], - "og:title": "public/test", - "title": "public/test" - } - } - } - }, - "/public/ticker": { - "get": { - "description": "Retrieves the ticker (24-hour statistics) for a specific instrument. The ticker includes the last trade price, best bid/ask prices, 24-hour high/low, 24-hour volume, open interest, mark price, and other market statistics.\n\nThis is a lightweight method for getting current market data for a single instrument. For real-time updates, consider using WebSocket subscriptions to ticker channels.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Fticker)\n\n", - "parameters": [ - { - "name": "instrument_name", - "in": "query", - "description": "Instrument name", - "required": true, - "schema": { - "$ref": "#/components/schemas/instrument_name" - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 8106, - "jsonrpc": "2.0", - "method": "public/ticker", - "params": { - "instrument_name": "BTC-PERPETUAL" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicTickerResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-ticker", - "metadata": { - "keywords": [ - "public/ticker", - "instrument_name", - "timestamp", - "state", - "stats", - "open_interest", - "best_bid_price", - "best_bid_amount", - "best_ask_price", - "best_ask_amount", - "index_price", - "min_price", - "max_price", - "mark_price", - "last_price", - "underlying_price", - "underlying_index", - "interest_rate", - "bid_iv", - "ask_iv", - "mark_iv", - "greeks", - "funding_8h", - "current_funding", - "interest_value", - "delivery_price", - "settlement_price", - "estimated_delivery_price", - "is_anchor_breached", - "anchor_min_price", - "anchor_max_price", - "volume", - "low", - "high", - "price_change", - "volume_usd", - "delta", - "gamma", - "rho", - "theta", - "vega" - ], - "og:title": "public/ticker", - "title": "public/ticker" - } - } - } - }, - "/public/tickers_by_currency": { - "get": { - "description": "Retrieves tickers (24-hour statistics) for all open instruments of a given currency.\n\nOptionally filter by instrument kind (future, option, spot) and specify orderbook depth (1, 3, or 10).\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Ftickers_by_currency)\n\n", - "parameters": [ - { - "name": "currency", - "in": "query", - "description": "The currency symbol", - "required": true, - "schema": { - "$ref": "#/components/schemas/currency" - } - }, - { - "name": "kind", - "in": "query", - "description": "Instrument kind filter. Pass a single value or repeat `kind[]` to filter by multiple kinds.", - "required": false, - "schema": { - "default": "any", - "oneOf": [ - { - "$ref": "#/components/schemas/kind" - }, - { - "enum": [ - "any" - ], - "type": "string" - }, - { - "items": { - "$ref": "#/components/schemas/kind" - }, - "type": "array" - } - ] - }, - "explode": true, - "style": "form" - }, - { - "name": "depth", - "in": "query", - "description": "Orderbook depth to include in the ticker response.", - "required": false, - "schema": { - "type": "integer", - "default": 1, - "enum": [ - 1, - 3, - 10 - ] - } - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "method": "public/tickers_by_currency", - "params": { - "currency": "BTC", - "kind": "future" - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/PublicTickersByCurrencyResponse" - } - }, - "security": [], - "tags": [ - "Market Data", - "Public" - ], - "x-mint": { - "href": "/api-reference/market-data/public-tickers_by_currency", - "metadata": { - "keywords": [ - "public/tickers_by_currency", - "currency", - "kind", - "depth" - ], - "og:title": "public/tickers_by_currency", - "title": "public/tickers_by_currency" - } - } - } - }, - "/public/unsubscribe": { - "get": { - "description": "Unsubscribe from one or more channels. The response contains only the channels that were successfully unsubscribed in this request.\n\nFor a complete list of available subscription channels and their notification formats, see [Notifications and Subscriptions](https://docs.deribit.com/articles/notifications).\n\n**Note:** The `result` field in the response contains only the channels that were successfully processed and unsubscribed from this specific request. It does not include all previously subscribed topics. If a channel in the request is invalid, not subscribed, or fails validation, it will not appear in the result.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Funsubscribe)\n\n", - "parameters": [ - { - "name": "channels", - "in": "query", - "description": "A list of channels to unsubscribe from. Only successfully unsubscribed channels will be returned in the result. See [Notifications and Subscriptions](https://docs.deribit.com/articles/notifications) for all available channels.", - "required": true, - "schema": { - "type": "array", - "items": { - "example": "deribit_price_index.btc_usd", - "type": "string" - }, - "example": [ - "deribit_price_index.btc_usd" - ] - }, - "explode": true, - "style": "form" - } - ], - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 8691, - "jsonrpc": "2.0", - "method": "public/unsubscribe", - "params": { - "channels": [ - "deribit_price_index.btc_usd" - ] - } - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/Getunsubscribe200response" - }, - "401": { - "$ref": "#/components/responses/ErrorMessageResponse" - } - }, - "security": [], - "tags": [ - "Subscription Management", - "Public", - "WebSocket Only" - ], - "x-mint": { - "href": "/api-reference/subscription-management/public-unsubscribe", - "metadata": { - "keywords": [ - "public/unsubscribe", - "channels" - ], - "og:title": "public/unsubscribe", - "title": "public/unsubscribe" - } - } - } - }, - "/public/unsubscribe_all": { - "get": { - "description": "Unsubscribe from all the channels subscribed so far. This method takes no parameters.\n\n[Try in API console](https://test.deribit.com/api_console?method=%2Fpublic%2Funsubscribe_all)\n\n", - "requestBody": { - "description": "JSON-RPC request body", - "content": { - "application/json": { - "examples": { - "request": { - "description": "JSON-RPC Request Example", - "value": { - "id": 153, - "jsonrpc": "2.0", - "method": "public/unsubscribe_all", - "params": {} - } - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/OkResponse" - } - }, - "security": [], - "tags": [ - "Subscription Management", - "WebSocket Only", - "Public" - ], - "x-mint": { - "href": "/api-reference/subscription-management/public-unsubscribe_all", - "metadata": { - "keywords": [ - "public/unsubscribe_all" - ], - "og:title": "public/unsubscribe_all", - "title": "public/unsubscribe_all" - } - } - } - } - }, - "components": { - "parameters": {}, - "schemas": { - "ErrorMessageResponse": { - "type": "object", - "properties": { - "error": { - "type": "integer" - }, - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "message": { - "type": "string" - } - }, - "required": [ - "message", - "error", - "jsonrpc" - ] - }, - "Getunsubscribe200response": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "example": 8691 - }, - "jsonrpc": { - "type": "string", - "example": "2.0" - }, - "result": { - "description": "List of channels that were successfully unsubscribed in this request", - "type": "array", - "items": { - "type": "string", - "x-deribit-type": "channel" - }, - "example": [ - "deribit_price_index.btc_usd" - ] - } - } - }, - "OkResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "Result of method execution. `ok` in case of success", - "type": "string", - "enum": [ - "ok" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateAccountResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "additional_reserve": { - "$ref": "#/components/schemas/additional_reserve" - }, - "affiliate_promotion_fee": { - "description": "Affiliate promotion fee (if greater than 0.0)", - "type": "number", - "example": 0 - }, - "available_funds": { - "description": "Funds available to increase margin usage (open or enlarge positions). Equal to `margin_balance - initial_margin`, floored at `0` in the API response. When initial margin usage exceeds 100%, this is `0` and only reducing orders can be placed. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 2.2638913 - }, - "available_withdrawal_funds": { - "description": "Funds available to withdraw in the selected currency. Typically lower than `available_funds` because withdrawals also exclude positive session profit, locked balance, `spot_reserve`, `additional_reserve`, and non-withdrawable external/implied equity components. Always ≥ `0`.", - "type": "number", - "example": 2.26 - }, - "balance": { - "description": "The account's cash balance in the selected currency (deposits, withdrawals, transfers, option premiums, settlements/deliveries, corrections, costs, and insurance refills). Does not include open futures PnL or options mark value.", - "type": "number", - "example": 3.4906363 - }, - "block_rfq_self_match_prevention": { - "description": "When enabled, Block RFQ self-match prevention stops RFQ execution between accounts under the same legal entity. Independent of general self-match prevention (available when parameter `extended` = `true`).", - "type": "boolean", - "example": false - }, - "close_out_margin": { - "$ref": "#/components/schemas/close_out_margin" - }, - "creation_timestamp": { - "description": "Time at which the account was created (milliseconds since the Unix epoch; available when parameter `extended` = `true`)", - "type": "integer", - "example": 1542100802842 - }, - "cross_collateral_enabled": { - "description": "When `true` cross collateral is enabled for user", - "type": "boolean", - "example": true - }, - "currency": { - "description": "The selected currency", - "type": "string", - "example": "ETH" - }, - "delta_total": { - "$ref": "#/components/schemas/delta_total" - }, - "delta_total_map": { - "$ref": "#/components/schemas/delta_total_map" - }, - "deposit_address": { - "description": "The deposit address for the account (if available)", - "type": "string", - "example": "14diAAyXL5UzhPTCKC998ch2GV7DMb7yDi" - }, - "email": { - "description": "User email (available when parameter `extended` = `true`)", - "type": "string", - "example": "support@deribit.com" - }, - "equity": { - "description": "The account's equity in the selected currency: `balance + futures (session UPL + RPL) + options mark value` (plus any external/implied equity). Related: `margin_balance` excludes options mark value under standard margin.", - "type": "number", - "example": 2.6437733 - }, - "fee_balance": { - "$ref": "#/components/schemas/fee_balance" - }, - "fee_group": { - "description": "Fee group indicates the level of fee discounts applied to an account. Use `extended`: `true` to view this field. If the field is missing, the account is not assigned to any fee group. **📖 Related Support Article:** [Automatically applied volume based fee discounts](https://support.deribit.com/hc/en-us/articles/25944746248989-Fees#heading-11)", - "type": "string" - }, - "fees": { - "description": "Fee structure for all currency pairs and instrument types related to the currency (available when parameter `extended` = `true` and user has any discounts). Keys are index names (e.g., \"btc_usd\"), values are objects with instrument types as keys (option, perpetual, future).", - "type": "object", - "additionalProperties": { - "additionalProperties": { - "properties": { - "block_trade": { - "description": "Block trade fee (if applicable)", - "type": "number" - }, - "default": { - "type": "object", - "properties": { - "maker": { - "description": "Maker fee", - "type": "number" - }, - "taker": { - "description": "Taker fee", - "type": "number" - }, - "type": { - "description": "Fee type - `relative` if fee is calculated as a fraction of base instrument fee, `fixed` if fee is calculated solely using user fee", - "type": "string" - } - }, - "required": [ - "type", - "taker", - "maker" - ] - } - }, - "required": [ - "default" - ], - "type": "object" - }, - "type": "object" - } - }, - "futures_pl": { - "description": "Combined profit and loss of all futures and perpetual positions included in `total_pl` (`total_pl - options_pl`).", - "type": "number", - "example": 0 - }, - "futures_session_rpl": { - "description": "Session realized profit and loss for futures and perpetual positions (resets at daily settlement).", - "type": "number", - "example": 0 - }, - "futures_session_upl": { - "description": "Session unrealized profit and loss for open futures and perpetual positions.", - "type": "number", - "example": 0 - }, - "has_non_block_chain_equity": { - "description": "Optional field returned with value `true` when user has non block chain equity that is excluded from proof of reserve calculations", - "type": "boolean" - }, - "id": { - "description": "Account id (available when parameter `extended` = `true`)", - "type": "integer", - "example": 12354 - }, - "initial_margin": { - "description": "Minimum margin required to open or increase positions (includes margin for open orders). If initial margin usage exceeds 100%, `available_funds` is `0`. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 0.379882 - }, - "interuser_transfers_enabled": { - "description": "`true` when the inter-user transfers are enabled for user (available when parameter `extended` = `true`)", - "type": "boolean", - "example": false - }, - "is_direct_access_allowed": { - "description": "Whether Direct Access trading is enabled for the account.", - "type": "boolean", - "example": false - }, - "limits": { - "$ref": "#/components/schemas/api_limits" - }, - "locked_balance": { - "$ref": "#/components/schemas/locked_balance" - }, - "login_enabled": { - "description": "Whether account is loginable using email and password (available when parameter `extended` = `true` and account is a subaccount)", - "type": "boolean", - "example": false - }, - "maintenance_margin": { - "description": "Minimum margin required to keep positions open. If `margin_balance` falls below maintenance margin, positions are liquidated. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 0.1334519 - }, - "margin_balance": { - "description": "Collateral available against margin requirements. Under standard margin (SM): `equity - options_value` (cash balance plus futures session UPL and RPL). Under portfolio margin (PM): equal to `equity` on a segregated account, and `equity - outstanding_loan_amount` on a cross account. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 2.25 - }, - "margin_model": { - "description": "Name of user's currently enabled margin model", - "type": "string", - "example": "segregated_sm" - }, - "mmp_enabled": { - "description": "Whether MMP is enabled (available when parameter `extended` = `true`)", - "type": "boolean", - "example": false - }, - "options_delta": { - "description": "Sum of the deltas of all options positions. For inverse (coin-margined) options this is the Black-Scholes delta; for linear options it is the index-price-adjusted delta. Unlike account-level `delta_total`, the options mark value is not subtracted.", - "type": "number", - "example": 0 - }, - "options_gamma": { - "description": "Sum of options position gammas (Black-Scholes).", - "type": "number", - "example": 0 - }, - "options_gamma_map": { - "description": "Map of options' gammas per index", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "options_pl": { - "description": "Combined profit and loss of all options positions included in `total_pl`.", - "type": "number", - "example": 0 - }, - "options_session_rpl": { - "description": "Session realized profit and loss for options positions (resets at daily settlement).", - "type": "number", - "example": 0 - }, - "options_session_upl": { - "description": "Session unrealized profit and loss for open options positions.", - "type": "number", - "example": 0 - }, - "options_theta": { - "description": "Sum of the thetas of all options positions. Theta is expressed per day; for options with less than one day left to expiry it is scaled down to the fraction of a day remaining.", - "type": "number", - "example": 0 - }, - "options_theta_map": { - "description": "Map of options' thetas per index", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "options_value": { - "description": "Mark value of all open options positions in the selected currency. Under standard margin, `margin_balance = equity - options_value`.", - "type": "number", - "example": 0 - }, - "options_vega": { - "description": "Sum of options position vegas (Black-Scholes).", - "type": "number", - "example": 0 - }, - "options_vega_map": { - "description": "Map of options' vegas per index", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "portfolio_margining_enabled": { - "description": "`true` when portfolio margining is enabled for user", - "type": "boolean", - "example": true - }, - "projected_close_out_margin": { - "$ref": "#/components/schemas/projected_close_out_margin" - }, - "projected_delta_total": { - "$ref": "#/components/schemas/projected_delta_total" - }, - "projected_initial_margin": { - "$ref": "#/components/schemas/projected_initial_margin" - }, - "projected_maintenance_margin": { - "$ref": "#/components/schemas/projected_maintenance_margin" - }, - "receive_notifications": { - "description": "Whether the account receives notifications", - "type": "boolean", - "example": false - }, - "referrer_id": { - "description": "Optional identifier of the referrer (of the affiliation program, and available when parameter `extended` = `true`), which link was used by this account at registration. It coincides with suffix of the affiliation link path after `/reg-`", - "type": "string", - "example": "517.6035" - }, - "security_keys_enabled": { - "description": "Whether Security Key authentication is enabled (available when parameter `extended` = `true`)", - "type": "boolean", - "example": false - }, - "self_trading_extended_to_subaccounts": { - "description": "`true` if self trading rejection behavior is applied to trades between subaccounts (available when parameter `extended` = `true`)", - "type": "string" - }, - "self_trading_reject_mode": { - "description": "Self trading rejection behavior - `reject_taker` or `cancel_maker` (available when parameter `extended` = `true`)", - "type": "string" - }, - "session_rpl": { - "$ref": "#/components/schemas/rpl" - }, - "session_upl": { - "$ref": "#/components/schemas/upl" - }, - "spot_reserve": { - "description": "The account's balance reserved in active spot orders", - "type": "number", - "example": 0.3 - }, - "system_name": { - "description": "System generated user nickname (available when parameter `extended` = `true`)", - "type": "string", - "example": "myname" - }, - "total_delta_total_usd": { - "description": "Optional (only for users using cross margin). The account's total delta total in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 1.8 - }, - "total_equity_usd": { - "description": "Optional (only for users using cross margin). The account's total equity in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 2.6437733 - }, - "total_initial_margin_usd": { - "description": "Optional (only for users using cross margin). The account's total initial margin in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 0.379882 - }, - "total_maintenance_margin_usd": { - "description": "Optional (only for users using cross margin). The account's total maintenance margin in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 0.1334519 - }, - "total_margin_balance_usd": { - "description": "Optional (only for users using cross margin). The account's total margin balance in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 2.25 - }, - "total_pl": { - "description": "Total profit and loss of all open positions since each position was opened (not limited to the current session). Differs from `session_rpl` + `session_upl`, which reset at daily settlement.", - "type": "number", - "example": 0.02032221 - }, - "trading_products_details": { - "description": "Which trading products are enabled or can be overwritten for the account", - "type": "object" - }, - "type": { - "description": "Account type (available when parameter `extended` = `true`)", - "type": "string", - "enum": [ - "main", - "subaccount" - ] - }, - "username": { - "description": "Account name (given by user) (available when parameter `extended` = `true`)", - "type": "string", - "example": "name" - } - }, - "required": [ - "equity", - "currency", - "maintenance_margin", - "initial_margin", - "available_funds", - "available_withdrawal_funds", - "balance", - "session_upl", - "session_rpl", - "total_pl", - "options_pl", - "options_session_upl", - "options_session_rpl", - "options_delta", - "options_gamma", - "options_vega", - "options_value", - "options_theta", - "futures_pl", - "options_gamma_map", - "options_theta_map", - "options_vega_map", - "futures_session_upl", - "futures_session_rpl", - "projected_maintenance_margin", - "delta_total", - "projected_delta_total", - "security_keys_enabled", - "system_name", - "username", - "email", - "type", - "id" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateAccountSummariesResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "affiliate_promotion_fee": { - "description": "Affiliate promotion fee (if greater than 0.0)", - "type": "number", - "example": 0 - }, - "block_rfq_self_match_prevention": { - "description": "When enabled, Block RFQ self-match prevention stops RFQ execution between accounts under the same legal entity. Independent of general self-match prevention (available when parameter `extended` = `true`).", - "type": "boolean", - "example": false - }, - "creation_timestamp": { - "description": "Time at which the account was created (milliseconds since the Unix epoch; available when parameter `extended` = `true`)", - "type": "integer", - "example": 1542100802842 - }, - "email": { - "description": "User email (available when parameter `extended` = `true`)", - "type": "string", - "example": "support@deribit.com" - }, - "id": { - "description": "Account id (available when parameter `extended` = `true`)", - "type": "integer", - "example": 12354 - }, - "interuser_transfers_enabled": { - "description": "`true` when the inter-user transfers are enabled for user (available when parameter `extended` = `true`)", - "type": "boolean", - "example": false - }, - "isolated_account_summaries": { - "description": "List of account summaries for active isolated-margin subaccounts, present only when `include_isolated=true`. Each entry includes the subaccount ID (`id`) and a nested `summaries` array containing per-currency account balances and risk metrics.", - "type": "array", - "items": { - "type": "object" - } - }, - "login_enabled": { - "description": "Whether account is loginable using email and password (available when parameter `extended` = `true` and account is a subaccount)", - "type": "boolean", - "example": false - }, - "mmp_enabled": { - "description": "Whether MMP is enabled (available when parameter `extended` = `true`)", - "type": "boolean", - "example": false - }, - "receive_notifications": { - "description": "Whether the account receives notifications", - "type": "boolean", - "example": false - }, - "referrer_id": { - "description": "Optional identifier of the referrer (of the affiliation program, and available when parameter `extended` = `true`), which link was used by this account at registration. It coincides with suffix of the affiliation link path after `/reg-`", - "type": "string", - "example": "517.6035" - }, - "security_keys_enabled": { - "description": "Whether Security Key authentication is enabled (available when parameter `extended` = `true`)", - "type": "boolean", - "example": false - }, - "self_trading_extended_to_subaccounts": { - "description": "`true` if self trading rejection behavior is applied to trades between subaccounts (available when parameter `extended` = `true`)", - "type": "string" - }, - "self_trading_reject_mode": { - "description": "Self trading rejection behavior - `reject_taker` or `cancel_maker` (available when parameter `extended` = `true`)", - "type": "string" - }, - "summaries": { - "description": "Aggregated list of per-currency account summaries", - "type": "array", - "items": { - "properties": { - "additional_reserve": { - "$ref": "#/components/schemas/additional_reserve" - }, - "affiliate_promotion_fee": { - "description": "Affiliate promotion fee (if greater than 0.0)", - "type": "number", - "example": 0 - }, - "available_funds": { - "description": "Funds available to increase margin usage (open or enlarge positions). Equal to `margin_balance - initial_margin`, floored at `0` in the API response. When initial margin usage exceeds 100%, this is `0` and only reducing orders can be placed. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 2.2638913 - }, - "available_withdrawal_funds": { - "description": "Funds available to withdraw in the selected currency. Typically lower than `available_funds` because withdrawals also exclude positive session profit, locked balance, `spot_reserve`, `additional_reserve`, and non-withdrawable external/implied equity components. Always ≥ `0`.", - "type": "number", - "example": 2.26 - }, - "balance": { - "description": "The account's cash balance in the selected currency (deposits, withdrawals, transfers, option premiums, settlements/deliveries, corrections, costs, and insurance refills). Does not include open futures PnL or options mark value.", - "type": "number", - "example": 3.4906363 - }, - "close_out_margin": { - "$ref": "#/components/schemas/close_out_margin" - }, - "cross_collateral_enabled": { - "description": "When `true` cross collateral is enabled for user", - "type": "boolean", - "example": true - }, - "currency": { - "description": "Currency of the summary", - "type": "string", - "example": "ETH" - }, - "delta_total": { - "$ref": "#/components/schemas/delta_total" - }, - "delta_total_map": { - "$ref": "#/components/schemas/delta_total_map" - }, - "deposit_address": { - "description": "The deposit address for the account (if available)", - "type": "string", - "example": "14diAAyXL5UzhPTCKC998ch2GV7DMb7yDi" - }, - "equity": { - "description": "The account's equity in the selected currency: `balance + futures (session UPL + RPL) + options mark value` (plus any external/implied equity). Related: `margin_balance` excludes options mark value under standard margin.", - "type": "number", - "example": 2.6437733 - }, - "fee_balance": { - "$ref": "#/components/schemas/fee_balance" - }, - "fee_group": { - "description": "Fee group indicates the level of fee discounts applied to an account. Use `extended`: `true` to view this field. If the field is missing, the account is not assigned to any fee group. **📖 Related Support Article:** [Automatically applied volume based fee discounts](https://support.deribit.com/hc/en-us/articles/25944746248989-Fees#heading-11)", - "type": "string" - }, - "fees": { - "description": "Fee structure for all currency pairs and instrument types related to the currency (available when parameter `extended` = `true` and user has any discounts). Keys are index names (e.g., \"btc_usd\"), values are objects with instrument types as keys (option, perpetual, future).", - "type": "object", - "additionalProperties": { - "additionalProperties": { - "properties": { - "block_trade": { - "description": "Block trade fee (if applicable)", - "type": "number" - }, - "default": { - "type": "object", - "properties": { - "maker": { - "description": "Maker fee", - "type": "number" - }, - "taker": { - "description": "Taker fee", - "type": "number" - }, - "type": { - "description": "Fee calculation type (e.g., fixed, relative)", - "type": "string" - } - }, - "required": [ - "type", - "taker", - "maker" - ] - } - }, - "required": [ - "default" - ], - "type": "object" - }, - "type": "object" - } - }, - "futures_pl": { - "description": "Combined profit and loss of all futures and perpetual positions included in `total_pl` (`total_pl - options_pl`).", - "type": "number", - "example": 0 - }, - "futures_session_rpl": { - "description": "Session realized profit and loss for futures and perpetual positions (resets at daily settlement).", - "type": "number", - "example": 0 - }, - "futures_session_upl": { - "description": "Session unrealized profit and loss for open futures and perpetual positions.", - "type": "number", - "example": 0 - }, - "has_non_block_chain_equity": { - "description": "Optional field returned with value `true` when user has non block chain equity that is excluded from proof of reserve calculations", - "type": "boolean" - }, - "initial_margin": { - "description": "Minimum margin required to open or increase positions (includes margin for open orders). If initial margin usage exceeds 100%, `available_funds` is `0`. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 0.379882 - }, - "limits": { - "$ref": "#/components/schemas/api_limits" - }, - "locked_balance": { - "$ref": "#/components/schemas/locked_balance" - }, - "maintenance_margin": { - "description": "Minimum margin required to keep positions open. If `margin_balance` falls below maintenance margin, positions are liquidated. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 0.1334519 - }, - "margin_balance": { - "description": "Collateral available against margin requirements. Under standard margin (SM): `equity - options_value` (cash balance plus futures session UPL and RPL). Under portfolio margin (PM): equal to `equity` on a segregated account, and `equity - outstanding_loan_amount` on a cross account. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 2.25 - }, - "margin_model": { - "description": "Name of user's currently enabled margin model", - "type": "string", - "example": "segregated_sm" - }, - "options_delta": { - "description": "Sum of the deltas of all options positions. For inverse (coin-margined) options this is the Black-Scholes delta; for linear options it is the index-price-adjusted delta. Unlike account-level `delta_total`, the options mark value is not subtracted.", - "type": "number", - "example": 0 - }, - "options_gamma": { - "description": "Sum of options position gammas (Black-Scholes).", - "type": "number", - "example": 0 - }, - "options_gamma_map": { - "description": "Map of options' gammas per index", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "options_pl": { - "description": "Combined profit and loss of all options positions included in `total_pl`.", - "type": "number", - "example": 0 - }, - "options_session_rpl": { - "description": "Session realized profit and loss for options positions (resets at daily settlement).", - "type": "number", - "example": 0 - }, - "options_session_upl": { - "description": "Session unrealized profit and loss for open options positions.", - "type": "number", - "example": 0 - }, - "options_theta": { - "description": "Sum of the thetas of all options positions. Theta is expressed per day; for options with less than one day left to expiry it is scaled down to the fraction of a day remaining.", - "type": "number", - "example": 0 - }, - "options_theta_map": { - "description": "Map of options' thetas per index", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "options_value": { - "description": "Mark value of all open options positions in the selected currency. Under standard margin, `margin_balance = equity - options_value`.", - "type": "number", - "example": 0 - }, - "options_vega": { - "description": "Sum of options position vegas (Black-Scholes).", - "type": "number", - "example": 0 - }, - "options_vega_map": { - "description": "Map of options' vegas per index", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "portfolio_margining_enabled": { - "description": "`true` when portfolio margining is enabled for user", - "type": "boolean", - "example": true - }, - "projected_close_out_margin": { - "$ref": "#/components/schemas/projected_close_out_margin" - }, - "projected_delta_total": { - "$ref": "#/components/schemas/projected_delta_total" - }, - "projected_initial_margin": { - "$ref": "#/components/schemas/projected_initial_margin" - }, - "projected_maintenance_margin": { - "$ref": "#/components/schemas/projected_maintenance_margin" - }, - "receive_notifications": { - "description": "Whether the account receives notifications", - "type": "boolean", - "example": false - }, - "session_rpl": { - "$ref": "#/components/schemas/rpl" - }, - "session_upl": { - "$ref": "#/components/schemas/upl" - }, - "spot_reserve": { - "description": "The account's balance reserved in active spot orders", - "type": "number", - "example": 0.3 - }, - "total_delta_total_usd": { - "description": "Optional (only for users using cross margin). The account's total delta total in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 1.8 - }, - "total_equity_usd": { - "description": "Optional (only for users using cross margin). The account's total equity in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 2.6437733 - }, - "total_initial_margin_usd": { - "description": "Optional (only for users using cross margin). The account's total initial margin in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 0.379882 - }, - "total_maintenance_margin_usd": { - "description": "Optional (only for users using cross margin). The account's total maintenance margin in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 0.1334519 - }, - "total_margin_balance_usd": { - "description": "Optional (only for users using cross margin). The account's total margin balance in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 2.25 - }, - "total_pl": { - "description": "Total profit and loss of all open positions since each position was opened (not limited to the current session). Differs from `session_rpl` + `session_upl`, which reset at daily settlement.", - "type": "number", - "example": 0.02032221 - }, - "trading_products_details": { - "description": "Which trading products are enabled or can be overwritten for the account", - "type": "object" - } - }, - "required": [ - "equity", - "currency", - "maintenance_margin", - "initial_margin", - "available_funds", - "available_withdrawal_funds", - "balance", - "session_upl", - "session_rpl", - "total_pl", - "options_pl", - "options_session_upl", - "options_session_rpl", - "options_delta", - "options_gamma", - "options_vega", - "options_value", - "options_theta", - "futures_pl", - "options_gamma_map", - "options_theta_map", - "options_vega_map", - "futures_session_upl", - "futures_session_rpl", - "projected_maintenance_margin", - "delta_total", - "projected_delta_total" - ], - "type": "object" - } - }, - "system_name": { - "description": "System generated user nickname (available when parameter `extended` = `true`)", - "type": "string", - "example": "myname" - }, - "trading_products_details": { - "description": "Which trading products are enabled or can be overwritten for the account", - "type": "object" - }, - "type": { - "description": "Account type (available when parameter `extended` = `true`)", - "type": "string", - "enum": [ - "main", - "subaccount" - ] - }, - "username": { - "description": "Account name (given by user) (available when parameter `extended` = `true`)", - "type": "string", - "example": "name" - } - }, - "required": [ - "security_keys_enabled", - "system_name", - "username", - "email", - "type", - "id" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateBuyAndSellResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/order" - }, - "trades": { - "type": "array", - "items": { - "$ref": "#/components/schemas/user_trade" - } - } - }, - "required": [ - "order", - "trades" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateCancelAllResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "Total number of successfully cancelled orders", - "type": "number", - "example": 7 - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateCancelResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "$ref": "#/components/schemas/order" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateChangeMarginModelResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "properties": { - "currency": { - "$ref": "#/components/schemas/currency" - }, - "new_state": { - "description": "Represents portfolio state after change", - "type": "object", - "properties": { - "available_balance": { - "description": "Available balance after change", - "type": "number" - }, - "initial_margin_rate": { - "description": "Initial margin rate after change", - "type": "number" - }, - "maintenance_margin_rate": { - "description": "Maintenance margin rate after change", - "type": "number" - } - }, - "required": [ - "maintenance_margin_rate", - "initial_margin_rate", - "available_balance" - ] - }, - "old_state": { - "description": "Represents portfolio state before change", - "type": "object", - "properties": { - "available_balance": { - "description": "Available balance before change", - "type": "number" - }, - "initial_margin_rate": { - "description": "Initial margin rate before change", - "type": "number" - }, - "maintenance_margin_rate": { - "description": "Maintenance margin rate before change", - "type": "number" - } - }, - "required": [ - "maintenance_margin_rate", - "initial_margin_rate", - "available_balance" - ] - } - }, - "required": [ - "old_state", - "new_state", - "currency" - ], - "type": "object" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateCreateComboResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "$ref": "#/components/schemas/combo" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateEditResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/order" - }, - "trades": { - "type": "array", - "items": { - "$ref": "#/components/schemas/user_trade" - } - } - }, - "required": [ - "order", - "trades" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetAccessLogResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/access_log" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetCancelOnDisconnectResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "enabled": { - "$ref": "#/components/schemas/enabled_field" - }, - "scope": { - "$ref": "#/components/schemas/cod_scope" - } - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetLegPricesResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "amount": { - "description": "This value multiplied by the ratio of a leg gives trade size on that leg.", - "type": "number" - }, - "legs": { - "$ref": "#/components/schemas/leg_structure" - } - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetLeverageResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "Leverage details for one requested future, a list of futures with stored custom leverage overrides, or an empty object/list when isolated settings are hidden from a regular subaccount.", - "oneOf": [ - { - "properties": { - "instrument_name": { - "description": "Instrument name", - "type": "string" - }, - "leverage": { - "description": "User-configured custom leverage, or null if defaulting to max_leverage", - "type": [ - "number", - "null" - ] - }, - "max_leverage": { - "description": "Effective maximum allowable leverage", - "type": "number" - } - }, - "required": [ - "instrument_name", - "max_leverage" - ], - "type": "object" - }, - { - "items": { - "properties": { - "instrument_name": { - "description": "Instrument name", - "type": "string" - }, - "leverage": { - "description": "User-configured custom leverage, or null if defaulting to max_leverage", - "type": [ - "number", - "null" - ] - }, - "max_leverage": { - "description": "Effective maximum allowable leverage", - "type": "number" - } - }, - "required": [ - "instrument_name", - "max_leverage" - ], - "type": "object" - }, - "type": "array" - }, - { - "description": "Empty object returned when isolated leverage details are hidden from a regular subaccount.", - "maxProperties": 0, - "type": "object" - } - ] - } - }, - "required": [ - "jsonrpc", - "result" - ] - }, - "PrivateGetMarginsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "buy": { - "description": "Margin when buying", - "type": "number", - "example": 0.01681367 - }, - "buy_maker_fee": { - "description": "Estimated fee when buying as a maker", - "type": "number", - "example": 0.000017 - }, - "buy_taker_fee": { - "description": "Estimated fee when buying as a taker", - "type": "number", - "example": 0.000017 - }, - "max_price": { - "$ref": "#/components/schemas/max_price" - }, - "min_price": { - "$ref": "#/components/schemas/min_price" - }, - "sell": { - "description": "Margin when selling", - "type": "number", - "example": 0.01680479 - }, - "sell_maker_fee": { - "description": "Estimated fee when selling as a maker", - "type": "number", - "example": 0.000017 - }, - "sell_taker_fee": { - "description": "Estimated fee when selling as a taker", - "type": "number", - "example": 0.000017 - } - }, - "required": [ - "buy", - "sell", - "buy_taker_fee", - "buy_maker_fee", - "sell_taker_fee", - "sell_maker_fee", - "min_price", - "max_price" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetMaxOrderSizeResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "buy_price": { - "description": "Reference buy price used for calculations.", - "type": "number" - }, - "max_tradable_amount": { - "type": "object", - "properties": { - "buy_notional": { - "description": "Maximum tradable buy amount in quote currency / cash format.", - "type": "number" - }, - "sell_notional": { - "description": "Maximum tradable sell amount in quote currency / cash format.", - "type": "number" - } - }, - "required": [ - "buy_notional", - "sell_notional" - ] - }, - "max_tradable_amount_reduce_only": { - "type": "object", - "properties": { - "buy_notional": { - "description": "Maximum reduce-only buy amount in quote currency / cash format.", - "type": "number" - }, - "sell_notional": { - "description": "Maximum reduce-only sell amount in quote currency / cash format.", - "type": "number" - } - }, - "required": [ - "buy_notional", - "sell_notional" - ] - }, - "sell_price": { - "description": "Reference sell price used for calculations.", - "type": "number" - } - }, - "required": [ - "max_tradable_amount", - "max_tradable_amount_reduce_only", - "buy_price", - "sell_price" - ] - } - }, - "required": [ - "jsonrpc", - "result" - ] - }, - "PrivateGetOpenOrdersResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/order" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetOrderHistoryResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/order" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetOrderMarginByIdsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/order_id_initial_margin_pair" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetOrderStateByLabelResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "$ref": "#/components/schemas/orders" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetOrderStateResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "$ref": "#/components/schemas/order" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetPositionResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "$ref": "#/components/schemas/position_with_open_orders_margin" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetPositionsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/position_with_open_orders_margin" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetRiskProfileResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "max_leverage": { - "description": "Maximum allowable leverage ceiling, or null if unconstrained", - "type": [ - "number", - "null" - ] - }, - "portfolio_margining_allowed": { - "description": "Permitted to use Portfolio Margining", - "type": "boolean" - }, - "short_option_allowed": { - "description": "Permitted to trade short options", - "type": "boolean" - } - }, - "required": [ - "portfolio_margining_allowed", - "short_option_allowed" - ] - } - }, - "required": [ - "jsonrpc", - "result" - ] - }, - "PrivateGetSubaccountsDetailsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "properties": { - "open_orders": { - "type": "array", - "items": { - "$ref": "#/components/schemas/order" - } - }, - "positions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/position" - } - }, - "uid": { - "description": "Account/Subaccount identifier", - "type": "integer" - } - }, - "required": [ - "uid", - "positions" - ], - "type": "object" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetSubaccountsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "properties": { - "email": { - "description": "User email", - "type": "string" - }, - "id": { - "description": "Account/Subaccount identifier", - "type": "integer" - }, - "is_password": { - "description": "`true` when password for the subaccount has been configured", - "type": "boolean" - }, - "isolated": { - "description": "True when the entry represents a managed isolated-margin subaccount; null for main account and regular subaccounts.", - "type": [ - "boolean", - "null" - ] - }, - "isolated_margin_instrument": { - "description": "Instrument name bound to the isolated margin subaccount, or null if unbound or non-isolated.", - "type": [ - "string", - "null" - ] - }, - "login_enabled": { - "description": "Informs whether login to the subaccount is enabled", - "type": "boolean" - }, - "margin_model": { - "description": "Margin model", - "type": "string" - }, - "not_confirmed_email": { - "description": "New email address that has not yet been confirmed. This field is only included if `with_portfolio` == `true`.", - "type": "string" - }, - "portfolio": { - "description": "Only if with_portfolio == true", - "$ref": "#/components/schemas/portfolio" - }, - "proof_id": { - "description": "Hashed identifier used in the Proof Of Liability for the subaccount. This identifier allows you to find your entries in the Deribit Proof-Of-Reserves files. IMPORTANT: Keep it secret to not disclose your entries in the Proof-Of-Reserves.", - "type": "string" - }, - "proof_id_signature": { - "description": "Signature used as a base string for proof_id hash. IMPORTANT: Keep it secret to not disclose your entries in the Proof-Of-Reserves.", - "type": "string" - }, - "receive_notifications": { - "description": "When `true` - receive all notification emails on the main email", - "type": "boolean" - }, - "security_keys_assignments": { - "description": "Names of assignments with Security Keys assigned", - "type": "array" - }, - "security_keys_enabled": { - "description": "Whether the Security Keys authentication is enabled", - "type": "boolean" - }, - "system_name": { - "description": "System generated user nickname", - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "main", - "subaccount" - ] - }, - "username": { - "type": "string" - } - }, - "required": [ - "username", - "email", - "type", - "tfa_enabled", - "receive_notifications", - "is_password", - "system_name", - "id" - ], - "type": "object" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetTradingLimitsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "currency": { - "description": "Currency code", - "type": "string" - }, - "max_future_open_orders": { - "description": "Maximum open future orders", - "type": "integer" - }, - "max_future_open_orders_size": { - "description": "Maximum future open orders size", - "type": "number" - }, - "max_future_position_size": { - "description": "Maximum future position size", - "type": "number" - }, - "max_open_orders_in_instrument": { - "description": "Maximum open orders per instrument", - "type": "integer" - }, - "max_option_open_orders": { - "description": "Maximum open option orders", - "type": "integer" - }, - "max_option_open_orders_size": { - "description": "Maximum option open orders size", - "type": "number" - }, - "max_risk_reducing_orders": { - "description": "Maximum risk reducing orders", - "type": "integer" - }, - "max_total_open_orders": { - "description": "Maximum total open orders", - "type": "integer" - }, - "max_total_short_options_positions": { - "description": "Maximum short options positions", - "type": "number" - }, - "portfolio_margining_enabled": { - "description": "Portfolio margining model status", - "type": "boolean" - } - }, - "required": [ - "currency", - "portfolio_margining_enabled" - ] - } - }, - "required": [ - "jsonrpc", - "result" - ] - }, - "PrivateGetTransactionLogResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "continuation": { - "$ref": "#/components/schemas/continuation_with_null" - }, - "logs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/transaction_log" - } - } - }, - "required": [ - "continuation", - "logs" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetTriggerOrderHistoryResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "continuation": { - "$ref": "#/components/schemas/continuation" - }, - "entries": { - "type": "array", - "items": { - "$ref": "#/components/schemas/trigger_order_history_record" - } - } - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetUserLocksResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "properties": { - "currency": { - "$ref": "#/components/schemas/currency" - }, - "enabled": { - "description": "Value is set to 'true' when user account is locked in currency", - "type": "boolean" - }, - "message": { - "description": "Optional information for user why his account is locked", - "type": "string" - } - }, - "required": [ - "currency", - "enabled" - ], - "type": "object" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetUserTradesByOrderResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/user_trade" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateGetUserTradesHistoryResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "has_more": { - "type": "boolean" - }, - "trades": { - "type": "array", - "items": { - "$ref": "#/components/schemas/user_trade" - } - } - }, - "required": [ - "trades", - "has_more" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivatePmeParamsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "Portfolio Margin order restrictions, or `enabled: false` when Portfolio Margin is disabled.", - "type": "object", - "oneOf": [ - { - "additionalProperties": false, - "properties": { - "enabled": { - "description": "Portfolio Margin is enabled for the account.", - "type": "boolean", - "enum": [ - true - ] - }, - "max_future_open_orders": { - "description": "Maximum number of open futures orders.", - "type": "integer" - }, - "max_future_open_orders_size": { - "description": "Maximum aggregate size of open futures orders.", - "type": "number" - }, - "max_option_open_orders": { - "description": "Maximum number of open option orders.", - "type": "integer" - }, - "max_option_open_orders_size": { - "description": "Maximum aggregate size of open option orders, in contracts.", - "type": "number" - }, - "max_risk_reducing_orders": { - "description": "Maximum number of risk-reducing orders.", - "type": "integer" - }, - "max_total_open_orders": { - "description": "Maximum total number of open derivatives orders.", - "type": "integer" - } - }, - "required": [ - "enabled", - "max_total_open_orders", - "max_future_open_orders", - "max_option_open_orders", - "max_future_open_orders_size", - "max_option_open_orders_size", - "max_risk_reducing_orders" - ], - "type": "object" - }, - { - "additionalProperties": false, - "properties": { - "enabled": { - "description": "Portfolio Margin is disabled for the account.", - "type": "boolean", - "enum": [ - false - ] - } - }, - "required": [ - "enabled" - ], - "type": "object" - } - ] - } - }, - "required": [ - "jsonrpc", - "result" - ] - }, - "PrivatePmeSimulateResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "Simulation details", - "type": "object" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateSetLeverageResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "The stored custom leverage value (or null if custom leverage was removed).", - "type": [ - "number", - "null" - ] - } - }, - "required": [ - "jsonrpc", - "result" - ] - }, - "PrivateSettlementResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "continuation": { - "$ref": "#/components/schemas/continuation" - }, - "settlements": { - "type": "array", - "items": { - "$ref": "#/components/schemas/settlement" - } - } - }, - "required": [ - "continuation", - "settlements" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateSimulatePortfolioResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "Portfolio margin simulation result", - "type": "object", - "properties": { - "additional_reserve": { - "$ref": "#/components/schemas/additional_reserve" - }, - "available_funds": { - "description": "Funds available to increase margin usage (open or enlarge positions). Equal to `margin_balance - initial_margin`, floored at `0` in the API response. When initial margin usage exceeds 100%, this is `0` and only reducing orders can be placed. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 115871741.76065847 - }, - "available_subaccount_transfer_funds": { - "description": "The account's available funds for subaccount transfers", - "type": "number", - "example": 0 - }, - "available_withdrawal_funds": { - "description": "Funds available to withdraw in the selected currency. Typically lower than `available_funds` because withdrawals also exclude positive session profit, locked balance, `spot_reserve`, `additional_reserve`, and non-withdrawable external/implied equity components. Always ≥ `0`.", - "type": "number", - "example": 115871741.76065847 - }, - "balance": { - "description": "The account's cash balance in the selected currency (deposits, withdrawals, transfers, option premiums, settlements/deliveries, corrections, costs, and insurance refills). Does not include open futures PnL or options mark value.", - "type": "number", - "example": 150076473.4995114 - }, - "cross_collateral_enabled": { - "description": "When `true` cross collateral is enabled for user", - "type": "boolean", - "example": true - }, - "currency": { - "description": "Currency of the simulation", - "type": "string", - "example": "BTC" - }, - "delta_total": { - "$ref": "#/components/schemas/delta_total" - }, - "delta_total_map": { - "description": "Map of total deltas per index", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "equity": { - "description": "The account's equity in the selected currency: `balance + futures (session UPL + RPL) + options mark value` (plus any external/implied equity). Related: `margin_balance` excludes options mark value under standard margin.", - "type": "number", - "example": 150075253.91354558 - }, - "fee_balance": { - "$ref": "#/components/schemas/fee_balance" - }, - "futures_pl": { - "description": "Futures profit and loss", - "type": "number", - "example": 39497.54616685 - }, - "futures_session_rpl": { - "description": "Futures session realized profit and loss", - "type": "number", - "example": 1.309136 - }, - "futures_session_upl": { - "description": "Futures session unrealized profit and loss", - "type": "number", - "example": -164.48253509 - }, - "initial_margin": { - "description": "The account's initial margin. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 37662472.03416069 - }, - "locked_balance": { - "description": "The account's locked balance", - "type": "number", - "example": 0 - }, - "maintenance_margin": { - "description": "The maintenance margin. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 30129215.84817124 - }, - "margin_balance": { - "description": "Collateral available against margin requirements. Under standard margin (SM): `equity - options_value` (cash balance plus futures session UPL and RPL). Under portfolio margin (PM): equal to `equity` on a segregated account, and `equity - outstanding_loan_amount` on a cross account. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number", - "example": 153534213.79481918 - }, - "margin_model": { - "description": "Name of user's currently enabled margin model", - "type": "string", - "example": "cross_pm" - }, - "options_delta": { - "description": "Sum of the deltas of all options positions. For inverse (coin-margined) options this is the Black-Scholes delta; for linear options it is the index-price-adjusted delta. Unlike account-level `delta_total`, the options mark value is not subtracted.", - "type": "number", - "example": 2883.38481 - }, - "options_gamma": { - "description": "Sum of options position gammas (Black-Scholes).", - "type": "number", - "example": -0.03907 - }, - "options_gamma_map": { - "description": "Map of options' gammas per index", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "options_pl": { - "description": "Options profit and loss", - "type": "number", - "example": 921.55562578 - }, - "options_session_rpl": { - "description": "Options session realized profit and loss", - "type": "number", - "example": 0 - }, - "options_session_upl": { - "description": "Options session unrealized profit and loss", - "type": "number", - "example": -174.67960675 - }, - "options_theta": { - "description": "Sum of the thetas of all options positions. Theta is expressed per day; for options with less than one day left to expiry it is scaled down to the fraction of a day remaining.", - "type": "number", - "example": 142583.29246 - }, - "options_theta_map": { - "description": "Map of options' thetas per index", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "options_value": { - "description": "Mark value of all open options positions in the selected currency. Under standard margin, `margin_balance = equity - options_value`.", - "type": "number", - "example": -1056.41256672 - }, - "options_vega": { - "description": "Sum of options position vegas (Black-Scholes).", - "type": "number", - "example": -39322.23046 - }, - "options_vega_map": { - "description": "Map of options' vegas per index", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "portfolio_margining_enabled": { - "description": "`true` when portfolio margining is enabled for user", - "type": "boolean", - "example": true - }, - "projected_delta_total": { - "$ref": "#/components/schemas/projected_delta_total" - }, - "projected_initial_margin": { - "$ref": "#/components/schemas/projected_initial_margin" - }, - "projected_maintenance_margin": { - "$ref": "#/components/schemas/projected_maintenance_margin" - }, - "session_rpl": { - "$ref": "#/components/schemas/rpl" - }, - "session_upl": { - "$ref": "#/components/schemas/upl" - }, - "spot_reserve": { - "description": "The account's balance reserved in active spot orders", - "type": "number", - "example": 0 - }, - "total_delta_total_usd": { - "description": "Optional (only for users using cross margin). The account's total delta total in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 6157454218.3753195 - }, - "total_equity_usd": { - "description": "Optional (only for users using cross margin). The account's total equity in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 13075634611389.318 - }, - "total_initial_margin_usd": { - "description": "Optional (only for users using cross margin). The account's total initial margin in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 3139528603778.822 - }, - "total_maintenance_margin_usd": { - "description": "Optional (only for users using cross margin). The account's total maintenance margin in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 2511559381417.215 - }, - "total_margin_balance_usd": { - "description": "Optional (only for users using cross margin). The account's total margin balance in all cross collateral currencies, expressed in USD", - "type": "number", - "example": 12798550648250.61 - }, - "total_pl": { - "description": "Total profit and loss of all open positions since each position was opened (not limited to the current session). Differs from `session_rpl` + `session_upl`, which reset at daily settlement.", - "type": "number", - "example": 40419.10179263 - } - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateSubmitTransferResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "$ref": "#/components/schemas/transfer_item" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PrivateSubscribeResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "A list of subscribed channels.", - "type": "array", - "items": { - "example": "deribit_price_index.btc_usd", - "type": "string" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicAuthResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "access_token": { - "description": "Access token to be used for authentication of subsequent requests.", - "type": "string", - "example": "843SehgeX5n6XxEU4XbABx4Cny5Akai5iHiJePTsvUw7" - }, - "enabled_features": { - "$ref": "#/components/schemas/api_key_features" - }, - "expires_in": { - "description": "Token lifetime in seconds", - "type": "integer", - "example": 315360000 - }, - "google_login": { - "description": "The access token was acquired by logging in through Google.", - "type": "boolean" - }, - "mandatory_tfa_status": { - "description": "2FA is required for privileged methods", - "type": "string", - "example": "enabled" - }, - "refresh_token": { - "description": "Can be used to request a new token (with a new lifetime)", - "type": "string", - "example": "6faf8L36JdaSqsjCEEiwqifPpj6JB18RWwiWHrsGTZ91" - }, - "scope": { - "description": "Space-separated list of granted scopes", - "type": "string" - }, - "sid": { - "description": "Optional Session id", - "type": "string" - }, - "state": { - "description": "Copied from the input (if applicable)", - "type": "string" - }, - "token_type": { - "description": "Authorization type, always `bearer`", - "type": "string", - "enum": [ - "bearer" - ] - } - }, - "required": [ - "access_token", - "token_type", - "expires_in", - "scope" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetAnnouncementsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "properties": { - "body": { - "description": "The HTML body of the announcement", - "type": "string", - "example": "An announcement" - }, - "confirmation": { - "description": "Whether the user confirmation is required for this announcement", - "type": "boolean", - "example": false - }, - "id": { - "description": "A unique identifier for the announcement", - "type": "number", - "example": 19288317 - }, - "important": { - "description": "Whether the announcement is marked as important", - "type": "boolean", - "example": false - }, - "publication_timestamp": { - "description": "The timestamp (milliseconds since the Unix epoch) of announcement publication", - "type": "integer", - "example": 1527844253000 - }, - "title": { - "description": "The title of the announcement", - "type": "string", - "example": "Example announcement" - } - }, - "required": [ - "title", - "body", - "important", - "id", - "publication_timestamp" - ], - "type": "object" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetBookSummaryResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/book_summary" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetComboDetailsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "$ref": "#/components/schemas/combo" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetComboIdsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/combo_id" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetCombosResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/combo" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetContractSizeResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "contract_size": { - "$ref": "#/components/schemas/contract_size" - } - }, - "required": [ - "contract_size" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetCurrenciesResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/currency_with_apr" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetDeliveryPricesResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "properties": { - "date": { - "$ref": "#/components/schemas/date" - }, - "delivery_price": { - "$ref": "#/components/schemas/delivery_price" - } - }, - "required": [ - "date", - "delivery_price" - ], - "type": "object" - } - }, - "records_total": { - "description": "Available delivery prices", - "type": "number", - "example": 120 - } - }, - "required": [ - "records_total", - "data" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetExpirationsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/expirations" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetFundingChartDataResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "current_interest": { - "description": "Current interest", - "type": "number", - "example": 0.005000670552845 - }, - "data": { - "type": "array", - "items": { - "properties": { - "index_price": { - "$ref": "#/components/schemas/index_price" - }, - "interest_8h": { - "description": "Historical interest 8h value", - "type": "number", - "example": 0.004999511380756577 - }, - "timestamp": { - "$ref": "#/components/schemas/timestamp" - } - }, - "required": [ - "timestamp", - "index_price", - "interest_8h" - ], - "type": "object" - } - }, - "interest_8h": { - "description": "Current interest 8h", - "type": "number", - "example": 0.0040080896931 - } - }, - "required": [ - "current_interest", - "data", - "interest_8h" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetFundingRateHistoryResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "properties": { - "index_price": { - "$ref": "#/components/schemas/price" - }, - "interest_1h": { - "description": "1hour interest rate", - "type": "number" - }, - "interest_8h": { - "description": "8hour interest rate", - "type": "number" - }, - "prev_index_price": { - "$ref": "#/components/schemas/price" - }, - "timestamp": { - "$ref": "#/components/schemas/timestamp" - } - }, - "type": "object" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetFundingRateValueResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "number" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetHistoricalVolatilityResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "properties": { - "timestamp": { - "type": "integer" - }, - "value": { - "type": "number" - } - }, - "required": [ - "timestamp", - "value" - ], - "type": "object" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetIndexChartDataResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "**Response:**\nThe response returns an array of data points, where each data point is an array containing:\n\n- **Index 0**: Timestamp in milliseconds since the Unix epoch\n- **Index 1**: Average index price at that timestamp\n\nExample response structure:\n```json\n[\n [1573228800000, 8751.7138636],\n [1573232400000, 8751.7138636],\n [1573236000000, 8751.7138636]\n]\n```\n\nEach entry in the result array represents a single data point:\n\n- The first value (timestamp) indicates when the price was recorded\n- The second value (price) is the average index price at that timestamp\n\nThe data points are returned in chronological order, making them ready for direct use in charting libraries.\n", - "type": "array", - "items": { - "items": { - "type": "number" - }, - "type": "array" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetIndexPriceNamesResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "properties": { - "future_combo_creation_enabled": { - "description": "Whether future combo creation is enabled for this index (only present when `extended`=`true`)", - "type": "boolean" - }, - "name": { - "description": "Index name", - "type": "string" - }, - "option_combo_creation_enabled": { - "description": "Whether option combo creation is enabled for this index (only present when `extended`=`true`)", - "type": "boolean" - } - }, - "required": [ - "name" - ], - "type": "object" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetIndexPriceResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "estimated_delivery_price": { - "description": "Estimated delivery price for the market. For more details, see Documentation > General > Expiration Price", - "type": "number", - "example": 11628.81 - }, - "index_price": { - "description": "Value of requested index", - "type": "number", - "example": 11628.81 - } - }, - "required": [ - "index_price", - "estimated_delivery_price" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetInstrumentResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "$ref": "#/components/schemas/instrument" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetInstrumentsResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/instrument" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetMarkPriceHistoryResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "Markprice history values as an array of arrays with 2 values each. The inner values correspond to the timestamp in ms and the markprice itself.", - "type": "array", - "items": { - "items": { - "type": "number" - }, - "type": "array" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetOrderBookResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "$ref": "#/components/schemas/TickerNotificationWithBidsAndAsks" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetTimeResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "Current timestamp (milliseconds since the UNIX epoch)", - "type": "integer", - "example": 1517329113791 - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetTradesVolumesResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/components/schemas/trades_volumes" - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetTradingviewChartDataResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "close": { - "description": "List of prices at close (one per candle)", - "type": "array", - "items": { - "$ref": "#/components/schemas/quote_price" - } - }, - "cost": { - "description": "List of cost bars (volume in quote currency, one per candle)", - "type": "array", - "items": { - "$ref": "#/components/schemas/chart_volume" - } - }, - "high": { - "description": "List of highest price levels (one per candle)", - "type": "array", - "items": { - "$ref": "#/components/schemas/quote_price" - } - }, - "low": { - "description": "List of lowest price levels (one per candle)", - "type": "array", - "items": { - "$ref": "#/components/schemas/quote_price" - } - }, - "open": { - "description": "List of prices at open (one per candle)", - "type": "array", - "items": { - "$ref": "#/components/schemas/quote_price" - } - }, - "status": { - "description": "Status of the query: `ok` or `no_data`", - "type": "string", - "enum": [ - "ok", - "no_data" - ] - }, - "ticks": { - "description": "Values of the time axis given in milliseconds since UNIX epoch", - "type": "array", - "items": { - "$ref": "#/components/schemas/timestamp" - } - }, - "volume": { - "description": "List of volume bars (in base currency, one per candle)", - "type": "array", - "items": { - "$ref": "#/components/schemas/chart_volume" - } - } - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicGetVolatilityIndexDataResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "description": "Volatility index candles.", - "type": "object", - "properties": { - "continuation": { - "description": "Continuation - to be used as the `end_timestamp` parameter on the next request. `NULL` when no continuation.", - "type": "integer" - }, - "data": { - "description": "Candles as an array of arrays with 5 values each. The inner values correspond to the timestamp in ms, open, high, low, and close values of the volatility index correspondingly.", - "type": "array" - } - } - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicSettlementResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "continuation": { - "$ref": "#/components/schemas/continuation" - }, - "settlements": { - "type": "array", - "items": { - "$ref": "#/components/schemas/settlement" - } - } - }, - "required": [ - "continuation", - "settlements" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicStatusResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "locked": { - "description": "`true` when platform is locked in all currencies, `partial` when some currencies are locked, `false` - when there are not currencies locked", - "type": "string" - }, - "locked_indices": { - "description": "List of currency indices locked platform-wise", - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "locked" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicTestResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "version": { - "description": "The API version", - "type": "string", - "example": "2.1.26" - } - }, - "required": [ - "version" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicTickerResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "$ref": "#/components/schemas/TickerNotification" - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "PublicTickersByCurrencyResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/TickerNotification" - }, - { - "$ref": "#/components/schemas/TickerNotificationWithBidsAndAsks" - } - ], - "description": "Ticker data for depth 1, or ticker data with bid and ask levels for depth 3 or 10." - } - } - }, - "required": [ - "jsonrpc", - "result" - ] - }, - "PublicTradesHistoryResponse": { - "type": "object", - "properties": { - "id": { - "description": "The id that was sent in the request", - "type": "integer" - }, - "jsonrpc": { - "description": "The JSON-RPC version (2.0)", - "type": "string", - "enum": [ - "2.0" - ] - }, - "result": { - "type": "object", - "properties": { - "has_more": { - "type": "boolean" - }, - "trades": { - "type": "array", - "items": { - "$ref": "#/components/schemas/public_trade" - } - } - }, - "required": [ - "trades", - "has_more" - ] - } - }, - "required": [ - "result", - "jsonrpc" - ] - }, - "TickerNotification": { - "type": "object", - "properties": { - "anchor_max_price": { - "description": "The upper bound of the anchor price band, computed as `anchor_price * (1 + bandwidth)`. Only present for RWA perpetual instruments when an anchor price and bandwidth are defined.", - "type": "number" - }, - "anchor_min_price": { - "description": "The lower bound of the anchor price band, computed as `anchor_price * (1 - bandwidth)`. Only present for RWA perpetual instruments when an anchor price and bandwidth are defined.", - "type": "number" - }, - "ask_iv": { - "$ref": "#/components/schemas/ask_iv" - }, - "best_ask_amount": { - "$ref": "#/components/schemas/best_ask_amount" - }, - "best_ask_price": { - "$ref": "#/components/schemas/best_ask_price" - }, - "best_bid_amount": { - "$ref": "#/components/schemas/best_bid_amount" - }, - "best_bid_price": { - "$ref": "#/components/schemas/best_bid_price" - }, - "bid_iv": { - "$ref": "#/components/schemas/bid_iv" - }, - "current_funding": { - "$ref": "#/components/schemas/current_funding" - }, - "delivery_price": { - "$ref": "#/components/schemas/delivery_price" - }, - "estimated_delivery_price": { - "$ref": "#/components/schemas/estimated_delivery_price" - }, - "funding_8h": { - "$ref": "#/components/schemas/funding_8h" - }, - "greeks": { - "$ref": "#/components/schemas/greeks" - }, - "index_price": { - "$ref": "#/components/schemas/index_price" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - }, - "interest_rate": { - "$ref": "#/components/schemas/interest_rate" - }, - "interest_value": { - "$ref": "#/components/schemas/interest_value" - }, - "is_anchor_breached": { - "description": "Whether the mark price has breached the anchor price band. Only present for RWA perpetual instruments when an anchor price is active.", - "type": "boolean" - }, - "last_price": { - "$ref": "#/components/schemas/last_price" - }, - "mark_iv": { - "$ref": "#/components/schemas/mark_iv" - }, - "mark_price": { - "$ref": "#/components/schemas/mark_price" - }, - "max_price": { - "$ref": "#/components/schemas/max_price" - }, - "min_price": { - "$ref": "#/components/schemas/min_price" - }, - "open_interest": { - "$ref": "#/components/schemas/open_interest" - }, - "settlement_price": { - "$ref": "#/components/schemas/settlement_price" - }, - "state": { - "$ref": "#/components/schemas/book_state" - }, - "stats": { - "$ref": "#/components/schemas/stats" - }, - "timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "underlying_index": { - "$ref": "#/components/schemas/underlying_index" - }, - "underlying_price": { - "$ref": "#/components/schemas/underlying_price" - } - }, - "required": [ - "instrument_name", - "timestamp", - "state", - "stats", - "open_interest", - "index_price", - "best_bid_price", - "best_bid_amount", - "best_ask_price", - "best_ask_amount", - "min_price", - "max_price", - "mark_price", - "last_price", - "estimated_delivery_price" - ] - }, - "TickerNotificationWithBidsAndAsks": { - "type": "object", - "properties": { - "ask_iv": { - "$ref": "#/components/schemas/ask_iv" - }, - "asks": { - "$ref": "#/components/schemas/asks" - }, - "best_ask_amount": { - "$ref": "#/components/schemas/best_ask_amount" - }, - "best_ask_price": { - "$ref": "#/components/schemas/best_ask_price" - }, - "best_bid_amount": { - "$ref": "#/components/schemas/best_bid_amount" - }, - "best_bid_price": { - "$ref": "#/components/schemas/best_bid_price" - }, - "bid_iv": { - "$ref": "#/components/schemas/bid_iv" - }, - "bids": { - "$ref": "#/components/schemas/bids" - }, - "current_funding": { - "$ref": "#/components/schemas/current_funding" - }, - "delivery_price": { - "$ref": "#/components/schemas/delivery_price" - }, - "funding_8h": { - "$ref": "#/components/schemas/funding_8h" - }, - "greeks": { - "$ref": "#/components/schemas/greeks" - }, - "index_price": { - "$ref": "#/components/schemas/index_price" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - }, - "interest_rate": { - "$ref": "#/components/schemas/interest_rate" - }, - "last_price": { - "$ref": "#/components/schemas/last_price" - }, - "mark_iv": { - "$ref": "#/components/schemas/mark_iv" - }, - "mark_price": { - "$ref": "#/components/schemas/mark_price" - }, - "max_price": { - "$ref": "#/components/schemas/max_price" - }, - "min_price": { - "$ref": "#/components/schemas/min_price" - }, - "open_interest": { - "$ref": "#/components/schemas/open_interest" - }, - "settlement_price": { - "$ref": "#/components/schemas/settlement_price" - }, - "state": { - "$ref": "#/components/schemas/book_state" - }, - "stats": { - "$ref": "#/components/schemas/stats" - }, - "timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "underlying_index": { - "$ref": "#/components/schemas/underlying_index" - }, - "underlying_price": { - "$ref": "#/components/schemas/underlying_price" - } - }, - "required": [ - "instrument_name", - "timestamp", - "state", - "stats", - "open_interest", - "index_price", - "best_bid_price", - "best_bid_amount", - "best_ask_price", - "best_ask_amount", - "min_price", - "max_price", - "mark_price", - "last_price", - "bids", - "asks" - ] - }, - "access_log": { - "type": "object", - "properties": { - "city": { - "description": "City where the IP address is registered (estimated)", - "type": "string" - }, - "country": { - "description": "Country where the IP address is registered (estimated)", - "type": "string" - }, - "data": { - "description": "Optional, additional information about action, type depends on `log` value", - "oneOf": [ - { - "type": "object" - }, - { - "type": "string" - } - ] - }, - "id": { - "$ref": "#/components/schemas/id" - }, - "ip": { - "description": "IP address of source that generated action", - "type": "string" - }, - "log": { - "description": "Action description. Possible values:\n\n- ``changed_email`` - email was changed\n- ``changed_password`` - password was changed\n- ``disabled_tfa`` - TFA was disabled\n- ``enabled_tfa`` - TFA was enabled\n- ``success`` - successful login\n- ``failure`` - login failure\n- ``enabled_subaccount_login`` - login was enabled for subaccount (in `data` - subaccount uid)\n- ``disabled_subaccount_login`` - login was disabled for subaccount (in `data` - subaccount uid)\n- ``new_api_key`` - API key was created (in `data` key client id)\n- ``removed_api_key`` - API key was removed (in `data` key client id)\n- ``changed_scope`` - scope of API key was changed (in `data` key client id)\n- ``changed_whitelist`` - whitelist of API key was edited (in `data` key client id)\n- ``disabled_api_key`` - API key was disabled (in `data` key client id)\n- ``enabled_api_key`` - API key was enabled (in `data` key client id)\n- ``reset_api_key`` - API key was reset (in `data` key client id)\n", - "type": "string" - }, - "timestamp": { - "$ref": "#/components/schemas/timestamp" - } - }, - "required": [ - "id", - "ip", - "timestamp", - "country", - "city", - "log" - ] - }, - "additional_reserve": { - "description": "The account's balance reserved for open buy option orders and option combo orders (the premium payable if they fill). Only non-zero on the `cross_sm` margin model; balance reserved by spot orders is reported separately in `spot_reserve`.", - "type": "number", - "example": 0.3 - }, - "advanced": { - "description": "advanced type: `\"usd\"` or `\"implv\"` (Only for options; field is omitted if not applicable).\n", - "type": "string", - "enum": [ - "usd", - "implv" - ] - }, - "amount": { - "description": "It represents the requested order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "type": "number" - }, - "api": { - "description": "`true` if created with API", - "type": "boolean" - }, - "api_key_features": { - "description": "List of enabled advanced on-key features.

Available options:
- restricted_block_trades: Limit the block_trade read the scope of the API key to block trades that have been made using this specific API key
- block_trade_approval: Block trades created using this API key require additional user approval. Methods that use block_rfq scope are not affected by Block Trade approval feature", - "type": "array", - "items": { - "type": "string" - } - }, - "api_limits": { - "description": "Returned object is described in [separate document](https://support.deribit.com/hc/en-us/articles/25944617523357-Rate-Limits).", - "type": "object" - }, - "ask_iv": { - "description": "(Only for option) implied volatility for best ask", - "type": "number" - }, - "asks": { - "type": "array", - "items": { - "description": "List of asks (price-amount pairs)", - "items": { - "type": "number" - }, - "maxItems": 2, - "minItems": 2, - "type": "array" - } - }, - "average_price": { - "description": "Average fill price of the order", - "type": "number" - }, - "best_ask_amount": { - "description": "It represents the requested order size of all best asks", - "type": [ - "number", - "null" - ] - }, - "best_ask_price": { - "description": "The current best ask price, `null` if there aren't any asks", - "type": [ - "number", - "null" - ] - }, - "best_bid_amount": { - "description": "It represents the requested order size of all best bids", - "type": [ - "number", - "null" - ] - }, - "best_bid_price": { - "description": "The current best bid price, `null` if there aren't any bids", - "type": [ - "number", - "null" - ] - }, - "bid_iv": { - "description": "(Only for option) implied volatility for best bid", - "type": "number" - }, - "bids": { - "type": "array", - "items": { - "description": "List of bids (price-amount pairs)", - "items": { - "type": "number" - }, - "maxItems": 2, - "minItems": 2, - "type": "array" - } - }, - "block_trade_id_in_result": { - "description": "Block trade id - when trade was part of a block trade", - "type": "string", - "example": "154" - }, - "block_trade_leg_count": { - "description": "Block trade leg count - when trade was part of a block trade", - "type": "integer", - "example": 3 - }, - "block_trade_order": { - "description": "`true` if order made from block_trade trade, added only in that case.", - "type": "boolean", - "example": true - }, - "book_state": { - "description": "The state of the order book. Represents the current lifecycle stage of the instrument.\n\n**State Lifecycle and Meanings:**\n\n- `open`: Default state for running books. In this state book is accepting new orders, edits, cancels; prices should be updated, trading is live.\n- `settlement`: Books enters to this state during settlement/delivery. New orders, edits, cancels are not accepted. After this state normally next state should be `open` if it was settlement, or `delivered` if it was delivery. On enter to this state good till day orders in book are canceled.\n- `delivered`: Final state of book that has been delivered. New orders, edits, cancels are not accepted. After some time book process will be terminated and, instrument moved to `expired_instruments` and its `instrument_state` will become archivized. On enter to this all open orders in book are canceled.\n- `inactive`: After a book is deactivated, this state is set on book. New orders, edits, cancels are not accepted. On enter to this all open orders in book are canceled. Book in this state is not considered as open. This can be also final state for book.\n- `locked`: New orders, edits, are not accepted, only cancels ARE accepted. In some cases when configured books can start as locked or it may become locked on admin request. Settlement is possible on locked books.\n- `halted`: The state that books enter as a result of an error. Settlement is not possible when there is at least one book in this state.\n- `archivized`: Set when instrument is moved to `expired_instruments` table, final state.\n", - "type": "string", - "enum": [ - "open", - "settlement", - "delivered", - "inactive", - "locked", - "halted", - "archivized" - ] - }, - "book_summary": { - "type": "object", - "properties": { - "ask_price": { - "description": "The current best ask price, `null` if there aren't any asks", - "type": "number", - "example": 7022.89 - }, - "base_currency": { - "description": "Base currency", - "type": "string", - "example": "ETH" - }, - "bid_price": { - "description": "The current best bid price, `null` if there aren't any bids", - "type": "number", - "example": 7022.89 - }, - "creation_timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "current_funding": { - "description": "Current instantaneous funding rate (perpetual only). Calculated as `(mark_price − index_price) / index_price` at this moment. This is the rate that would apply if a funding settlement occurred right now.", - "type": "number", - "example": 0.12344 - }, - "estimated_delivery_price": { - "description": "Optional (only for derivatives). Estimated delivery price for the market.", - "type": "number", - "example": 11628.81 - }, - "funding_8h": { - "description": "Projected 8-hour funding rate for the current settlement window (perpetual only). This is the time-weighted accumulation of the funding rate since the last 8-hour settlement — i.e. the total rate that will be charged or received at the next settlement. `current_funding` shows the instantaneous rate; `funding_8h` shows what has accumulated toward the next settlement.", - "type": "number" - }, - "high": { - "description": "Price of the 24h highest trade", - "type": "number", - "example": 7022.89 - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - }, - "interest_rate": { - "description": "Interest rate used in implied volatility calculations (options only)", - "type": "number", - "example": 0 - }, - "last": { - "description": "The price of the latest trade, `null` if there weren't any trades", - "type": "number", - "example": 7022.89 - }, - "low": { - "description": "Price of the 24h lowest trade, `null` if there weren't any trades", - "type": "number", - "example": 7022.89 - }, - "mark_iv": { - "$ref": "#/components/schemas/mark_iv" - }, - "mark_price": { - "description": "The current instrument market price", - "type": "number", - "example": 7022.89 - }, - "mid_price": { - "description": "The average of the best bid and ask, `null` if there aren't any asks or bids", - "type": "number", - "example": 7022.89 - }, - "open_interest": { - "description": "Optional (only for derivatives). The total amount of outstanding contracts in the corresponding amount units. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "type": "number", - "example": 0.5 - }, - "price_change": { - "description": "24-hour price change expressed as a percentage, `null` if there weren't any trades", - "type": "number", - "example": 10.23 - }, - "quote_currency": { - "description": "Quote currency", - "type": "string", - "example": "USD" - }, - "underlying_index": { - "description": "Name of the underlying future, or `'index_price'` (options only)", - "type": "string", - "example": "index_price" - }, - "underlying_price": { - "description": "underlying price for implied volatility calculations (options only)", - "type": "number", - "example": 6745.34 - }, - "volume": { - "description": "The total 24h traded volume (in base currency)", - "type": "number", - "example": 223 - }, - "volume_notional": { - "description": "Volume in quote currency (futures and spots only)", - "type": "number" - }, - "volume_usd": { - "description": "Volume in USD", - "type": "number" - } - }, - "required": [ - "instrument_name", - "high", - "low", - "base_currency", - "quote_currency", - "volume", - "bid_price", - "ask_price", - "mid_price", - "mark_price", - "last", - "open_interest", - "creation_timestamp" - ] - }, - "cancel_reason": { - "description": "Enumerated reason behind cancel `\"user_request\"`, `\"autoliquidation\"`, `\"cancel_on_disconnect\"`, `\"risk_mitigation\"`, `\"pme_risk_reduction\"` (portfolio margining risk reduction), `\"pme_account_locked\"` (portfolio margining account locked per currency), `\"position_locked\"`, `\"mmp_trigger\"` (market maker protection), `\"mmp_config_curtailment\"` (market maker configured quantity decreased), `\"edit_post_only_reject\"` (cancelled on edit because of `reject_post_only` setting), `\"oco_other_closed\"` (the oco order linked to this order was closed), `\"oto_primary_closed\"` (the oto primary order that was going to trigger this order was cancelled), `\"settlement\"` (closed because of a settlement event, e.g. good-til-day orders are cancelled when an instrument enters the daily settlement). Note: orders cancelled because an instrument expired (delivery) currently do not include a `cancel_reason` field.", - "type": "string", - "enum": [ - "user_request", - "autoliquidation", - "cancel_on_disconnect", - "risk_mitigation", - "pme_risk_reduction", - "pme_account_locked", - "position_locked", - "mmp_trigger", - "mmp_config_curtailment", - "edit_post_only_reject", - "oco_other_closed", - "oto_primary_closed", - "settlement" - ] - }, - "chart_volume": { - "description": "// todo", - "type": "number" - }, - "close_out_margin": { - "description": "Close-out margin threshold in the selected currency, equal to 50% of the positional maintenance margin.\nBecause it sits below `maintenance_margin`, it marks a later and more severe stage than ordinary liquidation: when `margin_balance` falls to or below this level, close-out liquidation takes over.\nOn a cross account with an outstanding loan it is not exactly half of the reported `maintenance_margin`: the loan's maintenance margin is included in `maintenance_margin` but excluded from the close-out threshold.\nReturned only when close-out margin is enabled on the platform.\n", - "type": "number", - "example": 0 - }, - "cod_scope": { - "description": "Informs if Cancel on Disconnect was checked for the current connection or the account", - "type": "string", - "enum": [ - "connection", - "account" - ] - }, - "combo": { - "type": "object", - "properties": { - "creation_timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "id": { - "$ref": "#/components/schemas/combo_id" - }, - "instrument_id": { - "$ref": "#/components/schemas/instrument_id" - }, - "legs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/combo_leg" - } - }, - "state": { - "$ref": "#/components/schemas/combo_state" - }, - "state_timestamp": { - "$ref": "#/components/schemas/timestamp" - } - } - }, - "combo_id": { - "description": "Unique combo identifier", - "type": "string", - "example": "BTC-FS-31DEC21-PERP" - }, - "combo_leg": { - "type": "object", - "properties": { - "amount": { - "$ref": "#/components/schemas/combo_leg_amount" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - } - } - }, - "combo_leg_amount": { - "description": "Size multiplier of a leg. A negative value indicates that the trades on given leg are in opposite direction to the combo trades they originate from", - "type": "integer", - "example": -1 - }, - "combo_state": { - "description": "Combo state: `\"active\"`, \"`inactive`\"", - "type": "string", - "enum": [ - "active", - "inactive" - ] - }, - "commission": { - "description": "Commission paid so far (in base currency)", - "type": "number" - }, - "continuation": { - "description": "Continuation token for pagination.", - "type": "string", - "example": "xY7T6cutS3t2B9YtaDkE6TS379oKnkzTvmEDUnEUP2Msa9xKWNNaT" - }, - "continuation_with_null": { - "description": "Continuation token for pagination. `NULL` when no continuation.", - "type": "integer", - "example": 429946 - }, - "contract_size": { - "description": "Contract size for the instrument, expressed in the same unit as the order amount. For inverse (reversed) futures and perpetuals this is USD — BTC-PERPETUAL has a contract size of 10 USD. For options, spots, and for linear futures and perpetuals it is the base currency coin — BTC_USDC-PERPETUAL has a contract size of 0.0001 BTC. Note that on an inverse instrument `base_currency` identifies the underlying and settlement coin and does not indicate the unit of `contract_size`.", - "type": "number", - "example": 10 - }, - "contracts": { - "description": "It represents the order size in contract units. (Optional, may be absent in historical data).", - "type": "number" - }, - "currency": { - "description": "Currency, i.e `\"BTC\"`, `\"ETH\"`, `\"USDC\"`", - "type": "string", - "enum": [ - "BTC", - "ETH", - "USDC", - "USDT", - "EURR" - ] - }, - "currency_amount": { - "description": "Amount of funds in given currency", - "type": "number", - "example": 1 - }, - "currency_portfolio": { - "type": "object", - "properties": { - "additional_reserve": { - "$ref": "#/components/schemas/additional_reserve" - }, - "available_funds": { - "description": "The account's available funds. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number" - }, - "available_withdrawal_funds": { - "description": "The account's available to withdrawal funds", - "type": "number" - }, - "balance": { - "description": "The account's balance", - "type": "number" - }, - "currency": { - "description": "The selected currency", - "type": "string", - "enum": [ - "btc", - "eth" - ] - }, - "equity": { - "description": "The account's current equity", - "type": "number" - }, - "initial_margin": { - "description": "The account's initial margin. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number" - }, - "maintenance_margin": { - "description": "The maintenance margin. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number" - }, - "margin_balance": { - "description": "The account's margin balance. When cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.", - "type": "number" - }, - "spot_reserve": { - "description": "The account's balance reserved in active spot orders", - "type": "number" - } - }, - "required": [ - "margin_balance", - "currency", - "maintenance_margin", - "initial_margin", - "equity", - "balance", - "available_withdrawal_funds", - "available_funds", - "additional_reserve", - "spot_reserve" - ] - }, - "currency_with_any": { - "description": "Currency name or `\"any\"` if don't care", - "type": "string", - "enum": [ - "BTC", - "ETH", - "USDC", - "USDT", - "EURR", - "any" - ] - }, - "currency_with_any_and_grouped": { - "description": "Currency name or `\"any\"` if don't care or `\"grouped\"` if grouped by currencies", - "type": "string", - "enum": [ - "BTC", - "ETH", - "USDC", - "SOL", - "USDT", - "EURR", - "XRP", - "STETH", - "USYC", - "PAXG", - "BNB", - "USDE", - "any", - "grouped" - ] - }, - "currency_with_any_and_list": { - "description": "The currency symbol, list of currency symbols or `\"any\"` for all", - "oneOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ] - }, - "currency_with_apr": { - "type": "object", - "properties": { - "apr": { - "description": "Simple Moving Average (SMA) of the last 7 days of rewards. If fewer than 7 days of reward data are available, the APR is calculated as the average of the available rewards. Only applicable to yield-generating tokens (`USDE`, `STETH`, `USDC`, `BUILD`).", - "type": "number" - }, - "coin_type": { - "description": "The type of the currency.", - "type": "string", - "enum": [ - "BITCOIN", - "ETHER" - ] - }, - "currency": { - "description": "The abbreviation of the currency. This abbreviation is used elsewhere in the API to identify the currency.", - "type": "string", - "example": "BTC" - }, - "currency_long": { - "description": "The full name for the currency.", - "type": "string", - "example": "Bitcoin" - }, - "currency_uuid": { - "description": "Internal identifier for this currency. Absent if the currency does not have an assigned identifier.", - "type": "string", - "example": "5b71fc48-3dd3-540c-809b-f8c94d0e68b5" - }, - "decimals": { - "description": "The number of decimal places for the currency", - "type": "integer", - "example": 6 - }, - "in_cross_collateral_pool": { - "description": "`true` if the currency is part of the cross collateral pool", - "type": "boolean" - }, - "min_confirmations": { - "description": "Minimum number of block chain confirmations before deposit is accepted.", - "type": "integer", - "example": 2 - }, - "min_withdrawal_fee": { - "description": "The minimum transaction fee paid for withdrawals", - "type": "number", - "example": 0.0001 - }, - "network_currency": { - "description": "The currency of the network", - "type": "string", - "example": "BTC" - }, - "network_fee": { - "description": "The network fee", - "type": "number", - "example": 0.0001 - }, - "withdrawal_fee": { - "description": "The total transaction fee paid for withdrawals", - "type": "number", - "example": 0.0001 - }, - "withdrawal_priorities": { - "type": "array", - "items": { - "$ref": "#/components/schemas/key_number_pair" - } - } - }, - "required": [ - "currency", - "currency_long", - "min_confirmations", - "withdrawal_fee", - "coin_type", - "in_cross_collateral_pool" - ] - }, - "current_funding": { - "description": "Current funding (perpetual only)", - "type": "number" - }, - "date": { - "description": "The event date with year, month and day", - "type": "string", - "example": "2019-11-24" - }, - "delivery_price": { - "description": "The settlement price for the instrument. Only when `state = closed`", - "type": "number" - }, - "delta_total": { - "description": "The sum of position deltas. \n\n**DeltaTotal = Net Transaction Delta of options + BTC Position of Futures**\n\nThe DeltaTotal uses the Net Transaction Delta (or price adjusted Delta) of the options, where Net Transaction Delta = Black Scholes Delta - Mark Price of Options.\n\nThis is because, from a risk perspective, we are interested in the change in Bitcoin price as the underlying changes.\n\nYou should actually treat your delta as **Equity + Delta Total** if you want to have less risk for your USD PnL.\n\n⚠️ **During the 30 minute settlement period we decay your Delta.** See [Delta decay during settlement](https://support.deribit.com/hc/en-us/articles/25944751433757-Delta-decay-during-settlement) for more details.\n", - "type": "number", - "example": 0.1334 - }, - "delta_total_map": { - "description": "Map of position delta sums by price index (e.g. `btc_usd`), covering both futures and options positions.\nThese are raw position deltas: they are not price-adjusted for linear instruments and the options mark value is not subtracted.\nThey therefore do not add up to `delta_total`, which is calculated on the Net Transaction Delta basis described under `delta_total`.\n", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "direction": { - "description": "Direction: `buy`, or `sell`", - "type": "string", - "enum": [ - "buy", - "sell" - ] - }, - "display_amount": { - "description": "The actual display amount of iceberg order. Absent for other types of orders.", - "type": "number" - }, - "enabled_field": { - "description": "Current configuration status", - "type": "boolean", - "example": true - }, - "estimated_delivery_price": { - "description": "Estimated delivery price for the market. For more details, see Contract Specification > General Documentation > Expiration Price", - "type": "number", - "example": 11628.81 - }, - "expirations": { - "description": "A map where each key is valid currency (e.g. btc, eth, usdc), and the value is a list of expirations or a map where each key is a valid kind (future or options) and value is a list of expirations from every instrument", - "type": "object", - "properties": { - "currency": { - "$ref": "#/components/schemas/currency_with_any_and_grouped" - }, - "kind": { - "$ref": "#/components/schemas/kind_future_or_option_with_any" - } - } - }, - "fee_balance": { - "description": "The account's fee balance (it can be used to pay for fees)", - "type": "number" - }, - "fee_role": { - "description": "Fee role of the user: `maker` or `taker`. Can be different from trade role of the user when iceberg order was involved in matching.", - "type": "string", - "enum": [ - "maker", - "taker" - ] - }, - "filled_amount": { - "description": "Filled amount of the order. For perpetual and futures the filled_amount is in USD units, for options - in units or corresponding cryptocurrency contracts, e.g., BTC or ETH.", - "type": "number" - }, - "funding_8h": { - "description": "Funding 8h (perpetual only)", - "type": "number" - }, - "greeks": { - "description": "Only for options. Greeks are risk measures that describe how the option's price changes with respect to various factors.\n\n**Delta (Δ)**\n\nDeribit uses two different Deltas:\n- **DeltaTotal** in the account summary uses the **Net Transaction Delta (NTD)**\n- **Delta** for individual option expiries is the **Black Scholes Delta**\n\nIn the settings section you can toggle Net Transaction Delta instead.\n\n**What is DeltaTotal in the account summary?**\n`DeltaTotal = Net Transaction Delta of options + BTC Position of Futures`\n\n**What is Net Transaction Delta?**\n`Net Transaction Delta = Black Scholes Delta - Mark Price of Options`\n\n**Why do we use a Net Transaction Delta?**\nThe Delta Total uses the Net Transaction Delta (or price adjusted Delta) of the options. This is because, from a risk perspective, we are interested in the change in Bitcoin price as the underlying changes.\n\nYou should actually treat your delta as **Equity + Delta Total** if you want to have less risk for your USD PnL.\n\n**Example:** Consider a call option with strike 0, which has a Black Scholes Delta of 1 and Net Transaction Delta = 0.\n\nImagine you have 2 BTC equity and no positions and BTC price is at USD 60k. In that case you would short 2 Futures contracts to hedge your USD exposure to BTC.\n\nNow let's say you buy one call with strike 0. The question is if you should sell another future?\n\nThe call will always have a price of 1 BTC. So you buy it at 1 BTC which equates to USD 60k. Let's say the price increases to USD 70k. The value of the call is still 1 BTC. At settlement you receive 1 BTC for the call. So you paid 1 BTC and then receive 1 BTC which means your USD PnL on buying the call is 0. If you sold a future on it, then you would actually lose on the future.\n\n⚠️ **During the 30 minute settlement period we decay your Delta.** See [Delta decay during settlement](https://support.deribit.com/hc/en-us/articles/25944751433757-Delta-decay-during-settlement) for more details.\n\n**Theta (Θ)**\n\nThe Theta that Deribit uses is the **minimum of (1 day Theta, lifetime theta of the option)**. So if you take an option with 1 hour to expire for example, generally Black Scholes Theta will give you the equivalent 1 day Theta. Whereas we show the 1 hour Theta, so our Theta would differ from Black Scholes Theta when time to expiry is less than 1 day.\n\n**Vega, Gamma, and Rho**\n\nVega (not actually a Greek symbol), Gamma, Theta and Rho values shown on Deribit are calculated using **standard Black Scholes without adjustments**.\n", - "type": "object", - "properties": { - "delta": { - "description": "(Only for option) The delta value for the option. This is the **Black Scholes Delta** for individual option expiries. \n\nNote that DeltaTotal in account summary uses Net Transaction Delta instead. See the greeks object description for more details.\n", - "type": "number" - }, - "gamma": { - "description": "(Only for option) The gamma value for the option. Calculated using standard Black Scholes without adjustments.\n\nGamma measures the rate of change of delta with respect to changes in the underlying asset price.\n", - "type": "number" - }, - "rho": { - "description": "(Only for option) The rho value for the option. Calculated using standard Black Scholes without adjustments.\n\nRho measures the sensitivity of the option price to changes in the risk-free interest rate.\n", - "type": "number" - }, - "theta": { - "description": "(Only for option) The theta value for the option. Deribit uses the **minimum of (1 day Theta, lifetime theta of the option)**.\n\nSo if you take an option with 1 hour to expire for example, generally Black Scholes Theta will give you the equivalent 1 day Theta. Whereas we show the 1 hour Theta, so our Theta would differ from Black Scholes Theta when time to expiry is less than 1 day.\n\nTheta measures the rate of change of the option price with respect to time decay.\n", - "type": "number" - }, - "vega": { - "description": "(Only for option) The vega value for the option. Calculated using standard Black Scholes without adjustments.\n\nVega (not actually a Greek symbol) measures the sensitivity of the option price to changes in implied volatility.\n", - "type": "number" - } - }, - "required": [ - "delta", - "gamma", - "rho", - "theta", - "vega" - ] - }, - "id": { - "description": "Unique identifier", - "type": "integer", - "example": 5967413 - }, - "implv": { - "description": "Implied volatility in percent. (Only if `advanced=\"implv\"`)", - "type": "number" - }, - "index_name": { - "description": "Index identifier, matches (base) cryptocurrency with quote currency", - "type": "string", - "enum": [ - "btc_usd", - "eth_usd", - "ada_usdc", - "algo_usdc", - "avax_usdc", - "bch_usdc", - "bnb_usdc", - "btc_usdc", - "btcdvol_usdc", - "buidl_usdc", - "doge_usdc", - "dot_usdc", - "eurr_usdc", - "eth_usdc", - "ethdvol_usdc", - "hype_usdc", - "link_usdc", - "ltc_usdc", - "near_usdc", - "paxg_usdc", - "shib_usdc", - "sol_usdc", - "steth_usdc", - "ton_usdc", - "trump_usdc", - "trx_usdc", - "uni_usdc", - "usde_usdc", - "usyc_usdc", - "xrp_usdc", - "btc_usdt", - "eth_usdt", - "eurr_usdt", - "sol_usdt", - "steth_usdt", - "usdc_usdt", - "usde_usdt", - "btc_eurr", - "btc_usde", - "btc_usyc", - "eth_btc", - "eth_eurr", - "eth_usde", - "eth_usyc", - "steth_eth", - "paxg_btc", - "drbfix-btc_usdc", - "drbfix-eth_usdc" - ] - }, - "index_price": { - "description": "Current index price", - "type": "number", - "example": 8247.27 - }, - "instrument": { - "type": "object", - "properties": { - "base_currency": { - "description": "The underlying currency being traded.", - "type": "string", - "enum": [ - "BTC", - "ETH" - ] - }, - "base_currency_uuid": { - "description": "Internal identifier for the base currency. Absent if the base currency does not have an assigned identifier.", - "type": "string", - "example": "5b71fc48-3dd3-540c-809b-f8c94d0e68b5" - }, - "block_trade_commission": { - "description": "Block Trade commission for instrument.", - "type": "number", - "example": 0.0005 - }, - "block_trade_min_trade_amount": { - "description": "Minimum amount for block trading.", - "type": "number", - "example": 25 - }, - "block_trade_tick_size": { - "description": "Specifies minimal price change for block trading.", - "type": "number", - "example": 0.01 - }, - "contract_size": { - "description": "Contract size for the instrument, expressed in the same unit as the order amount. For inverse (reversed) futures and perpetuals this is USD — BTC-PERPETUAL has a contract size of 10 USD. For options, spots, and for linear futures and perpetuals it is the base currency coin — BTC_USDC-PERPETUAL has a contract size of 0.0001 BTC. Note that on an inverse instrument `base_currency` identifies the underlying and settlement coin and does not indicate the unit of `contract_size`.", - "type": "number", - "example": 1 - }, - "counter_currency": { - "description": "Counter currency for the instrument.", - "type": "string", - "enum": [ - "USD", - "USDC" - ] - }, - "creation_timestamp": { - "description": "The time when the instrument was first created (milliseconds since the UNIX epoch).", - "type": "integer", - "example": 1536569522277 - }, - "expiration_timestamp": { - "description": "The time when the instrument will expire (milliseconds since the UNIX epoch).", - "type": "integer" - }, - "future_type": { - "description": "Future type (only for futures)(field is deprecated and will be removed in the future, `instrument_type` should be used instead).", - "type": "string", - "enum": [ - "linear", - "reversed" - ] - }, - "index_id": { - "description": "Numeric identifier of the price index used by this instrument. Derived from the index currency pair, so all instruments sharing the same `price_index` also share the same `index_id`.", - "type": "integer", - "example": 1000004 - }, - "instrument_id": { - "$ref": "#/components/schemas/instrument_id" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - }, - "instrument_type": { - "description": "Type of the instrument. `linear` or `reversed`", - "type": "string" - }, - "is_active": { - "description": "Indicates if the instrument can currently be traded.", - "type": "boolean" - }, - "is_cbe_routed": { - "description": "Optional (only for spot routed to Coinbase Exchange). Alias of `is_csr` added by `public/get_instrument` and `public/get_instruments`; other surfaces that return instrument metadata, such as the `instrument.creation.{kind}.{currency}` notification, carry `is_csr` only. When present it is always `true` and is omitted for every other instrument, so test for its presence rather than for a `false` value.", - "type": "boolean" - }, - "is_csr": { - "description": "Optional (only for spot routed to Coinbase Exchange). When present it is always `true`, meaning orders on this instrument are routed to Coinbase Exchange (CBE) for matching instead of the native Deribit matching engine. The field is omitted for every other instrument, so test for its presence rather than for a `false` value.", - "type": "boolean" - }, - "kind": { - "$ref": "#/components/schemas/kind" - }, - "lot_size": { - "description": "Lot size for instrument, used as the unit for fee lot counting.", - "type": "number", - "example": 1 - }, - "maker_commission": { - "description": "Maker commission for instrument.", - "type": "number", - "example": 0.0001 - }, - "max_leverage": { - "description": "Maximal leverage for instrument (only for futures).", - "type": "integer", - "example": 100 - }, - "max_liquidation_commission": { - "description": "Maximal liquidation trade commission for instrument (only for futures).", - "type": "number", - "example": 0.001 - }, - "min_trade_amount": { - "description": "Minimum amount for trading. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "type": "number", - "example": 0.1 - }, - "option_type": { - "description": "The option type (only for options).", - "type": "string", - "enum": [ - "call", - "put" - ] - }, - "price_index": { - "$ref": "#/components/schemas/price_index" - }, - "product_group": { - "description": "Product group classification of the instrument's base currency. Determines gateway and multicast channel assignment — see [Underlying Tiers](https://docs.deribit.com/starbase/underlying-tiers).", - "type": "string", - "example": "BTC", - "enum": [ - "BTC", - "ETH", - "TIER_2", - "TIER_3" - ] - }, - "qty_tick_size": { - "description": "Minimum quantity change (step size) for order amounts on this instrument.", - "type": "number", - "example": 1 - }, - "quote_currency": { - "description": "The currency in which the instrument prices are quoted.", - "type": "string", - "enum": [ - "USD" - ] - }, - "quote_currency_uuid": { - "description": "Internal identifier for the quote currency. Absent if the quote currency does not have an assigned identifier.", - "type": "string", - "example": "2b92315d-eab7-5bef-84fa-089a131333f5" - }, - "settlement_currency": { - "description": "Optional (not added for spot). Settlement currency for the instrument.", - "type": "string", - "enum": [ - "BTC", - "ETH" - ] - }, - "settlement_period": { - "description": "Optional (not added for spot). The settlement period.", - "type": "string", - "enum": [ - "month", - "week", - "perpetual" - ] - }, - "state": { - "$ref": "#/components/schemas/book_state" - }, - "strike": { - "description": "The strike value (only for options).", - "type": "number" - }, - "taker_commission": { - "description": "Taker commission for instrument.", - "type": "number", - "example": 0.0005 - }, - "tick_size": { - "description": "Specifies minimal price change and, as follows, the number of decimal places for instrument prices.", - "type": "number", - "example": 0.0001 - }, - "tick_size_steps": { - "$ref": "#/components/schemas/tick_size_step" - }, - "underlying_type": { - "description": "The type of the underlying asset.", - "type": "string", - "enum": [ - "crypto", - "equity", - "commodity", - "preipo", - "equity_etf", - "crypto_index", - "adr", - "foreign_equity", - "equity_index", - "commodity_index", - "commodity_etf", - "otc" - ] - } - }, - "required": [ - "kind", - "base_currency", - "quote_currency", - "min_trade_amount", - "instrument_name", - "is_active", - "settlement_period", - "creation_timestamp", - "tick_size", - "expiration_timestamp", - "contract_size", - "price_index", - "index_id", - "product_group", - "underlying_type" - ] - }, - "instrument_id": { - "description": "Instrument ID", - "type": "integer" - }, - "instrument_name": { - "description": "Unique instrument identifier", - "type": "string", - "example": "BTC-PERPETUAL" - }, - "interest_rate": { - "description": "Interest rate used in implied volatility calculations (options only)", - "type": "number" - }, - "interest_value": { - "description": "Value used to calculate `realized_funding` in positions (perpetual only)", - "type": "number" - }, - "is_secondary_oto": { - "description": "`true` if the order is an order that can be triggered by another order, otherwise not present.", - "type": "boolean" - }, - "key_number_pair": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "value": { - "type": "number" - } - }, - "required": [ - "name", - "value" - ] - }, - "kind": { - "description": "Instrument kind: `\"future\"`, `\"option\"`, `\"spot\"`, `\"future_combo\"`, `\"option_combo\"`", - "type": "string", - "enum": [ - "future", - "option", - "spot", - "future_combo", - "option_combo" - ] - }, - "kind_future_or_option_with_any": { - "description": "Instrument kind: `\"future\"`, `\"option\"` or `\"any\"` for all", - "type": "string", - "enum": [ - "future", - "option", - "any" - ] - }, - "kind_with_combo_all": { - "description": "Instrument kind: `\"future\"`, `\"option\"`, `\"spot\"`, `\"future_combo\"`, `\"option_combo\"`, `\"combo\"` for any combo or `\"any\"` for all", - "type": "string", - "enum": [ - "future", - "option", - "spot", - "future_combo", - "option_combo", - "combo", - "any" - ] - }, - "kind_without_spot": { - "description": "Instrument kind: `\"future\"`, `\"option\"`, `\"future_combo\"`, `\"option_combo\"` (spot is excluded as spot trades are settled immediately and have no open positions)", - "type": "string", - "enum": [ - "future", - "option", - "future_combo", - "option_combo" - ] - }, - "label": { - "description": "User defined label (up to 64 characters)", - "type": "string" - }, - "label_presentation": { - "description": "User defined label (presented only when previously set for order by user)", - "type": "string" - }, - "last_price": { - "description": "The price for the last trade", - "type": [ - "number", - "null" - ] - }, - "leg_structure": { - "type": "array", - "items": { - "properties": { - "direction": { - "description": "Direction: `buy`, or `sell`", - "type": "string", - "enum": [ - "buy", - "sell" - ] - }, - "instrument_name": { - "description": "Unique instrument identifier", - "type": "string", - "example": "BTC-PERPETUAL" - }, - "price": { - "description": "Price for a leg", - "type": "number" - }, - "ratio": { - "description": "Ratio of amount between legs", - "type": "integer" - } - }, - "type": "object" - } - }, - "locked_balance": { - "description": "Portion of the account balance that is locked and excluded from available withdrawal calculations.", - "type": "number", - "example": 0 - }, - "mark_iv": { - "description": "(Only for option) implied volatility for mark price", - "type": "number" - }, - "mark_price": { - "description": "The mark price for the instrument", - "type": "number" - }, - "max_price": { - "description": "The maximum price for the future. Any buy orders you submit higher than this price, will be clamped to this maximum.", - "type": "number" - }, - "min_price": { - "description": "The minimum price for the future. Any sell orders you submit lower than this price will be clamped to this minimum.", - "type": "number" - }, - "mobile": { - "description": "Optional field with value `true` added only when created with Mobile Application", - "type": "boolean" - }, - "nonce": { - "description": "Nonce", - "type": "string", - "example": "bF1_gfgcsd" - }, - "oco_ref": { - "description": "Unique reference that identifies a one_cancels_others (OCO) pair.", - "type": "string" - }, - "open_interest": { - "description": "The total amount of outstanding contracts in the corresponding amount units. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "type": "number" - }, - "open_order_price": { - "description": "Price in base currency or \"market_price\" in case of open trigger market orders", - "oneOf": [ - { - "type": "number" - }, - { - "enum": [ - "market_price" - ], - "type": "string" - } - ] - }, - "order": { - "type": "object", - "properties": { - "advanced": { - "$ref": "#/components/schemas/advanced" - }, - "amount": { - "$ref": "#/components/schemas/amount" - }, - "api": { - "$ref": "#/components/schemas/api" - }, - "app_name": { - "description": "The name of the application that placed the order on behalf of the user (optional).", - "type": "string", - "example": "Example Application" - }, - "auto_replaced": { - "description": "Options, advanced orders only - `true` if last modification of the order was performed by the pricing engine, otherwise `false`.", - "type": "boolean" - }, - "average_price": { - "$ref": "#/components/schemas/average_price" - }, - "block_trade": { - "$ref": "#/components/schemas/block_trade_order" - }, - "cancel_reason": { - "$ref": "#/components/schemas/cancel_reason" - }, - "combo_order_id": { - "description": "Id of the combo order that created this order (only present for orders that were created as legs of a combo order).", - "type": "string", - "example": "103148386169" - }, - "contracts": { - "$ref": "#/components/schemas/contracts" - }, - "creation_timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "direction": { - "$ref": "#/components/schemas/direction" - }, - "display_amount": { - "$ref": "#/components/schemas/display_amount" - }, - "filled_amount": { - "$ref": "#/components/schemas/filled_amount" - }, - "implv": { - "$ref": "#/components/schemas/implv" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - }, - "is_liquidation": { - "description": "Optional (not added for spot). `true` if order was automatically created during liquidation", - "type": "boolean" - }, - "is_primary_otoco": { - "description": "`true` if the order is an order that can trigger an OCO pair, otherwise not present.", - "type": "boolean" - }, - "is_rebalance": { - "description": "Optional (only for spot). `true` if order was automatically created during cross-collateral balance restoration", - "type": "boolean" - }, - "is_secondary_oto": { - "$ref": "#/components/schemas/is_secondary_oto" - }, - "isolated": { - "description": "Flag indicating whether the order belongs to an isolated margin subaccount. Present and true on isolated orders only.", - "type": "boolean" - }, - "label": { - "$ref": "#/components/schemas/label" - }, - "last_update_timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "main_uid": { - "description": "User identifier for the owning main account. Present on isolated orders only.", - "type": "integer" - }, - "mmp": { - "description": "`true` if the order is a MMP order, otherwise `false`.", - "type": "boolean" - }, - "mmp_cancelled": { - "description": "`true` if order was cancelled by mmp trigger (optional)", - "type": "boolean", - "example": true - }, - "mmp_group": { - "description": "Name of the MMP group supplied in the `private/mass_quote` request. Only present for quote orders.", - "type": "string" - }, - "mobile": { - "$ref": "#/components/schemas/mobile" - }, - "oco_ref": { - "$ref": "#/components/schemas/oco_ref" - }, - "order_id": { - "$ref": "#/components/schemas/order_id" - }, - "order_state": { - "$ref": "#/components/schemas/order_state" - }, - "order_type": { - "$ref": "#/components/schemas/order_type" - }, - "original_order_type": { - "$ref": "#/components/schemas/original_order_type" - }, - "oto_order_ids": { - "description": "The Ids of the orders that will be triggered if the order is filled", - "type": "array", - "items": { - "$ref": "#/components/schemas/order_id", - "description": "Order Id" - } - }, - "post_only": { - "$ref": "#/components/schemas/post_only" - }, - "price": { - "$ref": "#/components/schemas/open_order_price" - }, - "primary_order_id": { - "description": "ID of the order that triggered this order.", - "$ref": "#/components/schemas/order_id" - }, - "quote": { - "description": "If order is a quote. Present only if true.", - "type": "boolean" - }, - "quote_id": { - "description": "The same QuoteID as supplied in the `private/mass_quote` request. Only present for quote orders.", - "type": "string" - }, - "quote_set_id": { - "description": "Identifier of the QuoteSet supplied in the `private/mass_quote` request. Only present for quote orders.", - "type": "string" - }, - "reduce_only": { - "$ref": "#/components/schemas/reduce_only" - }, - "refresh_amount": { - "$ref": "#/components/schemas/refresh_amount" - }, - "reject_post_only": { - "$ref": "#/components/schemas/reject_post_only" - }, - "replaced": { - "description": "`true` if the order was edited (by user or - in case of advanced options orders - by pricing engine), otherwise `false`.", - "type": "boolean" - }, - "risk_reducing": { - "description": "`true` if the order is marked by the platform as a risk reducing order (can apply only to orders placed by PM users), otherwise `false`.", - "type": "boolean" - }, - "starbase_client_order_id": { - "description": "Client order id of an order submitted directly to [Starbase](https://docs.deribit.com/starbase/overview) via direct access; not returned for orders placed through the Deribit API (combo legs inherit the parent combo order's client order id)", - "type": "string" - }, - "starbase_last_update_timestamp": { - "$ref": "#/components/schemas/starbase_last_update_timestamp" - }, - "starbase_order_id": { - "description": "Raw Starbase order id, in Starbase's own (non currency-prefixed) id namespace. Only present for orders placed in Starbase. Combo leg orders expose the parent combo order's Starbase order id.", - "type": "integer", - "example": 103148386170 - }, - "time_in_force": { - "$ref": "#/components/schemas/time_in_force" - }, - "trigger": { - "$ref": "#/components/schemas/trigger" - }, - "trigger_fill_condition": { - "$ref": "#/components/schemas/trigger_fill_condition" - }, - "trigger_offset": { - "$ref": "#/components/schemas/trigger_offset" - }, - "trigger_order_id": { - "description": "Id of the trigger order that created the order (Only for orders that were created by triggered orders).", - "type": "string", - "example": "SLIB-370" - }, - "trigger_price": { - "$ref": "#/components/schemas/trigger_price" - }, - "trigger_reference_price": { - "$ref": "#/components/schemas/trigger_reference_price" - }, - "triggered": { - "$ref": "#/components/schemas/triggered" - }, - "usd": { - "$ref": "#/components/schemas/usd" - }, - "user_id": { - "description": "User identifier for the account that owns the order. For isolated orders, this is the subaccount ID.", - "type": "integer" - }, - "web": { - "$ref": "#/components/schemas/web" - } - }, - "required": [ - "order_id", - "order_state", - "order_type", - "time_in_force", - "instrument_name", - "creation_timestamp", - "last_update_timestamp", - "direction", - "price", - "label", - "post_only", - "api" - ] - }, - "order_id": { - "description": "Unique order identifier", - "type": "string", - "example": "ETH-100234" - }, - "order_id_initial_margin_pair": { - "type": "object", - "properties": { - "initial_margin": { - "description": "Initial margin of order", - "type": "number" - }, - "initial_margin_currency": { - "description": "Currency of initial margin", - "type": "string" - }, - "order_id": { - "$ref": "#/components/schemas/order_id" - } - }, - "required": [ - "order_id", - "initial_margin" - ] - }, - "order_state": { - "description": "Order state: `\"open\"`, `\"filled\"`, `\"rejected\"`, `\"cancelled\"`, `\"untriggered\"`", - "type": "string", - "enum": [ - "open", - "filled", - "rejected", - "cancelled", - "untriggered", - "triggered" - ] - }, - "order_state_in_user_trade": { - "description": "Order state: `\"open\"`, `\"filled\"`, `\"rejected\"`, `\"cancelled\"`, `\"untriggered\"` or `\"archive\"` (if order was archived)", - "type": "string", - "enum": [ - "open", - "filled", - "rejected", - "cancelled", - "untriggered", - "archive" - ] - }, - "order_state_stop": { - "description": "Order state: `\"triggered\"`, `\"cancelled\"`, or `\"rejected\"` with rejection reason (e.g. `\"rejected:reduce_direction\"`).", - "type": "string" - }, - "order_type": { - "description": "Order type: `\"limit\"`, `\"market\"`, `\"stop_limit\"`, `\"stop_market\"`, `\"take_limit\"`, `\"take_market\"`, `\"trailing_stop\"`", - "type": "string", - "enum": [ - "market", - "limit", - "stop_market", - "stop_limit", - "take_market", - "take_limit", - "trailing_stop" - ] - }, - "order_type2": { - "description": "Order type: `\"all\"`, `\"limit\"`, `\"trigger_all\"`, `\"stop_all\"`, `\"stop_limit\"`, `\"stop_market\"`, `\"take_all\"`, `\"take_limit\"`, `\"take_market\"`, `\"trailing_all\"`, `\"trailing_stop\"`", - "type": "string", - "enum": [ - "all", - "limit", - "trigger_all", - "stop_all", - "stop_limit", - "stop_market", - "take_all", - "take_limit", - "take_market", - "trailing_all", - "trailing_stop" - ] - }, - "orders": { - "type": "array", - "items": { - "$ref": "#/components/schemas/order" - } - }, - "original_order_type": { - "description": "Original API order type when an order is represented internally as a limit order. For example, Starbase market orders use `\"limit\"` as `order_type` with `\"market\"` in this optional field.", - "type": "string", - "enum": [ - "market", - "market_limit" - ] - }, - "pme_currency": { - "description": "The currency for which the Extended Risk Matrix will be calculated. Use `CROSS` for Cross Collateral simulation.", - "type": "string", - "enum": [ - "BTC", - "ETH", - "USDC", - "USDT", - "CROSS" - ] - }, - "portfolio": { - "type": "object", - "properties": { - "btc(example)": { - "$ref": "#/components/schemas/currency_portfolio" - } - } - }, - "position": { - "type": "object", - "properties": { - "average_price": { - "description": "Average price of trades that built this position", - "type": "number" - }, - "average_price_usd": { - "description": "Only for options, average price in USD", - "type": "number" - }, - "delta": { - "description": "Delta parameter", - "type": "number" - }, - "direction": { - "$ref": "#/components/schemas/position_direction" - }, - "floating_profit_loss": { - "description": "Floating profit or loss", - "type": "number" - }, - "floating_profit_loss_usd": { - "description": "Only for options, floating profit or loss in USD", - "type": "number" - }, - "gamma": { - "description": "Only for options, Gamma parameter", - "type": "number" - }, - "index_price": { - "description": "Current index price", - "type": "number" - }, - "initial_margin": { - "description": "Initial margin", - "type": "number" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - }, - "interest_value": { - "description": "Value used to calculate `realized_funding` (perpetual only)", - "type": "number" - }, - "isolated": { - "description": "Flag indicating whether the position is held by an isolated margin subaccount. Present and true on isolated positions only.", - "type": "boolean" - }, - "kind": { - "$ref": "#/components/schemas/kind" - }, - "leverage": { - "description": "Current available leverage for future position", - "type": "integer" - }, - "main_uid": { - "description": "User identifier for the owning main account. Present on isolated positions only.", - "type": "integer" - }, - "maintenance_margin": { - "description": "Maintenance margin", - "type": "number" - }, - "mark_price": { - "description": "Current mark price for position's instrument", - "type": "number" - }, - "realized_funding": { - "description": "Realized Funding in current session included in session realized profit or loss, only for positions of perpetual instruments", - "type": "number" - }, - "realized_profit_loss": { - "description": "Realized profit or loss", - "type": "number" - }, - "settlement_price": { - "description": "Optional (not added for spot). Last settlement price for position's instrument 0 if instrument wasn't settled yet", - "type": "number" - }, - "size": { - "description": "Position size for futures size in quote currency (e.g. USD), for options size is in base currency (e.g. BTC)", - "type": "number" - }, - "size_currency": { - "description": "Only for futures, position size in base currency", - "type": "number" - }, - "theta": { - "description": "Only for options, Theta parameter", - "type": "number" - }, - "total_profit_loss": { - "description": "Profit or loss from position", - "type": "number" - }, - "user_id": { - "$ref": "#/components/schemas/user_id" - }, - "vega": { - "description": "Only for options, Vega parameter", - "type": "number" - } - }, - "required": [ - "instrument_name", - "kind", - "user_id", - "average_price", - "direction", - "mark_price", - "delta", - "index_price", - "initial_margin", - "maintenance_margin", - "settlement_price", - "total_profit_loss", - "floating_profit_loss", - "realized_profit_loss", - "size" - ] - }, - "position_direction": { - "description": "Direction: `buy`, `sell` or `zero`", - "type": "string", - "enum": [ - "buy", - "sell", - "zero" - ] - }, - "position_with_open_orders_margin": { - "allOf": [ - { - "$ref": "#/components/schemas/position" - }, - { - "properties": { - "estimated_liquidation_price": { - "description": "[DEPRECATED] Estimated liquidation price, present only for futures positions and always `null` — the value is no longer computed. The Estimated Liquidation Price (ELP) remains available via the Position Builder API.", - "type": [ - "number", - "null" - ] - }, - "open_orders_margin": { - "description": "Open orders margin, present only for future positions", - "type": "number" - } - } - } - ] - }, - "post_only": { - "description": "`true` for post-only orders only", - "type": "boolean" - }, - "price": { - "description": "Price in base currency", - "type": "number" - }, - "price_index": { - "description": "Name of price index that is used for this instrument", - "type": "string", - "example": "btc_usdc" - }, - "profit_loss": { - "description": "Profit and loss in base currency.", - "type": "number" - }, - "projected_close_out_margin": { - "description": "Close-out margin calculated as if instruments expiring at the nearest expiration were excluded, i.e. 50% of the projected positional maintenance margin.\nAs with `close_out_margin`, the loan maintenance margin counted in `projected_maintenance_margin` is excluded here, so on a cross account with an outstanding loan the two are not exactly proportional.\nReturned only when close-out margin is enabled on the platform.\n", - "type": "number", - "example": 0 - }, - "projected_delta_total": { - "description": "The sum of position deltas excluding positions that expire at the nearest expiration, so it shows the delta that will remain once those positions have expired.\nCalculated on the same Net Transaction Delta basis as `delta_total`, including delta decay during the settlement period.\n", - "type": "number", - "example": 0.1334 - }, - "projected_initial_margin": { - "description": "Initial margin calculated as if instruments expiring at the nearest expiration were excluded, so it shows the requirement that will remain once those instruments have expired.\nWhen cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.\n", - "type": "number", - "example": 1 - }, - "projected_maintenance_margin": { - "description": "Maintenance margin calculated as if instruments expiring at the nearest expiration were excluded, so it shows the requirement that will remain once those instruments have expired.\nWhen cross collateral is enabled, this aggregated value is calculated by converting the sum of each cross collateral currency's value to the given currency, using each cross collateral currency's index.\n", - "type": "number", - "example": 1 - }, - "public_trade": { - "type": "object", - "properties": { - "amount": { - "description": "Trade amount. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "type": "number" - }, - "block_rfq_id": { - "description": "ID of the Block RFQ - when trade was part of the Block RFQ", - "type": "integer" - }, - "block_trade_id": { - "$ref": "#/components/schemas/block_trade_id_in_result" - }, - "block_trade_leg_count": { - "$ref": "#/components/schemas/block_trade_leg_count" - }, - "combo_id": { - "description": "Optional field containing combo instrument name if the trade is a combo trade", - "type": "string" - }, - "combo_trade_id": { - "description": "Optional field containing combo trade identifier if the trade is a combo trade", - "type": "string" - }, - "contracts": { - "description": "Trade size in contract units (optional, may be absent in historical trades)", - "type": "number" - }, - "direction": { - "description": "Trade direction of the taker", - "$ref": "#/components/schemas/direction" - }, - "index_price": { - "description": "Index Price at the moment of trade", - "type": "number" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - }, - "iv": { - "description": "Option implied volatility for the price (Option only)", - "type": "number" - }, - "liquidation": { - "description": "Optional field (only for trades caused by liquidation): `\"M\"` when maker side of trade was under liquidation, `\"T\"` when taker side was under liquidation, `\"MT\"` when both sides of trade were under liquidation", - "type": "string", - "enum": [ - "M", - "T", - "MT" - ] - }, - "mark_price": { - "description": "Mark Price at the moment of trade", - "type": "number" - }, - "price": { - "description": "The price of the trade", - "$ref": "#/components/schemas/price" - }, - "starbase_match_id": { - "description": "Optional field containing the Starbase match identifier (present only for trades matched via Starbase)", - "type": "integer" - }, - "starbase_timestamp": { - "description": "Optional field: the Starbase causal timestamp of the trade, in nanoseconds since the UNIX epoch (present only for trades matched in Starbase)", - "$ref": "#/components/schemas/starbase_timestamp" - }, - "tick_direction": { - "$ref": "#/components/schemas/tick_direction" - }, - "timestamp": { - "$ref": "#/components/schemas/trade_timestamp" - }, - "trade_id": { - "$ref": "#/components/schemas/trade_id" - }, - "trade_seq": { - "$ref": "#/components/schemas/trade_seq" - } - }, - "required": [ - "trade_id", - "instrument_name", - "timestamp", - "trade_seq", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "mark_price" - ] - }, - "quote_price": { - "description": "Price in quote currency", - "type": "number" - }, - "reduce_only": { - "description": "Optional (not added for spot). '`true` for reduce-only orders only'", - "type": "boolean" - }, - "refresh_amount": { - "description": "The initial display amount of iceberg order. Iceberg order display amount will be refreshed to that value after match consuming actual display amount. Absent for other types of orders", - "type": "number" - }, - "reject_post_only": { - "description": "`true` if order has `reject_post_only` flag (field is present only when `post_only` is `true`)", - "type": "boolean" - }, - "role": { - "description": "Trade role of the user: `maker` or `taker`", - "type": "string", - "enum": [ - "maker", - "taker" - ] - }, - "rpl": { - "description": "Realized profit and loss accrued in the current trading session (since the last daily settlement). Resets at each daily settlement.", - "type": "number", - "example": 0.1 - }, - "settlement": { - "type": "object", - "properties": { - "funded": { - "description": "funded amount (bankruptcy only)", - "type": "number", - "example": 0 - }, - "funding": { - "description": "funding (in base currency ; settlement for perpetual product only)", - "type": "number", - "example": -0.000002511 - }, - "index_price": { - "description": "underlying index price at time of event (in quote currency; settlement and delivery only)", - "type": "number", - "example": 11008.37 - }, - "instrument_name": { - "description": "instrument name (settlement and delivery only)", - "type": "string", - "example": "BTC-30MAR18" - }, - "mark_price": { - "description": "mark price for at the settlement time (in quote currency; settlement and delivery only)", - "type": "number", - "example": 11000 - }, - "position": { - "description": "position size (in quote currency; settlement and delivery only)", - "type": "number", - "example": 1000 - }, - "profit_loss": { - "description": "Platform-wide aggregate realized profit and loss for this settlement event, in base currency. This is the sum of the realized P&L of every position holder at the settlement or delivery price — it is **not** a per-account value. Present for `settlement` and `delivery` types only.", - "type": "number", - "example": 0 - }, - "session_bankruptcy": { - "description": "value of session bankruptcy (in base currency; bankruptcy only)", - "type": "number", - "example": 0.001160788 - }, - "session_profit_loss": { - "description": "Platform-wide aggregate total session profit and loss for this settlement event, in base currency. This is the sum of each position holder's session P&L (combining realized and unrealized components) across all users who held positions in the instrument — it is **not** a per-account value.", - "type": "number", - "example": 0.001160788 - }, - "session_tax": { - "description": "total amount of paid taxes/fees (in base currency; bankruptcy only)", - "type": "number", - "example": -0.001160788 - }, - "session_tax_rate": { - "description": "rate of paid taxes/fees (in base currency; bankruptcy only)", - "type": "number", - "example": 0.000103333 - }, - "socialized": { - "description": "the amount of the socialized losses (in base currency; bankruptcy only)", - "type": "number", - "example": -0.001160788 - }, - "timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "type": { - "$ref": "#/components/schemas/settlement_type" - } - }, - "required": [ - "type", - "timestamp", - "session_profit_loss", - "position", - "instrument_name", - "index_price", - "funding" - ] - }, - "settlement_currency_with_any_and_grouped": { - "description": "Currency name or `\"any\"` if don't care or `\"grouped\"` if grouped by currencies", - "type": "string", - "enum": [ - "BTC", - "ETH", - "USDC", - "USDT", - "any", - "grouped" - ] - }, - "settlement_price": { - "description": "Optional (not added for spot). The settlement price for the instrument. Only when `state = open`", - "type": "number" - }, - "settlement_type": { - "description": "The type of settlement event. `settlement`: daily settlement of futures and perpetual positions at 08:00 UTC, converting unrealized profit and loss into realized profit and loss (option positions do not settle). `delivery`: one-time expiration of a futures or options contract at 08:00 UTC, closing any remaining open position at the delivery price (does not apply to perpetual or spot instruments). `bankruptcy`.", - "type": "string", - "enum": [ - "settlement", - "delivery", - "bankruptcy" - ] - }, - "simple_order_type": { - "description": "Order type: `\"all\"`, `\"limit\"`, `\"stop\"`, `\"take\"`, `\"trailing_stop\"`, `\"trailing_take\"`", - "type": "string", - "enum": [ - "all", - "limit", - "trigger_all", - "stop", - "take", - "trailing_stop" - ] - }, - "sorting": { - "type": "string", - "enum": [ - "asc", - "desc", - "default" - ] - }, - "starbase_last_update_timestamp": { - "description": "The Starbase causal timestamp (nanoseconds since the Unix epoch) of the last book update that affected this order. Present only for orders placed in Starbase, including combo leg order updates; not always available for direct access orders", - "type": "integer", - "example": 1536569522277000000 - }, - "starbase_timestamp": { - "description": "The Starbase causal timestamp of the trade (nanoseconds since the Unix epoch)", - "type": "integer", - "example": 1536569522277000000 - }, - "stats": { - "type": "object", - "properties": { - "high": { - "description": "Highest price during 24h", - "type": "number" - }, - "low": { - "description": "Lowest price during 24h", - "type": "number" - }, - "price_change": { - "description": "24-hour price change expressed as a percentage, `null` if there weren't any trades", - "type": "number", - "example": 10.23 - }, - "volume": { - "description": "Volume during last 24h in base currency", - "type": "number" - }, - "volume_usd": { - "$ref": "#/components/schemas/volume_usd" - } - }, - "required": [ - "volume", - "high", - "low" - ] - }, - "tick_direction": { - "description": "Direction of the \"tick\" (`0` = Plus Tick, `1` = Zero-Plus Tick, `2` = Minus Tick, `3` = Zero-Minus Tick).", - "type": "integer", - "enum": [ - 0, - 1, - 2, - 3 - ] - }, - "tick_size_step": { - "type": "object", - "properties": { - "above_price": { - "description": "The price from which the increased tick size applies", - "type": "number" - }, - "tick_size": { - "description": "Tick size to be used above the price. It must be multiple of the minimum tick size.", - "type": "number" - } - } - }, - "time_in_force": { - "description": "Order time in force: `\"good_til_cancelled\"`, `\"good_til_day\"`, `\"fill_or_kill\"` or `\"immediate_or_cancel\"`", - "type": "string", - "enum": [ - "good_til_cancelled", - "good_til_day", - "fill_or_kill", - "immediate_or_cancel" - ] - }, - "timestamp": { - "description": "The timestamp (milliseconds since the Unix epoch)", - "type": "integer", - "example": 1536569522277 - }, - "trade_id": { - "description": "Unique (per currency) trade identifier", - "type": "string" - }, - "trade_seq": { - "description": "The sequence number of the trade within instrument", - "type": "integer" - }, - "trade_timestamp": { - "description": "The timestamp of the trade (milliseconds since the UNIX epoch)", - "type": "integer", - "example": 1517329113791 - }, - "trades_volumes": { - "type": "object", - "properties": { - "calls_volume": { - "description": "Total 24h trade volume for call options.", - "type": "number", - "example": 20.1 - }, - "calls_volume_30d": { - "description": "Total 30d trade volume for call options.", - "type": "number", - "example": 547.3 - }, - "calls_volume_7d": { - "description": "Total 7d trade volume for call options.", - "type": "number", - "example": 75.6 - }, - "currency": { - "$ref": "#/components/schemas/currency" - }, - "futures_volume": { - "description": "Total 24h trade volume for futures.", - "type": "number", - "example": 30.5178 - }, - "futures_volume_30d": { - "description": "Total 30d trade volume for futures.", - "type": "number", - "example": 998.2128 - }, - "futures_volume_7d": { - "description": "Total 7d trade volume for futures.", - "type": "number", - "example": 213.8841 - }, - "puts_volume": { - "description": "Total 24h trade volume for put options.", - "type": "number", - "example": 60.2 - }, - "puts_volume_30d": { - "description": "Total 30d trade volume for put options.", - "type": "number", - "example": 785.5 - }, - "puts_volume_7d": { - "description": "Total 7d trade volume for put options.", - "type": "number", - "example": 356.9 - }, - "spot_volume": { - "description": "Total 24h trade for spot.", - "type": "number", - "example": 11.6 - }, - "spot_volume_30d": { - "description": "Total 30d trade for spot.", - "type": "number", - "example": 310.5 - }, - "spot_volume_7d": { - "description": "Total 7d trade for spot.", - "type": "number", - "example": 64.8 - } - }, - "required": [ - "currency", - "futures_volume", - "puts_volume", - "calls_volume" - ] - }, - "transaction_log": { - "type": "object", - "properties": { - "amount": { - "description": "It represents the requested order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "type": "number" - }, - "balance": { - "description": "Cash balance after the transaction", - "type": "number" - }, - "block_rfq_id": { - "description": "ID of the Block RFQ - when trade was part of the Block RFQ", - "type": "integer" - }, - "cashflow": { - "description": "For futures and perpetual contracts: Realized session PNL (since last settlement). For options: the amount paid or received for the options traded.", - "type": "number" - }, - "change": { - "description": "Change in cash balance. For trades: fees and options premium paid/received. For settlement: Futures session PNL and perpetual session funding.", - "type": "number" - }, - "commission": { - "$ref": "#/components/schemas/commission" - }, - "contracts": { - "$ref": "#/components/schemas/contracts" - }, - "currency": { - "$ref": "#/components/schemas/currency" - }, - "equity": { - "description": "Updated equity value after the transaction", - "type": "number" - }, - "fee_role": { - "$ref": "#/components/schemas/fee_role" - }, - "id": { - "$ref": "#/components/schemas/id" - }, - "index_price": { - "description": "The index price for the instrument during the delivery", - "type": "number" - }, - "info": { - "description": "Additional information regarding transaction. Strongly dependent on the log entry type", - "type": "object" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - }, - "interest_pl": { - "description": "Funding PnL amount for the interval between this log entry and the previous trade or position change on perpetual instruments", - "type": "number" - }, - "ip": { - "description": "The IP address from which the trade was initiated", - "type": "string" - }, - "mark_price": { - "description": "Market price during the trade", - "type": "number" - }, - "order_id": { - "$ref": "#/components/schemas/order_id" - }, - "position": { - "description": "Updated position size after the transaction", - "type": "number" - }, - "price": { - "description": "Settlement/delivery price or the price level of the traded contracts", - "type": "number" - }, - "price_currency": { - "description": "Currency symbol associated with the `price` field value", - "type": "string" - }, - "profit_as_cashflow": { - "description": "Indicator informing whether the cashflow is waiting for settlement or not", - "type": "boolean" - }, - "role": { - "description": "For `LSP transfer`, `ADL transfer` and `liquidation transfer` entries, indicates which side of the position move this entry represents: `source` (the liquidated account) or `destination` (the account receiving the position, e.g. an LSP participant)", - "type": "string", - "enum": [ - "source", - "destination" - ] - }, - "session_rpl": { - "$ref": "#/components/schemas/rpl" - }, - "session_upl": { - "$ref": "#/components/schemas/upl" - }, - "settlement_price": { - "description": "The settlement price for the instrument during the delivery", - "type": "number" - }, - "side": { - "description": "One of: `short` or `long` in case of settlements, `close sell` or `close buy` in case of deliveries, `open sell`, `open buy`, `close sell`, `close buy` in case of trades", - "type": "string" - }, - "starbase_match_id": { - "description": "Starbase match id for `trade` entries executed in Starbase", - "type": "integer" - }, - "starbase_order_id": { - "description": "Raw Starbase order id for `trade` entries associated with orders placed in Starbase", - "type": "integer", - "example": 103148386170 - }, - "starbase_timestamp": { - "description": "Starbase causal timestamp for `trade` entries executed in Starbase", - "$ref": "#/components/schemas/starbase_timestamp" - }, - "timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "total_interest_pl": { - "description": "Total funding PnL accrued in the current trading session since the last daily settlement at 08:00 UTC, in the settlement currency. Resets at each daily settlement.", - "type": "number" - }, - "trade_id": { - "$ref": "#/components/schemas/trade_id" - }, - "type": { - "description": "Transaction category/type. The most common are: `trade`, `deposit`, `withdrawal`, `settlement`, `delivery`, `transfer`, `swap`, `correction`, `expiry`, `LSP transfer`, `LSP commission`, `ADL transfer`, `ADL commission`. New types can be added any time in the future", - "type": "string" - }, - "user_id": { - "$ref": "#/components/schemas/user_id" - }, - "user_role": { - "$ref": "#/components/schemas/role" - }, - "user_seq": { - "description": "Sequential identifier of user transaction", - "type": "integer" - }, - "username": { - "$ref": "#/components/schemas/username" - } - }, - "required": [ - "id", - "currency", - "timestamp", - "user_id", - "commission", - "cashflow", - "balance", - "change", - "user_seq", - "type" - ] - }, - "transfer_direction": { - "description": "Transfer direction", - "type": "string", - "enum": [ - "payment", - "income" - ] - }, - "transfer_id": { - "description": "Id of transfer", - "type": "integer", - "example": 12 - }, - "transfer_item": { - "type": "object", - "properties": { - "amount": { - "$ref": "#/components/schemas/currency_amount" - }, - "created_timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "currency": { - "$ref": "#/components/schemas/currency" - }, - "direction": { - "$ref": "#/components/schemas/transfer_direction" - }, - "id": { - "$ref": "#/components/schemas/transfer_id" - }, - "nonce": { - "description": "Optional idempotency nonce if provided in the request", - "type": "string" - }, - "other_side": { - "$ref": "#/components/schemas/transfer_other_side" - }, - "state": { - "$ref": "#/components/schemas/transfer_state" - }, - "type": { - "$ref": "#/components/schemas/transfer_type" - }, - "updated_timestamp": { - "$ref": "#/components/schemas/timestamp" - } - }, - "required": [ - "currency", - "id", - "type", - "amount", - "state", - "other_side", - "updated_timestamp", - "created_timestamp" - ] - }, - "transfer_other_side": { - "description": "For transfer from/to subaccount returns this subaccount name, for transfer to other account returns address, for transfer from other account returns that accounts username.", - "type": "string", - "example": "Smith" - }, - "transfer_state": { - "description": "Transfer state, allowed values : `prepared`, `confirmed`, `cancelled`, `waiting_for_admin`, `insufficient_funds`, `withdrawal_limit` otherwise rejection reason", - "type": "string" - }, - "transfer_type": { - "description": "Type of transfer: `user` - sent to user, `subaccount` - sent to subaccount", - "type": "string", - "enum": [ - "user", - "subaccount" - ] - }, - "trigger": { - "description": "Trigger type (only for trigger orders). Allowed values: `\"index_price\"`, `\"mark_price\"`, `\"last_price\"`.", - "type": "string", - "enum": [ - "index_price", - "mark_price", - "last_price" - ] - }, - "trigger_fill_condition": { - "description": "

The fill condition of the linked order (Only for linked order types), default: `first_hit`.

  • `\"first_hit\"` - any execution of the primary order will fully cancel/place all secondary orders.
  • `\"complete_fill\"` - a complete execution (meaning the primary order no longer exists) will cancel/place the secondary orders.
  • `\"incremental\"` - any fill of the primary order will cause proportional partial cancellation/placement of the secondary order. The amount that will be subtracted/added to the secondary order will be rounded down to the contract size.
", - "type": "string", - "enum": [ - "first_hit", - "complete_fill", - "incremental" - ] - }, - "trigger_offset": { - "description": "The maximum deviation from the price peak beyond which the order will be triggered (Only for trailing trigger orders)", - "type": "number" - }, - "trigger_order_history_record": { - "type": "object", - "properties": { - "amount": { - "$ref": "#/components/schemas/amount" - }, - "direction": { - "$ref": "#/components/schemas/direction" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - }, - "is_secondary_oto": { - "$ref": "#/components/schemas/is_secondary_oto" - }, - "label": { - "$ref": "#/components/schemas/label_presentation" - }, - "last_update_timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "oco_ref": { - "$ref": "#/components/schemas/oco_ref" - }, - "order_id": { - "$ref": "#/components/schemas/order_id" - }, - "order_state": { - "$ref": "#/components/schemas/order_state_stop" - }, - "order_type": { - "description": "Requested order type: `\"limit\"` or `\"market\"`", - "type": "string", - "enum": [ - "limit", - "market" - ] - }, - "post_only": { - "$ref": "#/components/schemas/post_only" - }, - "price": { - "$ref": "#/components/schemas/price" - }, - "reduce_only": { - "$ref": "#/components/schemas/reduce_only" - }, - "request": { - "description": "Type of last request performed on the trigger order by user or system. `\"cancel\"` - when order was cancelled, `\"trigger:order\"` - when trigger order spawned market or limit order after being triggered", - "type": "string", - "example": "trigger:order" - }, - "source": { - "description": "Source of the order that is linked to the trigger order.", - "type": "string", - "example": "api" - }, - "timestamp": { - "$ref": "#/components/schemas/timestamp" - }, - "trigger": { - "$ref": "#/components/schemas/trigger" - }, - "trigger_offset": { - "$ref": "#/components/schemas/trigger_offset" - }, - "trigger_order_id": { - "description": "Id of the user order used for the trigger-order reference before triggering", - "type": "string", - "example": "SLTB-187015" - }, - "trigger_price": { - "$ref": "#/components/schemas/trigger_price" - } - }, - "required": [ - "trigger", - "timestamp", - "trigger_price", - "trigger_order_id", - "order_state", - "request", - "post_only", - "order_type", - "price", - "order_id", - "trigger_offset", - "instrument_name", - "amount", - "direction", - "reduce_only" - ] - }, - "trigger_price": { - "description": "Trigger price (Only for future trigger orders)", - "type": "number" - }, - "trigger_reference_price": { - "description": "The price of the given trigger at the time when the order was placed (Only for trailing trigger orders)", - "type": "number" - }, - "triggered": { - "description": "Whether the trigger order has been triggered", - "type": "boolean" - }, - "underlying_index": { - "description": "Name of the underlying future, or `index_price` (options only)", - "type": "number" - }, - "underlying_price": { - "description": "Underlying price for implied volatility calculations (options only)", - "type": "number" - }, - "upl": { - "description": "Unrealized profit and loss on open positions in the current trading session (since the last daily settlement).", - "type": "number", - "example": 0.846863 - }, - "usd": { - "description": "Option price in USD (Only if `advanced=\"usd\"`)", - "type": "number" - }, - "user_id": { - "description": "Unique user identifier", - "type": "integer", - "example": 57874 - }, - "user_trade": { - "type": "object", - "properties": { - "advanced": { - "description": "Advanced type of user order: `\"usd\"` or `\"implv\"` (only for options; omitted if not applicable)", - "type": "string", - "enum": [ - "usd", - "implv" - ] - }, - "amount": { - "description": "Trade amount. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin.", - "type": "number" - }, - "api": { - "description": "`true` if user order was created with API", - "type": "boolean" - }, - "block_rfq_id": { - "description": "ID of the Block RFQ - when trade was part of the Block RFQ", - "type": "integer" - }, - "block_rfq_quote_id": { - "description": "ID of the Block RFQ quote - when trade was part of the Block RFQ", - "type": "integer" - }, - "block_trade_id": { - "$ref": "#/components/schemas/block_trade_id_in_result" - }, - "block_trade_leg_count": { - "$ref": "#/components/schemas/block_trade_leg_count" - }, - "combo_id": { - "description": "Optional field containing combo instrument name if the trade is a combo trade", - "type": "string" - }, - "combo_trade_id": { - "description": "Optional field containing combo trade identifier if the trade is a combo trade", - "type": "string" - }, - "contracts": { - "description": "Trade size in contract units (optional, may be absent in historical trades)", - "type": "number" - }, - "direction": { - "description": "Trade direction of the taker", - "$ref": "#/components/schemas/direction" - }, - "fee": { - "description": "User's fee in units of the specified `fee_currency`", - "type": "number" - }, - "fee_currency": { - "$ref": "#/components/schemas/currency" - }, - "index_price": { - "description": "Index Price at the moment of trade", - "type": "number" - }, - "instrument_name": { - "$ref": "#/components/schemas/instrument_name" - }, - "isolated": { - "description": "Flag indicating whether the trade belongs to an isolated margin subaccount. Present and true on isolated trades only.", - "type": "boolean" - }, - "iv": { - "description": "Option implied volatility for the price (Option only)", - "type": "number" - }, - "label": { - "$ref": "#/components/schemas/label_presentation" - }, - "legs": { - "description": "Optional field containing leg trades if trade is a combo trade (present when querying for **only** combo trades and in `combo_trades` events). Each leg trade has the same fields as a top-level user trade, including `starbase_match_id`, `starbase_order_id`, and `starbase_timestamp` when matched in Starbase, and `starbase_client_order_id` for orders submitted via [Starbase](https://docs.deribit.com/starbase/overview) direct access.", - "type": "array" - }, - "liquidation": { - "description": "Optional field (only for trades caused by liquidation): `\"M\"` when maker side of trade was under liquidation, `\"T\"` when taker side was under liquidation, `\"MT\"` when both sides of trade were under liquidation", - "type": "string", - "enum": [ - "M", - "T", - "MT" - ] - }, - "liquidity": { - "description": "Describes what was role of users order: `\"M\"` when it was maker order, `\"T\"` when it was taker order", - "type": "string", - "enum": [ - "M", - "T" - ] - }, - "main_uid": { - "description": "User identifier for the owning main account. Present on isolated trades only.", - "type": "integer" - }, - "mark_price": { - "description": "Mark Price at the moment of trade", - "type": "number" - }, - "matching_id": { - "description": "Always `null`", - "type": "string" - }, - "mmp": { - "description": "`true` if user order is MMP", - "type": "boolean" - }, - "order_id": { - "description": "Id of the user order (maker or taker), i.e. subscriber's order id that took part in the trade", - "type": "string" - }, - "order_type": { - "description": "Order type: `\"limit\"`, `\"market\"`, or `\"liquidation\"`", - "type": "string", - "enum": [ - "limit", - "market", - "liquidation" - ] - }, - "original_order_type": { - "$ref": "#/components/schemas/original_order_type" - }, - "post_only": { - "description": "`true` if user order is post-only", - "type": "string" - }, - "price": { - "description": "The price of the trade", - "$ref": "#/components/schemas/price" - }, - "profit_loss": { - "$ref": "#/components/schemas/profit_loss" - }, - "quote_id": { - "description": "QuoteID of the user order (optional, present only for orders placed with `private/mass_quote`)", - "type": "string" - }, - "quote_set_id": { - "description": "QuoteSet of the user order (optional, present only for orders placed with `private/mass_quote`)", - "type": "string" - }, - "reduce_only": { - "description": "`true` if user order is reduce-only", - "type": "string" - }, - "risk_reducing": { - "description": "`true` if user order is marked by the platform as a risk reducing order (can apply only to orders placed by PM users)", - "type": "boolean" - }, - "starbase_client_order_id": { - "description": "Client order id of the user's own order (maker or taker side) submitted directly to [Starbase](https://docs.deribit.com/starbase/overview) via direct access; not returned for orders placed through the Deribit API; for self-trades this is the taker order's client order id", - "type": "string" - }, - "starbase_match_id": { - "description": "Optional field containing the Starbase match identifier (present only for trades matched via Starbase)", - "type": "integer" - }, - "starbase_order_id": { - "description": "Raw Starbase order id of the user's order, in Starbase's own (non currency-prefixed) id namespace (present only for trades matched in Starbase)", - "type": "integer", - "example": 103148386170 - }, - "starbase_timestamp": { - "description": "Optional field: the Starbase causal timestamp of the trade, in nanoseconds since the UNIX epoch (present only for trades matched in Starbase)", - "$ref": "#/components/schemas/starbase_timestamp" - }, - "state": { - "$ref": "#/components/schemas/order_state_in_user_trade" - }, - "tick_direction": { - "$ref": "#/components/schemas/tick_direction" - }, - "timestamp": { - "$ref": "#/components/schemas/trade_timestamp" - }, - "trade_allocations": { - "description": "List of allocations for Block RFQ pre-allocation. Each allocation specifies `user_id`, `amount`, and `fee` for the allocated part of the trade. For broker client allocations, a `client_info` object will be included.", - "type": "array", - "items": { - "properties": { - "amount": { - "description": "Amount allocated to this user.", - "type": "number" - }, - "client_info": { - "description": "Optional client allocation info for brokers.", - "type": "object", - "properties": { - "client_id": { - "description": "ID of a client; available to broker. Represents a group of users under a common name.", - "type": "integer" - }, - "client_link_id": { - "description": "ID assigned to a single user in a client; available to broker.", - "type": "integer" - }, - "name": { - "description": "Name of the linked user within the client; available to broker.", - "type": "string" - } - } - }, - "fee": { - "description": "Fee for the allocated part of the trade.", - "type": "number" - }, - "user_id": { - "description": "User ID to which part of the trade is allocated. For brokers the User ID is obstructed.", - "type": "integer" - } - }, - "required": [ - "amount", - "fee" - ], - "type": "object" - } - }, - "trade_id": { - "$ref": "#/components/schemas/trade_id" - }, - "trade_seq": { - "$ref": "#/components/schemas/trade_seq" - }, - "underlying_price": { - "description": "Underlying price for implied volatility calculations (Options only)", - "type": "number" - }, - "user_id": { - "description": "User identifier for the account that executed the trade. For isolated trades, this is the subaccount ID.", - "type": "integer" - } - }, - "required": [ - "trade_id", - "trade_seq", - "instrument_name", - "timestamp", - "order_id", - "matching_id", - "direction", - "tick_direction", - "index_price", - "price", - "amount", - "fee", - "fee_currency", - "state", - "mark_price" - ] - }, - "username": { - "description": "System name or user defined subaccount alias", - "type": "string", - "example": "MrTrader" - }, - "volume_usd": { - "description": "Volume in usd (futures only)", - "type": "number" - }, - "wallet_currency": { - "description": "Currency, i.e `\"BTC\"`, `\"ETH\"`, `\"USDC\"`", - "type": "string", - "enum": [ - "BTC", - "ETH", - "STETH", - "ETHW", - "USDC", - "USDT", - "EURR", - "SOL", - "XRP", - "USYC", - "PAXG", - "BNB", - "USDE" - ] - }, - "web": { - "description": "`true` if created via Deribit frontend (optional)", - "type": "boolean" - } - }, - "responses": { - "ErrorMessageResponse": { - "description": "Success response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorMessageResponse" - } - } - } - }, - "Getunsubscribe200response": { - "description": "Successfully unsubscribed from channels", - "content": { - "application/json": { - "examples": { - "jsonObject": { - "value": { - "id": 3370, - "jsonrpc": "2.0", - "result": [ - "deribit_price_index.btc_usd" - ] - } - }, - "response": { - "description": "Response example", - "value": { - "id": 3370, - "jsonrpc": "2.0", - "result": [ - "deribit_price_index.btc_usd" - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/Getunsubscribe200response" - } - } - } - }, - "OkResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1569, - "jsonrpc": "2.0", - "result": "ok" - } - } - }, - "schema": { - "$ref": "#/components/schemas/OkResponse" - } - } - } - }, - "PrivateAccountResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 2515, - "jsonrpc": "2.0", - "result": { - "available_funds": 301.38059622, - "available_withdrawal_funds": 301.35396172, - "balance": 302.60065765, - "block_rfq_self_match_prevention": true, - "creation_timestamp": 1687352432143, - "cross_collateral_enabled": false, - "currency": "BTC", - "delta_total": 31.602958, - "delta_total_map": { - "btc_usd": 31.594357699 - }, - "email": "user@example.com", - "equity": 302.61869214, - "fee_balance": 0, - "fees": { - "btc_usd": { - "future": { - "block_trade": 0.3, - "default": { - "maker": -0.0001, - "taker": 0.00035000000000000005, - "type": "fixed" - } - }, - "option": { - "block_trade": 0.625, - "default": { - "maker": 0.625, - "taker": 0.625, - "type": "relative" - } - }, - "perpetual": { - "block_trade": 0.3, - "default": { - "maker": -0.0001, - "taker": 0.00035000000000000005, - "type": "fixed" - } - } - } - }, - "futures_pl": -0.32434225, - "futures_session_rpl": -0.03258105, - "futures_session_upl": 0.05921555, - "id": 10, - "initial_margin": 1.24669592, - "interuser_transfers_enabled": false, - "limits": { - "limits_per_currency": false, - "matching_engine": { - "cancel_all": { - "burst": 250, - "rate": 200 - }, - "guaranteed_quotes": { - "burst": 2, - "rate": 2 - }, - "max_quotes": { - "burst": 10, - "rate": 10 - }, - "quotes": { - "burst": 500, - "rate": 500 - }, - "spot": { - "burst": 250, - "rate": 200 - }, - "trading": { - "total": { - "burst": 250, - "rate": 200 - } - } - }, - "non_matching_engine": { - "burst": 1500, - "rate": 1000 - } - }, - "login_enabled": false, - "maintenance_margin": 0.8857841, - "margin_balance": 302.62729214, - "margin_model": "segregated_sm", - "mmp_enabled": false, - "options_delta": -1.01962, - "options_gamma": 0.00001, - "options_gamma_map": { - "btc_usd": 0.00001 - }, - "options_pl": -0.0065, - "options_session_rpl": 0, - "options_session_upl": -0.0065, - "options_theta": 15.97071, - "options_theta_map": { - "btc_usd": 15.97071 - }, - "options_value": -0.0086, - "options_vega": 0.0858, - "options_vega_map": { - "btc_usd": 0.0858 - }, - "portfolio_margining_enabled": false, - "projected_delta_total": 32.613978, - "projected_initial_margin": 1.01529592, - "projected_maintenance_margin": 0.7543841, - "referrer_id": null, - "security_keys_enabled": false, - "self_trading_extended_to_subaccounts": false, - "self_trading_reject_mode": "cancel_maker", - "session_rpl": -0.03258105, - "session_upl": 0.05271555, - "spot_reserve": 0, - "system_name": "user", - "total_pl": -0.33084225, - "type": "main", - "username": "user" - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateAccountResponse" - } - } - } - }, - "PrivateAccountSummariesResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 2515, - "jsonrpc": "2.0", - "result": { - "block_rfq_self_match_prevention": true, - "creation_timestamp": 1687352432143, - "email": "user@example.com", - "id": 10, - "interuser_transfers_enabled": false, - "login_enabled": false, - "mmp_enabled": false, - "referrer_id": null, - "security_keys_enabled": false, - "self_trading_extended_to_subaccounts": false, - "self_trading_reject_mode": "cancel_maker", - "summaries": [ - { - "available_funds": 301.38059622, - "available_withdrawal_funds": 301.35396172, - "balance": 302.60065765, - "cross_collateral_enabled": false, - "currency": "BTC", - "delta_total": 31.602958, - "delta_total_map": { - "btc_usd": 31.594357699 - }, - "equity": 302.61869214, - "fee_balance": 0, - "fees": { - "btc_usd": { - "future": { - "block_trade": 0.3, - "default": { - "maker": -0.0001, - "taker": 0.00035000000000000005, - "type": "fixed" - } - }, - "option": { - "block_trade": 0.625, - "default": { - "maker": 0.625, - "taker": 0.625, - "type": "relative" - } - }, - "perpetual": { - "block_trade": 0.3, - "default": { - "maker": -0.0001, - "taker": 0.00035000000000000005, - "type": "fixed" - } - } - } - }, - "futures_pl": -0.32434225, - "futures_session_rpl": -0.03258105, - "futures_session_upl": 0.05921555, - "initial_margin": 1.24669592, - "limits": { - "limits_per_currency": false, - "matching_engine": { - "cancel_all": { - "burst": 250, - "rate": 200 - }, - "guaranteed_quotes": { - "burst": 2, - "rate": 2 - }, - "max_quotes": { - "burst": 10, - "rate": 10 - }, - "quotes": { - "burst": 500, - "rate": 500 - }, - "spot": { - "burst": 250, - "rate": 200 - }, - "trading": { - "total": { - "burst": 250, - "rate": 200 - } - } - }, - "non_matching_engine": { - "burst": 1500, - "rate": 1000 - } - }, - "maintenance_margin": 0.8857841, - "margin_balance": 302.62729214, - "margin_model": "segregated_sm", - "options_delta": -1.01962, - "options_gamma": 0.00001, - "options_gamma_map": { - "btc_usd": 0.00001 - }, - "options_pl": -0.0065, - "options_session_rpl": 0, - "options_session_upl": -0.0065, - "options_theta": 15.97071, - "options_value": -0.0086, - "options_vega": 0.0858, - "options_vega_map": { - "btc_usd": 0.0858 - }, - "portfolio_margining_enabled": false, - "projected_delta_total": 32.613978, - "projected_initial_margin": 1.01529592, - "projected_maintenance_margin": 0.7543841, - "session_rpl": -0.03258105, - "session_upl": 0.05271555, - "spot_reserve": 0, - "total_pl": -0.33084225 - }, - { - "additional_reserve": 0, - "available_funds": 99.999598, - "available_withdrawal_funds": 99.999597, - "balance": 100, - "cross_collateral_enabled": false, - "currency": "ETH", - "delta_total": 0, - "delta_total_map": { - "eth_usd": 0 - }, - "equity": 100, - "fee_balance": 0, - "fees": { - "eth_usd": { - "future": { - "block_trade": 0.2, - "default": { - "maker": -0.00005, - "taker": 0.00025, - "type": "fixed" - } - }, - "option": { - "block_trade": 0.5, - "default": { - "maker": 0.5, - "taker": 0.5, - "type": "relative" - } - }, - "perpetual": { - "block_trade": 0.2, - "default": { - "maker": -0.00005, - "taker": 0.00025, - "type": "fixed" - } - } - } - }, - "futures_pl": 0, - "futures_session_rpl": 0, - "futures_session_upl": 0, - "initial_margin": 0.000402, - "limits": { - "limits_per_currency": false, - "matching_engine": { - "cancel_all": { - "burst": 250, - "rate": 200 - }, - "guaranteed_quotes": { - "burst": 2, - "rate": 2 - }, - "max_quotes": { - "burst": 10, - "rate": 10 - }, - "quotes": { - "burst": 500, - "rate": 500 - }, - "spot": { - "burst": 250, - "rate": 200 - }, - "trading": { - "total": { - "burst": 250, - "rate": 200 - } - } - }, - "non_matching_engine": { - "burst": 1500, - "rate": 1000 - } - }, - "maintenance_margin": 0, - "margin_balance": 100, - "margin_model": "segregated_sm", - "options_delta": 0, - "options_gamma": 0, - "options_gamma_map": {}, - "options_pl": 0, - "options_session_rpl": 0, - "options_session_upl": 0, - "options_theta": 0, - "options_theta_map": {}, - "options_value": 0, - "options_vega": 0, - "options_vega_map": {}, - "portfolio_margining_enabled": false, - "projected_delta_total": 0, - "projected_initial_margin": 0.0002, - "projected_maintenance_margin": 0, - "session_rpl": 0, - "session_upl": 0, - "spot_reserve": 0.0002, - "total_pl": 0 - } - ], - "system_name": "user", - "type": "main", - "username": "user" - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateAccountSummariesResponse" - } - } - } - }, - "PrivateBuyAndSellResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 6130, - "jsonrpc": "2.0", - "result": { - "order": { - "amount": 21, - "api": true, - "average_price": 202.8, - "creation_timestamp": 1590486335742, - "direction": "sell", - "filled_amount": 21, - "instrument_name": "ETH-PERPETUAL", - "is_liquidation": false, - "is_rebalance": false, - "label": "", - "last_update_timestamp": 1590486335742, - "max_show": 21, - "order_id": "ETH-584864807", - "order_state": "filled", - "order_type": "limit", - "post_only": false, - "price": 198.75, - "reduce_only": true, - "replaced": false, - "time_in_force": "good_til_cancelled", - "web": false - }, - "trades": [ - { - "amount": 21, - "direction": "sell", - "fee": 0.00007766, - "fee_currency": "ETH", - "index_price": 202.86, - "instrument_name": "ETH-PERPETUAL", - "liquidity": "T", - "mark_price": 202.79, - "matching_id": null, - "order_id": "ETH-584864807", - "order_type": "limit", - "post_only": false, - "price": 202.8, - "reduce_only": true, - "state": "filled", - "tick_direction": 0, - "timestamp": 1590486335742, - "trade_id": "ETH-2696097", - "trade_seq": 1966068 - } - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateBuyAndSellResponse" - } - } - } - }, - "PrivateCancelAllResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 47, - "jsonrpc": "2.0", - "result": 4 - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateCancelAllResponse" - } - } - } - }, - "PrivateCancelResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 4214, - "jsonrpc": "2.0", - "result": { - "amount": 5, - "api": false, - "creation_timestamp": 1550575961291, - "direction": "sell", - "instrument_name": "ETH-PERPETUAL", - "is_liquidation": false, - "is_rebalance": false, - "label": "", - "last_update_timestamp": 1550575961291, - "max_show": 5, - "order_id": "ETH-SLIS-12", - "order_state": "untriggered", - "order_type": "stop_market", - "post_only": false, - "price": "market_price", - "reduce_only": false, - "time_in_force": "good_til_cancelled", - "trigger": "index_price", - "trigger_price": 144.73, - "triggered": false - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateCancelResponse" - } - } - } - }, - "PrivateChangeMarginModelResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": [ - { - "currency": "eth", - "new_state": { - "available_balance": 0, - "initial_margin_rate": 0, - "maintenance_margin_rate": 0 - }, - "old_state": { - "available_balance": 0, - "initial_margin_rate": 0, - "maintenance_margin_rate": 0 - } - }, - { - "currency": "btc", - "new_state": { - "available_balance": 0.98106428, - "initial_margin_rate": 0.03252245, - "maintenance_margin_rate": 0.02710204 - }, - "old_state": { - "available_balance": 0.553590509, - "initial_margin_rate": 0.45407615, - "maintenance_margin_rate": 0.02862727 - } - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateChangeMarginModelResponse" - } - } - } - }, - "PrivateCreateComboResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 6, - "jsonrpc": "2.0", - "result": { - "creation_timestamp": 1650960943000, - "id": "BTC-REV-29APR22-37500", - "instrument_id": 52, - "legs": [ - { - "amount": 1, - "instrument_name": "BTC-29APR22-37500-C" - }, - { - "amount": -1, - "instrument_name": "BTC-29APR22-37500-P" - } - ], - "state": "active", - "state_timestamp": 1650960943922 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateCreateComboResponse" - } - } - } - }, - "PrivateEditResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 9, - "jsonrpc": "2.0", - "result": { - "order": { - "amount": 150, - "api": true, - "average_price": 0, - "creation_timestamp": 1616155547764, - "direction": "buy", - "filled_amount": 0, - "instrument_name": "BTC-PERPETUAL", - "is_liquidation": false, - "is_rebalance": false, - "label": "i_love_deribit", - "last_update_timestamp": 1616155550773, - "max_show": 150, - "order_id": "94166", - "order_state": "open", - "order_type": "limit", - "post_only": false, - "price": 50111, - "reduce_only": false, - "replaced": true, - "time_in_force": "good_til_cancelled", - "web": false - }, - "trades": [] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateEditResponse" - } - } - } - }, - "PrivateGetAccessLogResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": { - "data": [ - { - "city": "Local Town", - "country": "Local Country", - "id": 45, - "ip": "127.0.0.1", - "result": "success", - "timestamp": 1575876682576 - }, - { - "city": "Local Town", - "country": "Local Country", - "id": 44, - "ip": "127.0.0.1", - "result": "success", - "timestamp": 1575876459309 - }, - { - "city": "Local Town", - "country": "Local Country", - "id": 43, - "ip": "127.0.0.1", - "result": "disabled_tfa", - "timestamp": 1575546252774 - } - ], - "records_total": 34 - }, - "testnet": false, - "usDiff": 1417, - "usIn": 1575903572350348, - "usOut": 1575903572351765 - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetAccessLogResponse" - } - } - } - }, - "PrivateGetCancelOnDisconnectResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 220, - "jsonrpc": "2.0", - "result": { - "enabled": false, - "scope": "account" - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetCancelOnDisconnectResponse" - } - } - } - }, - "PrivateGetLegPricesResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": { - "amount": 2, - "legs": [ - { - "direction": "buy", - "instrument_name": "BTC-1NOV24-67000-C", - "price": 0.6001, - "ratio": 1 - }, - { - "direction": "sell", - "instrument_name": "BTC-1NOV24-66000-C", - "price": 0.0001, - "ratio": 1 - } - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetLegPricesResponse" - } - } - } - }, - "PrivateGetLeverageResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": { - "instrument_name": "BTC-PERPETUAL", - "leverage": 25, - "max_leverage": 100 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetLeverageResponse" - } - } - } - }, - "PrivateGetMarginsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 7, - "jsonrpc": "2.0", - "result": { - "buy": 0.0219949, - "buy_maker_fee": 0.000017, - "buy_taker_fee": 0.000085, - "max_price": 3759.24, - "min_price": 3684.8, - "sell": 0, - "sell_maker_fee": 0.000017, - "sell_taker_fee": 0.000085 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetMarginsResponse" - } - } - } - }, - "PrivateGetMaxOrderSizeResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": { - "buy_price": 65000, - "max_tradable_amount": { - "buy_notional": 125000, - "sell_notional": 150000 - }, - "max_tradable_amount_reduce_only": { - "buy_notional": 50000, - "sell_notional": 0 - }, - "sell_price": 65000 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetMaxOrderSizeResponse" - } - } - } - }, - "PrivateGetOpenOrdersResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1953, - "jsonrpc": "2.0", - "result": [ - { - "amount": 10, - "api": true, - "average_price": 0, - "creation_timestamp": 1550050597036, - "direction": "buy", - "filled_amount": 0, - "instrument_name": "BTC-15FEB19-3250-P", - "is_liquidation": false, - "is_rebalance": false, - "label": "fooBar", - "last_update_timestamp": 1550050597036, - "max_show": 10, - "order_id": "146062", - "order_state": "open", - "order_type": "limit", - "post_only": false, - "price": 0.0028, - "reduce_only": false, - "time_in_force": "good_til_cancelled" - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetOpenOrdersResponse" - } - } - } - }, - "PrivateGetOrderHistoryResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 9305, - "jsonrpc": "2.0", - "result": [ - { - "amount": 40, - "api": true, - "average_price": 3659.8, - "creation_timestamp": 1550661808761, - "direction": "buy", - "filled_amount": 40, - "instrument_name": "BTC-PERPETUAL", - "is_liquidation": false, - "is_rebalance": false, - "label": "", - "last_update_timestamp": 1550661808761, - "max_show": 40, - "order_id": "146475", - "order_state": "filled", - "order_type": "limit", - "post_only": false, - "price": 3886.5, - "reduce_only": false, - "time_in_force": "good_til_cancelled" - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetOrderHistoryResponse" - } - } - } - }, - "PrivateGetOrderMarginByIdsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 5625, - "jsonrpc": "2.0", - "result": [ - { - "initial_margin": 0.00091156, - "initial_margin_currency": "ETH", - "order_id": "ETH-349278" - }, - { - "initial_margin": 0, - "initial_margin_currency": "ETH", - "order_id": "ETH-349279" - }, - { - "initial_margin": 0, - "initial_margin_currency": "ETH", - "order_id": "ETH-349280" - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetOrderMarginByIdsResponse" - } - } - } - }, - "PrivateGetOrderStateByLabelResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 4316, - "jsonrpc": "2.0", - "result": [ - { - "amount": 37, - "api": false, - "average_price": 118.94, - "creation_timestamp": 1550219749176, - "direction": "sell", - "filled_amount": 37, - "instrument_name": "ETH-PERPETUAL", - "is_liquidation": false, - "is_rebalance": false, - "label": "fooBar", - "last_update_timestamp": 1550219810944, - "max_show": 37, - "order_id": "ETH-331562", - "order_state": "filled", - "order_type": "limit", - "post_only": false, - "price": 118.94, - "reduce_only": false, - "time_in_force": "good_til_cancelled" - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetOrderStateByLabelResponse" - } - } - } - }, - "PrivateGetOrderStateResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 4316, - "jsonrpc": "2.0", - "result": { - "amount": 37, - "api": false, - "average_price": 118.94, - "creation_timestamp": 1550219749176, - "direction": "sell", - "filled_amount": 37, - "instrument_name": "ETH-PERPETUAL", - "is_liquidation": false, - "is_rebalance": false, - "label": "", - "last_update_timestamp": 1550219810944, - "max_show": 37, - "order_id": "ETH-331562", - "order_state": "filled", - "order_type": "limit", - "post_only": false, - "price": 118.94, - "reduce_only": false, - "time_in_force": "good_til_cancelled" - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetOrderStateResponse" - } - } - } - }, - "PrivateGetPositionResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 404, - "jsonrpc": "2.0", - "result": { - "average_price": 0, - "delta": 0, - "direction": "buy", - "estimated_liquidation_price": null, - "floating_profit_loss": 0, - "index_price": 3555.86, - "initial_margin": 0, - "instrument_name": "BTC-PERPETUAL", - "interest_value": 1.7362511643080387, - "kind": "future", - "leverage": 100, - "maintenance_margin": 0, - "mark_price": 3556.62, - "open_orders_margin": 0.000165889, - "realized_profit_loss": 0, - "settlement_price": 3555.44, - "size": 0, - "size_currency": 0, - "total_profit_loss": 0, - "user_id": 1234 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetPositionResponse" - } - } - } - }, - "PrivateGetPositionsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 2236, - "jsonrpc": "2.0", - "result": [ - { - "average_price": 7440.18, - "delta": 0.006687487, - "direction": "buy", - "estimated_liquidation_price": null, - "floating_profit_loss": 0, - "index_price": 7466.79, - "initial_margin": 0.000197283, - "instrument_name": "BTC-PERPETUAL", - "interest_value": 1.7362511643080387, - "kind": "future", - "leverage": 34, - "maintenance_margin": 0.000143783, - "mark_price": 7476.65, - "open_orders_margin": 0.000197288, - "realized_funding": -1e-8, - "realized_profit_loss": -9e-9, - "settlement_price": 7476.65, - "size": 50, - "size_currency": 0.006687487, - "total_profit_loss": 0.000032781, - "user_id": 1234 - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetPositionsResponse" - } - } - } - }, - "PrivateGetRiskProfileResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": { - "max_leverage": null, - "portfolio_margining_allowed": true, - "short_option_allowed": true - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetRiskProfileResponse" - } - } - } - }, - "PrivateGetSubaccountsDetailsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "jsonrpc": "2.0", - "result": [ - { - "positions": [ - { - "average_price": 49571.3, - "delta": 0.004152776, - "direction": "buy", - "estimated_liquidation_price": null, - "floating_profit_loss": -0.00003451, - "index_price": 47897.12, - "initial_margin": 0.000122508, - "instrument_name": "BTC-PERPETUAL", - "kind": "future", - "leverage": 34, - "maintenance_margin": 0.000089286, - "mark_price": 48160.55, - "open_orders_margin": 0, - "realized_funding": -8.8e-7, - "realized_profit_loss": -8.79e-7, - "settlement_price": 48150.36, - "size": 200, - "size_currency": 0.004152776, - "total_profit_loss": -0.000118183 - } - ], - "uid": 3 - }, - { - "positions": [ - { - "average_price": 47182.76, - "delta": -0.001308984, - "direction": "sell", - "estimated_liquidation_price": null, - "floating_profit_loss": 0.000037333, - "index_price": 47897.12, - "initial_margin": 0.000038615, - "instrument_name": "BTC-3SEP21", - "kind": "future", - "leverage": 34, - "maintenance_margin": 0.000028143, - "mark_price": 45837.07, - "open_orders_margin": 0, - "realized_profit_loss": 0, - "settlement_price": 47886.98, - "size": -60, - "size_currency": -0.001308984, - "total_profit_loss": 0.000037333 - } - ], - "uid": 10 - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetSubaccountsDetailsResponse" - } - } - } - }, - "PrivateGetSubaccountsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 4947, - "jsonrpc": "2.0", - "result": [ - { - "email": "user_AAA@email.com", - "id": 2, - "is_password": true, - "login_enabled": true, - "margin_model": "segregated_sm", - "portfolio": { - "btc": { - "additional_reserve": 0, - "available_funds": 5.000413075, - "available_withdrawal_funds": 5.000413075, - "balance": 5.000593987, - "currency": "btc", - "equity": 5.000571846, - "initial_margin": 0.000158771, - "maintenance_margin": 0.000115715, - "margin_balance": 5.000571846, - "spot_reserve": 0 - }, - "eth": { - "additional_reserve": 0, - "available_funds": 5, - "available_withdrawal_funds": 5, - "balance": 5, - "currency": "eth", - "equity": 5, - "initial_margin": 0, - "maintenance_margin": 0, - "margin_balance": 5, - "spot_reserve": 0 - } - }, - "receive_notifications": false, - "security_keys_assignments": [], - "security_keys_enabled": false, - "system_name": "user_1", - "type": "main", - "username": "user_1" - }, - { - "email": "user_AAA@gmail.com", - "id": 7, - "is_password": true, - "login_enabled": false, - "margin_model": "cross_pm", - "portfolio": { - "btc": { - "additional_reserve": 0, - "available_funds": 0, - "available_withdrawal_funds": 0, - "balance": 0, - "currency": "btc", - "equity": 0, - "initial_margin": 0, - "maintenance_margin": 0, - "margin_balance": 0, - "spot_reserve": 0 - }, - "eth": { - "additional_reserve": 0, - "available_funds": 0, - "available_withdrawal_funds": 0, - "balance": 0, - "currency": "eth", - "equity": 0, - "initial_margin": 0, - "maintenance_margin": 0, - "margin_balance": 0, - "spot_reserve": 0 - } - }, - "receive_notifications": false, - "security_keys_assignments": [], - "security_keys_enabled": false, - "system_name": "user_1_1", - "type": "subaccount", - "username": "user_1_1" - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetSubaccountsResponse" - } - } - } - }, - "PrivateGetTradingLimitsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": { - "currency": "BTC", - "max_future_position_size": 5000000, - "max_open_orders_in_instrument": 100, - "max_total_open_orders": 1000, - "max_total_short_options_positions": 500000, - "portfolio_margining_enabled": false - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetTradingLimitsResponse" - } - } - } - }, - "PrivateGetTransactionLogResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 4, - "jsonrpc": "2.0", - "result": { - "continuation": 61282, - "logs": [ - { - "amount": 5000, - "balance": 2998.82270418, - "cashflow": -2.4, - "change": -2.4, - "commission": 0, - "currency": "BTC", - "equity": 2998.5275869, - "id": 61313, - "instrument_name": "BTC-PERPETUAL", - "interest_pl": 0.00000512, - "order_id": null, - "position": 0, - "price": 63481.75, - "price_currency": "USD", - "role": "source", - "session_rpl": -12.4, - "side": "sell", - "timestamp": 1613659900000, - "total_interest_pl": 0.00000512, - "trade_id": null, - "type": "LSP transfer", - "user_id": 7, - "user_seq": 6010, - "username": "TestUser" - }, - { - "balance": 3001.22270418, - "cashflow": -2.5, - "change": -2.5, - "commission": 0, - "currency": "BTC", - "equity": 3000.9275869, - "id": 61312, - "info": { - "other_user": "Subaccount", - "other_user_id": 27, - "transfer_type": "subaccount" - }, - "instrument_name": null, - "interest_pl": null, - "order_id": null, - "position": null, - "price": null, - "side": "-", - "timestamp": 1613659830333, - "trade_id": null, - "type": "transfer", - "user_id": 7, - "user_seq": 6009, - "username": "TestUser" - }, - { - "amount": 1520, - "balance": 3003.72270418, - "cashflow": 0.00215706, - "change": 0.00215706, - "commission": null, - "currency": "BTC", - "equity": 3003.42821428, - "id": 61311, - "info": { - "floating_pl": 0.00220172, - "settlement_price": 51807 - }, - "instrument_name": "BTC-PERPETUAL", - "interest_pl": 0.00000993, - "order_id": null, - "position": 1520, - "price": 51807.07, - "price_currency": "USD", - "session_rpl": -0.00004467, - "session_upl": 0.00220172, - "side": "long", - "timestamp": 1613659544153, - "total_interest_pl": 0.00001243, - "trade_id": null, - "type": "settlement", - "user_id": 7, - "user_seq": 6008, - "username": "TestUser" - }, - { - "balance": 3003.72054712, - "cashflow": 0.65, - "change": 0.65, - "commission": 0, - "currency": "BTC", - "equity": 3003.4876111, - "id": 61291, - "info": { - "addr": "2N8prMvpZHr8aYqodX3S4yhz5wMxjY8La3p", - "deposit_type": "wallet", - "transaction": "de6eba075855f32c9510f338d3ca0900376cedcb9f7b142caccfbdc292d3237e" - }, - "instrument_name": null, - "interest_pl": null, - "order_id": null, - "position": null, - "price": null, - "side": "-", - "timestamp": 1613657828414, - "trade_id": null, - "type": "deposit", - "user_id": 7, - "user_seq": 6007, - "username": "TestUser" - }, - { - "amount": 0.7, - "balance": 3003.07054712, - "cashflow": -0.10759, - "change": -0.10759, - "commission": 0, - "currency": "BTC", - "equity": 3002.83270455, - "id": 61289, - "info": "Source: api", - "instrument_name": "BTC-19FEB21-49200-C", - "interest_pl": 0, - "ip": "11.222.33.44", - "mark_price": 0.04884653215049635, - "order_id": "67546", - "position": 0.7, - "price": 0.1537, - "price_currency": "BTC", - "profit_as_cashflow": false, - "side": "open buy", - "timestamp": 1613657734620, - "trade_id": "28349", - "type": "trade", - "user_id": 7, - "user_role": "maker", - "user_seq": 6006, - "username": "TestUser" - }, - { - "amount": 0.3, - "balance": 3003.17813712, - "cashflow": -0.04611, - "change": -0.04611, - "commission": 0, - "currency": "BTC", - "equity": 3002.83270455, - "id": 61288, - "info": "Source: api", - "instrument_name": "BTC-19FEB21-49200-C", - "interest_pl": 0, - "mark_price": 0.04884653215049635, - "order_id": "67546", - "position": 0, - "price": 0.1537, - "price_currency": "BTC", - "profit_as_cashflow": false, - "side": "close buy", - "timestamp": 1613657734620, - "trade_id": "28349", - "type": "trade", - "user_id": 7, - "user_role": "maker", - "user_seq": 6005, - "username": "TestUser" - }, - { - "amount": 0.3, - "balance": 3003.17813712, - "cashflow": 0, - "change": 0, - "commission": 0, - "currency": "BTC", - "equity": 3002.83270455, - "id": 61287, - "info": null, - "instrument_name": "BTC-19FEB21-52000-C", - "interest_pl": null, - "order_id": null, - "position": 0, - "price": 0, - "price_currency": "BTC", - "side": "close buy", - "timestamp": 1613657734620, - "trade_id": null, - "type": "expiry", - "user_id": 7, - "user_seq": 6004, - "username": "TestUser" - } - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetTransactionLogResponse" - } - } - } - }, - "PrivateGetTriggerOrderHistoryResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 2192, - "jsonrpc": "2.0", - "result": { - "continuation": "1555918941451.SLIS-103", - "entries": [ - { - "amount": 10, - "direction": "buy", - "instrument_name": "BTC-PERPETUAL", - "offset": 277, - "order_id": "671473", - "order_state": "new", - "price": 5179.28, - "request": "trigger:order", - "timestamp": 1555918941451, - "trigger": "index", - "trigger_order_id": "SLIS-103", - "trigger_price": 5285 - } - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetTriggerOrderHistoryResponse" - } - } - } - }, - "PrivateGetUserLocksResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 74, - "result": [ - { - "currency": "BTC", - "locked": true, - "message": "locked in one currency" - }, - { - "currency": "ETH", - "locked": false - }, - { - "currency": "USDC", - "locked": false - }, - { - "currency": "SOL", - "locked": false - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetUserLocksResponse" - } - } - } - }, - "PrivateGetUserTradesByOrderResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 3466, - "jsonrpc": "2.0", - "result": [ - { - "amount": 100, - "direction": "buy", - "fee": 0.00036801, - "fee_currency": "ETH", - "index_price": 203.89, - "instrument_name": "ETH-PERPETUAL", - "liquidity": "T", - "mark_price": 203.78, - "matching_id": null, - "order_id": "ETH-584830574", - "order_type": "market", - "post_only": false, - "price": 203.8, - "reduce_only": false, - "state": "filled", - "tick_direction": 3, - "timestamp": 1590480712800, - "trade_id": "ETH-2696068", - "trade_seq": 1966042 - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetUserTradesByOrderResponse" - } - } - } - }, - "PrivateGetUserTradesHistoryResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 9292, - "jsonrpc": "2.0", - "result": { - "has_more": false, - "trades": [ - { - "amount": 1, - "direction": "sell", - "fee": 0.0004, - "fee_currency": "BTC", - "index_price": 8993.47, - "instrument_name": "BTC-27MAY20-8750-C", - "iv": 38.51, - "liquidity": "M", - "mark_price": 0.03135383, - "matching_id": null, - "order_id": "4008699030", - "order_type": "limit", - "post_only": false, - "price": 0.028, - "reduce_only": false, - "state": "filled", - "tick_direction": 1, - "timestamp": 1590480620145, - "trade_id": "48078936", - "trade_seq": 1, - "underlying_price": 8994.95 - }, - { - "amount": 10, - "direction": "buy", - "fee": -2.1e-7, - "fee_currency": "BTC", - "index_price": 9679.48, - "instrument_name": "BTC-26JUN20", - "liquidity": "M", - "mark_price": 9684, - "matching_id": null, - "order_id": "3993343822", - "order_type": "limit", - "post_only": false, - "price": 9681.5, - "reduce_only": false, - "state": "filled", - "tick_direction": 2, - "timestamp": 1589923311862, - "trade_id": "47958936", - "trade_seq": 299513 - } - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateGetUserTradesHistoryResponse" - } - } - } - }, - "PrivatePmeParamsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": { - "enabled": true, - "max_future_open_orders": 200, - "max_future_open_orders_size": 1000000, - "max_option_open_orders": 200, - "max_option_open_orders_size": 500, - "max_risk_reducing_orders": 5, - "max_total_open_orders": 300 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivatePmeParamsResponse" - } - } - } - }, - "PrivatePmeSimulateResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 2255, - "jsonrpc": "2.0", - "result": { - "aggregated_risk_vectors": { - "btc_btc": { - "extended": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "standard": [ - -0.05968587238095239, - -0.05968587238095239, - -0.05968587238095239, - -0.04272965863636364, - -0.04272965863636364, - -0.04272965863636364, - -0.02724789826086957, - -0.02724789826086957, - -0.02724789826086957, - -0.013056284583333334, - -0.013056284583333334, - -0.013056284583333334, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ] - } - }, - "index_price": { - "btc_usd": 65666.19 - }, - "initial_risk_vectors": { - "BTC-28JUN24": { - "extended": [ - 0.0002261969523809524, - 0.0002261969523809524, - -0.0001637977931034483, - -0.0001637977931034483, - -0.0001637977931034483, - -0.0001637977931034483, - -0.0001637977931034483, - -0.0001637977931034483 - ], - "standard": [ - 0.0002261969523809524, - 0.0002261969523809524, - 0.0002261969523809524, - 0.00016193645454545456, - 0.00016193645454545456, - 0.00016193645454545456, - 0.00010326382608695652, - 0.00010326382608695652, - 0.00010326382608695652, - 0.00004948058333333334, - 0.00004948058333333334, - 0.00004948058333333334, - 0, - 0, - 0, - -0.00004567438461538462, - -0.00004567438461538462, - -0.00004567438461538462, - -0.00008796548148148148, - -0.00008796548148148148, - -0.00008796548148148148, - -0.0001272357857142857, - -0.0001272357857142857, - -0.0001272357857142857, - -0.00016379779310344832, - -0.00016379779310344832, - -0.00016379779310344832 - ] - }, - "BTC-PERPETUAL": { - "extended": [ - -0.05991206933333334, - -0.05991206933333334, - 0.04338460193103449, - 0.04338460193103449, - 0.04338460193103449, - 0.04338460193103449, - 0.04338460193103449, - 0.04338460193103449 - ], - "standard": [ - -0.05991206933333334, - -0.05991206933333334, - -0.05991206933333334, - -0.04289159509090909, - -0.04289159509090909, - -0.04289159509090909, - -0.027351162086956524, - -0.027351162086956524, - -0.027351162086956524, - -0.013105765166666668, - -0.013105765166666668, - -0.013105765166666668, - 0, - 0, - 0, - 0.012097629384615385, - 0.012097629384615385, - 0.012097629384615385, - 0.023299138074074074, - 0.023299138074074074, - 0.023299138074074074, - 0.033700538999999995, - 0.033700538999999995, - 0.033700538999999995, - 0.043384601931034494, - 0.043384601931034494, - 0.043384601931034494 - ] - } - }, - "margins": { - "btc": { - "initial_margin": 0.122861343, - "initial_margin_details": { - "mmp_margin": 0.06, - "open_orders_margin": 0.000018212, - "risk_matrix_margin": 0.06284313098, - "risk_matrix_margin_details": { - "correlation_contingency": 0, - "delta_shock": 0, - "roll_shock": 0.00315725898, - "worst_case": 0.05968587238095239, - "worst_case_bucket": { - "bucket": 1, - "index": 1, - "side": "left", - "source": "standard" - } - }, - "spot_margin": 0 - }, - "maintenance_margin": 0.050274504784 - } - }, - "model_params": { - "currency": { - "btc": { - "annualised_move_risk": 0.075, - "correlation_set": false, - "equity_side_impact": "both", - "extended_dampener": 100000, - "haircut": 0, - "max_offsetable_pnl": 0, - "min_annualised_move": 0.01, - "pnl_offset": 0 - }, - "usd": { - "annualised_move_risk": 0.1, - "correlation_set": false, - "equity_side_impact": "none", - "extended_dampener": 25000, - "haircut": 0, - "max_offsetable_pnl": 0, - "min_annualised_move": 0.01, - "pnl_offset": 0 - } - }, - "currency_pair": { - "btc_usd": { - "delta_total_liq_shock_threshold": 20000000, - "extended_table_factor": 1, - "long_term_vega_power": 0.13, - "m_inc": 0.00005, - "max_delta_shock": 0.1, - "min_volatility_for_shock_up": 0.5, - "price_range": 0.16, - "short_term_vega_power": 0.3, - "volatility_range_down": 0.25, - "volatility_range_up": 0.5 - } - }, - "general": { - "buckets_count": 4, - "mm_factor": 0.8, - "timestamp": 1718619740501, - "vol_scenarios_count": 3 - } - }, - "portfolio": { - "currency": {}, - "position": { - "BTC-28JUN24": -0.001187534, - "BTC-PERPETUAL": 0.314538364 - } - }, - "ticker": { - "BTC-28JUN24": { - "index_price": 65666.19, - "mark_price": 67371.75 - }, - "BTC-PERPETUAL": { - "index_price": 65666.19, - "mark_price": 65910.57 - } - } - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivatePmeSimulateResponse" - } - } - } - }, - "PrivateSetLeverageResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": 50 - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateSetLeverageResponse" - } - } - } - }, - "PrivateSettlementResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 2192, - "jsonrpc": "2.0", - "result": { - "continuation": "xY7T6cusbMBNpH9SNmKb94jXSBxUPojJEdCPL4YociHBUgAhWQvEP", - "settlements": [ - { - "index_price": 119.8, - "instrument_name": "ETH-22FEB19", - "mark_price": 121.67, - "position": -66, - "profit_loss": -0.001783937, - "session_profit_loss": 0.038358299, - "timestamp": 1550475692526, - "type": "settlement" - } - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateSettlementResponse" - } - } - } - }, - "PrivateSimulatePortfolioResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 2, - "jsonrpc": "2.0", - "result": { - "additional_reserve": 0, - "available_funds": 115871741.76065847, - "available_subaccount_transfer_funds": 0, - "available_withdrawal_funds": 115871741.76065847, - "balance": 150076473.4995114, - "cross_collateral_enabled": true, - "currency": "BTC", - "delta_total": 69080.932029, - "delta_total_map": { - "btc_usd": 68024.519462366 - }, - "equity": 150075253.91354558, - "fee_balance": 0, - "futures_pl": 39497.54616685, - "futures_session_rpl": 1.309136, - "futures_session_upl": -164.48253509, - "initial_margin": 37662472.03416069, - "locked_balance": 0, - "maintenance_margin": 30129215.84817124, - "margin_balance": 153534213.79481918, - "margin_model": "cross_pm", - "options_delta": 2883.38481, - "options_gamma": -0.03907, - "options_gamma_map": { - "btc_usd": -0.03907 - }, - "options_pl": 921.55562578, - "options_session_rpl": 0, - "options_session_upl": -174.67960675, - "options_theta": 142583.29246, - "options_theta_map": { - "btc_usd": 142583.29246 - }, - "options_value": -1056.41256672, - "options_vega": -39322.23046, - "options_vega_map": { - "btc_usd": -39322.23046 - }, - "portfolio_margining_enabled": true, - "projected_delta_total": 69080.932029, - "projected_initial_margin": 37662472.03416069, - "projected_maintenance_margin": 30129215.84817124, - "session_rpl": 1.309136, - "session_upl": -339.16214185, - "spot_reserve": 0, - "total_delta_total_usd": 6157454218.3753195, - "total_equity_usd": 13075634611389.318, - "total_initial_margin_usd": 3139528603778.822, - "total_maintenance_margin_usd": 2511559381417.215, - "total_margin_balance_usd": 12798550648250.61, - "total_pl": 40419.10179263 - }, - "testnet": true, - "usDiff": 13650, - "usIn": 1742210019774525, - "usOut": 1742210019788175 - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateSimulatePortfolioResponse" - } - } - } - }, - "PrivateSubmitTransferResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 9187, - "jsonrpc": "2.0", - "result": { - "amount": 0.2, - "created_timestamp": 1550579457727, - "currency": "BTC", - "direction": "payment", - "id": 2, - "other_side": "2MzyQc5Tkik61kJbEpJV5D5H9VfWHZK9Sgy", - "state": "cancelled", - "type": "user", - "updated_timestamp": 1550579457727 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateSubmitTransferResponse" - } - } - } - }, - "PrivateSubscribeResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 4235, - "jsonrpc": "2.0", - "result": [ - "deribit_price_index.btc_usd" - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PrivateSubscribeResponse" - } - } - } - }, - "PublicAuthResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 9929, - "jsonrpc": "2.0", - "result": { - "access_token": "a3f8c2e1d4b7f09e5c6a2d8b1e4f7c0a9d3b6e2f5a8c1d4e7b0f3a6c9d2e5f8", - "enabled_features": [], - "expires_in": 3600, - "refresh_token": "1582628593469.1GP4rQd0.A9Wa78o5kFRIUP49mScaD1CqHgiK50HOl2VA6kCtWa8BQZU5Dr03BhcbXPNvEh3I_MVixKZXnyoBeKJwLl8LXnfo180ckAiPj3zOclcUu4zkXuF3NNP3sTPcDf1B3C1CwMKkJ1NOcf1yPmRbsrd7hbgQ-hLa40tfx6Oa-85ymm_3Z65LZcnCeLrqlj_A9jM", - "scope": "wallet:user:read wallet:accounts:read wallet:transactions:read wallet:buys:create", - "token_type": "bearer" - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicAuthResponse" - } - } - } - }, - "PublicGetAnnouncementsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 3022, - "jsonrpc": "2.0", - "result": [ - { - "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", - "id": 1550058362418, - "important": false, - "publication_timestamp": 1550058362418, - "title": "Example announcement" - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetAnnouncementsResponse" - } - } - } - }, - "PublicGetBookSummaryResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 3659, - "jsonrpc": "2.0", - "result": [ - { - "ask_price": 0.34, - "base_currency": "ETH", - "bid_price": 0.1488, - "creation_timestamp": 1550227952163, - "high": 0.34, - "instrument_name": "ETH-22FEB19-140-P", - "interest_rate": 0.207, - "last": 0.34, - "low": 0.34, - "mark_price": 80, - "mid_price": 0.2444, - "open_interest": 0.55, - "price_change": -26.7793594, - "quote_currency": "USD", - "underlying_index": "index_price", - "underlying_price": 121.38, - "volume": 0.55 - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetBookSummaryResponse" - } - } - } - }, - "PublicGetComboDetailsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 3, - "jsonrpc": "2.0", - "result": { - "creation_timestamp": 1650620575000, - "id": "BTC-FS-29APR22_PERP", - "instrument_id": 27, - "legs": [ - { - "amount": -1, - "instrument_name": "BTC-PERPETUAL" - }, - { - "amount": 1, - "instrument_name": "BTC-29APR22" - } - ], - "state": "active", - "state_timestamp": 1650620605150 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetComboDetailsResponse" - } - } - } - }, - "PublicGetComboIdsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": [ - "BTC-CS-29APR22-39300_39600", - "BTC-FS-29APR22_PERP" - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetComboIdsResponse" - } - } - } - }, - "PublicGetCombosResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 2, - "jsonrpc": "2.0", - "result": [ - { - "creation_timestamp": 1650636235000, - "id": "BTC-CS-29APR22-39300_39600", - "instrument_id": 28, - "legs": [ - { - "amount": 1, - "instrument_name": "BTC-29APR22-39300-C" - }, - { - "amount": -1, - "instrument_name": "BTC-29APR22-39600-C" - } - ], - "state": "active", - "state_timestamp": 1650636265101 - }, - { - "creation_timestamp": 1650620575000, - "id": "BTC-FS-29APR22_PERP", - "instrument_id": 27, - "legs": [ - { - "amount": -1, - "instrument_name": "BTC-PERPETUAL" - }, - { - "amount": 1, - "instrument_name": "BTC-29APR22" - } - ], - "state": "active", - "state_timestamp": 1650620605150 - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetCombosResponse" - } - } - } - }, - "PublicGetContractSizeResponse": { - "description": "Success response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PublicGetContractSizeResponse" - } - } - } - }, - "PublicGetCurrenciesResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 7538, - "jsonrpc": "2.0", - "result": [ - { - "coin_type": "ETHER", - "currency": "ETH", - "currency_long": "Ethereum", - "decimals": 6, - "min_confirmations": 1, - "min_withdrawal_fee": 0.0001, - "network_currency": "ETH", - "network_fee": 0.0006, - "withdrawal_fee": 0.0006, - "withdrawal_priorities": [] - }, - { - "coin_type": "BITCOIN", - "currency": "BTC", - "currency_long": "Bitcoin", - "decimals": 8, - "min_confirmations": 1, - "min_withdrawal_fee": 0.0001, - "network_currency": "BTC", - "network_fee": 0.0001, - "withdrawal_fee": 0.0001, - "withdrawal_priorities": [ - { - "name": "very_low", - "value": 0.15 - }, - { - "name": "very_high", - "value": 1.5 - } - ] - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetCurrenciesResponse" - } - } - } - }, - "PublicGetDeliveryPricesResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 3601, - "jsonrpc": "2.0", - "result": { - "data": [ - { - "date": "2020-01-02", - "delivery_price": 7131.214606410254 - }, - { - "date": "2019-12-21", - "delivery_price": 7150.943217777777 - }, - { - "date": "2019-12-20", - "delivery_price": 7175.988445532345 - }, - { - "date": "2019-12-19", - "delivery_price": 7189.540776143791 - }, - { - "date": "2019-12-18", - "delivery_price": 6698.353743857118 - } - ], - "records_total": 58 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetDeliveryPricesResponse" - } - } - } - }, - "PublicGetExpirationsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "jsonrpc": "2.0", - "result": { - "future": [ - "21SEP24", - "22SEP24", - "PERPETUAL" - ], - "option": [ - "21SEP24", - "22SEP24", - "23SEP24" - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetExpirationsResponse" - } - } - } - }, - "PublicGetFundingChartDataResponse": { - "description": "Success response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PublicGetFundingChartDataResponse" - } - } - } - }, - "PublicGetFundingRateHistoryResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 7617, - "jsonrpc": "2.0", - "result": [ - { - "index_price": 8222.87, - "interest_1h": -4.739622041017375e-7, - "interest_8h": -0.00009234260068476106, - "prev_index_price": 8305.72, - "timestamp": 1569891600000 - }, - { - "index_price": 8286.49, - "interest_1h": -2.8583510923267753e-7, - "interest_8h": -0.00006720918180255509, - "prev_index_price": 8222.87, - "timestamp": 1569895200000 - }, - { - "index_price": 8431.97, - "interest_1h": -0.000003815906848177951, - "interest_8h": -0.00003544496169694662, - "prev_index_price": 8286.49, - "timestamp": 1569898800000 - }, - { - "index_price": 8422.36, - "interest_1h": 8.312033064379086e-7, - "interest_8h": -0.00001404147515584998, - "prev_index_price": 8431.97, - "timestamp": 1569902400000 - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetFundingRateHistoryResponse" - } - } - } - }, - "PublicGetFundingRateValueResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 7617, - "jsonrpc": "2.0", - "result": -0.00025056853702101664 - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetFundingRateValueResponse" - } - } - } - }, - "PublicGetHistoricalVolatilityResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 8387, - "jsonrpc": "2.0", - "result": [ - [ - 1549720800000, - 14.747743607344217 - ], - [ - 1549720800000, - 14.747743607344217 - ], - [ - 1549724400000, - 14.74257778551467 - ], - [ - 1549728000000, - 14.73502799931767 - ], - [ - 1549731600000, - 14.73502799931767 - ], - [ - 1549735200000, - 14.73502799931767 - ], - [ - 1550228400000, - 46.371891307340015 - ] - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetHistoricalVolatilityResponse" - } - } - } - }, - "PublicGetIndexChartDataResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": [ - [ - 1573228800000, - 8751.7138636 - ], - [ - 1573232400000, - 8751.7138636 - ], - [ - 1573236000000, - 8751.7138636 - ], - [ - 1573239600000, - 8751.7138636 - ], - [ - 1573243200000, - 8751.7138636 - ] - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetIndexChartDataResponse" - } - } - } - }, - "PublicGetIndexPriceNamesResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 25718, - "jsonrpc": "2.0", - "result": [ - "btc_eth", - "btc_usdc", - "eth_usdc" - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetIndexPriceNamesResponse" - } - } - } - }, - "PublicGetIndexPriceResponse": { - "description": "Success response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PublicGetIndexPriceResponse" - } - } - } - }, - "PublicGetInstrumentResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 2, - "jsonrpc": "2.0", - "result": { - "base_currency": "BTC", - "block_trade_commission": 0.00015, - "block_trade_min_trade_amount": 25, - "block_trade_tick_size": 0.0001, - "contract_size": 1, - "counter_currency": "USD", - "creation_timestamp": 1671696002000, - "expiration_timestamp": 1673596800000, - "index_id": 1000033, - "instrument_id": 144613, - "instrument_name": "BTC-13JAN23-16000-P", - "is_active": true, - "kind": "option", - "lot_size": 1, - "maker_commission": 0.0003, - "min_trade_amount": 0.1, - "option_type": "put", - "price_index": "btc_usd", - "product_group": "BTC", - "qty_tick_size": 0.1, - "quote_currency": "BTC", - "settlement_currency": "BTC", - "settlement_period": "week", - "state": "open", - "strike": 16000, - "taker_commission": 0.0003, - "tick_size": 0.0005, - "tick_size_steps": [ - { - "above_price": 120, - "tick_size": 0.001 - }, - { - "above_price": 200, - "tick_size": 0.003 - } - ], - "underlying_type": "crypto" - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetInstrumentResponse" - } - } - } - }, - "PublicGetInstrumentsResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": [ - { - "base_currency": "BTC", - "block_trade_commission": 0.00025, - "block_trade_min_trade_amount": 200000, - "block_trade_tick_size": 0.01, - "contract_size": 10, - "counter_currency": "USD", - "creation_timestamp": 1664524802000, - "expiration_timestamp": 1695974400000, - "index_id": 1000033, - "instrument_id": 138583, - "instrument_name": "BTC-29SEP23", - "instrument_type": "reversed", - "is_active": true, - "kind": "future", - "lot_size": 1, - "maker_commission": 0, - "max_leverage": 50, - "max_liquidation_commission": 0.0075, - "min_trade_amount": 10, - "price_index": "btc_usd", - "product_group": "BTC", - "qty_tick_size": 10, - "quote_currency": "USD", - "settlement_currency": "BTC", - "settlement_period": "month", - "state": "open", - "taker_commission": 0.0005, - "tick_size": 2.5, - "tick_size_steps": [], - "underlying_type": "crypto" - }, - { - "base_currency": "BTC", - "block_trade_commission": 0.00025, - "block_trade_min_trade_amount": 200000, - "block_trade_tick_size": 0.01, - "contract_size": 10, - "counter_currency": "USD", - "creation_timestamp": 1534167754000, - "expiration_timestamp": 32503708800000, - "index_id": 1000033, - "instrument_id": 124972, - "instrument_name": "BTC-PERPETUAL", - "instrument_type": "reversed", - "is_active": true, - "kind": "future", - "lot_size": 1, - "maker_commission": 0, - "max_leverage": 50, - "max_liquidation_commission": 0.0075, - "min_trade_amount": 10, - "price_index": "btc_usd", - "product_group": "BTC", - "qty_tick_size": 10, - "quote_currency": "USD", - "settlement_currency": "BTC", - "settlement_period": "perpetual", - "state": "open", - "taker_commission": 0.0005, - "tick_size": 0.5, - "tick_size_steps": [], - "underlying_type": "crypto" - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetInstrumentsResponse" - } - } - } - }, - "PublicGetMarkPriceHistoryResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 25, - "jsonrpc": "2.0", - "result": [ - [ - 1608142381229, - 0.5165791606037885 - ], - [ - 1608142380231, - 0.5165737855432504 - ], - [ - 1608142379227, - 0.5165768236356326 - ] - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetMarkPriceHistoryResponse" - } - } - } - }, - "PublicGetOrderBookResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 8772, - "jsonrpc": "2.0", - "result": { - "asks": [], - "best_ask_amount": 0, - "best_ask_price": 0, - "best_bid_amount": 30, - "best_bid_price": 3955.75, - "bids": [ - [ - 3955.75, - 30 - ], - [ - 3940.75, - 102020 - ], - [ - 3423, - 42840 - ] - ], - "change_id": 474988, - "current_funding": 0.00500063, - "funding_8h": 0.00455263, - "index_price": 3910.46, - "instrument_name": "BTC-PERPETUAL", - "last_price": 3955.75, - "mark_price": 3931.97, - "max_price": 3971.74, - "min_price": 3932.22, - "open_interest": 45.27600333464605, - "settlement_price": 3925.85, - "state": "open", - "stats": { - "high": 3976.25, - "low": 3940.75, - "price_change": 0.6913, - "volume": 93.35589552 - }, - "timestamp": 1550757626706 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetOrderBookResponse" - } - } - } - }, - "PublicGetTimeResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 7365, - "jsonrpc": "2.0", - "result": 1550147385946 - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetTimeResponse" - } - } - } - }, - "PublicGetTradesVolumesResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 6387, - "jsonrpc": "2.0", - "result": [ - { - "calls_volume": 145, - "currency": "BTC", - "futures_volume": 6.25578452, - "puts_volume": 48, - "spot_volume": 11.1 - }, - { - "calls_volume": 37.4, - "currency": "ETH", - "futures_volume": 374.392173, - "puts_volume": 122.65, - "spot_volume": 57.7 - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetTradesVolumesResponse" - } - } - } - }, - "PublicGetTradingviewChartDataResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 833, - "jsonrpc": "2.0", - "result": { - "close": [ - 5052.95, - 5013.59 - ], - "cost": [ - 19000, - 23400 - ], - "high": [ - 5185.45, - 5250.87 - ], - "low": [ - 4728.94, - 4726.6 - ], - "open": [ - 4963.42, - 4986.29 - ], - "status": "ok", - "ticks": [ - 1554373800000, - 1554375600000 - ], - "volume": [ - 19.007942601, - 20.095877981 - ] - }, - "testnet": false, - "usDiff": 205, - "usIn": 1554381680742493, - "usOut": 1554381680742698 - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetTradingviewChartDataResponse" - } - } - } - }, - "PublicGetVolatilityIndexDataResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 5, - "jsonrpc": "2.0", - "result": { - "continuation": null, - "data": [ - [ - 1598019300000, - 0.210084879, - 0.212860821, - 0.210084879, - 0.212860821 - ], - [ - 1598019360000, - 0.212869011, - 0.212987527, - 0.212869011, - 0.212987527 - ], - [ - 1598019420000, - 0.212987723, - 0.212992597, - 0.212987723, - 0.212992597 - ] - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicGetVolatilityIndexDataResponse" - } - } - } - }, - "PublicSettlementResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 5482, - "jsonrpc": "2.0", - "result": { - "continuation": "2Z7mdtavzYvfuyYcHkJXvPTr9ZSMsEzM3sLCH7AbYEDd1AzTXY2hnhegQDiaP1TtU4b5iSJZ4", - "settlements": [ - { - "index_price": 3796.43, - "instrument_name": "BTC-22FEB19", - "mark_price": 3578.16, - "position": 240, - "profit_loss": -9.999999999886402e-10, - "session_profit_loss": 0.116509752, - "timestamp": 1550502000023, - "type": "settlement" - } - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicSettlementResponse" - } - } - } - }, - "PublicStatusResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 55, - "jsonrpc": "2.0", - "result": { - "locked": true, - "locked_currencies": [ - "BTC", - "ETH" - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicStatusResponse" - } - } - } - }, - "PublicTestResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 8212, - "jsonrpc": "2.0", - "result": { - "version": "1.2.26" - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicTestResponse" - } - } - } - }, - "PublicTickerResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 8106, - "jsonrpc": "2.0", - "result": { - "best_ask_amount": 53040, - "best_ask_price": 36290, - "best_bid_amount": 4600, - "best_bid_price": 36289.5, - "current_funding": 0, - "estimated_delivery_price": 36297.02, - "funding_8h": 0.00002203, - "index_price": 36297.02, - "instrument_name": "BTC-PERPETUAL", - "interest_value": 1.7362511643080387, - "last_price": 36289.5, - "mark_price": 36288.31, - "max_price": 36833.4, - "min_price": 35744.73, - "open_interest": 502231260, - "settlement_price": 36169.49, - "state": "open", - "stats": { - "high": 36824.5, - "low": 35213.5, - "price_change": 0.2362, - "volume": 7831.26548117, - "volume_usd": 282615600 - }, - "timestamp": 1623059681955 - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicTickerResponse" - } - } - } - }, - "PublicTickersByCurrencyResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1, - "jsonrpc": "2.0", - "result": [ - { - "best_ask_amount": 53040, - "best_ask_price": 36290, - "best_bid_amount": 4600, - "best_bid_price": 36289.5, - "index_price": 36297.02, - "instrument_name": "BTC-PERPETUAL", - "last_price": 36289.5, - "mark_price": 36288.31, - "max_price": 36833.4, - "min_price": 35744.73, - "open_interest": 502231260, - "settlement_price": 36169.49, - "state": "open", - "stats": { - "high": 36824.5, - "low": 35213.5, - "price_change": 0.2362, - "volume": 7831.26548117, - "volume_usd": 282615600 - }, - "timestamp": 1623059681955 - } - ] - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicTickersByCurrencyResponse" - } - } - } - }, - "PublicTradesHistoryResponse": { - "description": "Success response", - "content": { - "application/json": { - "examples": { - "response": { - "description": "Response example", - "value": { - "id": 1469, - "jsonrpc": "2.0", - "result": { - "has_more": true, - "trades": [ - { - "amount": 3, - "contracts": 3, - "direction": "buy", - "index_price": 66930.31, - "instrument_name": "BTC-24APR26-72000-C", - "iv": 45.91, - "mark_price": 0.05253883, - "price": 0.0525, - "tick_direction": 2, - "timestamp": 1770984454552, - "trade_id": "415305279", - "trade_seq": 467 - } - ] - } - } - } - }, - "schema": { - "$ref": "#/components/schemas/PublicTradesHistoryResponse" - } - } - } - } - }, - "securitySchemes": { - "ApiKey": { - "description": "Call `public/auth` with `grant_type: coinbase_cdp` and a CDP JWT. Send the returned `access_token` as `Authorization: Bearer`.", - "scheme": "bearer", - "type": "http" - }, - "OAuth2": { - "description": "Call `public/auth` with `grant_type: coinbase_oauth2` and an OAuth access token. Send the returned `access_token` as `Authorization: Bearer`.", - "flows": { - "authorizationCode": { - "authorizationUrl": "https://login.coinbase.com/oauth2/auth", - "scopes": { - "wallet:accounts:read": "View your accounts.", - "wallet:accounts:update": "Authorize `wallet:accounts:update` operations.", - "wallet:buys:create": "Place, edit, and cancel orders.", - "wallet:payment-methods:read": "View your payment methods.", - "wallet:trades:create": "Convert cryptocurrencies.", - "wallet:trades:read": "View your cryptocurrency conversions.", - "wallet:transactions:read": "View your transactions.", - "wallet:transactions:transfer": "Transfer funds between accounts.", - "wallet:user:read": "View your account information.", - "wallet:user:update": "Update your account information." - }, - "tokenUrl": "https://login.coinbase.com/oauth2/token" - } - }, - "type": "oauth2" - } - } - }, - "tags": [ - { - "description": "Can only be used over websockets.", - "name": "WebSocket Only" - }, - { - "description": "Public methods can be used without authentication.", - "name": "Public" - }, - { - "description": "

Private methods require authentication. All requests must include a valid OAuth2 token.

\n

A token can be requested using the /public/auth method.

\n

When using the websockets protocol, the token must be included as a parameter access_token in the message. When using REST (HTTP GET), the token may also be passed in the Authorization header.

", - "name": "Private" - }, - { - "name": "Authentication" - }, - { - "name": "Session Management" - }, - { - "description": "Subscription works as [notifications](#notifications), so users will automatically (after subscribing) receive messages from the server. Overview for each channel response format is described in [subscriptions](#subscriptions) section.", - "name": "Subscription Management" - }, - { - "name": "Account Management" - }, - { - "name": "Trading" - }, - { - "name": "Market Data" - }, - { - "name": "Wallet" - } - ] -} - -================ -File: advanced-trade-spec.yaml -================ -openapi: 3.1.0 -info: - title: Coinbase Advanced Trade API - version: '0.1' -paths: - /api/v3/brokerage/accounts: - get: - summary: List Accounts - description: Get a list of authenticated accounts for the current user. - operationId: RetailBrokerageApi_GetAccounts - security: - - ApiKey: - - view - - OAuth2: - - "wallet:accounts:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetAccountsResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetAccountsResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: limit - description: The number of accounts to display per page. By default, displays - 49 (max 250). If `has_next` is true, additional pages of accounts are available - to be fetched. Use the `cursor` parameter to start on a specified page. - in: query - required: false - schema: - type: integer - format: int32 - - name: cursor - description: For paginated responses, returns all responses that come after - this value. - in: query - required: false - schema: - type: string - - name: retail_portfolio_id - description: '**(Deprecated)** Only returns the accounts matching the portfolio - ID. Only applicable for legacy keys. CDP keys will default to the key''s - permissioned portfolio.' - in: query - required: false - schema: - type: string - tags: - - Accounts - /api/v3/brokerage/accounts/{account_uuid}: - get: - summary: Get Account - description: Get a list of information about an account, given an account UUID. - operationId: RetailBrokerageApi_GetAccount - security: - - ApiKey: - - view - - OAuth2: - - "wallet:accounts:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetAccountResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetAccountResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: account_uuid - description: The account's UUID. - in: path - required: true - schema: - type: string - tags: - - Accounts - /api/v3/brokerage/best_bid_ask: - get: - summary: Get Best Bid/Ask - description: Get the best bid/ask for all products. A subset of all products - can be returned instead by using the product_ids input. - operationId: RetailBrokerageApi_GetBestBidAsk - security: - - ApiKey: - - view - - OAuth2: - - "wallet:user:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetBestBidAskResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetBestBidAskResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_ids - description: The list of trading pairs (e.g. 'BTC-USD'). - in: query - required: false - explode: true - schema: - type: array - items: - type: string - tags: - - Products - /api/v3/brokerage/product_book: - get: - summary: Get Product Book - description: Get a list of bids/asks for a single product. The amount of detail - shown can be customized with the limit parameter. - operationId: RetailBrokerageApi_GetProductBook - security: - - ApiKey: - - view - - OAuth2: - - "wallet:user:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetProductBookResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetProductBookResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_id - description: The trading pair (e.g. 'BTC-USD'). - in: query - required: true - schema: - type: string - - name: limit - description: 'The number of bid/asks to be returned. ' - in: query - required: false - schema: - type: integer - format: int32 - - name: aggregation_price_increment - description: The minimum price intervals at which buy and sell orders are - grouped or combined in the order book. - in: query - required: false - schema: - type: string - tags: - - Products - /api/v3/brokerage/products: - get: - summary: List Products - description: Get a list of the available currency pairs for trading. - operationId: RetailBrokerageApi_GetProducts - security: - - ApiKey: - - view - - OAuth2: - - "wallet:user:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Products' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Products' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: limit - description: The number of products to be returned. - in: query - required: false - schema: - type: integer - format: int32 - - name: offset - description: The number of products to skip before returning. - in: query - required: false - schema: - type: integer - format: int32 - - name: product_type - description: Only returns products matching this product type. If omitted, - only SPOT products are returned. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_PRODUCT_TYPE - - SPOT - - FUTURE - - EQUITY - - OPTION_GROUP - - FUTURE_GROUP - default: UNKNOWN_PRODUCT_TYPE - - name: product_ids - description: The list of trading pairs (e.g. 'BTC-USD'). - in: query - required: false - explode: true - schema: - type: array - items: - type: string - - name: contract_expiry_type - description: Only returns the products matching the contract expiry type. - Only applicable if product_type is set to FUTURE. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_CONTRACT_EXPIRY_TYPE - - EXPIRING - - PERPETUAL - default: UNKNOWN_CONTRACT_EXPIRY_TYPE - - name: expiring_contract_status - description: Only returns contracts with this status (default is UNEXPIRED). - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_EXPIRING_CONTRACT_STATUS - - STATUS_UNEXPIRED - - STATUS_EXPIRED - - STATUS_ALL - default: UNKNOWN_EXPIRING_CONTRACT_STATUS - - name: get_tradability_status - description: Whether or not to populate view_only with the tradability status - of the product. This is only enabled for SPOT products. - in: query - required: false - schema: - type: boolean - - name: get_all_products - description: If true, return all products of all product types (including - expired futures contracts). - in: query - required: false - schema: - type: boolean - - name: products_sort_order - description: The order in which products are returned. By default, products - are returned in 24 hour volume descending (in quote). - in: query - required: false - schema: - type: string - enum: - - PRODUCTS_SORT_ORDER_UNDEFINED - - PRODUCTS_SORT_ORDER_VOLUME_24H_DESCENDING - - PRODUCTS_SORT_ORDER_LIST_TIME_DESCENDING - default: PRODUCTS_SORT_ORDER_UNDEFINED - - name: cursor - description: The cursor to use for pagination. This will be a base64 encoded - string that decodes into the last productId of the previously returned page - in: query - required: false - schema: - type: string - - name: futures_underlying_type - description: Only returns the products matching the underlying type. Only - applicable if product_type is set to FUTURE. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_FUTURES_UNDERLYING_TYPE - - FUTURES_UNDERLYING_TYPE_SPOT - - FUTURES_UNDERLYING_TYPE_INDEX - - FUTURES_UNDERLYING_TYPE_EQUITY - - FUTURES_UNDERLYING_TYPE_EQUITY_INDEX - - FUTURES_UNDERLYING_TYPE_EQUITY_ETF - - FUTURES_UNDERLYING_TYPE_PREIPO - - FUTURES_UNDERLYING_TYPE_COMMOD - - FUTURES_UNDERLYING_TYPE_COMMOD_ETF - - FUTURES_UNDERLYING_TYPE_COMMOD_INDEX - - FUTURES_UNDERLYING_TYPE_ADR - - FUTURES_UNDERLYING_TYPE_FOREIGN_EQUITY - - FUTURES_UNDERLYING_TYPE_OTC - default: UNKNOWN_FUTURES_UNDERLYING_TYPE - - name: user_country_code - description: The country code of the user. This is used to provide differentiated - product display names. - in: query - required: false - schema: - type: string - - name: expired - description: If true, return recently expired instruments instead of active - ones. Only applicable to product_venue=DERIBIT; ignored for other venues. - Defaults to false. - in: query - required: false - schema: - type: boolean - tags: - - Products - /api/v3/brokerage/products/{product_id}: - get: - summary: Get Product - description: 'Get information on a single product by product ID. - - - **Equities:** Use the canonical `product_id` returned by the Products API, - not the display ticker. Equity responses include `equity_product_details`, - which describes the security, current trading session, order-size permissions, - and halt or liquidate-only state.' - operationId: RetailBrokerageApi_GetProduct - security: - - ApiKey: - - view - - OAuth2: - - "wallet:user:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Product' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Product' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_id - description: The trading pair (e.g. 'BTC-USD'). - in: path - required: true - schema: - type: string - - name: get_tradability_status - description: Whether or not to populate view_only with the tradability status - of the product. This is only enabled for SPOT products. - in: query - required: false - schema: - type: boolean - tags: - - Products - /api/v3/brokerage/products/{product_id}/candles: - get: - summary: Get Product Candles - description: Get rates for a single product by product ID, grouped in buckets. - operationId: RetailBrokerageApi_GetCandles - security: - - ApiKey: - - view - - OAuth2: - - "wallet:user:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Candles' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Candles' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_id - description: The trading pair (e.g. 'BTC-USD'). - in: path - required: true - schema: - type: string - - name: start - description: The UNIX timestamp indicating the start of the time interval. - in: query - required: true - schema: - type: string - - name: end - description: The UNIX timestamp indicating the end of the time interval. - in: query - required: true - schema: - type: string - - name: granularity - description: The timeframe each candle represents. - in: query - required: true - schema: - type: string - enum: - - UNKNOWN_GRANULARITY - - ONE_MINUTE - - FIVE_MINUTE - - FIFTEEN_MINUTE - - THIRTY_MINUTE - - ONE_HOUR - - TWO_HOUR - - FOUR_HOUR - - SIX_HOUR - - ONE_DAY - default: UNKNOWN_GRANULARITY - - name: limit - description: The number of candle buckets to be returned. By default, returns - 350 (max 350). - in: query - required: false - schema: - type: integer - format: int32 - tags: - - Products - /api/v3/brokerage/products/{product_id}/ticker: - get: - summary: Get Market Trades - description: Get snapshot information by product ID about the last trades (ticks) - and best bid/ask. - operationId: RetailBrokerageApi_GetMarketTrades - security: - - ApiKey: - - view - - OAuth2: - - "wallet:user:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetMarketTradesResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetMarketTradesResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_id - description: The trading pair (e.g. 'BTC-USD'). - in: path - required: true - schema: - type: string - - name: limit - description: 'The number of trades to be returned. ' - in: query - required: true - schema: - type: integer - format: int32 - - name: start - description: The UNIX timestamp indicating the start of the time interval. - in: query - required: false - schema: - type: string - - name: end - description: The UNIX timestamp indicating the end of the time interval. - in: query - required: false - schema: - type: string - tags: - - Products - /api/v3/brokerage/orders: - post: - summary: Create Order - description: 'Create an order with a specified `product_id`, `side`, and `order_configuration`. - - - **Equities:** Use the canonical `product_id` returned by the Products API, - not the display ticker. Include `equity_order_metadata` to select the trading - session and time in force. Use `market_market_ioc` with `MARKET_GFD` for market - orders, which are supported only during the normal session. Use `limit_limit_gtc` - with `LIMIT_GFD` or `LIMIT_GTC` for limit orders. In pre-market, after-hours, - overnight, or multi-session trading, specify a positive whole-share `base_size`; - `quote_size` and fractional sizing are not supported. Attached orders are - not supported for equities.' - operationId: RetailBrokerageApi_PostOrder - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:buys:create" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.NewOrderResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.NewOrderResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.NewOrderRequest' - required: true - tags: - - Orders - /api/v3/brokerage/orders/batch_cancel: - post: - summary: Cancel Orders - description: 'Initiate cancel requests for one or more orders. - - - **Equities:** Equity orders use the same `order_ids` request and per-order - result format as other products. Do not include `equity_order_metadata` when - canceling an order.' - operationId: RetailBrokerageApi_CancelOrders - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:buys:create" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CancelOrdersResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CancelOrdersResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CancelOrdersRequest' - required: true - tags: - - Orders - /api/v3/brokerage/orders/edit: - post: - summary: Edit Order - description: Edit an order with a specified new `size`, or new `price`. - operationId: RetailBrokerageApi_EditOrder - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:buys:create" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EditOrderResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EditOrderResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - $ref: '#/components/requestBodies/coinbase.public_api.authed.retail_brokerage_api.EditOrderRequest' - tags: - - Orders - /api/v3/brokerage/orders/edit_preview: - post: - summary: Edit Order Preview - description: Preview an edit order request with a specified new `size`, or new - `price`. - operationId: RetailBrokerageApi_PreviewEditOrder - security: - - ApiKey: - - view - - OAuth2: - - "wallet:buys:create" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewEditOrderResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewEditOrderResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - $ref: '#/components/requestBodies/coinbase.public_api.authed.retail_brokerage_api.EditOrderRequest' - tags: - - Orders - /api/v3/brokerage/orders/historical/batch: - get: - summary: List Orders - description: 'Get a list of orders filtered by optional query parameters (`product_ids`, - `order_status`, etc.). - - - **Equities:** Set `product_type` to `EQUITY` to return only equity orders. - Each equity order includes its time in force in `displayed_order_config` and - execution session in `equity_trading_session`.' - operationId: RetailBrokerageApi_GetHistoricalOrders - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetHistoricalOrdersResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetHistoricalOrdersResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: order_ids - description: ID(s) of order(s). - in: query - required: false - explode: true - schema: - type: array - items: - type: string - - name: product_ids - description: Optional canonical product ID(s) to filter by. For equities, - use product_id rather than the display ticker. If omitted, orders for all - products are returned. - in: query - required: false - explode: true - schema: - type: array - items: - type: string - - name: product_type - description: Returns orders matching this product type. Use EQUITY for equity - orders. By default, returns all product types. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_PRODUCT_TYPE - - SPOT - - FUTURE - - EQUITY - - OPTION_GROUP - - FUTURE_GROUP - default: UNKNOWN_PRODUCT_TYPE - - name: order_status - description: Only returns orders matching the specified order statuses. - in: query - required: false - explode: true - schema: - type: array - items: - type: string - enum: - - PENDING - - OPEN - - FILLED - - CANCELLED - - EXPIRED - - FAILED - - UNKNOWN_ORDER_STATUS - - QUEUED - - CANCEL_QUEUED - - EDIT_QUEUED - - name: time_in_forces - description: Only orders matching this time in force(s) are returned. Default - is to return all time in forces. - in: query - required: false - explode: true - schema: - type: array - items: - type: string - enum: - - UNKNOWN_TIME_IN_FORCE - - GOOD_UNTIL_DATE_TIME - - GOOD_UNTIL_CANCELLED - - IMMEDIATE_OR_CANCEL - - FILL_OR_KILL - - name: order_types - description: Only returns orders matching the specified order types (e.g. - MARKET). By default, returns all order types. - in: query - required: false - explode: true - schema: - type: array - items: - type: string - enum: - - UNKNOWN_ORDER_TYPE - - MARKET - - LIMIT - - STOP - - STOP_LIMIT - - BRACKET - - TWAP - - ROLL_OPEN - - ROLL_CLOSE - - LIQUIDATION - - SCALED - - name: order_side - description: Only returns the orders matching the specified side (e.g. 'BUY', - 'SELL'). By default, returns all sides. - in: query - required: false - schema: - type: string - enum: - - BUY - - SELL - default: '' - - name: start_date - description: The start date to fetch orders from (inclusive). If provided, - only orders created after this date will be returned. - in: query - required: false - schema: - type: string - format: RFC3339 Timestamp - - name: end_date - description: The end date to fetch orders from (exclusive). If provided, only - orders with creation time before this date will be returned. - in: query - required: false - schema: - type: string - format: RFC3339 Timestamp - - name: order_placement_source - description: Only returns the orders matching this placement source. By default, - returns RETAIL_ADVANCED placement source. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_PLACEMENT_SOURCE - - RETAIL_SIMPLE - - RETAIL_ADVANCED - - RETAIL_ADMIN - - RETAIL_RAISE - default: RETAIL_ADVANCED - - name: contract_expiry_type - description: Only returns the orders matching the contract expiry type. Only - applicable if product_type is set to FUTURE. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_CONTRACT_EXPIRY_TYPE - - EXPIRING - - PERPETUAL - default: UNKNOWN_CONTRACT_EXPIRY_TYPE - - name: asset_filters - description: Only returns the orders where the quote, base or underlying asset - matches the provided asset filter(s) (e.g. 'BTC'). - in: query - required: false - explode: true - schema: - type: array - items: - type: string - - name: retail_portfolio_id - description: '**(Deprecated)** Only orders matching this retail portfolio - id are returned. Only applicable for legacy keys. CDP keys will default - to the key''s permissioned portfolio.' - in: query - required: false - schema: - type: string - - name: limit - description: The number of orders to display per page (no default amount). - If `has_next` is true, additional pages of orders are available to be fetched. - Use the `cursor` parameter to start on a specified page. - in: query - required: false - schema: - type: integer - format: int32 - - name: cursor - description: For paginated responses, returns all responses that come after - this value. - in: query - required: false - schema: - type: string - - name: sort_by - description: Sort results by a field, results use unstable pagination. Default - is to sort by creation time. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_SORT_BY - - LIMIT_PRICE - - LAST_FILL_TIME - - LAST_UPDATE_TIME - default: UNKNOWN_SORT_BY - - name: user_native_currency - description: '**(Deprecated)** Native currency to fetch order with. Default - is `USD`.' - in: query - required: false - schema: - type: string - - name: use_simplified_total_value_calculation - description: Optional boolean to use simplified total value calculation. Default - is true. - in: query - required: false - schema: - type: boolean - default: 'true' - - name: proof_token - description: Optional proof token for 2FA validation when accessing transaction - history (EU SCA compliance). - in: query - required: false - schema: - type: string - tags: - - Orders - /api/v3/brokerage/orders/historical/fills: - get: - summary: List Fills - description: 'Get a list of fills filtered by optional query parameters (`product_ids`, - `order_ids`, etc.). - - - **Equities:** Pass `EQUITY` in `product_types` to return only equity fills. - When filtering by product, use the canonical `product_id` rather than the - display ticker.' - operationId: RetailBrokerageApi_GetFills - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetFillsResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetFillsResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: order_ids - description: The ID(s) of order(s). - in: query - required: false - explode: true - schema: - type: array - items: - type: string - - name: trade_ids - description: The ID(s) of the trades of fills. - in: query - required: false - explode: true - schema: - type: array - items: - type: string - - name: product_ids - description: Canonical product ID(s) to filter fills by. For equities, use - product_id rather than the display ticker. - in: query - required: false - explode: true - schema: - type: array - items: - type: string - - name: start_sequence_timestamp - description: Only fills with a trade time after the specified start date are - returned. - in: query - required: false - schema: - type: string - format: RFC3339 Timestamp - - name: end_sequence_timestamp - description: Only fills with a trade time before the specified end date are - returned. - in: query - required: false - schema: - type: string - format: RFC3339 Timestamp - - name: retail_portfolio_id - description: '**(Deprecated)** Only fills matching this retail portfolio id - are returned. Only applicable for legacy keys. CDP keys will default to - the key''s permissioned portfolio.' - in: query - required: false - schema: - type: string - - name: limit - description: The number of fills to be returned (default is 100). - in: query - required: false - schema: - type: integer - format: int64 - - name: cursor - description: For paginated responses, returns all responses that come after - this value. - in: query - required: false - schema: - type: string - - name: sort_by - description: Sort results by a field, results use unstable pagination. Default - is sort by creation time - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_SORT_BY - - PRICE - - TRADE_TIME - default: UNKNOWN_SORT_BY - - name: asset_filters - description: Only returns the fills where the quote, base or underlying asset - matches the provided asset filter(s) (e.g. 'BTC'). - in: query - required: false - explode: true - schema: - type: array - items: - type: string - - name: order_types - description: "Only returns fills for orders matching the specified order types\ - \ (e.g. 'MARKET', 'LIMIT').\n\n - MARKET: A [market order](https://en.wikipedia.org/wiki/Order_(exchange)#Market_order)\n\ - \ - LIMIT: A [limit order](https://en.wikipedia.org/wiki/Order_(exchange)#Limit_order)\n\ - \ - STOP: A stop order is an order that becomes a market order when triggered\n\ - \ - STOP_LIMIT: A stop order is a limit order that doesn't go on the book\ - \ until it hits the stop price\n - BRACKET: A bracket order is a way to\ - \ mitigate potential losses in volatile markets, consisting of a limit price\ - \ leg and a stop trigger price.\n - TWAP: TWAP order is a way to split large\ - \ buy/sell orders to smaller chunks to reduce market impact\n - ROLL_OPEN:\ - \ ROLL_OPEN order is the open step order of a contract roll\n - ROLL_CLOSE:\ - \ ROLL_CLOSE is the close step order in a contract roll\n - LIQUIDATION:\ - \ LIQUIDATION is a special order type that is used to liquidate a position\n\ - \ - SCALED: SCALED order is an order that is split into multiple child orders\ - \ at incrementally increasing or decreasing prices" - in: query - required: false - explode: true - schema: - type: array - items: - type: string - enum: - - UNKNOWN_ORDER_TYPE - - MARKET - - LIMIT - - STOP - - STOP_LIMIT - - BRACKET - - TWAP - - ROLL_OPEN - - ROLL_CLOSE - - LIQUIDATION - - SCALED - - name: order_side - description: Only returns fills for orders matching the specified side ('BUY' - or 'SELL'). By default, returns all sides. - in: query - required: false - schema: - type: string - enum: - - BUY - - SELL - default: '' - - name: product_types - description: Only returns fills for orders matching the specified product - types (for example, SPOT, FUTURE, or EQUITY). By default, returns all product - types. - in: query - required: false - explode: true - schema: - type: array - items: - type: string - enum: - - UNKNOWN_PRODUCT_TYPE - - SPOT - - FUTURE - - EQUITY - - OPTION_GROUP - - FUTURE_GROUP - - name: proof_token - description: Optional proof token for 2FA validation when accessing transaction - history (EU SCA compliance). - in: query - required: false - schema: - type: string - tags: - - Orders - /api/v3/brokerage/orders/historical/{order_id}: - get: - summary: Get Order - description: 'Get a single order by order ID. - - - **Equities:** The response identifies equity orders with `product_type: EQUITY`. - Use `displayed_order_config` for the equity time in force and `equity_trading_session` - for the session in which the order is eligible to execute.' - operationId: RetailBrokerageApi_GetHistoricalOrder - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetHistoricalOrderResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetHistoricalOrderResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: order_id - description: The ID of the order. - in: path - required: true - schema: - type: string - - name: client_order_id - description: '**(Deprecated)** Client Order ID to fetch the order with.' - in: query - required: false - schema: - type: string - - name: user_native_currency - description: '**(Deprecated)** Native currency to fetch order with. Default - is `USD`.' - in: query - required: false - schema: - type: string - tags: - - Orders - /api/v3/brokerage/orders/preview: - post: - summary: Preview Order - description: Preview an order. - operationId: RetailBrokerageApi_PreviewOrder - security: - - ApiKey: - - view - - OAuth2: - - "wallet:buys:create" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderPreviewResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderPreviewResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderPreviewRequest' - required: true - tags: - - Orders - /api/v3/brokerage/orders/close_position: - post: - summary: Close Position - description: Places an order to close any open positions for a specified `product_id`. - operationId: RetailBrokerageApi_ClosePosition - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:buys:create" - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ClosePositionResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ClosePositionResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ClosePositionRequest' - required: true - tags: - - Orders - /api/v3/brokerage/portfolios: - get: - summary: List Portfolios - description: Get all portfolios of a user. - operationId: RetailBrokerageApi_GetPortfolios - security: - - ApiKey: - - view - - OAuth2: - - "wallet:accounts:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetPortfoliosResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetPortfoliosResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: portfolio_type - description: Only returns portfolios matching this portfolio type. - in: query - required: false - schema: - type: string - enum: - - UNDEFINED - - DEFAULT - - CONSUMER - - INTX - default: UNDEFINED - tags: - - Portfolios - post: - summary: Create Portfolio - description: Create a portfolio. - operationId: RetailBrokerageApi_CreatePortfolio - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:user:update" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CreatePortfolioResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CreatePortfolioResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CreatePortfolioRequest' - required: true - tags: - - Portfolios - /api/v3/brokerage/portfolios/move_funds: - post: - summary: Move Portfolio Funds - description: Move funds between portfolios. - operationId: RetailBrokerageApi_MovePortfolioFunds - security: - - ApiKey: - - transfer - - OAuth2: - - "wallet:transactions:transfer" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MovePortfolioFundsResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MovePortfolioFundsResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MovePortfolioFundsRequest' - required: true - tags: - - Portfolios - /api/v3/brokerage/portfolios/{portfolio_uuid}: - get: - summary: Get Portfolio Breakdown - description: Get the breakdown of a portfolio. - operationId: RetailBrokerageApi_GetPortfolioBreakdown - security: - - ApiKey: - - view - - OAuth2: - - "wallet:accounts:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetPortfolioBreakdownResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetPortfolioBreakdownResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: portfolio_uuid - description: The portfolio UUID. - in: path - required: true - schema: - type: string - - name: currency - description: The currency symbol (e.g. USD). - in: query - required: false - schema: - type: string - tags: - - Portfolios - delete: - summary: Delete Portfolio - description: Delete portfolio. - operationId: RetailBrokerageApi_DeletePortfolio - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:accounts:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.DeletePortfolioResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.DeletePortfolioResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: portfolio_uuid - description: The portfolio UUID. - in: path - required: true - schema: - type: string - tags: - - Portfolios - put: - summary: Edit Portfolio - description: Edit a portfolio. - operationId: RetailBrokerageApi_EditPortfolio - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:user:update" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EditPortfolioResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EditPortfolioResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: portfolio_uuid - description: The portfolio UUID. - in: path - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EditPortfolioRequest' - required: true - tags: - - Portfolios - /api/v3/brokerage/cfm/balance_summary: - get: - summary: Get Futures Balance Summary - description: Get a summary of balances for CFM trading - operationId: RetailBrokerageApi_GetFCMBalanceSummary - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetFCMBalanceSummaryResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetFCMBalanceSummaryResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - tags: - - Futures - /api/v3/brokerage/cfm/intraday/margin_setting: - get: - summary: Get Intraday Margin Setting - description: Get the futures intraday margin setting - operationId: RetailBrokerageApi_GetIntradayMarginSetting - security: - - ApiKey: - - view - - OAuth2: - - "wallet:user:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetIntradayMarginSettingResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetIntradayMarginSettingResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - tags: - - Futures - post: - summary: Set Intraday Margin Setting - description: Set the futures intraday margin setting - operationId: RetailBrokerageApi_SetIntradayMarginSetting - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:user:update" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.SetIntradayMarginSettingResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.SetIntradayMarginSettingResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.SetIntradayMarginSettingRequest' - required: true - tags: - - Futures - /api/v3/brokerage/cfm/intraday/current_margin_window: - get: - summary: Get Current Margin Window - description: Get the futures current margin window - operationId: RetailBrokerageApi_GetCurrentMarginWindow - security: - - ApiKey: - - view - - OAuth2: - - "wallet:user:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetCurrentMarginWindowResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetCurrentMarginWindowResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: margin_profile_type - description: The margin profile type for your account. - in: query - required: false - schema: - type: string - enum: - - MARGIN_PROFILE_TYPE_UNSPECIFIED - - MARGIN_PROFILE_TYPE_RETAIL_REGULAR - - MARGIN_PROFILE_TYPE_RETAIL_INTRADAY_MARGIN_1 - default: MARGIN_PROFILE_TYPE_UNSPECIFIED - tags: - - Futures - /api/v3/brokerage/cfm/positions: - get: - summary: List Futures Positions - description: Get a list of positions in CFM products - operationId: RetailBrokerageApi_GetFCMPositions - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetFCMPositionsResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetFCMPositionsResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - tags: - - Futures - /api/v3/brokerage/cfm/positions/{product_id}: - get: - summary: Get Futures Position - description: Get positions for a specific CFM product - operationId: RetailBrokerageApi_GetFCMPosition - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetFCMPositionResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetFCMPositionResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_id - description: The ticker symbol (e.g. 'BIT-28JUL23-CDE'). - in: path - required: true - schema: - type: string - tags: - - Futures - /api/v3/brokerage/cfm/sweeps/schedule: - post: - summary: Schedule Futures Sweep - description: Schedules a sweep of funds from FCM wallet to USD Spot wallet - operationId: RetailBrokerageApi_ScheduleFCMSweep - security: - - ApiKey: - - transfer - - OAuth2: - - "wallet:transactions:transfer" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.ScheduleFCMSweepResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.ScheduleFCMSweepResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.ScheduleFCMSweepRequest' - required: true - tags: - - Futures - /api/v3/brokerage/cfm/sweeps: - get: - summary: List Futures Sweeps - description: Get pending and processing sweeps of funds from FCM wallet to USD - Spot wallet - operationId: RetailBrokerageApi_GetFCMSweeps - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetFCMSweepsResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.GetFCMSweepsResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - tags: - - Futures - delete: - summary: Cancel Pending Futures Sweep - description: Cancel the pending sweep of funds from FCM wallet to USD Spot wallet - operationId: RetailBrokerageApi_CancelFCMSweep - security: - - ApiKey: - - transfer - - OAuth2: - - "wallet:transactions:transfer" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.CancelFCMSweepResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.CancelFCMSweepResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - tags: - - Futures - /api/v3/brokerage/intx/allocate: - post: - summary: Allocate Portfolio - description: Allocate portfolio funds to a sub-portfolio on Intx Portfolio - operationId: RetailBrokerageApi_AllocatePortfolio - security: - - ApiKey: - - transfer - - OAuth2: - - "wallet:transactions:transfer" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.AllocatePortfolioResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.AllocatePortfolioResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.AllocatePortfolioRequest' - required: true - tags: - - Perpetuals - /api/v3/brokerage/intx/portfolio/{portfolio_uuid}: - get: - summary: Get Perpetuals Portfolio Summary - description: Get a summary of your Perpetuals portfolio - operationId: RetailBrokerageApi_GetIntxPortfolioSummary - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.GetPortfoliosResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.GetPortfoliosResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: portfolio_uuid - description: The portfolio UUID. - in: path - required: true - schema: - type: string - tags: - - Perpetuals - /api/v3/brokerage/intx/positions/{portfolio_uuid}: - get: - summary: List Perpetuals Positions - description: Get a list of open positions in your Perpetuals portfolio - operationId: RetailBrokerageApi_GetIntxPositions - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.GetPositionsResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.GetPositionsResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: portfolio_uuid - description: The portfolio UUID. - in: path - required: true - schema: - type: string - tags: - - Perpetuals - /api/v3/brokerage/intx/positions/{portfolio_uuid}/{symbol}: - get: - summary: Get Perpetuals Position - description: Get a specific open position on Intx - operationId: RetailBrokerageApi_GetIntxPosition - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.GetPositionResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.GetPositionResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: portfolio_uuid - description: The portfolio UUID. - in: path - required: true - schema: - type: string - - name: symbol - description: The trading pair (e.g. 'BTC-PERP-INTX'). - in: path - required: true - schema: - type: string - tags: - - Perpetuals - /api/v3/brokerage/intx/balances/{portfolio_uuid}: - get: - summary: Get Portfolios Balances - description: Get a list of asset balances on Intx for a given Portfolio - operationId: RetailBrokerageApi_GetIntxBalances - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.intx_common.GetBalanceSummaryResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.intx_common.GetBalanceSummaryResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: portfolio_uuid - in: path - required: true - schema: - type: string - tags: - - Perpetuals - /api/v3/brokerage/intx/multi_asset_collateral: - post: - summary: Opt In or Out of Multi Asset Collateral - description: Enable or Disable Multi Asset Collateral for a given Portfolio - operationId: RetailBrokerageApi_IntxMultiAssetCollateral - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:buys:create" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.MultiAssetCollateralResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.MultiAssetCollateralResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.MultiAssetCollateralRequest' - required: true - tags: - - Perpetuals - /api/v3/brokerage/transaction_summary: - get: - summary: Get Transaction Summary - description: Get a summary of transactions with fee tiers, total volume, and - fees. - operationId: RetailBrokerageApi_GetTransactionSummary - security: - - ApiKey: - - view - - OAuth2: - - "wallet:transactions:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetTransactionSummaryResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetTransactionSummaryResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_type - description: Only returns the orders matching this product type. By default, - returns all product types. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_PRODUCT_TYPE - - SPOT - - FUTURE - - EQUITY - - OPTION_GROUP - - FUTURE_GROUP - default: UNKNOWN_PRODUCT_TYPE - - name: contract_expiry_type - description: Only returns the orders matching this contract expiry type. Only - applicable if product_type is set to FUTURE. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_CONTRACT_EXPIRY_TYPE - - EXPIRING - - PERPETUAL - default: UNKNOWN_CONTRACT_EXPIRY_TYPE - - name: product_venue - description: Venue for product - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_VENUE_TYPE - - CBE - - FCM - - INTX - default: UNKNOWN_VENUE_TYPE - tags: - - Fees - /api/v3/brokerage/convert/quote: - post: - summary: Create Convert Quote - description: Create a convert quote with a specified source account, target - account, and amount. Convert is applicable for USDC-USD, PYUSD-USD, EURC-EUR - conversion, and PYUSD-USDC conversion - operationId: RetailBrokerageApi_CreateConvertQuote - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:trades:create" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.CreateConvertQuoteResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.CreateConvertQuoteResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.CreateConvertQuoteRequest' - required: true - tags: - - Converts - /api/v3/brokerage/convert/trade/{trade_id}: - get: - summary: Get Convert Trade - description: Gets a list of information about a convert trade with a specified - trade id, source account, and target account - operationId: RetailBrokerageApi_GetConvertTrade - security: - - ApiKey: - - view - - OAuth2: - - "wallet:trades:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.GetConvertTradeResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.GetConvertTradeResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: trade_id - description: The ID of the trade to commit. - in: path - required: true - schema: - type: string - - name: from_account - description: The currency of the account to convert from (e.g. USD). - in: query - required: true - schema: - type: string - - name: to_account - description: The currency of the account to convert to (e.g. USDC). - in: query - required: true - schema: - type: string - tags: - - Converts - post: - summary: Commit Convert Trade - description: Commits a convert trade with a specified trade id, source account, - and target account - operationId: RetailBrokerageApi_CommitConvertTrade - security: - - ApiKey: - - trade - - OAuth2: - - "wallet:trades:create" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.CommitConvertTradeResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.CommitConvertTradeResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: trade_id - description: The ID of the trade to commit. - in: path - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.CommitConvertTradeRequest' - required: true - tags: - - Converts - /api/v3/brokerage/time: - get: - summary: Get Server Time - description: Get the current time from the Coinbase Advanced API. - operationId: RetailBrokerageApi_GetServerTime - security: [] - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.common.ExtendedTimestamp' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.common.ExtendedTimestamp' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - tags: - - Public - /api/v3/brokerage/market/product_book: - get: - summary: Get Public Product Book - description: Get a list of bids/asks for a single product. The amount of detail - shown can be customized with the limit parameter. - operationId: RetailBrokerageApi_GetPublicProductBook - security: [] - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetProductBookResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetProductBookResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_id - description: The trading pair (e.g. 'BTC-USD'). - in: query - required: true - schema: - type: string - - name: limit - description: 'The number of bid/asks to be returned. ' - in: query - required: false - schema: - type: integer - format: int32 - - name: aggregation_price_increment - description: The minimum price intervals at which buy and sell orders are - grouped or combined in the order book. - in: query - required: false - schema: - type: string - tags: - - Public - /api/v3/brokerage/market/products: - get: - summary: List Public Products - description: Get a list of the available currency pairs for trading. - operationId: RetailBrokerageApi_GetPublicProducts - security: [] - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Products' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Products' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: limit - description: The number of products to be returned. - in: query - required: false - schema: - type: integer - format: int32 - - name: offset - description: The number of products to skip before returning. - in: query - required: false - schema: - type: integer - format: int32 - - name: product_type - description: Only returns products matching this product type. If omitted, - only SPOT products are returned. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_PRODUCT_TYPE - - SPOT - - FUTURE - - EQUITY - - OPTION_GROUP - - FUTURE_GROUP - default: UNKNOWN_PRODUCT_TYPE - - name: product_ids - description: The list of trading pairs (e.g. 'BTC-USD'). - in: query - required: false - explode: true - schema: - type: array - items: - type: string - - name: contract_expiry_type - description: Only returns the products matching the contract expiry type. - Only applicable if product_type is set to FUTURE. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_CONTRACT_EXPIRY_TYPE - - EXPIRING - - PERPETUAL - default: UNKNOWN_CONTRACT_EXPIRY_TYPE - - name: expiring_contract_status - description: Only returns contracts with this status (default is UNEXPIRED). - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_EXPIRING_CONTRACT_STATUS - - STATUS_UNEXPIRED - - STATUS_EXPIRED - - STATUS_ALL - default: UNKNOWN_EXPIRING_CONTRACT_STATUS - - name: get_all_products - description: If true, return all products of all product types (including - expired futures contracts). - in: query - required: false - schema: - type: boolean - - name: products_sort_order - description: The order in which products are returned. By default, products - are returned in 24 hour volume descending (in quote). - in: query - required: false - schema: - type: string - enum: - - PRODUCTS_SORT_ORDER_UNDEFINED - - PRODUCTS_SORT_ORDER_VOLUME_24H_DESCENDING - - PRODUCTS_SORT_ORDER_LIST_TIME_DESCENDING - default: PRODUCTS_SORT_ORDER_UNDEFINED - - name: cursor - description: The cursor to use for pagination. This will be a base64 encoded - string that decodes into the last productId of the previously returned page - in: query - required: false - schema: - type: string - - name: futures_underlying_type - description: Only returns the products matching the underlying type. Only - applicable if product_type is set to FUTURE. - in: query - required: false - schema: - type: string - enum: - - UNKNOWN_FUTURES_UNDERLYING_TYPE - - FUTURES_UNDERLYING_TYPE_SPOT - - FUTURES_UNDERLYING_TYPE_INDEX - - FUTURES_UNDERLYING_TYPE_EQUITY - - FUTURES_UNDERLYING_TYPE_EQUITY_INDEX - - FUTURES_UNDERLYING_TYPE_EQUITY_ETF - - FUTURES_UNDERLYING_TYPE_PREIPO - - FUTURES_UNDERLYING_TYPE_COMMOD - - FUTURES_UNDERLYING_TYPE_COMMOD_ETF - - FUTURES_UNDERLYING_TYPE_COMMOD_INDEX - - FUTURES_UNDERLYING_TYPE_ADR - - FUTURES_UNDERLYING_TYPE_FOREIGN_EQUITY - - FUTURES_UNDERLYING_TYPE_OTC - default: UNKNOWN_FUTURES_UNDERLYING_TYPE - - name: user_country_code - description: The country code of the user. This is used to provide differentiated - product display names. - in: query - required: false - schema: - type: string - - name: expired - description: If true, return recently expired instruments instead of active - ones. Only applicable to product_venue=DERIBIT; ignored for other venues. - Defaults to false. - in: query - required: false - schema: - type: boolean - tags: - - Public - /api/v3/brokerage/market/products/{product_id}: - get: - summary: Get Public Product - description: Get information on a single product by product ID. - operationId: RetailBrokerageApi_GetPublicProduct - security: [] - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Product' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Product' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_id - description: The trading pair (e.g. 'BTC-USD'). - in: path - required: true - schema: - type: string - tags: - - Public - /api/v3/brokerage/market/products/{product_id}/candles: - get: - summary: Get Public Product Candles - description: Get rates for a single product by product ID, grouped in buckets. - operationId: RetailBrokerageApi_GetPublicCandles - security: [] - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Candles' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Candles' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_id - description: The trading pair (e.g. 'BTC-USD'). - in: path - required: true - schema: - type: string - - name: start - description: The UNIX timestamp indicating the start of the time interval. - in: query - required: true - schema: - type: string - - name: end - description: The UNIX timestamp indicating the end of the time interval. - in: query - required: true - schema: - type: string - - name: granularity - description: The timeframe each candle represents. - in: query - required: true - schema: - type: string - enum: - - UNKNOWN_GRANULARITY - - ONE_MINUTE - - FIVE_MINUTE - - FIFTEEN_MINUTE - - THIRTY_MINUTE - - ONE_HOUR - - TWO_HOUR - - FOUR_HOUR - - SIX_HOUR - - ONE_DAY - default: UNKNOWN_GRANULARITY - - name: limit - description: The number of candle buckets to be returned. By default, returns - 350 (max 350). - in: query - required: false - schema: - type: integer - format: int32 - tags: - - Public - /api/v3/brokerage/market/products/{product_id}/ticker: - get: - summary: Get Public Market Trades - description: Get snapshot information by product ID about the last trades (ticks) - and best bid/ask. - operationId: RetailBrokerageApi_GetPublicMarketTrades - security: [] - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetMarketTradesResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GetMarketTradesResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: product_id - description: The trading pair (e.g. 'BTC-USD'). - in: path - required: true - schema: - type: string - - name: limit - description: 'The number of trades to be returned. ' - in: query - required: true - schema: - type: integer - format: int32 - - name: start - description: The UNIX timestamp indicating the start of the time interval. - in: query - required: false - schema: - type: string - - name: end - description: The UNIX timestamp indicating the end of the time interval. - in: query - required: false - schema: - type: string - tags: - - Public - /api/v3/brokerage/payment_methods: - get: - summary: List Payment Methods - description: Get a list of payment methods for the current user. - operationId: RetailBrokerageApi_GetPaymentMethods - security: - - ApiKey: - - view - - OAuth2: - - "wallet:payment-methods:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.payment_method.GetPaymentMethodsResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.payment_method.GetPaymentMethodsResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - tags: - - Payment Methods - /api/v3/brokerage/payment_methods/{payment_method_id}: - get: - summary: Get Payment Method - description: Get information about a payment method for the current user. - operationId: RetailBrokerageApi_GetPaymentMethod - security: - - ApiKey: - - view - - OAuth2: - - "wallet:payment-methods:read" - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.payment_method.GetPaymentMethodResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.payment_method.GetPaymentMethodResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - parameters: - - name: payment_method_id - description: The ID of the payment method. Refer to [List Payment Methods](https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpaymentmethods/) - for the list of all available payment methods and their corresponding IDs. - in: path - required: true - schema: - type: string - tags: - - Payment Methods - /api/v3/brokerage/key_permissions: - get: - summary: Get API Key Permissions - description: Get information about your CDP API key permissions - operationId: RetailBrokerageApi_GetApiKeyPermissions - security: - - ApiKey: - - view - responses: - '200': - description: A successful response. - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.utility.GetApiKeyPermissionsResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.utility.GetApiKeyPermissionsResponse' - default: - description: An unexpected error response. - content: - application/json: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - text/event-stream: - schema: - $ref: '#/components/schemas/grpc.gateway.runtime.Error' - tags: - - Data API -x-readme: - explorer-enabled: false - samples-enabled: false - headers: - - key: CB-ACCESS-KEY - value: $ACCESS_KEY - - key: CB-ACCESS-SIGN - value: $SIGNATURE - - key: CB-ACCESS-TIMESTAMP - value: $TIMESTAMP -servers: -- url: https://api.coinbase.com -components: - requestBodies: - coinbase.public_api.authed.retail_brokerage_api.EditOrderRequest: - content: - application/json: - schema: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EditOrderRequest' - required: true - schemas: - coinbase.bin_check.CardInfo: - type: object - properties: - match_found: - type: boolean - title: 'used to check for an empty result without throwing an error clientside - - if false, then all other fields are left blank' - type: - title: Card's Type - allOf: - - $ref: '#/components/schemas/coinbase.bin_check.CardInfo.Type' - issuer: - type: string - title: Card's issuer - issuer_country_code: - type: string - title: Card's country - prepaid: - type: boolean - title: Flag to check if is a prepaid card or not - corporate: - type: boolean - title: Flag to check if is corporate card or not - consumer: - type: boolean - visa: - allOf: - - $ref: '#/components/schemas/coinbase.bin_check.VisaInfo' - mastercard: - allOf: - - $ref: '#/components/schemas/coinbase.bin_check.MastercardInfo' - use_3ds: - type: boolean - title: Flag to check if card uses 3D Secure - title: CardInfo message - coinbase.bin_check.CardInfo.Type: - type: string - enum: - - UNKNOWN - - CREDIT - - DEBIT - default: UNKNOWN - title: Card Type enum - coinbase.bin_check.MastercardInfo: - type: object - properties: - fast_funds_supported: - type: boolean - title: 'Are fast funds supported by this card? - - If a card is "fast fund supported" the cardholder can access incoming - funds almost instantly. - - In other words, will this card receive instant payouts?' - title: MastercardInfo info - coinbase.bin_check.VisaInfo: - type: object - properties: - oct_supported: - type: boolean - title: 'Are Original Credit Transactions (OCTs) supported by this card? - - An OCT is a method to transfer funds directly to a cardholder''s account. - - In other words, can this card receive payouts?' - fast_funds_supported: - type: boolean - title: 'Are fast funds supported by this card? - - If a card is "fast fund supported" the cardholder can access incoming - funds almost instantly. - - In other words, will this card receive instant payouts?' - title: VisaInfo message - coinbase.brokerage.types.Decimal: - type: object - properties: - value: - type: string - description: String representation allows for unlimited precision. - description: Represents a decimal number with precision. - coinbase.consumer.shared.common.Amount: - type: object - properties: - value: - type: string - currency: - type: string - cbrn: - type: string - title: 'CBRN Format: version:type:network:sub-network:id:sub-id - - Example: v1:token:solana:mainnet:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:' - title: Message that represents the monetary amount. - coinbase.consumer.shared.common.Link: - type: object - properties: - text: - type: string - url: - type: string - title: 'In-app hyperlink, commonly used to reference support pages. - - e.g. Link(text: "Learn More", url: "https://help.coinbase.com/...")' - coinbase.intx_common.Asset: - type: object - properties: - asset_id: - type: string - asset_uuid: - type: string - asset_name: - type: string - status: - type: string - collateral_weight: - type: string - account_collateral_limit: - type: string - ecosystem_collateral_limit_breached: - type: boolean - asset_icon_url: - type: string - supported_networks_enabled: - type: boolean - coinbase.intx_common.Balance: - type: object - properties: - asset: - allOf: - - $ref: '#/components/schemas/coinbase.intx_common.Asset' - quantity: - type: string - hold: - type: string - transfer_hold: - type: string - collateral_value: - type: string - collateral_weight: - type: string - max_withdraw_amount: - type: string - loan: - type: string - loan_collateral_requirement_usd: - type: string - pledged_quantity: - type: string - max_portfolio_transfer_amount: - type: string - coinbase.intx_common.GetBalanceSummaryResponse: - type: object - properties: - portfolio_balances: - type: array - items: - $ref: '#/components/schemas/coinbase.intx_common.PortfolioBalance' - coinbase.intx_common.PortfolioBalance: - type: object - properties: - portfolio_uuid: - type: string - balances: - type: array - items: - $ref: '#/components/schemas/coinbase.intx_common.Balance' - is_margin_limit_reached: - type: boolean - coinbase.intx_common.PortfolioLiquidationStatus: - type: string - enum: - - PORTFOLIO_LIQUIDATION_STATUS_UNSPECIFIED - - PORTFOLIO_LIQUIDATION_STATUS_CANCELING - - PORTFOLIO_LIQUIDATION_STATUS_AUTO_LIQUIDATING - - PORTFOLIO_LIQUIDATION_STATUS_LSP_ASSIGNMENT - - PORTFOLIO_LIQUIDATION_STATUS_CUSTOMER_ASSIGNMENT - - PORTFOLIO_LIQUIDATION_STATUS_MANUAL - - PORTFOLIO_LIQUIDATION_STATUS_NOT_LIQUIDATING - default: PORTFOLIO_LIQUIDATION_STATUS_UNSPECIFIED - coinbase.intx_common.PortfolioMarginFlags: - type: string - enum: - - PORTFOLIO_MARGIN_FLAGS_UNSPECIFIED - - PORTFOLIO_MARGIN_FLAGS_IN_LIQUIDATION - default: PORTFOLIO_MARGIN_FLAGS_UNSPECIFIED - coinbase.intx_common.PortfolioMarginType: - type: string - enum: - - MARGIN_TYPE_UNSPECIFIED - - MARGIN_TYPE_CROSS - - MARGIN_TYPE_ISOLATED - default: MARGIN_TYPE_UNSPECIFIED - coinbase.intx_common.PositionSide: - type: string - enum: - - POSITION_SIDE_UNKNOWN - - POSITION_SIDE_LONG - - POSITION_SIDE_SHORT - default: POSITION_SIDE_UNKNOWN - coinbase.payments.common.Address: - type: object - properties: - address1: - type: string - address2: - type: string - city: - type: string - state: - type: string - postal_code: - type: string - country: - type: string - uuid: - type: string - id: - type: string - coinbase.payments.common.DigitalWalletDetails: - type: object - properties: - nonce: - type: string - correlation_id: - type: string - version: - type: string - title: 3ds version from samsung pay ex `100` - coinbase.payments.common.Money: - type: object - properties: - amount: - type: string - currency: - type: string - description: This is a clone of - title: A quantity of money - coinbase.payments.common.payment_methods.AccountNameInquiryDetails: - type: object - properties: - first_name_match: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.MatchResult' - middle_name_match: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.MatchResult' - last_name_match: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.MatchResult' - name_match_indicator: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.NameMatchIndicator' - description: 'Results from Visa Account Name Inquiry, which verifies cardholder - name - - components against the name on file at the issuing bank.' - title: Account Name Inquiry (ANI) - coinbase.payments.common.payment_methods.Address: - type: object - properties: - address1: - type: string - address2: - type: string - city: - type: string - state: - type: string - postal_code: - type: string - country: - type: string - uuid: - type: string - id: - type: string - coinbase.payments.common.payment_methods.AddressVerificationInfo: - type: object - properties: - source: - type: string - avs_street_address: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.AddressVerificationStatus' - avs_postal_code: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.AddressVerificationStatus' - title: Address Verification - coinbase.payments.common.payment_methods.AddressVerificationStatus: - type: string - enum: - - ADDRESS_VERIFICATION_STATUS_UNSPECIFIED - - ADDRESS_VERIFICATION_STATUS_MATCH - - ADDRESS_VERIFICATION_STATUS_NO_MATCH - default: ADDRESS_VERIFICATION_STATUS_UNSPECIFIED - coinbase.payments.common.payment_methods.Allocation: - type: object - properties: - id: - type: string - legs: - type: array - items: - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.AllocationLeg' - is_netted: - type: boolean - coinbase.payments.common.payment_methods.AllocationLeg: - type: object - properties: - id: - type: string - movements: - type: array - items: - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.FundMovement' - is_netted: - type: boolean - coinbase.payments.common.payment_methods.ApplePay: - type: object - properties: - braintree: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ApplePay.BraintreeData' - apple_pay: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.DigitalWalletDetails' - user_id: - type: string - postal_code: - type: string - title: 'The following fields can be populated on the PM after an order - - is submitted in the InstructionResponse. They should not be filled in - - a normal order Instruction though' - customer_name: - type: string - address: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Address' - six_digit_bin: - type: string - last_four: - type: string - issuing_country: - type: string - issuing_bank: - type: string - product_id: - type: string - customer_dob: - type: string - title: Date of birth in YYYY-MM-DD format - billing_address_id: - type: string - title: Users address id - currency: - type: string - title: Currency of the transaction - scheme: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ApplePay.Scheme' - prepaid: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ApplePay.Result' - debit: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ApplePay.Result' - title: uniquely identifies a user's Coinbase account - coinbase.payments.common.payment_methods.ApplePay.BraintreeData: - type: object - properties: - nonce: - type: string - correlation_id: - type: string - coinbase.payments.common.payment_methods.ApplePay.Result: - type: string - enum: - - UNCERTAIN - - 'TRUE' - - 'FALSE' - default: UNCERTAIN - coinbase.payments.common.payment_methods.ApplePay.Scheme: - type: string - enum: - - UNKNOWN - - VISA - - MASTERCARD - default: UNKNOWN - coinbase.payments.common.payment_methods.ArgentineBankAccountDetails: - type: object - properties: - tax_id: - type: string - cbu: - type: string - coinbase.payments.common.payment_methods.BancomatPay: - type: object - properties: - customer_name: - type: string - account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.BancomatPayAccount' - coinbase.payments.common.payment_methods.BancomatPayAccount: - type: object - properties: - phone_number: - type: string - coinbase.payments.common.payment_methods.BankAccount: - type: object - properties: - customer_account_type: - type: string - customer_account_number: - type: string - customer_routing_number: - type: string - customer_name: - type: string - currency: - type: string - title: default USD in code - bank_name: - type: string - title: This is called 'name' in PMSvc ACH proto - ach_entry_class: - type: string - verification_method: - type: string - title: default 'cdv' in code - cdv_amount_1: - allOf: - - $ref: '#/components/schemas/coinbase.payments.shared.Money' - cdv_amount_2: - allOf: - - $ref: '#/components/schemas/coinbase.payments.shared.Money' - ach_invalid_account: - type: boolean - ach_bad_account: - type: boolean - received_non_nsf_return: - type: boolean - giactInfo: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.GiactInfo' - vendor_verification_status: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.VendorVerificationStatus' - plaid_verification_info: - description: Information about the Plaid Info linked through Plaid. - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PlaidInfo' - stripe_verification_info: - description: Information about the financial connections linked through - Stripe. - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.StripeFinancialConnectionsInfo' - coinbase.payments.common.payment_methods.BankingCircleNowDetails: - type: object - properties: - iban: - type: string - currency: - type: string - customer_payment_name: - type: string - coinbase.payments.common.payment_methods.BankingCircleToken: - type: object - properties: - mandate_id: - type: string - description: mandate_id is a 32 char long unique identifier of the account - token (mandate) on Banking Circle side. - active: - type: boolean - title: 'AIDoc: Whether the mandate is active' - balance_check_supported: - type: boolean - title: 'AIDoc: Whether balance check is supported for this mandate' - hosted_page_id: - type: string - description: 'hosted_page_id is the unique identifier for the hosted page - used for creating the mandate object. - - It is updated when a new mandate is created (i.e. when the mandate_id - is updated).' - description: 'AIDoc: BankingCircleToken is used to embed information related - to an account token for SEPA Direct Debit payments with Banking Circle.' - coinbase.payments.common.payment_methods.BlikDetails: - type: object - properties: - email: - type: string - title: The RFC-compliant email address of the account holder. (Optional) - country: - type: string - description: The country where the payer's bank account is located. Populated - for all Blik payments in the PMSvc API response. - account_holder: - type: string - description: Account holder names. This field is optional and may not be - populated for all Blik payments in the PMSvc API response. - title: https://developerhub.ppro.com/simple-api/docs/blik-redirect#specific-input-parameters-for-the-transaction-call - coinbase.payments.common.payment_methods.BlockchainAddress: - type: object - properties: - address: - type: string - destination_tag: - type: string - coinbase.payments.common.payment_methods.BlockchainTransaction: - type: object - properties: - hsh: - type: string - height: - type: integer - format: int32 - normalized_hash: - type: string - description: optional, for cases such as Scot asset deposit/withdrawal, - needed for Nova & Wallets data stream. - coinbase.payments.common.payment_methods.CTN: - type: object - properties: - id: - type: string - coinbase.payments.common.payment_methods.CadWireDetails: - type: object - properties: - account_number: - type: string - customer_payment_name: - type: string - account_address: - type: string - institution_number: - type: string - title: 'Part of the financial institution''s routing information: the 3-digit - Canadian financial institution number' - transit_number: - type: string - title: 'Part of the financial institution''s routing information: the 5-digit - branch transit number' - bank_address1: - type: string - title: The address of the customer's bank, required for outbound payments - institution_name: - type: string - title: Name of the user's institution that was used for the CAD Wire transaction - coinbase.payments.common.payment_methods.Card: - type: object - properties: - first_data_token: - title: Vendor-Specific Tokens and Parameters - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.FirstDataToken' - merchant: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Merchant' - vault_token: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.VaultToken' - worldpay_params: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.WorldpayParams' - checkout_token: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.CheckoutToken' - stripe_params: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.StripeParams' - six_digit_bin: - type: string - title: Card Identification - last_four: - type: string - eight_digit_bin: - type: string - card_sub_brand: - type: string - card_brand: - type: string - obfuscated_pan: - type: string - bin_info: - allOf: - - $ref: '#/components/schemas/coinbase.bin_check.CardInfo' - scheme: - title: Card Network and Issuer Information - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Card.Scheme' - issuer: - type: string - issuer_country_code: - type: string - address: - title: Customer Information - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Address' - phone_number: - type: string - user_id: - type: string - postal_code: - type: string - customer_info: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.CustomerInfo' - expiry_date: - title: Card Expiration and Timestamps - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ExpiryDate' - cdv_method: - type: string - title: Card Debit Verification (CDV) - cdv_amount_1: - allOf: - - $ref: '#/components/schemas/coinbase.payments.shared.Money' - cdv_amount_2: - allOf: - - $ref: '#/components/schemas/coinbase.payments.shared.Money' - worldpay_card_cdv_status: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.WorldpayCardCdvStatus' - previous_scheme_tx_id: - type: string - title: Transaction and Scheme References - initial_scheme_tx_id: - type: string - rejected: - type: boolean - title: Rejection Status - rejected_at: - type: string - format: RFC3339 Timestamp - rejection_count: - type: integer - format: int32 - rejected_via_purchase: - type: boolean - account_updater_updated_at: - type: string - format: RFC3339 Timestamp - title: Account Updater - account_updater_reason: - type: string - account_updater_status: - type: string - almost_expired_notified: - type: boolean - title: Migration and Notification Status - is_migrated_card: - type: boolean - migrated_created_at: - type: string - format: RFC3339 Timestamp - card_source: - title: Metadata - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.CardSource' - added_via_buy_widget: - type: boolean - encrypted_data: - type: string - verification_method: - type: string - coinbase_credit_card_params: - title: Coinbase Credit Card - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.CoinbaseCreditCardParams' - address_verification_info: - title: Risk Verification - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.AddressVerificationInfo' - account_name_inquiry: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.AccountNameInquiryDetails' - customer_name: - type: string - title: Deprecated Fields - customer_first_name: - type: string - customer_last_name: - type: string - customer_dob: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Card.Dob' - title: 'The card as a payment method source or target - - Next available field number: 52' - coinbase.payments.common.payment_methods.Card.Dob: - type: object - properties: - month: - type: string - day: - type: string - year: - type: string - coinbase.payments.common.payment_methods.Card.Scheme: - type: string - enum: - - UNKNOWN - - VISA - - MASTERCARD - default: UNKNOWN - coinbase.payments.common.payment_methods.CardSource: - type: string - enum: - - SOURCE_UNKNOWN - - CARD_IO_SCAN - - MANUAL_ENTRY - - DYNETI_SCAN - - DYNETI_SCAN_AND_MANUAL - - AUTO_ASSIGNED - default: SOURCE_UNKNOWN - title: Card Source Identification - coinbase.payments.common.payment_methods.Cbit: - type: object - properties: - cbit_wallet_address: - type: string - title: 'AIDoc: The wallet address for the CBIT payment method' - customers_bank_account_id: - type: string - title: 'AIDoc: The customer''s bank account identifier' - currency: - type: string - title: 'AIDoc: The currency code for the payment method' - title: 'AIDoc: Represents details for a CBIT payment method' - coinbase.payments.common.payment_methods.CheckoutPaymentLink: - type: object - properties: - payment_link_id: - type: string - title: unique identifier for a checkout.com payment link - coinbase.payments.common.payment_methods.CheckoutToken: - type: object - properties: - source_id: - type: string - title: 'A payment source identifier from Checkout with format ^(src)_(\w{26})$ - - Example: src_nwd3m4in3hkuddfpjsaevunhdy' - coinbase.payments.common.payment_methods.CoinbaseAccount: - type: object - properties: - account_id: - type: string - title: uniquely identifies a user's Coinbase account - coinbase.payments.common.payment_methods.CoinbaseCreditCardParams: - type: object - properties: - credit_card_account_id: - type: string - title: Account ID for the CB card account in CardService - title: Card params for CB cards which will be used to charge CB1 subscription - fees through the cb credit card processor - coinbase.payments.common.payment_methods.CustodialPool: - type: object - properties: - name: - type: string - network: - type: string - fiat_id: - type: string - title: note this is to support transaction logs where everything is expected - to be a pm for a transfers source and target - coinbase.payments.common.payment_methods.CustomerInfo: - type: object - properties: - full_name: - type: string - first_name: - type: string - last_name: - type: string - dob: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Dob' - nationality: - type: string - description: 'The 2-letter ISO country code representing the nationality - of the customer initiating the card payment. - - Primarily used by our Checkout.com processor to reduce the number of RFIs - (requests for information) needed to verify transactions.' - email: - type: string - title: email address that will be sent in payins by checkout processor - coinbase.payments.common.payment_methods.DAppWalletAccount: - type: object - properties: - user_uuid: - type: string - network: - type: string - cohort_id: - type: string - signing_backend: - type: string - currency: - type: string - title: uniquely identifies a user's dapp wallet account/address - coinbase.payments.common.payment_methods.DAppWalletBlockchainAddress: - type: object - properties: - network: - type: string - address: - type: string - cohort_id: - type: string - user_uuid: - type: string - pool: - type: string - coinbase.payments.common.payment_methods.DefaultAccount: - type: object - properties: - user_uuid: - type: string - currency: - type: string - coinbase.payments.common.payment_methods.DenebIMPS: - type: object - properties: - ifsc_code: - type: string - account_number: - type: string - customer_first_name: - type: string - customer_last_name: - type: string - email: - type: string - phone_number: - type: string - pan: - type: string - address: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Address' - coinbase.payments.common.payment_methods.DenebUPI: - type: object - properties: - vpa_id: - type: string - customer_first_name: - type: string - customer_last_name: - type: string - email: - type: string - phone_number: - type: string - pan: - type: string - address: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Address' - coinbase.payments.common.payment_methods.DerivativeSettlement: - type: object - properties: - account_settlements: - type: array - items: - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.DerivativeSettlement.AccountSettlement' - title: derivative EOD settlement can involve one or more fund movements - equity_reset: - title: optionally reset CFM equity account - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.DerivativeSettlement.EquityReset' - coinbase.payments.common.payment_methods.DerivativeSettlement.AccountSettlement: - type: object - properties: - amount: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.Money' - source_ledger_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.LedgerAccount' - source_ledger_named_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.LedgerNamedAccount' - target_ledger_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.LedgerAccount' - target_ledger_named_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.LedgerNamedAccount' - hold_id_to_replace: - type: string - title: Deprecated, use existing_hold_id instead - new_hold_id: - type: string - title: 'account settlement can optionally replace an existing hold with - - `hold_id_to_replace` to a new hold with `new_hold_id` and amount - - of `new_hold_amount`' - new_hold_amount: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.Money' - existing_hold_id: - type: string - coinbase.payments.common.payment_methods.DerivativeSettlement.EquityReset: - type: object - properties: - amount: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.Money' - equity_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.LedgerAccount' - coinbase.payments.common.payment_methods.DirectDeposit: - type: object - properties: - direct_deposit_account: - type: string - coinbase.payments.common.payment_methods.Dob: - type: object - properties: - month: - type: string - day: - type: string - year: - type: string - title: Customer Information - coinbase.payments.common.payment_methods.Eft: - type: object - properties: - account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Eft.Account' - coinbase.payments.common.payment_methods.Eft.Account: - type: object - properties: - account_name: - type: string - title: Name of the account fulfilling the Request Money Transaction - account_phone_number: - type: string - title: Phone number of the account fulfilling the Request Money Transaction - account_email: - type: string - title: Email of the account fulfilling the Request Money Transaction - institution_number: - type: string - description: 'Institution Number: a 3-digit code that tells you which bank - the account belongs to — unique for every Canadian bank.' - transit_number: - type: string - description: 'Transit Number: a 5-digit code that tells which branch of - the bank the account was created at — it is unique to each bank branch.' - account_number: - type: string - description: 'Account Number: a 7-digit code that identifies the account - within the branch and bank entered.' - provider_id: - type: string - provider_name: - type: string - trustly_account_token_status: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Eft.TrustlyAccountTokenStatus' - account_type: - type: string - coinbase.payments.common.payment_methods.Eft.TrustlyAccountTokenStatus: - type: string - enum: - - TRUSTLY_TOKEN_STATUS_UNSPECIFIED - - TRUSTLY_TOKEN_STATUS_ACTIVE - - TRUSTLY_TOKEN_STATUS_RELINK_NEEDED - default: TRUSTLY_TOKEN_STATUS_UNSPECIFIED - coinbase.payments.common.payment_methods.EmailAddress: - type: object - properties: - value: - type: string - coinbase.payments.common.payment_methods.ExpiryDate: - type: object - properties: - month: - type: string - year: - type: string - title: Basic Card Information - coinbase.payments.common.payment_methods.ExternalPaymentMethod: - type: object - properties: - payment_method_id: - type: string - title: uniquely identifies am external payment method in the Payment Method - Service - coinbase.payments.common.payment_methods.Fedwire: - type: object - properties: - routing_number: - type: string - title: 'AIDoc: The routing number for the fedwire payment method' - account_holder: - title: 'AIDoc: The account holder information' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.FedwireAccount' - bank: - title: 'AIDoc: The primary bank institution details' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.FedwireInstitution' - intermediary_bank: - title: 'AIDoc: The intermediary bank institution details, if applicable' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.FedwireInstitution' - currency: - type: string - title: 'AIDoc: The currency code for the payment method' - fiat_id: - type: string - title: 'AIDoc: ONLY used by prime admin - Venue Entity Type reference code - onboarding' - rejection_count_v2: - type: integer - format: int32 - title: 'AIDoc: The number of rejections for this fedwire payment method' - title: 'Fedwire contains all information necessary to initiate a payment to/from - a fedwire eligible bank account. - - Format based on the Fedwire Format Reference Guide Nov 2014' - coinbase.payments.common.payment_methods.FedwireAccount: - type: object - properties: - legal_name: - type: string - title: 'AIDoc: The legal name of the account holder' - account_number: - type: string - title: 'AIDoc: The account number at the financial institution' - address: - title: 'AIDoc: The address associated with the account' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.FedwireAddress' - title: FedwireAccount represents an account at a financial institution eligible - for Fedwire - coinbase.payments.common.payment_methods.FedwireAddress: - type: object - properties: - lines: - type: array - items: - type: string - description: 'AIDoc: The address lines passed onto the Fedwire network. - Must be at least 2 non-empty lines. Only 3 lines will be passed on.' - country_code: - type: string - description: 'AIDoc: A 2-letter country code ISO-3166-1 Alpha 2. For example - US, CA or SE.' - city: - type: string - title: 'AIDoc: The city associated with the Fedwire address' - state: - type: string - title: 'AIDoc: The state or province associated with the Fedwire address' - postal_code: - type: string - title: 'AIDoc: The postal code or ZIP code associated with the Fedwire address' - title: FedwireAddress is an address for Fedwire payment methods - coinbase.payments.common.payment_methods.FedwireInstitution: - type: object - properties: - name: - type: string - title: 'AIDoc: The name of the financial institution (must be present)' - address: - title: 'AIDoc: The address of the financial institution (must be present - for Fedwire payments)' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.FedwireAddress' - identifier: - type: string - title: 'Required field that will be populated with a value according to - the identifier_code. - - 1. When identifier_code is ''F'', this field represents a 9 digit ABA - code and is likely to match - - the value of the `routing_number` field. - - Ex: "026009593" - - 2. When identifier_code is ''B'', this field represents an 8-11 character - SWIFT code, it *should* identify the same bank as the ABA code in - - `routing_number`. Some implementations (Crossriver) provide the Swift - here instead - - Ex: "BOFAUS3N" - - 3. When identifier_code is ''D'', this field represents an account number. - This usually means it is a "For Further Credit" (FFC) to the - - account number and there is an intermediary bank involved. - - Ex: "000004121345797"' - type: - title: 'AIDoc: The type of institution identifier' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.FedwireInstitution.Type' - identifier_code: - type: string - title: 'The beneficiary bank id code is a standard identifier which tells - us what the beneficiary bank id value represents. - - B - SWIFT Bank Identifier Code (BIC) - - C - CHIPS Participant - - D - Demand Deposit Account (DDA) Number - - F - Fed Routing Number - - T - SWIFT BIC or Bank Entity Identifier (BEI) and Account Number - - U - CHIPS Identifier' - description: FedwireInstitution is usually a bank, but can also be credit unions - or other financial institutions. - coinbase.payments.common.payment_methods.FedwireInstitution.Type: - type: string - enum: - - CHIPS_IDENTIFIER - - CHIPS_PARTICIPANT - - DDA - - FEDWIRE - - SWIFT_BIC - - SWIFT_BIC_OR_BEI_AND_ACCOUNT - - PASSPORT_NUMBER - - TAX_IDENTIFICATION_NUMBER - - DRIVERS_LICENSE_NUMBER - - ALIEN_REGISTRATION_NUMBER - - CORPORATE_IDENTIFICATION_NUMBER - - OTHER_IDENTIFICATION - - UNKNOWN - default: CHIPS_IDENTIFIER - coinbase.payments.common.payment_methods.FirstDataToken: - type: object - properties: - value: - type: string - store_id: - type: string - id: - type: string - title: Vendor Tokens - coinbase.payments.common.payment_methods.FundMovement: - type: object - properties: - id: - type: string - source_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.LedgerAccount' - destination_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.LedgerAccount' - source_currency: - type: string - target_currency: - type: string - amount: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.Money' - fee: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.Money' - coinbase.payments.common.payment_methods.GiactInfo: - type: object - properties: - giact_item_id: - type: string - giact_bank_result: - type: string - giact_customer_result: - type: string - giact_status: - type: string - giact_last_updated_at: - type: string - format: RFC3339 Timestamp - giact_account_added_date: - type: string - format: RFC3339 Timestamp - giact_account_last_updated_date: - type: string - format: RFC3339 Timestamp - giact_account_added_range: - type: string - description: 'Range string indicating how recently the account was added - in GIACT - - (e.g. "Less than 7 days as of Mar 18, 2026 UTC").' - giact_account_last_updated_range: - type: string - description: 'Range string indicating how recently the account was last - updated in GIACT - - (e.g. "Less than 30 days as of Mar 18, 2026 UTC").' - coinbase.payments.common.payment_methods.GooglePay: - type: object - properties: - braintree: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.GooglePay.BraintreeData' - google_pay: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.DigitalWalletDetails' - user_id: - type: string - postal_code: - type: string - title: 'The following fields can be populated on the PM after an order - - is submitted in the InstructionResponse. They should not be filled in - - a normal order Instruction though' - customer_name: - type: string - address: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Address' - six_digit_bin: - type: string - last_four: - type: string - issuing_country: - type: string - issuing_bank: - type: string - product_id: - type: string - customer_dob: - type: string - title: Date of birth in YYYY-MM-DD format - billing_address_id: - type: string - title: Users address id - currency: - type: string - title: Currency of the transaction - scheme: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.GooglePay.Scheme' - prepaid: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.GooglePay.Result' - debit: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.GooglePay.Result' - title: uniquely identifies a user's Coinbase account - coinbase.payments.common.payment_methods.GooglePay.BraintreeData: - type: object - properties: - nonce: - type: string - correlation_id: - type: string - coinbase.payments.common.payment_methods.GooglePay.Result: - type: string - enum: - - UNCERTAIN - - 'TRUE' - - 'FALSE' - default: UNCERTAIN - coinbase.payments.common.payment_methods.GooglePay.Scheme: - type: string - enum: - - UNKNOWN - - VISA - - MASTERCARD - default: UNKNOWN - coinbase.payments.common.payment_methods.HotWallet: - type: object - properties: - network: - type: string - address: - type: string - coinbase.payments.common.payment_methods.Ideal: - type: object - properties: - currency: - type: string - iban: - type: string - bic: - type: string - bank_name: - type: string - customer_payment_name: - type: string - customer_country_code: - type: string - title: '' - coinbase.payments.common.payment_methods.IdentityContractCall: - type: object - properties: - network: - type: string - address: - type: string - coinbase.payments.common.payment_methods.IndiaBankAccountDetails: - type: object - properties: - account_number: - type: string - title: Beneficiary bank account number (9 - 18 alphanumeric character limit) - ifsc_code: - type: string - title: An alphanumeric code used to uniquely identify every bank branch - participating in online fund transfers (IMPS, NEFT, RTGS) within India. - The format is typically XXXX0YYYYYY, where the first four characters represent - the bank's name, the fifth character is always a zero, and the last six - characters represent the specific branch code - bank_name: - type: string - title: Beneficiary bank name - customer_first_name: - type: string - title: 'First name of the customer - - Not used when interacting with vendors (e.g., Neokred) that return full - name in account verification flow' - customer_last_name: - type: string - title: 'Last name of the customer - - Not used when interacting with vendors (e.g., Neokred) that return full - name in account verification flow' - email: - type: string - title: Beneficiary email address, string in email Id format - phone_number: - type: string - title: Beneficiary phone number registered in India (only digits, 10 characters - after stripping +91) - pan_number: - type: string - title: The Indian Permanent Account Number (PAN) is a unique, 10-character - alphanumeric identifier issued by the Income Tax Department - customer_payment_name: - type: string - description: 'Full name of the owner of this account - - Used when the full name is provided in the response during account verification.' - title: Represents India Bank Account PM details - coinbase.payments.common.payment_methods.Interac: - type: object - properties: - account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Interac.Account' - pmsvc_id: - type: string - withdrawal_only: - type: boolean - coinbase_email: - type: string - coinbase.payments.common.payment_methods.Interac.Account: - type: object - properties: - account_name: - type: string - title: Name of the account fulfilling the Request Money Transaction - institution_number: - type: string - description: 'Institution Number: a 3-digit code that tells you which bank - the account belongs to — unique for every Canadian bank.' - transit_number: - type: string - description: 'Transit Number: a 5-digit code that tells which branch of - the bank the account was created at — it is unique to each bank branch.' - account_number: - type: string - description: 'Account Number: a 7-digit code that identifies the account - within the branch and bank entered.' - coinbase.payments.common.payment_methods.IntraBank: - type: object - properties: - currency: - type: string - account_number: - type: string - routing_number: - type: string - customer_name: - type: string - fiat_id: - type: string - coinbase.payments.common.payment_methods.JpmorganKinexysDetails: - type: object - properties: - account_number: - type: string - description: The account number of the customer's Blockchain Deposit Account - (BDA) for Kinexys transfers. - bic: - type: string - description: The JPMorgan BIC for the branch servicing the user's BDA account. - description: The details of the customer's Blockchain Deposit Account (BDA) - enabled for Kinexys transfers. - coinbase.payments.common.payment_methods.LedgerAccount: - type: object - properties: - account_id: - type: string - currency: - type: string - owner: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Owner' - account_uuid: - type: string - account_name: - type: string - title: uniquely identifies an account in the Ledger Service - coinbase.payments.common.payment_methods.LedgerNamedAccount: - type: object - properties: - name: - type: string - currency: - type: string - foreign_network: - type: string - title: uniquely identifies a named account in the Ledger Service - coinbase.payments.common.payment_methods.LiquidityPool: - type: object - properties: - network: - type: string - pool: - type: string - currency: - type: string - account_id: - type: string - from_address: - type: string - title: For the purpose of Liquidity Management - coinbase.payments.common.payment_methods.MagicSpendBlockchainAddress: - type: object - properties: - address: - type: string - destination_tag: - type: string - title: 'MagicSpendBlockchainAddress is specific object of type blockchain_address - - which is used to uniquely identifies if a user is using magic spend feature - - to send funds to a smart contract wallet' - coinbase.payments.common.payment_methods.MagicWallet: - type: object - properties: - user_uuid: - type: string - network_name: - type: string - description: Specifies the blockchain and network. Similar to `chain_id` - but more extensible (e.g. it can be `solana-mainnet` or `base-mainnet`). - wallet_name: - type: string - title: 'The wallet name is mapped to a wallet address for a user and network. - Stored in FAS right now. This should match - - names defined in https://example.com' - coinbase.payments.common.payment_methods.Manual: - type: object - properties: - settlement_bank_name: - type: string - settlement_account_number: - type: string - reference: - type: string - title: ManualDeposit as a payment method source or target for manual fiat deposits - coinbase.payments.common.payment_methods.MatchResult: - type: string - enum: - - MATCH_RESULT_UNSPECIFIED - - MATCH_RESULT_MATCH - - MATCH_RESULT_NO_MATCH - - MATCH_RESULT_PARTIAL_MATCH - default: MATCH_RESULT_UNSPECIFIED - description: 'MatchResult represents the result of matching a single component - - against external data (e.g. name on file at the issuer via Visa ANI).' - coinbase.payments.common.payment_methods.MbWayDetails: - type: object - properties: - account_holder: - type: string - description: Account holder name linked to this MB Way account. - country: - type: string - description: The country where the payer's bank account is located. - phone_number: - type: string - description: 'Phone number linked to this MB Way account. - - Country code followed by hash symbol (#) followed by rest of number.' - title: 'MB Way payment method details. - - https://developerhub.ppro.com/simple-api/docs/mb-way#specific-input-parameters-for-the-transaction-call' - coinbase.payments.common.payment_methods.Merchant: - type: object - properties: - mid: - type: string - coinbase.payments.common.payment_methods.NameMatchIndicator: - type: string - enum: - - NAME_MATCH_INDICATOR_UNSPECIFIED - - NAME_MATCH_INDICATOR_PERFORMED - - NAME_MATCH_INDICATOR_NOT_SUPPORTED - - NAME_MATCH_INDICATOR_NOT_PERFORMED - default: NAME_MATCH_INDICATOR_UNSPECIFIED - description: NameMatchIndicator represents whether the ANI lookup was performed - by the issuer. - coinbase.payments.common.payment_methods.NovaAccount: - type: object - properties: - network: - type: string - nova_account_id: - type: string - pool_name: - type: string - account_idempotency_key: - type: string - coinbase.payments.common.payment_methods.OpenBankingDetails: - type: object - properties: - true_layer_bank_provider_id: - type: string - description: An ID used by TrueLayer to identify the bank. - open_banking_provider_id: - type: string - title: A universal ID used to identify the Open Banking bank, see go/universal-ob-provider-id - for details - title: 'AIDoc: Represents Open Banking details for bank identification' - coinbase.payments.common.payment_methods.Owner: - type: object - properties: - id: - type: string - uuid: - type: string - user_uuid: - type: string - type: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Owner.Type' - coinbase.payments.common.payment_methods.Owner.Type: - type: string - enum: - - UNKNOWN - - INVESTMENT_VEHICLE - - RETAIL - - VENUE - - PORTFOLIO - default: UNKNOWN - coinbase.payments.common.payment_methods.PaymentMethod: - type: object - properties: - type: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PaymentMethod.Type' - network: - type: string - payment_method_id: - type: string - payment_method_uuid: - type: string - payment_method_type_string: - type: string - blockchain_address: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.BlockchainAddress' - coinbase_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.CoinbaseAccount' - blockchain_transaction: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.BlockchainTransaction' - fedwire: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Fedwire' - swift: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Swift' - card: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Card' - zengin: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Zengin' - uk: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Uk' - sepa: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Sepa' - paypal: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Paypal' - ledger_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.LedgerAccount' - external_payment_method: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ExternalPaymentMethod' - pro_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ProAccount' - rtp: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Rtp' - venue: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Venue' - ledger_named_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.LedgerNamedAccount' - custodial_pool: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.CustodialPool' - apple_pay: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ApplePay' - default_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.DefaultAccount' - remitly: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Remitly' - pro_internal_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ProInternalAccount' - dapp_wallet_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.DAppWalletAccount' - google_pay: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.GooglePay' - dapp_wallet_blockchain_address: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.DAppWalletBlockchainAddress' - zaakpay_mobikwik: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ZaakpayMobikwik' - deneb_upi: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.DenebUPI' - bank_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.BankAccount' - identity_contract_call: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.IdentityContractCall' - deneb_imps: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.DenebIMPS' - allocation: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Allocation' - liquidity_pool: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.LiquidityPool' - zengin_v2: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ZenginV2' - direct_deposit: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.DirectDeposit' - sepa_v2: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SepaV2' - zepto: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Zepto' - pix_ebanx: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PixEbanx' - signet: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Signet' - derivative_settlement: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.DerivativeSettlement' - user: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.User' - sg_fast: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SgFast' - interac: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Interac' - intra_bank: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.IntraBank' - cbit: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Cbit' - ideal: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Ideal' - sofort: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Sofort' - sg_paynow: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SgPayNow' - checkout_payment_link: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.CheckoutPaymentLink' - email_address: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.EmailAddress' - phone_number: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PhoneNumber' - vendor_payment: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.VendorPayment' - ctn: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.CTN' - bancomat_pay: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.BancomatPay' - hot_wallet: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.HotWallet' - nova_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.NovaAccount' - magic_spend_blockchain_address: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.MagicSpendBlockchainAddress' - transfer_pointer: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.TransferPointer' - eft: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Eft' - wallace_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.WallaceAccount' - manual: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Manual' - argentine_bank_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ArgentineBankAccountDetails' - representment: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Representment' - banking_circle_now: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.BankingCircleNowDetails' - trustly: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.TrustlyDetails' - blik: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.BlikDetails' - mb_way: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.MbWayDetails' - pix: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PixDetails' - magic_wallet: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.MagicWallet' - samsung_pay: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SamsungPay' - cad_wire: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.CadWireDetails' - wab_intra_bank: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.WabIntraBankDetails' - india_bank_account: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.IndiaBankAccountDetails' - jpmorgan_kinexys: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.JpmorganKinexysDetails' - sic: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SicDetails' - spei: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SpeiDetails' - title: "PaymentMethod is a wrapper describing a specific type of payment method.\n\ - \ this is probably the only type you need to modify (and possibly VerificationRequest/Response)" - coinbase.payments.common.payment_methods.PaymentMethod.Type: - type: string - enum: - - INVALID - - UNSET - - BLOCKCHAIN_ADDRESS - - COINBASE_ACCOUNT - - BLOCKCHAIN_TRANSACTION - - FEDWIRE - - SWIFT - - CARD - - ZENGIN - - UK - - SEPA - - PAYPAL - - LEDGER_ACCOUNT - - EXTERNAL_PAYMENT_METHOD - - PRO_ACCOUNT - - RTP - - CARD_REPRESENTMENT - - VENUE - - LEDGER_NAMED_ACCOUNT - - CUSTODIAL_POOL - - APPLE_PAY - - DEFAULT_ACCOUNT - - REMITLY - - PRO_INTERNAL_ACCOUNT - - DAPP_WALLET_ACCOUNT - - GOOGLE_PAY - - DAPP_WALLET_BLOCKCHAIN_ADDRESS - - ZAAKPAY_MOBIKWIK - - DENEB_UPI - - BANK_ACCOUNT - - IDENTITY_CONTRACT_CALL - - DENEB_IMPS - - ALLOCATION - - LIQUIDITY_POOL - - ZENGIN_V2 - - DIRECT_DEPOSIT - - SEPA_V2 - - ZEPTO - - PIX_EBANX - - SIGNET - - DERIVATIVE_SETTLEMENT - - USER - - SG_FAST - - INTERAC - - INTRA_BANK - - CBIT - - IDEAL - - SOFORT - - SG_PAYNOW - - CHECKOUT_PAYMENT_LINK - - EMAIL_ADDRESS - - PHONE_NUMBER - - VENDOR_PAYMENT - - CTN - - BANCOMAT_PAY - - HOT_WALLET - - NOVA_ACCOUNT - - MAGIC_SPEND_BLOCKCHAIN_ADDRESS - - TRANSFER_POINTER - - EFT - - WALLACE_ACCOUNT - - MANUAL - - ARGENTINE_BANK_ACCOUNT - - REPRESENTMENT - - BANKING_CIRCLE_NOW - - TRUSTLY - - BLIK - - MB_WAY - - PIX - - MAGIC_WALLET - - SAMSUNG_PAY - - CAD_WIRE - - WAB_INTRA_BANK - - INDIA_BANK_ACCOUNT - - OPEN_BANKING - - SPEI - - JPMORGAN_KINEXYS - - SIC - - PIX_DEPOSIT - - PIX_WITHDRAWAL - - FAKE_ACH - default: INVALID - title: "- CAD_WIRE: Canada Wire payment type\n - WAB_INTRA_BANK: WAB Intra Bank\ - \ Transfer payment type\n - INDIA_BANK_ACCOUNT: India Bank Account payment\ - \ type\n - OPEN_BANKING: While OB is a facilitator and not an indepedent payment\ - \ method, it can be displayed\nto the user as an available payment method.\ - \ Concrete payment method will be UK\nor SEPA_V2 which hold open banking details.\n\ - \ - SPEI: Mexico SPEI payment type\n - JPMORGAN_KINEXYS: JPMorgan Kinexys\ - \ is a 24x7 real-time cross-border network for clients of JPMorgan.\n - SIC:\ - \ CHF SIC payment type for Swiss users\n - PIX_DEPOSIT: Used by PMSvc for\ - \ legacy PIX deposit while it's being deprecated\n - PIX_WITHDRAWAL: Used\ - \ by PMSvc for legacy PIX withdrawal while it's being deprecated\n - FAKE_ACH:\ - \ Test PMs (9001-9999); prefix all pm types with FAKE_\nFake implementation\ - \ of an ACH payment method" - coinbase.payments.common.payment_methods.Paypal: - type: object - properties: - account_holder: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PaypalAccount' - merchant: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PaypalMerchant' - metadata: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PaypalMetadata' - email: - type: string - owner_name: - type: string - birth_date: - type: string - phone_number: - type: string - phone_type: - type: string - billing_address: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.Address' - braintree_customer_id: - type: string - payment_method_nonce: - type: string - payer_id: - type: string - coinbase.payments.common.payment_methods.PaypalAccount: - type: object - properties: - paypal_id: - type: string - paypal_pm_id: - type: string - paypal_verified: - type: boolean - account_type: - type: string - account_age: - type: string - title: Represents a customer's paypal account - coinbase.payments.common.payment_methods.PaypalMerchant: - type: object - properties: - merchant_account_id: - type: string - title: 'Represents coinbase''s merchant account - - For payouts, this is the source of funds' - coinbase.payments.common.payment_methods.PaypalMetadata: - type: object - properties: - paypal_correlation_id: - type: string - authorization_code: - type: string - coinbase.payments.common.payment_methods.PhoneNumber: - type: object - properties: - value: - type: string - coinbase.payments.common.payment_methods.PixAccountType: - type: string - enum: - - ACCOUNT_TYPE_UNSPECIFIED - - ACCOUNT_TYPE_CHECKING - - ACCOUNT_TYPE_SALARY - - ACCOUNT_TYPE_SAVINGS - - ACCOUNT_TYPE_TRANSACTION - default: ACCOUNT_TYPE_UNSPECIFIED - description: " - ACCOUNT_TYPE_CHECKING: Checking account.\n - ACCOUNT_TYPE_SALARY:\ - \ Salary account.\n - ACCOUNT_TYPE_SAVINGS: Savings account.\n - ACCOUNT_TYPE_TRANSACTION:\ - \ Transaction account." - coinbase.payments.common.payment_methods.PixDetails: - type: object - properties: - account_number: - type: string - title: The account number for the PIX transaction - account_type: - type: string - title: The type of account (e.g., checking, savings) - bank_code: - type: string - title: The code of the bank involved in the transaction - bank_name: - type: string - title: The name of the bank - branch_number: - type: string - title: The branch number of the bank, do not use this field, use branch_code - instead - customer_payment_name: - type: string - title: The name of the customer making the payment - sender_document: - type: string - title: 'The sender document for the transaction. It is really the tax_id - of the sender: CPF for individual) or CNPJ for business in Brazil' - pix_key: - type: string - description: The PIX key for the transaction. Only used for withdraw. For - deposit, it is not used. - pix_account_type: - description: The type of account. - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PixAccountType' - branch_code: - type: string - title: The branch code of the bank - title: Represents details for a PIX transaction - coinbase.payments.common.payment_methods.PixEbanx: - type: object - properties: - payment_method_id: - type: string - user_uuid: - type: string - deposit: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PixEbanx.PixDeposit' - withdrawal: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PixEbanx.PixWithdrawal' - coinbase.payments.common.payment_methods.PixEbanx.PixDeposit: - type: object - properties: - transaction_id: - type: string - account_id: - type: string - account_number: - type: string - account_type: - type: string - bank_code: - type: string - bank_name: - type: string - branch_number: - type: string - customer_payment_name: - type: string - sender_document: - type: string - coinbase.payments.common.payment_methods.PixEbanx.PixWithdrawal: - type: object - properties: - account_number: - type: string - account_type: - type: string - bank_code: - type: string - branch_number: - type: string - pix_key: - type: string - customer_payment_name: - type: string - sender_document: - type: string - bank_name: - type: string - coinbase.payments.common.payment_methods.PlaidInfo: - type: object - properties: - plaid_bank_name: - type: string - plaid_access_token: - type: string - plaid_item_id: - type: string - plaid_old_access_token: - type: string - plaid_response: - type: string - plaid_info: - type: string - plaid_account_id: - type: string - plaid_test_account: - type: boolean - plaid_link_account: - type: boolean - plaid_link_bank_name: - type: string - balance: - allOf: - - $ref: '#/components/schemas/coinbase.payments.shared.Money' - balance_updated_at: - type: string - format: RFC3339 Timestamp - plaid_name_check: - type: boolean - plaid_public_token: - type: string - account_number_mask: - type: string - plaid_persistent_account_id: - type: string - title: 'plaid_persistent_account_id is a stable identifier that persists - across re-links for TAN banks. - - Only available for TAN banks (Chase, PNC, US Bank). - - See: https://plaid.com/docs/api/accounts/#accounts-get-response-accounts-persistent-account-id' - is_tokenized_account_number: - type: boolean - title: 'is_tokenized_account_number indicates if the account uses tokenized - account numbers (TAN). - - When true, use plaid_persistent_account_id for matching; when false, use - plaid_account_id. - - See: https://plaid.com/docs/api/products/auth/#auth-get-response-numbers-ach-is-tokenized-account-number' - is_plaid_supported: - type: boolean - description: 'is_plaid_supported indicates whether the bank account''s routing - number supports Plaid. - - Computed from routing number lookup at request time and used for risk - evaluation.' - coinbase.payments.common.payment_methods.ProAccount: - type: object - properties: - account_id: - type: string - coinbase_account_id: - type: string - user_id: - type: string - currency: - type: string - portfolio_id: - type: string - title: uniquely identifies an account on Pro - coinbase.payments.common.payment_methods.ProInternalAccount: - type: object - properties: - user_id: - type: string - currency: - type: string - title: uniquely identifies an internal account on Pro - coinbase.payments.common.payment_methods.Remitly: - type: object - properties: - account_holder: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.RemitlyAccount' - coinbase.payments.common.payment_methods.RemitlyAccount: - type: object - properties: - recipient_id: - type: string - payout_method_type: - type: string - recipient_version: - type: string - currency: - type: string - title: Represents a customer in remitly - coinbase.payments.common.payment_methods.Representment: - type: object - properties: - currency: - type: string - title: Representment debit won to overturn a card chargeback - coinbase.payments.common.payment_methods.Rtp: - type: object - properties: - account_holder: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.RtpAccount' - institution: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.RtpInstitution' - currency: - type: string - description: 'For withdrawals: contains all info to initiate payment to eligible - bank account. - - For deposits: contains info to initiate payment to a Coinbase Fiat account.' - coinbase.payments.common.payment_methods.RtpAccount: - type: object - properties: - legal_name: - type: string - identifier: - type: string - bank_account_id: - type: string - title: RtpAccount represents an account at a financial institution eligible - for RTP network payments - coinbase.payments.common.payment_methods.RtpInstitution: - type: object - properties: - routing_number: - type: string - title: RtpInstitution is financial institution eligible for RTP network payments - coinbase.payments.common.payment_methods.SamsungPay: - type: object - properties: - samsung_pay: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.DigitalWalletDetails' - user_id: - type: string - title: uniquely identifies a user's Coinbase account - postal_code: - type: string - title: 'The following fields can be populated on the PM after an order - - is submitted in the InstructionResponse. They should not be filled in - - A normal order Instruction though - - Billing postal code for the card' - customer_name: - type: string - address: - title: Billing address for the card - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.Address' - six_digit_bin: - type: string - last_four: - type: string - issuing_country: - type: string - issuing_bank: - type: string - product_id: - type: string - customer_dob: - type: string - title: Date of birth in YYYY-MM-DD format - currency: - type: string - title: Currency of the transaction - billing_address_id: - type: string - title: Users address id - scheme: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SamsungPay.Scheme' - prepaid: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SamsungPay.Result' - debit: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SamsungPay.Result' - coinbase.payments.common.payment_methods.SamsungPay.Result: - type: string - enum: - - UNCERTAIN - - 'TRUE' - - 'FALSE' - default: UNCERTAIN - title: Flag to mark card as prepaid or debit - coinbase.payments.common.payment_methods.SamsungPay.Scheme: - type: string - enum: - - UNKNOWN - - VISA - - MASTERCARD - default: UNKNOWN - title: Field to store scheme of the card - coinbase.payments.common.payment_methods.Sepa: - type: object - properties: - account_holder: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SepaAccount' - institution: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SepaInstitution' - customer_first_name: - type: string - customer_last_name: - type: string - email: - type: string - phone_number: - type: string - coinbase.payments.common.payment_methods.SepaAccount: - type: object - properties: - legal_name: - type: string - iban: - type: string - bban: - type: string - coinbase.payments.common.payment_methods.SepaAccountDetail: - type: object - properties: - legal_name: - type: string - description: Required. Legal name of the account holder. - iban: - type: string - description: Required. The IBAN number identifies the account. - bban: - type: string - title: 'AIDoc: The Basic Bank Account Number' - account_address: - type: string - title: 'AIDoc: The address associated with the account' - description: The detailed SEPA account information. - coinbase.payments.common.payment_methods.SepaInstitution: - type: object - properties: - bic: - type: string - title: 'AIDoc: The Bank Identifier Code - - Required field that conforms to the 8-11 character ISO 9362 SWIFT format. - Used to identify - - the bank for international processing: - - Ex: "BOFAUS3N"' - name: - type: string - title: 'AIDoc: The name of the financial institution' - bank_country_code: - type: string - title: 'AIDoc: The country code for the bank' - bank_country_name: - type: string - title: 'AIDoc: The country name for the bank' - bank_address: - type: string - title: 'AIDoc: The address of the bank' - title: 'AIDoc: Represents a SEPA financial institution' - coinbase.payments.common.payment_methods.SepaV2: - type: object - properties: - account: - description: The SEPA account details. - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SepaAccountDetail' - customer_first_name: - type: string - title: 'AIDoc: The customer''s first name' - customer_last_name: - type: string - title: 'AIDoc: The customer''s last name' - email: - type: string - title: 'AIDoc: The customer''s email address' - phone_number: - type: string - title: 'AIDoc: The customer''s phone number' - customer_country: - type: string - description: Customer's country in ISO-3166-1 ALPHA-2. - address: - description: 'Deprecated. Address was required for Banking Circle ' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.Address' - supports_open_banking: - type: boolean - description: Meant to be used for routing in PGS. - banking_circle_token: - description: Used for SEPA Direct Debit payments. - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.BankingCircleToken' - institution: - title: 'AIDoc: The financial institution details' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SepaInstitution' - currency: - type: string - title: 'AIDoc: The currency code for the payment method' - fiat_id: - type: string - title: ONLY used by prime admin - Venue Entity Type reference code onboarding - direct_debit_ineligible: - type: boolean - description: 'If the user''s bank account does not support this flow, direct_debit_ineligible - will be marked explicitly as true. - - So that users will be refrained from attempting with this payment method - again.' - open_banking_details: - title: 'AIDoc: Open Banking details for bank identification' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.OpenBankingDetails' - description: SepaV2 identifies for the payment method SEPA_V2 - coinbase.payments.common.payment_methods.SgFast: - type: object - properties: - account: - title: 'AIDoc: The account details for the FAST transfer' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SgFastAccount' - institution: - title: 'AIDoc: The financial institution details' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SgFastInstitution' - direct_debit_auth_state: - title: 'AIDoc: The current state of direct debit authorisation' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SgFastDirectDebitAuthorisationState' - direct_debit_token: - type: string - title: 'AIDoc: Token for direct debit authorisation' - title: SgFast identifies the FAST Bank Transfer payment method in Singapore - coinbase.payments.common.payment_methods.SgFastAccount: - type: object - properties: - customer_name: - type: string - title: 'AIDoc: The name of the customer' - account_number: - type: string - title: 'AIDoc: The account number (e.g. 1201231231)' - title: 'AIDoc: Represents a Singapore FAST bank account' - coinbase.payments.common.payment_methods.SgFastDirectDebitAuthorisationState: - type: string - enum: - - STATE_UNSPECIFIED - - STATE_PENDING - - STATE_AUTHORIZED - - STATE_REJECTED - - STATE_EXPIRED - default: STATE_UNSPECIFIED - description: "- STATE_UNSPECIFIED: AIDoc: Default state when SG FAST PM is created\n\ - \ - STATE_PENDING: AIDoc: Authorisation is pending approval\n - STATE_AUTHORIZED:\ - \ AIDoc: Authorisation has been approved\n - STATE_REJECTED: AIDoc: Authorisation\ - \ has been rejected\n - STATE_EXPIRED: AIDoc: Authorisation has expired" - title: 'AIDoc: Represents the possible states of direct debit authorisation' - coinbase.payments.common.payment_methods.SgFastInstitution: - type: object - properties: - bank_code: - type: string - title: 'AIDoc: The SWIFT Code of the bank (e.g. DBSSGSG)' - title: 'AIDoc: Represents a Singapore FAST financial institution' - coinbase.payments.common.payment_methods.SgPayNow: - type: object - properties: - identifier_type: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SgPayNow.IdentifierType' - identifier: - type: string - customer_name: - type: string - description: SgPayNow identifies the PayNow Transfer payment method in Singapore. - coinbase.payments.common.payment_methods.SgPayNow.IdentifierType: - type: string - enum: - - TYPE_UNSPECIFIED - - TYPE_NRIC - - TYPE_PHONE - default: TYPE_UNSPECIFIED - coinbase.payments.common.payment_methods.SicDetails: - type: object - properties: - legal_name: - type: string - title: The legal name of the account holder (same as customer_payment_name - in PMSvc definition) - iban: - type: string - title: The International Bank Account Number - swift: - type: string - title: Bank Identification SWIFT - customer_payment_address1: - type: string - title: The first line of the customer payment address - customer_payment_address2: - type: string - title: The second line of the customer payment address - customer_payment_address3: - type: string - title: The third line of the customer payment address - bank_name: - type: string - title: The name of the bank - bank_address1: - type: string - title: The first line of the bank address - bank_address2: - type: string - title: The second line of the bank address - bank_address3: - type: string - title: The third line of the bank address - bank_country_code: - type: string - title: The country code for the bank - coinbase.payments.common.payment_methods.Signet: - type: object - properties: - signet_wallet_id: - type: string - coinbase.payments.common.payment_methods.Sofort: - type: object - properties: - currency: - type: string - iban: - type: string - bic: - type: string - bank_name: - type: string - customer_payment_name: - type: string - customer_country_code: - type: string - title: '' - coinbase.payments.common.payment_methods.SpeiDetails: - type: object - properties: - account_number: - type: string - title: The account number (CLABE) - customer_name: - type: string - title: The name of the account holder - description: '* - - Contains all information necessary to process SPEI transactions including - account number (CLABE) and customer name. - - SPEI is a real-time gross settlement system developed and operated by Banco - de México, the country''s central bank. - - It supports 24/7 electronic fund transfers between all major banks and can - process transactions within seconds.' - coinbase.payments.common.payment_methods.StripeCardCheckStatus: - type: string - enum: - - STRIPE_CARD_CHECK_STATUS_UNKNOWN - - STRIPE_CARD_CHECK_STATUS_PASS - - STRIPE_CARD_CHECK_STATUS_FAIL - - STRIPE_CARD_CHECK_STATUS_UNAVAILABLE - - STRIPE_CARD_CHECK_STATUS_UNCHECKED - default: STRIPE_CARD_CHECK_STATUS_UNKNOWN - title: stripe card check status result is one of pass, fail, unavailable, or - unchecked - coinbase.payments.common.payment_methods.StripeFinancialConnectionsInfo: - type: object - properties: - stripe_response: - type: string - description: The response data returned by Stripe for the financial connection. - stripe_info: - type: string - description: Additional information about the Stripe financial connection. - stripe_financial_connections_id: - type: string - description: The unique identifier for the Stripe financial connection. - stripe_payment_method_id: - type: string - description: The unique identifier for the Stripe payment method. - stripe_test_account: - type: boolean - description: Indicates whether the account is a test account in Stripe. - stripe_link_account: - type: boolean - description: Indicates whether the account is linked through Stripe. - stripe_link_bank_name: - type: string - description: The name of the bank linked through Stripe. - stripe_institution_id: - type: string - description: The unique identifier for the institution linked through Stripe. - balance: - description: The balance of the account, represented as a Money object. - allOf: - - $ref: '#/components/schemas/coinbase.payments.shared.Money' - balance_updated_at: - type: string - format: RFC3339 Timestamp - description: The timestamp of the last balance update. - stripe_name_check: - type: boolean - description: Indicates whether the name check passed for the Stripe account. - coinbase.payments.common.payment_methods.StripeParams: - type: object - properties: - stripe_id: - type: string - title: 'Stripe payment method ID used to retrive the card and initiate the - payment - - Example: pm_1QxbXIHUb191ZnmcL8TqLfIM' - radar_session_id: - type: string - title: 'Stripe Radar provides real-time fraud protection - - radar session ID collected by FE SDK is required for the payment method - creation call with Stripe - - Ex: "rse_1234567890abcdef"' - address_line1_check: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.StripeCardCheckStatus' - address_postal_code_check: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.StripeCardCheckStatus' - cvc_check: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.StripeCardCheckStatus' - title: Stripe Integration - coinbase.payments.common.payment_methods.Swift: - type: object - properties: - account_holder: - title: 'AIDoc: The account holder information' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SwiftAccount' - institution: - title: 'AIDoc: The primary financial institution details' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SwiftInstitution' - intermediary: - title: 'AIDoc: The intermediary bank details (populated if intermediary - bank is used)' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.SwiftInstitution' - currency: - type: string - title: 'AIDoc: The currency code for the payment method' - rejection_count: - type: integer - format: int32 - title: 'AIDoc: The number of rejections for this SWIFT payment method' - title: 'AIDoc: Represents details for a SWIFT payment method' - coinbase.payments.common.payment_methods.SwiftAccount: - type: object - properties: - legal_name: - type: string - title: 'AIDoc: The legal name of the account holder (same as customer_payment_name - in PMSvc definition)' - iban: - type: string - title: 'AIDoc: The International Bank Account Number' - bban: - type: string - title: 'AIDoc: The Basic Bank Account Number - - This field is populated using the Swift value for Swift payment method' - domestic_account_id: - type: string - title: 'AIDoc: The domestic account identifier' - customer_payment_address1: - type: string - title: 'AIDoc: The first line of the customer payment address' - customer_payment_address2: - type: string - title: 'AIDoc: The second line of the customer payment address' - customer_payment_address3: - type: string - title: 'AIDoc: The third line of the customer payment address' - customer_payment_country_code: - type: string - title: 'AIDoc: The country code for the customer payment address' - iban_generated: - type: boolean - title: 'AIDoc: Whether the IBAN was generated automatically' - title: 'AIDoc: Represents a SWIFT bank account' - coinbase.payments.common.payment_methods.SwiftInstitution: - type: object - properties: - bic: - type: string - title: 'AIDoc: The Bank Identifier Code' - name: - type: string - title: 'AIDoc: The name of the financial institution' - bank_address1: - type: string - title: 'AIDoc: The first line of the bank address' - bank_address2: - type: string - title: 'AIDoc: The second line of the bank address' - bank_address3: - type: string - title: 'AIDoc: The third line of the bank address' - bank_country_code: - type: string - title: 'AIDoc: The country code for the bank' - domestic_bank_id: - type: string - title: 'AIDoc: The domestic bank identifier' - international_bank_id: - type: string - title: 'AIDoc: The international bank identifier' - title: 'AIDoc: Represents a SWIFT financial institution' - coinbase.payments.common.payment_methods.TransferPointer: - type: object - properties: - idem: - type: string - coinbase.payments.common.payment_methods.TrustlyDetails: - type: object - properties: - country: - type: string - description: The country where the payer's bank account is located. Populated - for all Trustly payments in the PMSvc API response. - iban: - type: string - description: IBAN of the payer. This field is optional and may not be populated - for all Trustly payments in the PMSvc API response. - account_holder: - type: string - description: Account holder names. This field is optional and may not be - populated for all Trustly payments in the PMSvc API response. - bank_code: - type: string - description: Bank code of the payer's bank account. This field is optional - and may not be populated for all Trustly payments in the PMSvc API response. - account_number: - type: string - description: Bank account number belonging to the payer. This field is optional - and may not be populated for all Trustly payments in the PMSvc API response. - partial_account_number: - type: string - description: Partial Account Number belonging to the payer. Populated for - all Trustly payments in the PMSvc API response. - bank_name: - type: string - description: Bank name of the payer. Populated for all Trustly payments - in the PMSvc API response. - email: - type: string - description: Consumer Email. Populated for all Trustly payments in the PMSvc - API response. - description: https://developerhub.ppro.com/simple-api/docs/trustly#specific-input-parameters-for-the-transaction-call. - coinbase.payments.common.payment_methods.Uk: - type: object - properties: - account_holder: - title: 'AIDoc: The account holder information' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.UkAccount' - institution: - title: 'AIDoc: The financial institution details' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.UkInstitution' - customer_first_name: - type: string - title: 'AIDoc: The customer''s first name' - customer_last_name: - type: string - title: 'AIDoc: The customer''s last name' - email: - type: string - title: 'AIDoc: The customer''s email address' - phone_number: - type: string - title: 'AIDoc: The customer''s phone number' - currency: - type: string - title: 'AIDoc: The currency code for the payment method' - open_banking_details: - title: 'AIDoc: Open Banking details for bank identification' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.OpenBankingDetails' - title: 'AIDoc: Represents details for a UK bank transfer' - coinbase.payments.common.payment_methods.UkAccount: - type: object - properties: - legal_name: - type: string - title: 'AIDoc: The legal name of the account holder' - bban: - type: string - title: 'AIDoc: The Basic Bank Account Number' - sort_code: - type: string - title: 'AIDoc: The UK bank sort code' - account_number: - type: string - title: 'AIDoc: The account number' - address: - title: 'AIDoc: The address associated with the account' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.Address' - account_type: - title: 'AIDoc: The type of UK bank account (savings, etc.)' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.UkAccountType' - title: 'AIDoc: Represents a UK bank account' - coinbase.payments.common.payment_methods.UkAccountType: - type: string - enum: - - UK_ACCOUNT_TYPE_UNSPECIFIED - - UK_ACCOUNT_TYPE_SAVINGS - default: UK_ACCOUNT_TYPE_UNSPECIFIED - description: "- UK_ACCOUNT_TYPE_UNSPECIFIED: Default value when the UK account\ - \ type is not known\n - UK_ACCOUNT_TYPE_SAVINGS: Represents a UK savings account" - title: Represents the types of UK bank accounts - coinbase.payments.common.payment_methods.UkInstitution: - type: object - properties: - name: - type: string - title: 'AIDoc: The name of the financial institution' - title: 'AIDoc: Represents a UK financial institution' - coinbase.payments.common.payment_methods.User: - type: object - properties: - user_uuid: - type: string - coinbase.payments.common.payment_methods.VaultToken: - type: object - properties: - value: - type: string - vault_id: - type: string - attempted_at: - type: string - format: RFC3339 Timestamp - encrypted_data: - type: string - encrypted_cvv: - type: string - coinbase.payments.common.payment_methods.VendorPayment: - type: object - properties: - vendor_name: - type: string - vendor_payment_id: - type: string - title: vendor payment is currenly only used by coinbase pay guest checkout - coinbase.payments.common.payment_methods.VendorVerificationStatus: - type: object - properties: - iav_status: - type: string - description: The status of the IAV (Instant Account Verification) process. - md_status: - type: string - description: The status of the MD (Micro Deposit) process. - email_verification_status: - type: string - description: The status of the email verification process. - description: VendorVerificationStatus is used to store the verification status - of the vendor. - coinbase.payments.common.payment_methods.Venue: - type: object - properties: - name: - type: string - coinbase.payments.common.payment_methods.WabIntraBankDetails: - type: object - properties: - account_id: - type: string - description: The account ID of the customer's WAB account for Intra Bank - Transfer. - customer_name: - type: string - description: The name of the customer. - description: WabIntraBankDetails is the details of the customer's WAB account - for Intra Bank Transfer. - coinbase.payments.common.payment_methods.WallaceAccount: - type: object - properties: - wallace_account_id: - type: string - pool_name: - type: string - coinbase.payments.common.payment_methods.WorldpayCardCdvStatus: - type: object - properties: - cdv_required: - type: boolean - cdv_failed: - type: boolean - title: Card Verification and Status - coinbase.payments.common.payment_methods.WorldpayParams: - type: object - properties: - token_value: - type: string - token_event: - type: string - uses_merchant_token: - type: boolean - accept_header: - type: string - user_agent_header: - type: string - shopper_ip: - type: string - shopper_session_id: - type: string - title: Vendor-Specific Parameters - coinbase.payments.common.payment_methods.ZaakpayMobikwik: - type: object - properties: - phone_number: - type: string - description: Represents a customer's mobikwik account. - coinbase.payments.common.payment_methods.Zengin: - type: object - properties: - account_holder: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ZenginAccount' - institution: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ZenginInstitution' - description: 'For withdrawals: contains all info to initiate payment to a Zengin - eligible bank account. (MUFG-only) - - For deposits: contains info to initiate payment to a Coinbase Fiat account.' - coinbase.payments.common.payment_methods.ZenginAccount: - type: object - properties: - legal_name: - type: string - identifier: - type: string - type: - type: string - title: ZenginAccount represents an account at a financial institution eligible - for Zengin - coinbase.payments.common.payment_methods.ZenginInstitution: - type: object - properties: - bank_code: - type: string - branch_code: - type: string - title: ZenginInstitution is financial institution eligible for Zengin - coinbase.payments.common.payment_methods.ZenginV2: - type: object - properties: - account_holder: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ZenginV2Account' - institution: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ZenginV2Institution' - description: 'For withdrawals: contains all info to initiate payment to a Zengin - eligible bank account (non-MUFG). - - For deposits: contains info to initiate payment to a Coinbase Fiat account.' - coinbase.payments.common.payment_methods.ZenginV2Account: - type: object - properties: - legal_name: - type: string - identifier: - type: string - type: - type: string - title: ZenginV2Account represents an account at a financial institution eligible - for Zengin (non-MUFG) - coinbase.payments.common.payment_methods.ZenginV2Institution: - type: object - properties: - bank_code: - type: string - branch_code: - type: string - title: ZenginV2Institution is financial institution eligible for Zengin (non-MUFG) - coinbase.payments.common.payment_methods.Zepto: - type: object - properties: - account: - title: 'AIDoc: The Zepto account information' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ZeptoAccount' - institution: - title: 'AIDoc: The Zepto institution information' - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.ZeptoInstitution' - title: Zepto identifies the ZEPTO payment method - coinbase.payments.common.payment_methods.ZeptoAccount: - type: object - properties: - contact_id: - type: string - description: It is "Contact.data.id" in Zepto API (https://docs.zepto.money) - title: 'AIDoc: The Zepto contact ID (UUID) of the account' - bank_account_id: - type: string - description: It is "contact.data.bank_account.id" in Zepto API (https://docs.zepto.money) - title: 'AIDoc: The Zepto bank account ID (UUID) of contact' - account_number: - type: string - title: 'AIDoc: The account number' - customer_payment_name: - type: string - title: 'AIDoc: The name of the customer making the payment' - title: 'AIDoc: Zepto account information' - coinbase.payments.common.payment_methods.ZeptoInstitution: - type: object - properties: - branch_code: - type: string - title: 'AIDoc: The branch code for the bank' - title: 'AIDoc: Zepto institution information' - coinbase.payments.shared.Money: - type: object - properties: - amount: - type: string - description: 'The quantity in string. - - - For fiat, its unit is the corresponding fractional currency unit. For - example, "1" means 1 JPY or 0.01 USD when - - currency is JPY or USD respectively. The source of truth for ratio to - main unit is in http://go/money-fractional. - - - Stored as a string because some cryptocurrencies, namely ETH supports - up to 19 digits of precision which would - - exceed the capacity of storing the value as an int64.' - currency: - type: string - description: 'Currency in 3-letter ISO4217 code. - - - For example, USD, GBP or EUR or in the case of cryptocurrencies its 3-letter - ticker BTC, ETH, XLM etc. - - - As of 2019-09-16 there are _no_ clashes between ISO4217 and crypto currency - abbreviations.' - description: 'A quantity of money. - - - Note that a few places refer to this file for documentation using Github URL. - Please search and modify those URLs if - - this file is moved.' - coinbase.portfolio_service.AccountType: - type: string - enum: - - ACCOUNT_TYPE_UNKNOWN_UNSPECIFIED - - ACCOUNT_TYPE_WALLET - - ACCOUNT_TYPE_FIAT - - ACCOUNT_TYPE_VAULT - - ACCOUNT_TYPE_COLLATERAL - - ACCOUNT_TYPE_DEFI_YIELD - - ACCOUNT_TYPE_LOAN_MANAGEMENT - - ACCOUNT_TYPE_MULTISIG - - ACCOUNT_TYPE_MULTISIG_VAULT - - ACCOUNT_TYPE_DERIVATIVES_TRANSFER - - ACCOUNT_TYPE_DERIVATIVES_EQUITY - - ACCOUNT_TYPE_STAKED_FUNDS - - ACCOUNT_TYPE_PERP_FUTURES - - ACCOUNT_TYPE_PERP_FUTURES_ISOLATED - - ACCOUNT_TYPE_LENT_FUNDS - - ACCOUNT_TYPE_PERP_FUTURES_COLLATERAL - - ACCOUNT_TYPE_DERIVATIVES_CASH - - ACCOUNT_TYPE_CLAWBACK_DEBT - - ACCOUNT_TYPE_SUSPENSE_GEOFENCE - - ACCOUNT_TYPE_RETAIL_DEFI_LEND - - ACCOUNT_TYPE_DEFI_BORROW_COLLATERAL - - ACCOUNT_TYPE_FIAT_SAVINGS - - ACCOUNT_TYPE_RAISE_INVESTMENTS - - ACCOUNT_TYPE_CCM_EQUITY - - ACCOUNT_TYPE_PREDICTION_MARKETS_TRANSFER - - ACCOUNT_TYPE_PREDICTION_MARKETS_EQUITY - - ACCOUNT_TYPE_PREDICTION_MARKETS_CFM - - ACCOUNT_TYPE_CREDIT_CARD_COLLATERAL - default: ACCOUNT_TYPE_UNKNOWN_UNSPECIFIED - description: AccountType defines the type of account that is supported. - coinbase.portfolio_service.Amount: - type: object - properties: - value: - type: string - description: The amount of specified currency. - currency: - type: string - description: The currency symbol (e.g. USD). - description: Represents a monetary amount. - coinbase.portfolio_service.BalancePair: - type: object - properties: - userNativeCurrency: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - rawCurrency: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - description: Balance pair represents balances in both native and raw underlying - currency. - coinbase.portfolio_service.EquityPosition: - type: object - properties: - cbrn: - type: string - account_uuid: - type: string - total_balance_fiat: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - total_balance_equity: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - available_to_trade_equity: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - available_to_trade_fiat: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - account_type: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.AccountType' - allocation: - type: number - format: float - cost_basis: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - average_entry_price: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - unrealized_pnl: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - description: EquityPosition represents an equity position for a user in a portfolio. - coinbase.portfolio_service.FuturesPosition: - type: object - properties: - product_id: - type: string - contract_size: - type: string - side: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.FuturesPositionSide' - amount: - type: string - avg_entry_price: - type: string - current_price: - type: string - unrealized_pnl: - type: string - expiry: - type: string - format: RFC3339 Timestamp - underlying_asset: - type: string - asset_img_url: - type: string - product_name: - type: string - venue: - type: string - notional_value: - type: string - asset_color: - type: string - last_traded_at: - type: string - format: RFC3339 Timestamp - roll_date: - type: string - format: RFC3339 Timestamp - price_increment: - type: string - price_precision: - type: integer - format: int32 - title: FuturesPosition represents a futures position - coinbase.portfolio_service.FuturesPositionSide: - type: string - enum: - - FUTURES_POSITION_SIDE_UNSPECIFIED - - FUTURES_POSITION_SIDE_LONG - - FUTURES_POSITION_SIDE_SHORT - default: FUTURES_POSITION_SIDE_UNSPECIFIED - description: FuturesPosition defines the side of the position. - coinbase.portfolio_service.PerpPosition: - type: object - properties: - product_id: - type: string - product_uuid: - type: string - symbol: - type: string - asset_image_url: - type: string - vwap: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.BalancePair' - position_side: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.FuturesPositionSide' - net_size: - type: string - buy_order_size: - type: string - sell_order_size: - type: string - im_contribution: - type: string - unrealized_pnl: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.BalancePair' - mark_price: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.BalancePair' - liquidation_price: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.BalancePair' - leverage: - type: string - im_notional: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.BalancePair' - mm_notional: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.BalancePair' - position_notional: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.BalancePair' - margin_type: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.PortfolioMarginType' - liquidation_buffer: - type: string - liquidation_percentage: - type: string - asset_color: - type: string - description: PerpPosition defines a perpetuals position. - coinbase.portfolio_service.Portfolio: - type: object - properties: - name: - type: string - uuid: - type: string - type: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.PortfolioType' - deleted: - type: boolean - description: Portfolio is the identifying information for a portfolio. - coinbase.portfolio_service.PortfolioBalances: - type: object - properties: - total_balance: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - total_futures_balance: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - total_cash_equivalent_balance: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - total_crypto_balance: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - futures_unrealized_pnl: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - perp_unrealized_pnl: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - total_equities_balance: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - description: PortfolioBalances is a summary of all balances within a given portfolio. - coinbase.portfolio_service.PortfolioBreakdown: - type: object - properties: - portfolio: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Portfolio' - portfolio_balances: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.PortfolioBalances' - spot_positions: - type: array - items: - $ref: '#/components/schemas/coinbase.portfolio_service.PortfolioPosition' - perp_positions: - type: array - items: - $ref: '#/components/schemas/coinbase.portfolio_service.PerpPosition' - futures_positions: - type: array - items: - $ref: '#/components/schemas/coinbase.portfolio_service.FuturesPosition' - prediction_markets_positions: - type: array - items: - $ref: '#/components/schemas/coinbase.portfolio_service.Position' - equity_positions: - type: array - items: - $ref: '#/components/schemas/coinbase.portfolio_service.EquityPosition' - description: PortfolioBreakdown is a breakdown of a portfolio, all balances, - and all positions within the portfolio. - coinbase.portfolio_service.PortfolioMarginType: - type: string - enum: - - MARGIN_TYPE_UNSPECIFIED - - MARGIN_TYPE_CROSS - - MARGIN_TYPE_ISOLATED - default: MARGIN_TYPE_UNSPECIFIED - description: PortfolioMarginType defines the type of margin type. - coinbase.portfolio_service.PortfolioPosition: - type: object - properties: - asset: - type: string - account_uuid: - type: string - total_balance_fiat: - type: number - format: float - total_balance_crypto: - type: number - format: float - available_to_trade_fiat: - type: number - format: float - allocation: - type: number - format: float - cost_basis: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - asset_img_url: - type: string - is_cash: - type: boolean - average_entry_price: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - asset_uuid: - type: string - available_to_trade_crypto: - type: number - format: float - unrealized_pnl: - type: number - format: float - available_to_transfer_fiat: - type: number - format: float - available_to_transfer_crypto: - type: number - format: float - asset_color: - type: string - account_type: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.AccountType' - funding_pnl: - type: number - format: float - available_to_send_fiat: - type: number - format: float - available_to_send_crypto: - type: number - format: float - description: PortfolioPosition represents a spot position for a user in a portfolio. - coinbase.portfolio_service.PortfolioType: - type: string - enum: - - UNDEFINED - - DEFAULT - - CONSUMER - - INTX - default: UNDEFINED - description: PortfolioType defines the type of Portfolio. - coinbase.portfolio_service.Position: - type: object - properties: - product_type: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.ProductType' - cbrn: - type: string - prediction_markets: - title: add more position metadata here as needed - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.PredictionMarketPositionMetadata' - title: Position represents a unified position across different product types - coinbase.portfolio_service.PredictionMarketPositionMetadata: - type: object - properties: - side: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.PredictionMarketsPositionSide' - last_traded_at: - type: string - format: RFC3339 Timestamp - average_entry_price: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - current_price: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - unrealized_pnl: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - notional_value: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - cost_basis: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - contracts_owned: - type: string - quote_cbrn: - type: string - description: PredictionMarketPosition represents a Prediction Markets position. - coinbase.portfolio_service.PredictionMarketsPositionSide: - type: string - enum: - - PREDICTION_MARKETS_POSITION_SIDE_UNSPECIFIED - - PREDICTION_MARKETS_POSITION_SIDE_LONG - - PREDICTION_MARKETS_POSITION_SIDE_SHORT - default: PREDICTION_MARKETS_POSITION_SIDE_UNSPECIFIED - description: PredictionMarketPositionSide defines the side of the position. - coinbase.portfolio_service.ProductType: - type: string - enum: - - PRODUCT_TYPE_UNSPECIFIED - - PRODUCT_TYPE_ALL - - PRODUCT_TYPE_SPOT - - PRODUCT_TYPE_FCM_FUTURES - - PRODUCT_TYPE_PERP_FUTURES - - PRODUCT_TYPE_INTX_SPOT - - PRODUCT_TYPE_DEX - - PRODUCT_TYPE_EQUITY - - PRODUCT_TYPE_PREDICTION_MARKETS - - PRODUCT_TYPE_COMPOSITE_CRYPTO - default: PRODUCT_TYPE_UNSPECIFIED - description: ProductType defines the type of product. - coinbase.positions.CostBasisMethod: - type: string - enum: - - COST_BASIS_METHOD_UNSPECIFIED - - COST_BASIS_METHOD_HIFO - - COST_BASIS_METHOD_LIFO - - COST_BASIS_METHOD_FIFO - - COST_BASIS_METHOD_SPEC_ID - default: COST_BASIS_METHOD_UNSPECIFIED - description: CostBasisMethod specifies the cost basis method for tax lot matching. - coinbase.public_api.authed.retail_brokerage_api.Account: - type: object - properties: - uuid: - type: string - example: 8bfc20d7-f7c6-4422-bf07-8243ca4169fe - description: Unique identifier for account. - name: - type: string - example: BTC Wallet - description: Name for the account. - currency: - type: string - example: BTC - description: Currency symbol for the account. - available_balance: - description: Available balance in the account. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - default: - type: boolean - example: false - description: Whether or not this account is the user's primary account - active: - type: boolean - example: true - description: Whether or not this account is active and okay to use. - created_at: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: Time at which this account was created. - updated_at: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: Time at which this account was updated. - deleted_at: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: Time at which this account was deleted. - type: - example: FIAT - description: What type the account is. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.AccountType' - ready: - type: boolean - example: true - description: Whether or not this account is ready to trade. - hold: - description: Amount that is being held for pending transfers against the - available balance. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - retail_portfolio_id: - type: string - example: b87a2d3f-8a1e-49b3-a4ea-402d8c389aca - description: The ID of the portfolio this account is associated with. - platform: - example: ACCOUNT_PLATFORM_CONSUMER - description: Platform indicates if the account is for spot (CONSUMER), US - Derivatives (CFM_CONSUMER), or International Exchange (INTX). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.AccountPlatform' - coinbase.public_api.authed.retail_brokerage_api.AccountPlatform: - type: string - enum: - - ACCOUNT_PLATFORM_UNSPECIFIED - - ACCOUNT_PLATFORM_CONSUMER - - ACCOUNT_PLATFORM_CFM_CONSUMER - - ACCOUNT_PLATFORM_INTX - default: ACCOUNT_PLATFORM_UNSPECIFIED - coinbase.public_api.authed.retail_brokerage_api.AccountType: - type: string - enum: - - ACCOUNT_TYPE_UNSPECIFIED - - ACCOUNT_TYPE_CRYPTO - - ACCOUNT_TYPE_FIAT - - ACCOUNT_TYPE_VAULT - - ACCOUNT_TYPE_PERP_FUTURES - default: ACCOUNT_TYPE_UNSPECIFIED - title: Account type defines the type of account that is supported - coinbase.public_api.authed.retail_brokerage_api.Amount: - type: object - properties: - value: - type: string - example: '1.23' - description: Amount of currency that this object represents. - required: - - value - currency: - type: string - example: BTC - description: Denomination of the currency. - required: - - currency - required: - - value - - currency - coinbase.public_api.authed.retail_brokerage_api.CancelOrderFailureReason: - type: string - enum: - - UNKNOWN_CANCEL_FAILURE_REASON - - INVALID_CANCEL_REQUEST - - UNKNOWN_CANCEL_ORDER - - COMMANDER_REJECTED_CANCEL_ORDER - - DUPLICATE_CANCEL_REQUEST - - INVALID_CANCEL_PRODUCT_ID - - INVALID_CANCEL_FCM_TRADING_SESSION - - NOT_ALLOWED_TO_CANCEL - - ORDER_IS_FULLY_FILLED - - ORDER_IS_BEING_REPLACED - default: UNKNOWN_CANCEL_FAILURE_REASON - title: "- UNKNOWN_CANCEL_FAILURE_REASON: nil value\n - INVALID_CANCEL_REQUEST:\ - \ Internal error when placing cancel request\n - UNKNOWN_CANCEL_ORDER: Internal\ - \ error when placing cancel request\n - COMMANDER_REJECTED_CANCEL_ORDER: Internal\ - \ error when placing cancel request\n - DUPLICATE_CANCEL_REQUEST: Cancel request\ - \ was placed prior for the same order\n - INVALID_CANCEL_PRODUCT_ID: Invalid\ - \ product id\n - INVALID_CANCEL_FCM_TRADING_SESSION: Invalid FCM trading session\n\ - \ - NOT_ALLOWED_TO_CANCEL: Invalid permissions\n - ORDER_IS_FULLY_FILLED:\ - \ Order is fully filled\n - ORDER_IS_BEING_REPLACED: Order is being replaced" - coinbase.public_api.authed.retail_brokerage_api.CancelOrderResponse: - type: object - properties: - success: - type: boolean - example: true - description: Whether the cancel request was submitted successfully. - required: - - success - failure_reason: - description: The reason the cancel request did not get submitted - required: - - failure_reason - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CancelOrderFailureReason' - order_id: - type: string - example: 0000-00000 - description: The ID of the order. - required: - - order_id - required: - - success - - failure_reason - - order_id - coinbase.public_api.authed.retail_brokerage_api.CancelOrdersRequest: - type: object - properties: - order_ids: - type: array - example: - - 0000-00000 - - 1111-11111 - items: - type: string - description: The order IDs that cancel requests should be initiated for. - required: - - order_ids - required: - - order_ids - coinbase.public_api.authed.retail_brokerage_api.CancelOrdersResponse: - type: object - properties: - results: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CancelOrderResponse' - description: The result of initiated cancel requests - coinbase.public_api.authed.retail_brokerage_api.Candle: - type: object - properties: - start: - type: string - example: '1639508050' - description: The UNIX timestamp indicating the start of the time interval. - low: - type: string - example: '140.21' - description: Lowest price during the bucket interval. - high: - type: string - example: '140.21' - description: Highest price during the bucket interval. - open: - type: string - example: '140.21' - description: Opening price (first trade) in the bucket interval. - close: - type: string - example: '140.21' - description: Closing price (last trade) in the bucket interval. - volume: - type: string - example: '56437345' - description: Volume of trading activity during the bucket interval. - coinbase.public_api.authed.retail_brokerage_api.Candles: - type: object - properties: - candles: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Candle' - coinbase.public_api.authed.retail_brokerage_api.ClosePositionRequest: - type: object - properties: - client_order_id: - type: string - example: 0000-00000-000000 - description: The unique ID provided for the order (used for identification - purposes). - required: - - client_order_id - product_id: - type: string - example: BIT-28JUL23-CDE - description: The trading pair (e.g. 'BIT-28JUL23-CDE'). - required: - - product_id - size: - type: string - example: 3 - description: The amount of contracts that should be closed. - required: - - client_order_id - - product_id - coinbase.public_api.authed.retail_brokerage_api.ClosePositionResponse: - type: object - properties: - success: - type: boolean - example: true - description: Whether the order was created. - required: - - success - success_response: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.NewOrderSuccessResponse' - error_response: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.NewOrderErrorResponse' - order_configuration: - description: The configuration of the order (e.g. the order type, size, - etc). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration' - required: - - success - coinbase.public_api.authed.retail_brokerage_api.CommissionDetailTotal: - type: object - properties: - total_commission: - type: string - title: 'Total commission amount charged for the order - - This is the sum of all commission charged on the order' - gst_commission: - type: string - title: Goods and Services Tax (GST) portion of the commission - withholding_commission: - type: string - title: Tax withholding portion of the commission - client_commission: - type: string - title: Client commission on the trade - venue_commission: - type: string - title: Venue Commission - regulatory_commission: - type: string - title: Regulatory Commission - clearing_commission: - type: string - title: Clearing Commission - title: CommissionDetailTotal contains the breakdown of commission charges for - an order - coinbase.public_api.authed.retail_brokerage_api.ComplianceLimitData: - type: object - properties: - total_limit: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - remaining_limits: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - title: Compliance Limit service data - coinbase.public_api.authed.retail_brokerage_api.ContractExpiryType: - type: string - enum: - - UNKNOWN_CONTRACT_EXPIRY_TYPE - - EXPIRING - - PERPETUAL - default: UNKNOWN_CONTRACT_EXPIRY_TYPE - description: Represents the types of contract expiry. - coinbase.public_api.authed.retail_brokerage_api.CreatePortfolioRequest: - type: object - properties: - name: - type: string - description: The name of the portfolio. - coinbase.public_api.authed.retail_brokerage_api.CreatePortfolioResponse: - type: object - properties: - portfolio: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Portfolio' - coinbase.public_api.authed.retail_brokerage_api.DeletePortfolioResponse: - type: object - coinbase.public_api.authed.retail_brokerage_api.DeribitProductDetails: - type: object - properties: - instrument_id: - type: string - description: The venue's numeric instrument identifier. - settlement_currency: - type: string - description: The currency the instrument settles in. - counter_currency: - type: string - description: The counter currency for the instrument. - settlement_period: - type: string - description: The settlement period (e.g. 'day', 'week', 'month', 'perpetual'). - price_index: - type: string - description: The name of the price index used for this instrument. - instrument_type: - type: string - description: Whether the instrument is 'linear' or 'reversed' (inverse). - maker_commission: - type: string - description: The maker commission rate. - taker_commission: - type: string - description: The taker commission rate. - block_trade_commission: - type: string - description: The block trade commission rate. - block_trade_tick_size: - type: string - description: The minimal price change for block trading. - block_trade_min_trade_amount: - type: string - description: The minimum amount for block trading. - creation_time: - type: string - format: RFC3339 Timestamp - description: The time when the instrument was first created. - max_leverage: - type: string - description: Maximal leverage for the instrument (futures only). - max_liquidation_commission: - type: string - description: Maximal liquidation trade commission for the instrument (futures - only). - tick_size_steps: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TickSizeStep' - description: Piecewise tick-size overrides that apply above given price - thresholds. - qty_tick_size: - type: string - description: Minimum quantity change (step size) for order amounts on this - instrument. - index_id: - type: string - description: Numeric identifier for the price index associated with this - instrument. - product_group: - type: string - description: Product group classification for the instrument's base currency - (e.g. BTC, ETH, TIER_2). - base_currency_uuid: - type: string - description: Identifier for the base currency. - quote_currency_uuid: - type: string - description: Identifier for the quote currency. - state: - type: string - description: The raw Deribit order-book state (e.g. 'open', 'locked', 'settlement', - 'delivered', 'inactive', 'halted', 'archivized'). Product.status is normalised - to online/offline; this preserves the exact venue state. - delivery_price: - type: string - description: The settlement (delivery) price the instrument resolved at - when it expired. Only populated for expired Deribit instruments. - description: 'DeribitProductDetails carries the venue-specific instrument metadata - returned - - by Deribit''s get_instruments that is common to futures and options. It hangs - - off FutureProductDetails / OptionProductDetails and is only populated for - - Deribit products.' - coinbase.public_api.authed.retail_brokerage_api.DeribitVenueData: - type: object - properties: - perps: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.DerivativesProductTransactionSummary' - dated_futures: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.DerivativesProductTransactionSummary' - options: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.DerivativesProductTransactionSummary' - description: 'DeribitVenueData groups the transaction summary for each INTX - derivatives product type, - - resolved together by the shared fee_data_fetcher pipeline.' - coinbase.public_api.authed.retail_brokerage_api.DerivativesProductTransactionSummary: - type: object - properties: - total_volume: - type: number - format: double - example: 1000 - description: Total volume for this product, denoted in USD. - total_fees: - type: number - format: double - example: 25 - description: Total fees for this product, denoted in USD. - fee_tier: - description: Description of maker and taker rates across all applicable - fee tiers. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FeeTier' - description: 'DerivativesProductTransactionSummary is the transaction summary - for a single INTX derivatives - - product type (perps, dated futures, or options). There is no per-product total_balance: - the - - pipeline only resolves an account-level balance, which doesn''t have a per-product - meaning.' - coinbase.public_api.authed.retail_brokerage_api.DisplayedOrderConfig: - type: string - enum: - - UNKNOWN_DISPLAYED_ORDER_CONFIG - - INSTANT_GFD - - LIMIT_GFD - - LIMIT_GTC - - MARKET_GFD - - EXERCISE_GFD - default: UNKNOWN_DISPLAYED_ORDER_CONFIG - description: 'Equity time-in-force values: MARKET_GFD is Good For Day for Advanced - Trade market orders; LIMIT_GFD is Good For Day for limit orders; LIMIT_GTC - is Good Till Cancelled for limit orders. INSTANT_GFD is a legacy Simple Trade - value and EXERCISE_GFD applies only to equity option exercise orders.' - title: Displayed order configuration. Equity values encode time-in-force instructions. - coinbase.public_api.authed.retail_brokerage_api.Edit: - type: object - properties: - price: - type: string - example: '19000.00' - description: The update price of the order. - size: - type: string - example: '0.001' - description: The updated size of the order. - replace_accept_timestamp: - type: string - format: RFC3339 Timestamp - coinbase.public_api.authed.retail_brokerage_api.EditOrderError: - type: object - properties: - edit_failure_reason: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EditOrderFailureReason' - preview_failure_reason: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewFailureReason' - coinbase.public_api.authed.retail_brokerage_api.EditOrderFailureReason: - type: string - enum: - - UNKNOWN_EDIT_ORDER_FAILURE_REASON - - COMMANDER_REJECTED_EDIT_ORDER - - CANNOT_EDIT_TO_BELOW_FILLED_SIZE - - ORDER_NOT_FOUND - - CALLER_ID_MISMATCH - - ONLY_LIMIT_ORDER_EDITS_SUPPORTED - - INVALID_EDITED_SIZE - - INVALID_EDITED_PRICE - - INVALID_ORIGINAL_SIZE - - INVALID_ORIGINAL_PRICE - - EDIT_REQUEST_EQUAL_TO_ORIGINAL_REQUEST - - ONLY_OPEN_ORDERS_CAN_BE_EDITED - - SIZE_IN_QUOTE_EDITS_NOT_ALLOWED - - ORDER_IS_ALREADY_BEING_REPLACED - - PORTFOLIO_NOT_ALLOWED_FOR_EDITS - - STRATEGY_NOT_SUPPORTED - - FIELD_STOPPRICE_NOT_SUPPORTED - - FIELD_DISPLAYSIZE_NOT_SUPPORTED - - FIELD_ENDTIME_NOT_SUPPORTED - - INVALID_ORIGINAL_TIME - - INVALID_NEW_ENDTIME - - NOT_STARTED - - CANNOT_EDIT_FUTURES_ORDER - - FUTURES_VENUE_ORDER_NOT_FOUND - - CANNOT_EDIT_STOP_PRICE_FOR_TRIGGERED_ORDER - - CANNOT_EDIT_ORDER_PENDING_CANCEL - - INSUFFICIENT_TIME_TO_EDIT - - EXCEEDED_MAX_ALLOWED_EDIT_REQUEST_COUNT - - CANNOT_CANCEL_ACTIVE_ATTACHED_ORDER - - ORDER_EDIT_INVALID_ATTACHED_ORDER_REQUEST - - ORDER_EDIT_ORDER_TYPE_NOT_SUPPORTED - - CANNOT_EDIT_TRIGGERED_ORDER - - INVALID_EDITED_STOP_PRICE - - INVALID_EDITED_STOP_LIMIT_PRICE - - INVALID_ORIGINAL_STOP_PRICE - - INVALID_ORIGINAL_STOP_LIMIT_PRICE - - INVALID_ORIGINAL_ATTACHED_ORDER_CONFIG - - CANNOT_EDIT_ATTACHED_ORDER_CONFIGURATION_AFTER_CREATION - - CANNOT_CONVERT_SIZE_ASSET - - CANNOT_CONVERT_DISPLAY_SIZE_ASSET - - CANNOT_EDIT_ATTACHED_ORDER_SIZE_WITH_OPEN_ORIGINATING_ORDER - - INVALID_EDITED_TAKE_PROFIT_PRICE - - INVALID_EDITED_STOP_LOSS_PRICE - - INVALID_EDITED_ATTACHED_ORDER_CONFIGURATION - - CANNOT_EDIT_ATTACHED_SL_ORDER_PRICE - - CANNOT_ADD_ATTACHED_ORDER_TO_ORDER_TYPE - - CANNOT_CHANGE_SIDE_OF_ORDER - - CANNOT_CHANGE_ORDER_TYPE_OF_ORDER - - CANNOT_CHANGE_PRODUCT_ID_OF_ORDER - - PREV_CLIENT_ORDER_ID_REQUIRED_WHEN_CLIENT_ORDER_ID_PROVIDED - - CLIENT_ORDER_ID_REQUIRED_WHEN_PREV_CLIENT_ORDER_ID_PROVIDED - - CLIENT_ORDER_ID_MUST_BE_DIFFERENT_FROM_PREV_CLIENT_ORDER_ID - - PREV_CLIENT_ORDER_ID_MUST_MATCH_CURRENT_CLIENT_ORDER_ID - - CANNOT_MODIFY_ATTACHED_CONFIG_OF_NON_NEW_ORDER - - INVALID_EDITED_ATTACHED_ORDER_CONFIGURATION_NON_MODIFIABLE_VALUE_EDIT - - ATTACHED_CONFIGURATION_IS_EQUAL - - CANNOT_ADD_LEG_TO_TPSL_ORDER - - CANNOT_REMOVE_LEG_FROM_TPSL_ORDER - - SINGLE_LEGGED_BRACKET_ORDER_NOT_ALLOWED - - SINGLE_LEGGED_ATTACHED_ORDER_CONFIGURATION_NOT_ALLOWED - - FIELD_PEG_OFFSET_NOT_SUPPORTED - - INVALID_EDITED_PEG_WIG_LEVEL - - INVALID_EDITED_PEG_OFFSET - - FIELD_PEG_WIG_LEVEL_NOT_SUPPORTED - default: UNKNOWN_EDIT_ORDER_FAILURE_REASON - description: 'Used to provide detailed error information when an order modification - request fails. - - This helps clients understand exactly why their edit operation was unsuccessful - - and what corrective action might be needed.' - coinbase.public_api.authed.retail_brokerage_api.EditOrderRequest: - type: object - properties: - order_id: - type: string - description: The ID of the order. - required: - - order_id - price: - type: string - example: '19000.00' - description: The update price of the order. - required: - - price - size: - type: string - example: '0.001' - description: The updated size of the order. - required: - - size - attached_order_configuration: - description: The configuration of the attached order. Only TriggerBracketGtc, - LimitLimitGtc or StopLimitStopLimitGtc are eligible. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration' - cancel_attached_order: - type: boolean - example: 'true' - description: Drops both the legs of TP/SL, order becomes a simple limit - order. - stop_price: - type: string - example: '17000.00' - description: The updated stop price of the order. Only applicable for editing - TP/SL or SL orders. - average_entry_price: - type: string - example: '18000.00' - description: The average entry price of the position. Used for estimated - PnL - required: - - order_id - - price - - size - coinbase.public_api.authed.retail_brokerage_api.EditOrderResponse: - type: object - properties: - success: - type: boolean - example: true - description: Whether the order edit request was placed. - required: - - success - errors: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EditOrderError' - required: - - success - coinbase.public_api.authed.retail_brokerage_api.EditPortfolioRequest: - type: object - properties: - name: - type: string - description: The name of the portfolio. - coinbase.public_api.authed.retail_brokerage_api.EditPortfolioResponse: - type: object - properties: - portfolio: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Portfolio' - coinbase.public_api.authed.retail_brokerage_api.EquityOrderMetadata: - type: object - properties: - equity_trading_session: - description: Trading session in which the equity order may execute. Defaults - to EQUITY_TRADING_SESSION_NORMAL when omitted. Market orders are supported - only in the normal session. Any non-normal session requires a limit order - with a positive whole-share base_size; quote_size and fractional sizing - are not supported. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityTradingSession' - displayed_order_config: - description: Time-in-force instruction for the equity order. Use MARKET_GFD - with market_market_ioc, or LIMIT_GFD/LIMIT_GTC with limit_limit_gtc. If - omitted from a public market order, the API normalizes it to MARKET_GFD. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.DisplayedOrderConfig' - description: Equity-specific order instructions and response metadata. - coinbase.public_api.authed.retail_brokerage_api.EquityOrderProductDetails: - type: object - properties: - base_cbrn: - type: string - ticker: - type: string - quote_id: - type: string - title: Equity-specific product details - coinbase.public_api.authed.retail_brokerage_api.EquityProductDetails: - type: object - properties: - equity_subtype: - description: Security classification, such as common stock, ADR, or ETF. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityProductSubtype' - fractionable: - type: boolean - description: Whether the product supports fractional-share trading. Check - equity_trading_flags for side- and size-specific permissions. - liquidate_only: - type: boolean - description: Whether the product may only be sold to reduce an existing - position. New buy orders are not accepted when true. - ticker: - type: string - description: Display ticker for the equity, such as COIN. Use Product.product_id, - not this ticker, in order requests. - description: - type: string - description: Display name of the equity, such as Coinbase Global Inc. - trading_halted: - type: boolean - description: Whether trading is currently halted. New orders are not accepted - while true. - trading_halted_start_time: - type: string - format: RFC3339 Timestamp - description: Time at which the current trading halt began. - trading_halted_end_time: - type: string - format: RFC3339 Timestamp - description: Expected end time of the current trading halt, when available. - fractional_notional_min_size: - type: string - description: Minimum quote-currency amount for a fractional or notional - order. - cik: - type: string - description: SEC Central Index Key for the issuer. - short_name: - type: string - description: Short display name for the issuer or fund. - company_description: - type: string - description: Description of the issuer or fund. - company_website: - type: string - description: Public website for the issuer or fund. - trading_day_info: - description: Schedule and status for the current equity trading day, including - session windows and holiday information. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityTradingDayInfo' - current_session: - description: Trading session active at the time of the response. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityTradingSession' - opol: - type: string - description: ISO 10383 Market Identifier Code (MIC) for the official place - of listing. - recent_trading_days: - description: Recent trading-day schedules used to account for weekends, - holidays, and early closes. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TradingDayData' - equity_trading_flags: - description: Granular permissions that indicate which buy/sell and whole-share/fractional/notional - order combinations are currently supported. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityTradingFlags' - coinbase.public_api.authed.retail_brokerage_api.EquityProductSubtype: - type: string - enum: - - EQUITY_PRODUCT_SUBTYPE_UNSPECIFIED - - EQUITY_PRODUCT_SUBTYPE_COMMON_STOCK - - EQUITY_PRODUCT_SUBTYPE_PREFERRED_STOCK - - EQUITY_PRODUCT_SUBTYPE_PREFERRED_ADR - - EQUITY_PRODUCT_SUBTYPE_SPECIAL_STOCK - - EQUITY_PRODUCT_SUBTYPE_INDEX - - EQUITY_PRODUCT_SUBTYPE_WARRANT - - EQUITY_PRODUCT_SUBTYPE_ADR - - EQUITY_PRODUCT_SUBTYPE_RIGHTS - - EQUITY_PRODUCT_SUBTYPE_SHARES_OF_BENEFICIAL_INTEREST - - EQUITY_PRODUCT_SUBTYPE_CERTIFICATES - - EQUITY_PRODUCT_SUBTYPE_UNITS - - EQUITY_PRODUCT_SUBTYPE_DEBT_ISSUE - - EQUITY_PRODUCT_SUBTYPE_OPTION - - EQUITY_PRODUCT_SUBTYPE_ETF - default: EQUITY_PRODUCT_SUBTYPE_UNSPECIFIED - description: Defines the subtype of an equity product. - coinbase.public_api.authed.retail_brokerage_api.EquityTradeDateType: - type: string - enum: - - TRADE_DATE_TYPE_UNSPECIFIED - - TRADE_DATE_TYPE_REGULAR - - TRADE_DATE_TYPE_EARLY_CLOSE - - TRADE_DATE_TYPE_FULL_CLOSE - default: TRADE_DATE_TYPE_UNSPECIFIED - description: Describes whether and how an equity market trades on a calendar - date. - coinbase.public_api.authed.retail_brokerage_api.EquityTradingDayInfo: - type: object - properties: - venue_id: - type: string - description: Identifier for the equity trading venue. - date: - type: string - description: Trading date in YYYY-MM-DD format. - trade_date_type: - description: Whether the date follows a regular, early-close, or fully closed - schedule. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityTradeDateType' - holiday_name: - type: string - description: Holiday name when the schedule is affected by a market holiday. - version_id: - type: string - description: Version identifier for this trading-day schedule. - trading_sessions: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityTradingSessionWindow' - description: Trading sessions available on this date. Use these windows - instead of hard-coded market hours. - title: EquityTradingDayInfo contains trading day and session information for - an equity venue - coinbase.public_api.authed.retail_brokerage_api.EquityTradingFlags: - type: object - properties: - tradable: - type: boolean - description: Whether at least one buy or sell flow is enabled for this product. - searchable: - type: boolean - description: Whether the product is searchable and discoverable. - buy_enabled: - type: boolean - description: Whether any buy order flow is enabled. - buy_whole_shares: - type: boolean - description: Whether buying a whole number of shares is enabled. - buy_fractional_shares: - type: boolean - description: Whether buying a fractional number of shares is enabled. - buy_notional: - type: boolean - description: Whether buying by quote-currency amount is enabled. - sell_enabled: - type: boolean - description: Whether any sell order flow is enabled. - sell_whole_shares: - type: boolean - description: Whether selling a whole number of shares is enabled. - sell_fractional_shares: - type: boolean - description: Whether selling a fractional number of shares is enabled. - sell_notional: - type: boolean - description: Whether selling by quote-currency amount is enabled. - title: EquityTradingFlags contains granular trading permissions for equity products - coinbase.public_api.authed.retail_brokerage_api.EquityTradingSession: - type: string - enum: - - UNKNOWN_EQUITY_TRADING_SESSION - - EQUITY_TRADING_SESSION_NORMAL - - EQUITY_TRADING_SESSION_AFTER_HOURS - - EQUITY_TRADING_SESSION_MULTI_SESSION - - EQUITY_TRADING_SESSION_OVERNIGHT - - EQUITY_TRADING_SESSION_PRE_MARKET - default: UNKNOWN_EQUITY_TRADING_SESSION - description: Equity execution session. NORMAL is regular market hours and is - the only session that supports market orders. PRE_MARKET, AFTER_HOURS, OVERNIGHT, - and MULTI_SESSION accept only whole-share limit orders. MULTI_SESSION spans - multiple eligible sessions. - title: Trading session in which an equity order may execute. - coinbase.public_api.authed.retail_brokerage_api.EquityTradingSessionWindow: - type: object - properties: - session_type: - description: Trading session represented by this window. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityTradingSession' - session_start_time: - type: string - format: RFC3339 Timestamp - description: Start of the session window. - session_end_time: - type: string - format: RFC3339 Timestamp - description: End of the session window. - support_fractional: - type: boolean - description: Whether fractional-share orders are supported during this session. - limit_only: - type: boolean - description: Whether only limit orders are supported during this session. - title: TradingWindow represents a trading session window within a trading day - coinbase.public_api.authed.retail_brokerage_api.FcmScheduledMaintenance: - type: object - properties: - start_time: - type: string - format: RFC3339 Timestamp - end_time: - type: string - format: RFC3339 Timestamp - description: Fcm specific scheduled maintenance details. - coinbase.public_api.authed.retail_brokerage_api.FcmTradingSessionClosedReason: - type: string - enum: - - FCM_TRADING_SESSION_CLOSED_REASON_UNDEFINED - - FCM_TRADING_SESSION_CLOSED_REASON_REGULAR_MARKET_CLOSE - - FCM_TRADING_SESSION_CLOSED_REASON_EXCHANGE_MAINTENANCE - - FCM_TRADING_SESSION_CLOSED_REASON_VENDOR_MAINTENANCE - default: FCM_TRADING_SESSION_CLOSED_REASON_UNDEFINED - description: This helps distinguish between regular market close and downtimes - due to maintenance. - coinbase.public_api.authed.retail_brokerage_api.FcmTradingSessionDetails: - type: object - properties: - is_session_open: - type: boolean - open_time: - type: string - format: RFC3339 Timestamp - close_time: - type: string - format: RFC3339 Timestamp - session_state: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FcmTradingSessionState' - after_hours_order_entry_disabled: - type: boolean - closed_reason: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FcmTradingSessionClosedReason' - maintenance: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FcmScheduledMaintenance' - coinbase.public_api.authed.retail_brokerage_api.FcmTradingSessionState: - type: string - enum: - - FCM_TRADING_SESSION_STATE_UNDEFINED - - FCM_TRADING_SESSION_STATE_PRE_OPEN - - FCM_TRADING_SESSION_STATE_PRE_OPEN_NO_CANCEL - - FCM_TRADING_SESSION_STATE_OPEN - - FCM_TRADING_SESSION_STATE_CLOSE - - FCM_TRADING_SESSION_STATE_HALTED - default: FCM_TRADING_SESSION_STATE_UNDEFINED - description: Defines the state of a trading session. - coinbase.public_api.authed.retail_brokerage_api.FeeTier: - type: object - properties: - pricing_tier: - type: string - example: <$10k - description: Pricing tier for user, determined by notional (USD) volume. - taker_fee_rate: - type: string - example: '0.0010' - description: Taker fee rate, applied if the order takes liquidity. - maker_fee_rate: - type: string - example: '0.0020' - description: Maker fee rate, applied if the order creates liquidity. - aop_from: - type: string - example: '0' - description: Lower bound (inclusive) of pricing tier in usd of total assets - on platform. - aop_to: - type: string - example: '10000' - description: Upper bound (exclusive) of pricing tier in usd of total assets - on platform. - volume_types_and_range: - type: array - example: - - volume_types: - - VOLUME_TYPE_SPOT - - VOLUME_TYPE_US_DERIVATIVES - vol_from: '0' - vol_to: '50000' - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.VolumeTypesAndRange' - description: List of rules that define how a tier evaluates 30-day volume - by combining specific volume types. - coinbase.public_api.authed.retail_brokerage_api.FeeTierQualificationType: - type: string - enum: - - FEE_TIER_QUALIFICATION_TYPE_UNKNOWN - - FEE_TIER_QUALIFICATION_TYPE_SPOT_VOLUME - - FEE_TIER_QUALIFICATION_TYPE_US_DERIVATIVES_VOLUME - - FEE_TIER_QUALIFICATION_TYPE_INTX_PERPS_VOLUME - - FEE_TIER_QUALIFICATION_TYPE_AOP - - FEE_TIER_QUALIFICATION_TYPE_COMBINED_VOLUME - default: FEE_TIER_QUALIFICATION_TYPE_UNKNOWN - description: "FeeTierQualificationType identifies which dimension placed the\ - \ user in their fee tier\nwhen promotional fees/incentives are excluded.\n\ - \n - FEE_TIER_QUALIFICATION_TYPE_COMBINED_VOLUME: COMBINED_VOLUME indicates\ - \ the tier is qualified by a sum of multiple volume types\n(see volume_types\ - \ on the corresponding fee tier for details)." - coinbase.public_api.authed.retail_brokerage_api.FeeTierWithoutPromotion: - type: object - properties: - pricing_tier: - type: string - example: Advanced 3 - description: '**(Deprecated)** Pricing tier name; prefer `current_tier.pricing_tier`.' - qualification_type: - description: Dimension that qualifies the user for this tier (spot volume, - AOP, etc.). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FeeTierQualificationType' - current_value: - type: string - example: '25000' - description: The user's current value for the qualifying dimension (volume - in USD, or AOP in USD). - next_tier_threshold: - type: string - example: '50000' - description: The value of the qualifying dimension needed to reach the next - tier. Empty if the user is already in the top tier. - current_tier: - description: Full fee schedule definition for the user's current non-promotional - tier (maker/taker rates and tier bounds). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FeeTier' - next_tier: - description: Full fee schedule definition for the next non-promotional tier. - Omitted when the user is already in the top tier. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FeeTier' - current_tier_threshold: - type: string - example: '10000' - description: The lower bound of the qualifying dimension for the user's - current tier (volume in USD, or AOP in USD). Empty if undetermined. - description: 'FeeTierWithoutPromotion describes the fee tier a user is in based - purely on volume or AOP, - - excluding any promotional fee schedules or fee incentives.' - coinbase.public_api.authed.retail_brokerage_api.Fill: - type: object - properties: - entry_id: - type: string - example: 22222-2222222-22222222 - description: Unique identifier for the fill. - trade_id: - type: string - example: 1111-11111-111111 - description: ID of the fill -- unique for all `FILL` trade_types but not - unique for adjusted fills. - order_id: - type: string - example: 0000-000000-000000 - description: The ID of the order. - trade_time: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: Time at which this fill was completed. - trade_type: - type: string - example: FILL - description: String denoting what type of fill this is. Regular fills have - the value `FILL`. Adjusted fills have possible values `REVERSAL`, `CORRECTION`, - `SYNTHETIC`. - price: - type: string - example: '10000.00' - description: Price the fill was posted at. - size: - type: string - example: '0.001' - description: Amount of order that was transacted at this fill. - commission: - type: string - example: '1.25' - description: Fee amount for fill. - product_id: - type: string - example: BTC-USD - description: Canonical product identifier for the fill. For equities, use - the product_id returned by the Products API, not the display ticker. - sequence_timestamp: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:58:59Z' - description: Time at which this fill was posted. - liquidity_indicator: - description: Whether this fill gives or takes liquidity. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.LiquidityIndicator' - size_in_quote: - type: boolean - example: false - description: Whether the order was placed with quote currency. - user_id: - type: string - example: 3333-333333-3333333 - description: User that placed the order the fill belongs to. - side: - description: Side of order that this fill belongs to. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderSide' - retail_portfolio_id: - type: string - example: 4444-444444-4444444 - description: Portfolio that the order fill belongs to. - fillSource: - description: Field denoting what type of fill source was used for this fill. - title: Represents a fill source type used - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FillSource' - commission_detail_total: - description: Breakdown of commission charges for the fill - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CommissionDetailTotal' - order_data_source: - description: The backend system from which this fill was retrieved. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderDataSource' - future_legs: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FillFutureLeg' - description: Individual legs of a futures combo fill. Empty for non-combo - fills. - title: Represents a fill for an order in the system - coinbase.public_api.authed.retail_brokerage_api.FillFutureLeg: - type: object - properties: - product_id: - type: string - description: Futures product identifier for this leg. - combo_id: - type: string - description: Identifier shared by all legs of the same combo fill. - trade_id: - type: string - description: Trade identifier for this leg's fill. - filled_price: - type: string - description: Filled price for this leg. - filled_size: - type: string - description: Filled quantity for this leg. - side: - description: BUY/SELL direction of this leg. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderSide' - description: FillFutureLeg represents an individual leg of a futures combo fill. - coinbase.public_api.authed.retail_brokerage_api.FillSource: - type: string - enum: - - FILL_SOURCE_UNKNOWN - - FILL_SOURCE_CLOB - - FILL_SOURCE_RFQ - default: FILL_SOURCE_UNKNOWN - title: Represents the source of a fill in the system - coinbase.public_api.authed.retail_brokerage_api.FutureProductDetails: - type: object - properties: - venue: - type: string - contract_code: - type: string - contract_expiry: - type: string - format: RFC3339 Timestamp - contract_size: - type: string - contract_root_unit: - type: string - group_description: - type: string - contract_expiry_timezone: - type: string - group_short_description: - type: string - risk_managed_by: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.RiskManagementType' - contract_expiry_type: - description: The contract expiry type (e.g. 'EXPIRING'). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ContractExpiryType' - perpetual_details: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PerpetualProductDetails' - contract_display_name: - type: string - time_to_expiry_ms: - type: string - format: int64 - non_crypto: - type: boolean - contract_expiry_name: - type: string - twenty_four_by_seven: - type: boolean - funding_interval: - type: string - open_interest: - type: string - funding_rate: - type: string - funding_time: - type: string - format: RFC3339 Timestamp - display_name: - type: string - region_enabled: - type: object - additionalProperties: - type: boolean - intraday_margin_rate: - description: Margin rates during intraday trading hours - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarginRate' - overnight_margin_rate: - description: Margin rates during overnight trading hours - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarginRate' - settlement_price: - type: string - description: The most recent official settlement price for the futures contract - futures_asset_type: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FuturesAssetType' - index_price: - type: string - description: The index price for the futures contract, used for mark-to-market - and PnL calculations - contract_code_display_name: - type: string - product_group_cbrn: - type: string - description: The CBRN of the product group this future belongs to - futures_asset_types: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FuturesAssetType' - trading_hours_type: - description: Trading hours schedule this futures product follows. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TradingHoursType' - deribit_product_details: - description: Deribit-specific instrument metadata. Only populated for Deribit - products. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.DeribitProductDetails' - coinbase.public_api.authed.retail_brokerage_api.FuturesAssetType: - type: string - enum: - - UNKNOWN_FUTURES_ASSET_TYPE - - FUTURES_ASSET_TYPE_CRYPTO - - FUTURES_ASSET_TYPE_METALS - - FUTURES_ASSET_TYPE_ENERGY - - FUTURES_ASSET_TYPE_STOCKS - - FUTURES_ASSET_TYPE_COMMODITIES - - FUTURES_ASSET_TYPE_INDICES - default: UNKNOWN_FUTURES_ASSET_TYPE - description: 'Asset type for futures/derivatives products. - - Other product types (Equity, Prediction Market) will have their own enums.' - coinbase.public_api.authed.retail_brokerage_api.GetAccountResponse: - type: object - properties: - account: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Account' - coinbase.public_api.authed.retail_brokerage_api.GetAccountsResponse: - type: object - properties: - accounts: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Account' - has_next: - type: boolean - example: true - description: Whether there are additional pages for this query. - required: - - has_next - cursor: - type: string - example: '789100' - description: For paginated responses, returns all responses that come after - this value. - size: - type: integer - format: int32 - description: Number of accounts returned - required: - - has_next - coinbase.public_api.authed.retail_brokerage_api.GetBestBidAskResponse: - type: object - properties: - pricebooks: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PriceBook' - required: - - pricebooks - required: - - pricebooks - coinbase.public_api.authed.retail_brokerage_api.GetFillsResponse: - type: object - properties: - fills: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Fill' - description: All fills matching the filters. - cursor: - type: string - example: '789100' - description: For paginated responses, returns all responses that come after - this value. - proof_token_required: - type: boolean - example: true - description: Indicates that a valid proof token is required to access this - data (EU SCA compliance). - coinbase.public_api.authed.retail_brokerage_api.GetHistoricalOrderResponse: - type: object - properties: - order: - description: The retrieved order. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Order' - coinbase.public_api.authed.retail_brokerage_api.GetHistoricalOrdersResponse: - type: object - properties: - orders: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Order' - description: A list of orders matching the query. - required: - - orders - sequence: - type: string - format: int64 - description: '**(Deprecated)** The sequence of the db at which this state - was read.' - has_next: - type: boolean - example: true - description: Whether there are additional pages for this query. - required: - - has_next - cursor: - type: string - example: '789100' - description: For paginated responses, returns all responses that come after - this value. - proof_token_required: - type: boolean - example: true - description: Indicates that a valid proof token is required to access this - data (EU SCA compliance). - required: - - orders - - has_next - coinbase.public_api.authed.retail_brokerage_api.GetMarketTradesResponse: - type: object - properties: - trades: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.HistoricalMarketTrade' - best_bid: - type: string - example: '291.13' - description: The best bid for the `product_id`, in quote currency. - best_ask: - type: string - example: '292.40' - description: The best ask for the `product_id`, in quote currency. - coinbase.public_api.authed.retail_brokerage_api.GetPortfolioBreakdownResponse: - type: object - properties: - breakdown: - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.PortfolioBreakdown' - coinbase.public_api.authed.retail_brokerage_api.GetPortfoliosResponse: - type: object - properties: - portfolios: - type: array - items: - $ref: '#/components/schemas/coinbase.portfolio_service.Portfolio' - coinbase.public_api.authed.retail_brokerage_api.GetProductBookResponse: - type: object - properties: - pricebook: - required: - - pricebook - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PriceBook' - last: - type: string - mid_market: - type: string - spread_bps: - type: string - spread_absolute: - type: string - required: - - pricebook - coinbase.public_api.authed.retail_brokerage_api.GetTransactionSummaryResponse: - type: object - properties: - total_fees: - type: number - format: double - example: 25 - description: Total fees across assets, denoted in USD. - required: - - total_fees - fee_tier: - description: Description of maker and taker rates across all applicable - fee tiers. - required: - - fee_tier - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FeeTier' - margin_rate: - example: 0.5 - description: Margin rate, only applicable to product_type `FUTURE`. - allOf: - - $ref: '#/components/schemas/coinbase.brokerage.types.Decimal' - goods_and_services_tax: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GoodsAndServicesTax' - advanced_trade_only_volume: - type: number - format: double - example: 1000 - description: Advanced Trade volume (non-inclusive of Pro) across assets, - denoted in USD. - advanced_trade_only_fees: - type: number - format: double - example: 25 - description: Advanced Trade fees (non-inclusive of Pro) across assets, denoted - in USD. - coinbase_pro_volume: - type: number - format: double - example: 1000 - description: Coinbase Pro volume across assets, denoted in USD. - coinbase_pro_fees: - type: number - format: double - example: 25 - description: Coinbase Pro fees across assets, denoted in USD. - total_balance: - type: string - example: '1000' - description: Total balance across assets and products, which is comprised - of the sum of spot, intx, and fcm, and denoted in USD. - volume_breakdown: - type: array - example: - - volume_type: VOLUME_TYPE_SPOT - volume: 1000 - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Volume' - description: Breakdown of volumes that contributed to the fee tier calculation. - has_cost_plus_commission: - type: boolean - example: false - description: Indicates whether the user uses cost plus commission pricing - model. - fee_tier_without_promotion: - description: The fee tier the user qualifies for based purely on their volume - or AOP, ignoring any promotional fees or incentives. Includes current - and next `FeeTier` rows, which dimension qualifies them, their current - value for that dimension, and the threshold needed to reach the next tier. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FeeTierWithoutPromotion' - deribit_venue_data: - description: Transaction summary for each INTX derivatives product type - (perps, dated futures, options), resolved together by the shared fee data - pipeline. Only populated for INTX derivatives requests. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.DeribitVenueData' - required: - - total_volume - - total_fees - - fee_tier - coinbase.public_api.authed.retail_brokerage_api.GoodsAndServicesTax: - type: object - properties: - rate: - type: string - type: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.GstType' - coinbase.public_api.authed.retail_brokerage_api.GstType: - type: string - enum: - - INCLUSIVE - - EXCLUSIVE - default: INCLUSIVE - title: "- INCLUSIVE: inclusive means the `feeTier`` is inclusive of the GST\ - \ (e.g SG)\n - EXCLUSIVE: exclusive means the `feeTier`` is exclusive of the\ - \ GST (e.g AU)" - coinbase.public_api.authed.retail_brokerage_api.HistoricalMarketTrade: - type: object - properties: - trade_id: - type: string - example: 34b080bf-fcfd-445a-832b-46b5ddc65601 - description: The ID of the trade that was placed. - product_id: - type: string - example: BTC-USD - description: The trading pair (e.g. 'BTC-USD'). - price: - type: string - example: '140.91' - description: The price of the trade, in quote currency. - size: - type: string - example: '4' - description: The size of the trade, in base currency. - time: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: The time of the trade. - side: - description: The maker side of the trade. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderSide' - exchange: - type: string - description: The exchange where the trade was placed. - coinbase.public_api.authed.retail_brokerage_api.L2Level: - type: object - properties: - price: - type: string - size: - type: string - coinbase.public_api.authed.retail_brokerage_api.LimitLimitFok: - type: object - properties: - quote_size: - type: string - example: '10.00' - description: The amount of the second Asset in the Trading Pair. For example, - on the BTC/USD Order Book, USD is the Quote Asset. - base_size: - type: string - example: '0.001' - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - limit_price: - type: string - example: '10000.00' - description: The specified price, or better, that the Order should be executed - at. A Buy Order will execute at or lower than the limit price. A Sell - Order will execute at or higher than the limit price. - coinbase.public_api.authed.retail_brokerage_api.LimitLimitGtc: - type: object - properties: - quote_size: - type: string - example: '10.00' - description: The amount of the second Asset in the Trading Pair. For example, - on the BTC/USD Order Book, USD is the Quote Asset. - base_size: - type: string - example: '0.001' - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - limit_price: - type: string - example: '10000.00' - description: The specified price, or better, that the Order should be executed - at. A Buy Order will execute at or lower than the limit price. A Sell - Order will execute at or higher than the limit price. - post_only: - type: boolean - example: false - description: Enable or disable Post-only Mode. When enabled, only Maker - Orders will be posted to the Order Book. Orders that will be posted as - a Taker Order will be rejected. - currency_size: - description: quote_size converted to the user's native currency. Empty when - the order is not sized in quote or when rates are unavailable. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - coinbase.public_api.authed.retail_brokerage_api.LimitLimitGtd: - type: object - properties: - quote_size: - type: string - example: '10.00' - description: The amount of the second Asset in the Trading Pair. For example, - on the BTC/USD Order Book, USD is the Quote Asset. - base_size: - type: string - example: '0.001' - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - limit_price: - type: string - example: '10000.00' - description: The specified price, or better, that the Order should be executed - at. A Buy Order will execute at or lower than the limit price. A Sell - Order will execute at or higher than the limit price. - end_time: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: The time at which the order will be cancelled if it is not - Filled. - post_only: - type: boolean - example: false - description: Enable or disable Post-only Mode. When enabled, only Maker - Orders will be posted to the Order Book. Orders that will be posted as - a Taker Order will be rejected. - currency_size: - description: quote_size converted to the user's native currency. Empty when - the order is not sized in quote or when rates are unavailable. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - coinbase.public_api.authed.retail_brokerage_api.LiquidityIndicator: - type: string - enum: - - UNKNOWN_LIQUIDITY_INDICATOR - - MAKER - - TAKER - default: UNKNOWN_LIQUIDITY_INDICATOR - coinbase.public_api.authed.retail_brokerage_api.MarginRate: - type: object - properties: - long_margin_rate: - type: string - example: '0.5' - description: Long margin rate - short_margin_rate: - type: string - example: '0.5' - description: Short margin rate - title: Margin rate information for futures products - coinbase.public_api.authed.retail_brokerage_api.MarginRatioData: - type: object - properties: - current_margin_ratio: - type: string - projected_margin_ratio: - type: string - title: New margin ratio fields replacing current_liquidation_buffer and projected_liquidation_buffer - coinbase.public_api.authed.retail_brokerage_api.MarginType: - type: string - enum: - - CROSS - - ISOLATED - default: '' - description: "- CROSS: Cross margin applies margin to the position of the entire\ - \ portfolio\n - ISOLATED: Isolated margin applies margin to a single position" - title: MarginType reflects the margin type of an order, used for Intx Perps - trades - coinbase.public_api.authed.retail_brokerage_api.MarketMarketFok: - type: object - properties: - quote_size: - type: string - example: '10.00' - description: The amount of the second Asset in the Trading Pair. For example, - on the BTC/USD Order Book, USD is the Quote Asset. - base_size: - type: string - example: '0.001' - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - coinbase.public_api.authed.retail_brokerage_api.MarketMarketIoc: - type: object - properties: - quote_size: - type: string - example: '10.00' - description: The amount of the second Asset in the Trading Pair. For example, - on the BTC/USD Order Book, USD is the Quote Asset. - base_size: - type: string - example: '0.001' - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - currency_size: - description: quote_size converted to the user's native currency. Empty when - the order is not sized in quote or when rates are unavailable. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - title: Order entry configurations - coinbase.public_api.authed.retail_brokerage_api.MovePortfolioFundsRequest: - type: object - properties: - funds: - description: The amount to be moved to the specified portfolio. - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.Amount' - source_portfolio_uuid: - type: string - example: 8bfc20d7-f7c6-4422-bf07-8243ca4169fe - description: The UUID of the portfolio to send funds from. - target_portfolio_uuid: - type: string - example: 8bfc20d7-f7c6-4422-bf07-8243ca4169fe - description: The UUID of the portfolio to send funds to. - coinbase.public_api.authed.retail_brokerage_api.MovePortfolioFundsResponse: - type: object - properties: - source_portfolio_uuid: - type: string - example: 8bfc20d7-f7c6-4422-bf07-8243ca4169fe - description: The UUID of the portfolio to send funds from. - target_portfolio_uuid: - type: string - example: 8bfc20d7-f7c6-4422-bf07-8243ca4169fe - description: The UUID of the portfolio to send funds to. - coinbase.public_api.authed.retail_brokerage_api.NewOrderErrorResponse: - type: object - properties: - error: - description: '**(Deprecated)** The reason the order failed to be created' - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.NewOrderFailureReason' - message: - type: string - example: The order configuration was invalid - description: Generic error message explaining why the order was not created - error_details: - type: string - example: Market orders cannot be placed with empty order sizes - description: Descriptive error message explaining why the order was not - created - preview_failure_reason: - description: '**(Deprecated)** The reason the order failed to be created' - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewFailureReason' - new_order_failure_reason: - description: The reason the order failed to be created - required: - - new_order_failure_reason - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.NewOrderFailureReason' - coinbase.public_api.authed.retail_brokerage_api.NewOrderFailureReason: - type: string - enum: - - UNKNOWN_FAILURE_REASON - - UNSUPPORTED_ORDER_CONFIGURATION - - INVALID_SIDE - - INVALID_PRODUCT_ID - - INVALID_SIZE_PRECISION - - INVALID_PRICE_PRECISION - - INSUFFICIENT_FUND - - INVALID_LEDGER_BALANCE - - ORDER_ENTRY_DISABLED - - INELIGIBLE_PAIR - - INVALID_LIMIT_PRICE_POST_ONLY - - INVALID_LIMIT_PRICE - - INVALID_NO_LIQUIDITY - - INVALID_REQUEST - - COMMANDER_REJECTED_NEW_ORDER - - INSUFFICIENT_FUNDS - - IN_LIQUIDATION - - INVALID_MARGIN_TYPE - - INVALID_LEVERAGE - - UNTRADABLE_PRODUCT - - INVALID_FCM_TRADING_SESSION - - GEOFENCING_RESTRICTION - - QUOTE_SIZE_NOT_ALLOWED_FOR_BRACKET - - INVALID_BRACKET_PRICES - - MISSING_MARKET_TRADE_DATA - - INVALID_BRACKET_LIMIT_PRICE - - INVALID_BRACKET_STOP_TRIGGER_PRICE - - BRACKET_LIMIT_PRICE_OUT_OF_BOUNDS - - STOP_TRIGGER_PRICE_OUT_OF_BOUNDS - - BRACKET_ORDER_NOT_SUPPORTED - - FOK_DISABLED - - FOK_ONLY_ALLOWED_ON_LIMIT_ORDERS - - POST_ONLY_NOT_ALLOWED_WITH_FOK - - UBO_HIGH_LEVERAGE_QUANTITY_BREACHED - - END_TIME_TOO_FAR_IN_FUTURE - - LIMIT_PRICE_TOO_FAR_FROM_MARKET - - OPEN_BRACKET_ORDERS - - FUTURES_AFTER_HOUR_INVALID_ORDER_TYPE - - FUTURES_AFTER_HOUR_INVALID_TIME_IN_FORCE - - INVALID_ATTACHED_TAKE_PROFIT_PRICE - - INVALID_ATTACHED_STOP_LOSS_PRICE - - INVALID_ATTACHED_TAKE_PROFIT_PRICE_PRECISION - - INVALID_ATTACHED_STOP_LOSS_PRICE_PRECISION - - INVALID_ATTACHED_TAKE_PROFIT_PRICE_OUT_OF_BOUNDS - - INVALID_ATTACHED_STOP_LOSS_PRICE_OUT_OF_BOUNDS - - INVALID_ATTACHED_TAKE_PROFIT_PRICE_EXCEEDS_MAX_DISTANCE_FROM_ORIGINATING_PRICE - - INVALID_ATTACHED_TAKE_PROFIT_SIZE_BELOW_MIN - - ATTACHED_ORDER_SIZE_MUST_BE_NIL - - INVALID_SETTLEMENT_CURRENCY - - DURATION_TOO_SMALL - - INTX_FOK_ONLY_ALLOWED_ON_LIMIT_AND_MARKET_ORDERS - - BUCKET_SIZE_SMALLER_THAN_QUOTE_MIN - - BUCKET_SIZE_SMALLER_THAN_BASE_MIN - - END_TIME_AFTER_CONTRACT_EXPIRATION - - START_TIME_MUST_BE_SPECIFIED - - ICEBERG_ORDERS_NOT_SUPPORTED - - END_TIME_IS_IN_THE_PAST - - GTD_ORDERS_MUST_HAVE_END_TIME - - ATTACHED_ORDER_MUST_HAVE_POSITIVE_PRICES - - INVALID_ORDER_SIDE_FOR_ATTACHED_TPSL - - ATTACHED_ORDERS_ONLY_ALLOWED_ON_MARKET_LIMIT - - INVALID_ORDER_TYPE_FOR_ATTACHED - - PRICE_NOT_ALLOWED_FOR_MARKET_ORDERS - - REDUCE_ONLY_NOT_ALLOWED_ON_VENUE - - DURATION_TOO_LARGE - - REDUCE_ONLY_NOT_ALLOWED_ON_SPOT_PRODUCTS - - LIMIT_ORDER_PRICE_EXCEEDS_PRICE_BAND_ON_BUY - - LIMIT_ORDER_PRICE_EXCEEDS_PRICE_BAND_ON_SELL - - INVALID_ATTACHED_TAKE_PROFIT_PRICE_OUT_OF_BOUNDS_ON_AGGRESSIVE_ORDER - - INVALID_ATTACHED_STOP_LOSS_PRICE_OUT_OF_BOUNDS_ON_AGGRESSIVE_ORDER - - STOP_ALREADY_TRIGGERED - - REPLACE_NOT_SUPPORTED - - ORDER_IS_PENDING_CANCEL - - POSITION_SIZE_INCREASE_REJECT - - ASSET_BALANCE_INCREASE_REJECT - - TOO_MANY_PENDING_REPLACES - - INVALID_RFQ_BASE_SIZE_TOO_SMALL - - INVALID_RFQ_BASE_SIZE_TOO_LARGE - - INVALID_RFQ_QUOTE_SIZE_TOO_SMALL - - INVALID_RFQ_QUOTE_SIZE_TOO_LARGE - - INVALID_UNSUPPORTED_INSTRUMENT - - REDUCE_ONLY_INCREASED_POSITION_SIZE - - SCALED_PARAM_INFEASIBLE - - SCALED_MIN_ORDER_VIOLATION - - SCALED_MAX_ORDER_VIOLATION - - POST_ONLY_NOT_ALLOWED_WITH_PEG - - INVALID_PEG_OFFSET - - INVALID_PEG_WIG_LEVEL - - INVALID_PEG_VENUE_OPTIONS - - PEG_INVALID_ORDER_TYPE - - SINGLE_LEGGED_TPSL_NOT_ALLOWED - - FRACTIONAL_ORDERS_NOT_ALLOWED_FOR_PRODUCT - - QUOTE_ORDERS_NOT_ALLOWED_FOR_PRODUCT - - NBBO_NOT_PROVIDED - - INVALID_NBBO_BID_PRICE - - INVALID_NBBO_ASK_PRICE - - NOTIONAL_SIZE_BREACHES_FRACTIONAL_MINIMUM - - MARKET_ORDERS_PROHIBITED_DURING_NON_CORE_SESSION - - NOTIONAL_ORDERS_PROHIBITED_DURING_NON_CORE_SESSION - - MAX_NOTIONAL_PER_ORDER_BREACHED_15C35_CHECK - - MAX_SHARES_PER_ORDER_BREACHED_15C35_CHECK - - INVALID_EQUITY_TRADING_SESSION - - PRODUCT_TRADING_HALTED - - TRADING_DISABLED - - CANNOT_CLOSE_ZERO_POSITION - - SCALED_PARAM_DISCREPANCY - - STOP_LOSS_PRICE_TOO_LOW - - ATTACHED_STOP_LOSS_PRICE_TOO_LOW - - BREACHED_RISK_LIMIT - - STOP_LOSS_PRICE_TOO_HIGH - - ATTACHED_STOP_LOSS_PRICE_TOO_HIGH - - TAKE_PROFIT_PRICE_TOO_HIGH - - ATTACHED_TAKE_PROFIT_PRICE_TOO_HIGH - - TAKE_PROFIT_PRICE_TOO_LOW - - ATTACHED_TAKE_PROFIT_PRICE_TOO_LOW - - MODIFY_POSITION_WORKFLOW_ALREADY_RUNNING - - DUPLICATE_CLIENT_ORDER_ID - - RFQ_QUOTE_EXPIRED - - RFQ_TOO_MANY_OPEN_QUOTES - - RFQ_RATE_LIMITED - - RFQ_INVALID_COMBO_LEGS - - RFQ_VALIDATION_FAILURE - - RFQ_VENUE_REJECTED - default: UNKNOWN_FAILURE_REASON - coinbase.public_api.authed.retail_brokerage_api.NewOrderRequest: - type: object - properties: - client_order_id: - type: string - example: 0000-00000-000000 - description: A unique ID provided for the order (used for identification - purposes). If the ID provided is not unique, the order will not be created - and the order corresponding with that ID will be returned instead. - required: - - client_order_id - product_id: - type: string - example: BTC-USD - description: Canonical product identifier for the order. For equities, use - the product_id returned by the Products API, not the display ticker. - required: - - product_id - side: - description: The side of the market that the order is on (e.g. 'BUY', 'SELL'). - required: - - side - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderSide' - order_configuration: - description: The configuration of the order (e.g. the order type, size, - etc). - required: - - order_configuration - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration' - leverage: - type: string - example: '2.0' - description: The amount of leverage for the order (default is 1.0). - margin_type: - description: Margin Type for this order (default is CROSS). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarginType' - retail_portfolio_id: - type: string - example: 11111111-1111-1111-1111-111111111111 - description: '**(Deprecated)** The ID of the portfolio to associate the - order with. Only applicable for legacy keys. CDP keys will default to - the key''s permissioned portfolio.' - preview_id: - type: string - example: b40bbff9-17ce-4726-8b64-9de7ae57ad26 - description: Preview ID for this order, to associate this order with a preview - request - attached_order_configuration: - description: The configuration of the attached order. Only TriggerBracketGtc - is eligible. Size field must be omitted as the size of the attached order - is the same as that of the parent order. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration' - sor_preference: - example: SOR_ENABLED - description: Smart Order Routing preference for this order. UNSPECIFIED - uses default behavior based on user settings. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.SorPreference' - prediction_metadata: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PredictionRequestMetadata' - equity_order_metadata: - description: Equity-specific order instructions. For equity products, use - this field to select the trading session and time in force. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityOrderMetadata' - cost_basis_method: - description: The cost basis method for the order - allOf: - - $ref: '#/components/schemas/coinbase.positions.CostBasisMethod' - required: - - client_order_id - - product_id - - side - - order_configuration - coinbase.public_api.authed.retail_brokerage_api.NewOrderResponse: - type: object - properties: - success: - type: boolean - example: true - description: Whether the order was created. - required: - - success - success_response: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.NewOrderSuccessResponse' - error_response: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.NewOrderErrorResponse' - order_configuration: - description: The configuration of the order (e.g. the order type, size, - etc). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration' - required: - - success - coinbase.public_api.authed.retail_brokerage_api.NewOrderSuccessResponse: - type: object - properties: - order_id: - type: string - example: 11111-00000-000000 - description: The ID of the order. - required: - - order_id - product_id: - type: string - example: BTC-USD - description: The trading pair (e.g. 'BTC-USD'). - side: - description: The side of the market that the order is on (e.g. 'BUY', 'SELL'). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderSide' - client_order_id: - type: string - example: 0000-00000-000000 - description: The unique ID provided for the order (used for identification - purposes). - required: - - order_id - coinbase.public_api.authed.retail_brokerage_api.Order: - type: object - properties: - order_id: - type: string - example: 0000-000000-000000 - description: The ID of the order. - required: - - order_id - product_id: - type: string - example: BTC-USD - description: The trading pair (e.g. 'BTC-USD'). - required: - - product_id - user_id: - type: string - example: 2222-000000-000000 - description: The id of the User owning this Order - required: - - user_id - order_configuration: - description: The configuration of the order (e.g. the order type, size, - etc). - required: - - order_configuration - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration' - side: - description: The side of the market that the order is on (e.g. 'BUY', 'SELL'). - required: - - side - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderSide' - client_order_id: - type: string - example: 11111-000000-000000 - description: The unique ID provided for the order (used for identification - purposes). - required: - - client_order_id - status: - description: The current state of the order - required: - - status - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderExecutionStatus' - time_in_force: - description: The client specified window for which the order can remain - active - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TimeInForceType' - created_time: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: Timestamp for when the order was created - required: - - created_time - completion_percentage: - type: string - example: '50' - description: The percent of total order amount that has been filled - required: - - completion_percentage - filled_size: - type: string - example: '0.001' - description: The portion (in base currency) of total order amount that has - been filled - average_filled_price: - type: string - example: '50' - description: The average of all prices of fills for this order - required: - - average_filled_price - fee: - type: string - description: '**(Deprecated)** Commission amount' - number_of_fills: - type: string - example: '2' - description: Number of fills that have been posted for this order - required: - - number_of_fills - filled_value: - type: string - example: '10000' - description: The portion (in quote current) of total order amount that has - been filled - pending_cancel: - type: boolean - example: true - description: Whether a cancel request has been initiated for the order, - and not yet completed - required: - - pending_cancel - size_in_quote: - type: boolean - example: false - description: Whether the order was placed with quote currency - required: - - size_in_quote - total_fees: - type: string - example: '5.00' - description: The total fees for the order - required: - - total_fees - size_inclusive_of_fees: - type: boolean - example: false - description: Whether the order size includes fees - required: - - size_inclusive_of_fees - total_value_after_fees: - type: string - description: 'derived field: filled_value + total_fees for buy orders and - filled_value - total_fees for sell orders.' - required: - - total_value_after_fees - trigger_status: - description: The trigger status of the order, with respect to stop price. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.StopTriggerStatus' - order_type: - description: Type of the order - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderType' - reject_reason: - description: Reason the order was rejected. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.RejectReason' - settled: - type: boolean - description: True if the order is fully filled, false otherwise. - product_type: - description: The type of order, i.e. Spot or Future - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ProductType' - reject_message: - type: string - description: Message stating why the order was rejected. - cancel_message: - type: string - description: Message stating why the order was canceled. - order_placement_source: - description: Message stating which source an order was placed from. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderPlacementSource' - outstanding_hold_amount: - type: string - description: The remaining hold amount (holdAmount - holdAmountReleased). - [value is 0 if holdReleased is true] - is_liquidation: - type: boolean - description: True if order is of liquidation type. - last_fill_time: - type: string - format: RFC3339 Timestamp - description: Time of the most recent fill for this order - edit_history: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Edit' - description: An array of the latest 5 edits per order - leverage: - type: string - description: The amount of leverage for the order (default is 1.0). - margin_type: - description: Margin Type for this order (default is CROSS). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarginType' - retail_portfolio_id: - type: string - example: b87a2d3f-8a1e-49b3-a4ea-402d8c389aca - description: The ID of the portfolio this order is associated with. - originating_order_id: - type: string - example: b87a2d3f-8a1e-49b3-a4ea-402d8c389aca - description: The ID of the parent order of an attached order. - attached_order_id: - type: string - example: b87a2d3f-8a1e-49b3-a4ea-402d8c389aca - description: The ID of the attached order of a parent order. - attached_order_configuration: - description: The configuration of the attached order. Only TriggerBracketGtc - is eligible. Size field must be omitted as the size of the attached order - is the same as that of the originating or parent order. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration' - current_pending_replace: - description: Price/Size of the current edit - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Edit' - commission_detail_total: - description: Breakdown of commission charges for the order - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CommissionDetailTotal' - workable_size: - type: string - example: '3' - description: The size of order in the originating order which is filled. - workable_size_completion_pct: - type: string - example: '50' - description: Percentage of the originating order which is filled - product_details: - description: Product-specific details, the oneof corresponds to the ProductType - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ProductDetails' - cost_basis_method: - description: The cost basis method for the order - allOf: - - $ref: '#/components/schemas/coinbase.positions.CostBasisMethod' - displayed_order_config: - description: Displayed order configuration. For equity orders, MARKET_GFD - is used for market orders and LIMIT_GFD/LIMIT_GTC for limit orders. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.DisplayedOrderConfig' - equity_trading_session: - description: Trading session in which an equity order is eligible to execute. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityTradingSession' - prediction_side: - description: Direction of the prediction market order (YES or NO) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PredictionSide' - last_update_time: - type: string - format: RFC3339 Timestamp - description: Time of the latest update to this order. It is defined as the - time of the most recent fill if the order has any fills. Else this timestamp - will be the order creation time. - total_value_after_fees_native: - description: Total value after fees, converted to the user's native currency. - Empty when rates are unavailable. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - outstanding_hold_amount_native: - description: Outstanding hold amount, converted to the user's native currency - (source currency is quote for BUY, base for SELL). Empty when rates are - unavailable. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - total_fees_native: - description: Total fees, converted to the user's native currency. Empty - when rates are unavailable. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - required: - - order_id - - product_id - - side - - created_time - - status - - user_id - - order_configuration - - client_order_id - - completion_percentage - - average_filled_price - - number_of_fills - - pending_cancel - - size_in_quote - - total_fees - - size_inclusive_of_fees - - total_value_after_fees - coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration: - type: object - properties: - market_market_ioc: - description: 'Buy or sell a specified quantity of an Asset at the current - best available market price. [Read more on Market Orders](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#market-order) ' - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarketMarketIoc' - market_market_fok: - description: Buy or sell a specified quantity of an Asset at the current - best available market price. The Order will only post to the Order Book - if it is to immediately and completely Fill. [Read more on Market Orders](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#market-order) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarketMarketFok' - sor_limit_ioc: - description: Buy or sell a specified quantity of an Asset at a specified - price. The Order will only post to the Order Book if it will immediately - Fill; any remaining quantity is canceled. [Read more on Limit Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#limit-order) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.SorLimitIoc' - limit_limit_gtc: - description: Buy or sell a specified quantity of an Asset at a specified - price. If posted, the Order will remain on the Order Book until canceled. - [Read more on Limit Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#limit-order) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.LimitLimitGtc' - limit_limit_gtd: - description: Buy or sell a specified quantity of an Asset at a specified - price. If posted, the Order will remain on the Order Book until a certain - time is reached or the Order is canceled. [Read more on Limit Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#limit-order) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.LimitLimitGtd' - limit_limit_fok: - description: Buy or sell a specified quantity of an Asset at a specified - price. The Order will only post to the Order Book if it is to immediately - and completely Fill. [Read more on Limit Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#limit-order) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.LimitLimitFok' - twap_limit_gtd: - description: A time-weighted average price (TWAP) order type that calculates - the average price of a product to programmatically execute an order over - a specified duration. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TwapLimitGtd' - stop_limit_stop_limit_gtc: - description: Posts an Order to buy or sell a specified quantity of an Asset, - but only if and when the last trade price on the Order Book equals or - surpasses the Stop Price. If posted, the Order will remain on the Order - Book until canceled. [Read more on Stop-Limit Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#stop-limit-order) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.StopLimitStopLimitGtc' - stop_limit_stop_limit_gtd: - description: Posts an Order to buy or sell a specified quantity of an Asset, - but only if and when the last trade price on the Order Book equals or - surpasses the Stop Price. If posted, the Order will remain on the Order - Book until a certain time is reached or the Order. [Read more on Stop-Limit - Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#stop-limit-order) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.StopLimitStopLimitGtd' - trigger_bracket_gtc: - description: A Limit Order to buy or sell a specified quantity of an Asset - at a specified price, with stop limit order parameters embedded in the - order. If posted, the Order will remain on the Order Book until canceled. - [Read more on Bracket Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#bracket-order) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TriggerBracketGtc' - trigger_bracket_gtd: - description: A Limit Order to buy or sell a specified quantity of an Asset - at a specified price, with stop limit order parameters embedded in the - order. If posted, the Order will remain on the Order Book until a certain - time is reached or the Order is canceled. [Read more on Bracket Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#bracket-order) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TriggerBracketGtd' - scaled_limit_gtc: - description: A scaled order enables users to divide a large order into multiple - smaller limit orders, which are placed incrementally across a user-defined - price range. [Read more on Limit Orders.](https://help.coinbase.com/en/coinbase/trading-and-funding/advanced-trade/order-types#limit-order) - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ScaledLimitGtc' - coinbase.public_api.authed.retail_brokerage_api.OrderDataSource: - type: string - enum: - - ORDER_DATA_SOURCE_UNKNOWN - - ORDER_DATA_SOURCE_TRADING_PROXY - - ORDER_DATA_SOURCE_ACCOUNT_HISTORY_SERVICE - default: ORDER_DATA_SOURCE_UNKNOWN - description: OrderDataSource identifies which backend system served the order. - coinbase.public_api.authed.retail_brokerage_api.OrderExecutionStatus: - type: string - enum: - - PENDING - - OPEN - - FILLED - - CANCELLED - - EXPIRED - - FAILED - - UNKNOWN_ORDER_STATUS - - QUEUED - - CANCEL_QUEUED - - EDIT_QUEUED - default: PENDING - coinbase.public_api.authed.retail_brokerage_api.OrderPlacementSource: - type: string - enum: - - UNKNOWN_PLACEMENT_SOURCE - - RETAIL_SIMPLE - - RETAIL_ADVANCED - - RETAIL_ADMIN - - RETAIL_RAISE - default: UNKNOWN_PLACEMENT_SOURCE - title: OrderPlacementSource reflects which source an order was placed from - coinbase.public_api.authed.retail_brokerage_api.OrderPreviewRequest: - type: object - properties: - product_id: - type: string - description: The trading pair (e.g. 'BTC-USD'). - required: - - product_id - side: - description: The side of the market that the order is on (e.g. 'BUY', 'SELL'). - required: - - side - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderSide' - order_configuration: - description: The configuration of the order (e.g. the order type, size, - etc). - required: - - order_configuration - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration' - leverage: - type: string - example: '2.0' - description: The amount of leverage for the order (default is 1.0). - margin_type: - description: Margin Type for this order (default is CROSS). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarginType' - retail_portfolio_id: - type: string - example: 11111111-1111-1111-1111-111111111111 - description: '**(Deprecated)** The ID of the portfolio to associate the - order with. Only applicable for legacy keys. CDP keys will default to - the key''s permissioned portfolio.' - attached_order_configuration: - description: The configuration of the attached order. Only TriggerBracketGtc - is eligible. Size field must be omitted as the size of the attached order - is the same as that of the parent order. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.OrderConfiguration' - equity_order_metadata: - description: Equity-specific metadata for the order. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityOrderMetadata' - prediction_metadata: - description: Request metadata specific to prediction market orders (YES/NO). - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PredictionRequestMetadata' - cost_basis_method: - description: The method used to calculate the cost basis for the order. - allOf: - - $ref: '#/components/schemas/coinbase.positions.CostBasisMethod' - title: OrderPreview - required: - - product_id - - side - - commission_rate - - order_configuration - coinbase.public_api.authed.retail_brokerage_api.OrderPreviewResponse: - type: object - properties: - order_total: - type: string - required: - - order_total - commission_total: - type: string - description: Currency amount of the applied commission (so not the rate - that was used on input) - required: - - commission_total - errs: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewFailureReason' - description: List of potential failure reasons were this order to be submitted - required: - - errs - warning: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewWarningMsg' - required: - - warning - quote_size: - type: string - example: 10 - description: The amount of the second Asset in the Trading Pair. For example, - on the BTC/USD Order Book, USD is the Quote Asset. - required: - - quote_size - base_size: - type: string - example: 0.001 - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - required: - - base_size - best_bid: - type: string - required: - - best_bid - best_ask: - type: string - required: - - best_ask - is_max: - type: boolean - description: Indicates whether tradable_balance should be set to the maximum - amount. - required: - - is_max - order_margin_total: - type: string - leverage: - type: string - example: '2.0' - description: The amount of leverage for the order (default is 1.0). - long_leverage: - type: string - short_leverage: - type: string - slippage: - type: string - preview_id: - type: string - current_liquidation_buffer: - type: string - projected_liquidation_buffer: - type: string - max_leverage: - type: string - pnl_configuration: - description: Expected PNL of an order. This value is an estimate and does - not take into account fees and slippage. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PnlConfiguration' - twap_bucket_metadata: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TwapBucketMetadata' - position_notional_limit: - type: string - max_notional_at_requested_leverage: - type: string - margin_ratio_data: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.MarginRatioData' - commission_detail_total: - description: Breakdown of commission charges for the order - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CommissionDetailTotal' - scaled_metadata: - description: Metadata for scaled orders containing the order distribution - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ScaledOrderMetadata' - compliance_limit_data: - description: Optional compliance limit data - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ComplianceLimitData' - est_average_filled_price: - type: string - description: Estimated fill price for order. - prediction_order_metadata: - description: Metadata specific to prediction market orders. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PredictionOrderMetadata' - predicted_liquidation_price: - type: string - description: Predicted liquidation price for FCM orders. - available_buying_power: - type: string - description: Available buying power for futures trading. Used to calculate - funding shortfall when order fails due to insufficient funds. - max_loss: - type: string - example: '10.00' - description: Maximum potential loss for the order. For equity option buy - orders this equals order_total. - required: - - order_total - - commission_total - - errs - - warning - - quote_size - - base_size - - best_bid - - best_ask - - is_max - coinbase.public_api.authed.retail_brokerage_api.OrderSide: - type: string - enum: - - BUY - - SELL - default: '' - coinbase.public_api.authed.retail_brokerage_api.OrderType: - type: string - enum: - - UNKNOWN_ORDER_TYPE - - MARKET - - LIMIT - - STOP - - STOP_LIMIT - - BRACKET - - TWAP - - ROLL_OPEN - - ROLL_CLOSE - - LIQUIDATION - - SCALED - default: UNKNOWN_ORDER_TYPE - title: "- MARKET: A [market order](https://en.wikipedia.org/wiki/Order_(exchange)#Market_order)\n\ - \ - LIMIT: A [limit order](https://en.wikipedia.org/wiki/Order_(exchange)#Limit_order)\n\ - \ - STOP: A stop order is an order that becomes a market order when triggered\n\ - \ - STOP_LIMIT: A stop order is a limit order that doesn't go on the book\ - \ until it hits the stop price\n - BRACKET: A bracket order is a way to mitigate\ - \ potential losses in volatile markets, consisting of a limit price leg and\ - \ a stop trigger price.\n - TWAP: TWAP order is a way to split large buy/sell\ - \ orders to smaller chunks to reduce market impact\n - ROLL_OPEN: ROLL_OPEN\ - \ order is the open step order of a contract roll\n - ROLL_CLOSE: ROLL_CLOSE\ - \ is the close step order in a contract roll\n - LIQUIDATION: LIQUIDATION\ - \ is a special order type that is used to liquidate a position\n - SCALED:\ - \ SCALED order is an order that is split into multiple child orders at incrementally\ - \ increasing or decreasing prices" - coinbase.public_api.authed.retail_brokerage_api.PaginationMetadata: - type: object - properties: - prev_cursor: - type: string - next_cursor: - type: string - has_next: - type: boolean - has_prev: - type: boolean - description: Pagination metadata for paginated responses. - coinbase.public_api.authed.retail_brokerage_api.PerpetualProductDetails: - type: object - properties: - open_interest: - type: string - funding_rate: - type: string - funding_time: - type: string - format: RFC3339 Timestamp - max_leverage: - type: string - base_asset_uuid: - type: string - underlying_type: - type: string - coinbase.public_api.authed.retail_brokerage_api.PnlConfiguration: - type: object - properties: - trigger_bracket_pnl: - description: PNL configuration for a bracket order. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.TriggerBracketPnl' - coinbase.public_api.authed.retail_brokerage_api.PredictionOrderMetadata: - type: object - properties: - contract_subtotal: - type: string - description: The base contract value from user's perspective, adjusted for - prediction market direction. - user_net_total: - type: string - description: The net amount user pays (for buys) or receives (for sells), - accounting for prediction market direction and fees. - slippage_percentage: - type: string - description: Slippage tolerance percentage based on price tier. - minimum_contracts: - type: string - description: Minimum contracts the user will receive after slippage. Populated - for BUY orders with quote_size. - minimum_total: - description: Minimum USD the user will receive after slippage. Populated - for SELL orders with base_size. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - maximum_total: - description: Maximum USD the user will pay after slippage. Populated for - BUY orders with base_size. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Amount' - maximum_contracts: - type: string - description: Maximum contracts the user will sell after slippage. Populated - for SELL orders with quote_size. - title: Prediction market-specific metadata for the order preview response - coinbase.public_api.authed.retail_brokerage_api.PredictionRequestMetadata: - type: object - properties: - prediction_side: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PredictionSide' - preview_order_est_average_filled_price: - type: string - supports_fractional_base_size: - type: boolean - description: Request metadata specific to prediction market orders. - coinbase.public_api.authed.retail_brokerage_api.PredictionSide: - type: string - enum: - - PREDICTION_SIDE_UNKNOWN - - PREDICTION_SIDE_YES - - PREDICTION_SIDE_NO - default: PREDICTION_SIDE_UNKNOWN - description: 'Prediction market orders can be either a YES or NO. - - - Under the hood, there is only a YES order book; NO orders are technically - - short positions on the YES order book.' - coinbase.public_api.authed.retail_brokerage_api.PreviewEditOrderResponse: - type: object - properties: - errors: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EditOrderError' - required: - - errors - slippage: - type: string - order_total: - type: string - commission_total: - type: string - quote_size: - type: string - example: 10 - description: The amount of the second Asset in the Trading Pair. For example, - on the BTC/USD Order Book, USD is the Quote Asset. - base_size: - type: string - example: 0.001 - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - best_bid: - type: string - best_ask: - type: string - average_filled_price: - type: string - order_margin_total: - type: string - commission_detail_total: - description: Breakdown of commission charges for the order - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.CommissionDetailTotal' - pnl_configuration: - description: Expected PNL of an order. This value is an estimate and does - not take into account fees and slippage. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PnlConfiguration' - required: - - errors - coinbase.public_api.authed.retail_brokerage_api.PreviewFailureReason: - type: string - enum: - - UNKNOWN_PREVIEW_FAILURE_REASON - - PREVIEW_MISSING_COMMISSION_RATE - - PREVIEW_INVALID_SIDE - - PREVIEW_INVALID_ORDER_CONFIG - - PREVIEW_INVALID_PRODUCT_ID - - PREVIEW_INVALID_SIZE_PRECISION - - PREVIEW_INVALID_PRICE_PRECISION - - PREVIEW_MISSING_PRODUCT_PRICE_BOOK - - PREVIEW_INVALID_LEDGER_BALANCE - - PREVIEW_INSUFFICIENT_LEDGER_BALANCE - - PREVIEW_INVALID_LIMIT_PRICE_POST_ONLY - - PREVIEW_INVALID_LIMIT_PRICE - - PREVIEW_INVALID_NO_LIQUIDITY - - PREVIEW_INSUFFICIENT_FUND - - PREVIEW_INVALID_COMMISSION_CONFIGURATION - - PREVIEW_INVALID_STOP_PRICE - - PREVIEW_INVALID_BASE_SIZE_TOO_LARGE - - PREVIEW_INVALID_BASE_SIZE_TOO_SMALL - - PREVIEW_INVALID_QUOTE_SIZE_PRECISION - - PREVIEW_INVALID_QUOTE_SIZE_TOO_LARGE - - PREVIEW_INVALID_PRICE_TOO_LARGE - - PREVIEW_INVALID_QUOTE_SIZE_TOO_SMALL - - PREVIEW_INSUFFICIENT_FUNDS_FOR_FUTURES - - PREVIEW_BREACHED_PRICE_LIMIT - - PREVIEW_BREACHED_ACCOUNT_POSITION_LIMIT - - PREVIEW_BREACHED_COMPANY_POSITION_LIMIT - - PREVIEW_INVALID_MARGIN_HEALTH - - PREVIEW_RISK_PROXY_FAILURE - - PREVIEW_UNTRADABLE_FCM_ACCOUNT_STATUS - - PREVIEW_IN_LIQUIDATION - - PREVIEW_INVALID_MARGIN_TYPE - - PREVIEW_INVALID_LEVERAGE - - PREVIEW_UNTRADABLE_PRODUCT - - PREVIEW_INVALID_FCM_TRADING_SESSION - - PREVIEW_NOT_ALLOWED_BY_MARKET_STATE - - PREVIEW_BREACHED_OPEN_INTEREST_LIMIT - - PREVIEW_GEOFENCING_RESTRICTION - - PREVIEW_INVALID_END_TIME - - PREVIEW_OPPOSITE_MARGIN_TYPE_EXISTS - - PREVIEW_QUOTE_SIZE_NOT_ALLOWED_FOR_BRACKET - - PREVIEW_INVALID_BRACKET_PRICES - - PREVIEW_MISSING_MARKET_TRADE_DATA - - PREVIEW_INVALID_BRACKET_LIMIT_PRICE - - PREVIEW_INVALID_BRACKET_STOP_TRIGGER_PRICE - - PREVIEW_BRACKET_LIMIT_PRICE_OUT_OF_BOUNDS - - PREVIEW_STOP_TRIGGER_PRICE_OUT_OF_BOUNDS - - PREVIEW_BRACKET_ORDER_NOT_SUPPORTED - - PREVIEW_INVALID_STOP_PRICE_PRECISION - - PREVIEW_STOP_PRICE_ABOVE_LIMIT_PRICE - - PREVIEW_STOP_PRICE_BELOW_LIMIT_PRICE - - PREVIEW_STOP_PRICE_ABOVE_LAST_TRADE_PRICE - - PREVIEW_STOP_PRICE_BELOW_LAST_TRADE_PRICE - - PREVIEW_FOK_DISABLED - - PREVIEW_FOK_ONLY_ALLOWED_ON_LIMIT_ORDERS - - PREVIEW_POST_ONLY_NOT_ALLOWED_WITH_FOK - - PREVIEW_UBO_HIGH_LEVERAGE_QUANTITY_BREACHED - - PREVIEW_ECOSYSTEM_LEVERAGE_UTILIZATION_BREACHED - - PREVIEW_CLOSE_ONLY_FAILURE - - PREVIEW_UBO_HIGH_LEVERAGE_NOTIONAL_BREACHED - - PREVIEW_END_TIME_TOO_FAR_IN_FUTURE - - PREVIEW_LIMIT_PRICE_TOO_FAR_FROM_MARKET - - PREVIEW_FUTURES_AFTER_HOUR_INVALID_ORDER_TYPE - - PREVIEW_FUTURES_AFTER_HOUR_INVALID_TIME_IN_FORCE - - PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_PRICE - - PREVIEW_INVALID_ATTACHED_STOP_LOSS_PRICE - - PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_PRICE_PRECISION - - PREVIEW_INVALID_ATTACHED_STOP_LOSS_PRICE_PRECISION - - PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_PRICE_OUT_OF_BOUNDS - - PREVIEW_INVALID_ATTACHED_STOP_LOSS_PRICE_OUT_OF_BOUNDS - - PREVIEW_INVALID_BRACKET_ORDER_SIDE - - PREVIEW_BRACKET_ORDER_SIZE_EXCEEDS_POSITION - - PREVIEW_ORDER_SIZE_EXCEEDS_BRACKETED_POSITION - - PREVIEW_INVALID_LIMIT_PRICE_PRECISION - - PREVIEW_INVALID_STOP_TRIGGER_PRICE_PRECISION - - PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_PRICE_EXCEEDS_MAX_DISTANCE_FROM_ORIGINATING_PRICE - - PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_SIZE_BELOW_MIN - - PREVIEW_ATTACHED_ORDER_SIZE_MUST_BE_NIL - - PREVIEW_BELOW_MIN_SIZE_FOR_DURATION - - PREVIEW_MAX_DAILY_VOLUME_NOTIONAL_BREACHED - - PREVIEW_INVALID_SETTLEMENT_CURRENCY - - PREVIEW_DURATION_TOO_SMALL - - PREVIEW_INTX_FOK_ONLY_ALLOWED_ON_LIMIT_AND_MARKET_ORDERS - - PREVIEW_BUCKET_SIZE_SMALLER_THAN_QUOTE_MIN - - PREVIEW_BUCKET_SIZE_SMALLER_THAN_BASE_MIN - - PREVIEW_END_TIME_AFTER_CONTRACT_EXPIRATION - - PREVIEW_START_TIME_MUST_BE_SPECIFIED - - PREVIEW_ICEBERG_ORDERS_NOT_SUPPORTED - - PREVIEW_END_TIME_IS_IN_THE_PAST - - PREVIEW_GTD_ORDERS_MUST_HAVE_END_TIME - - PREVIEW_ATTACHED_ORDER_MUST_HAVE_POSITIVE_PRICES - - PREVIEW_INVALID_ORDER_SIDE_FOR_ATTACHED_TPSL - - PREVIEW_ATTACHED_ORDERS_ONLY_ALLOWED_ON_MARKET_LIMIT - - PREVIEW_INVALID_ORDER_TYPE_FOR_ATTACHED - - PREVIEW_PRICE_NOT_ALLOWED_FOR_MARKET_ORDERS - - PREVIEW_REDUCE_ONLY_NOT_ALLOWED_ON_VENUE - - PREVIEW_NON_NUMERIC_ORDER_SIZE - - PREVIEW_INVALID_INTX_CLIENT_ORDER_ID - - PREVIEW_DURATION_TOO_LARGE - - PREVIEW_REDUCE_ONLY_NOT_ALLOWED_ON_SPOT_PRODUCTS - - PREVIEW_LIMIT_ORDER_PRICE_EXCEEDS_PRICE_BAND_ON_BUY - - PREVIEW_LIMIT_ORDER_PRICE_EXCEEDS_PRICE_BAND_ON_SELL - - PREVIEW_INVALID_ATTACHED_TAKE_PROFIT_PRICE_OUT_OF_BOUNDS_ON_AGGRESSIVE_ORDER - - PREVIEW_INVALID_ATTACHED_STOP_LOSS_PRICE_OUT_OF_BOUNDS_ON_AGGRESSIVE_ORDER - - PREVIEW_STOP_TRIGGERED - - PREVIEW_REPLACE_NOT_SUPPORTED - - PREVIEW_ORDER_IS_PENDING_CANCEL - - PREVIEW_POSITION_SIZE_INCREASE_REJECT - - PREVIEW_ASSET_BALANCE_INCREASE_REJECT - - PREVIEW_TOO_MANY_PENDING_REPLACES - - PREVIEW_INVALID_RFQ_BASE_SIZE_TOO_SMALL - - PREVIEW_INVALID_RFQ_BASE_SIZE_TOO_LARGE - - PREVIEW_INVALID_RFQ_QUOTE_SIZE_TOO_SMALL - - PREVIEW_INVALID_RFQ_QUOTE_SIZE_TOO_LARGE - - PREVIEW_REDUCE_ONLY_INCREASED_POSITION_SIZE - - PREVIEW_COMPLIANCE_PURCHASE_LIMIT_EXCEEDED - - PREVIEW_SCALED_PARAM_INFEASIBLE - - PREVIEW_SCALED_MIN_ORDER_VIOLATION - - PREVIEW_SCALED_MAX_ORDER_VIOLATION - - PREVIEW_POST_ONLY_NOT_ALLOWED_WITH_PEG - - PREVIEW_INVALID_PEG_OFFSET - - PREVIEW_INVALID_PEG_WIG_LEVEL - - PREVIEW_INVALID_PEG_VENUE_OPTIONS - - PREVIEW_PEG_INVALID_ORDER_TYPE - - PREVIEW_SINGLE_LEGGED_TPSL_NOT_ALLOWED - - PREVIEW_FRACTIONAL_ORDERS_NOT_ALLOWED_FOR_PRODUCT - - PREVIEW_QUOTE_ORDERS_NOT_ALLOWED_FOR_PRODUCT - - PREVIEW_NBBO_NOT_PROVIDED - - PREVIEW_INVALID_NBBO_BID_PRICE - - PREVIEW_INVALID_NBBO_ASK_PRICE - - PREVIEW_NOTIONAL_SIZE_BREACHES_FRACTIONAL_MINIMUM - - PREVIEW_MARKET_ORDERS_PROHIBITED_DURING_NON_CORE_SESSION - - PREVIEW_NOTIONAL_ORDERS_PROHIBITED_DURING_NON_CORE_SESSION - - PREVIEW_MAX_NOTIONAL_PER_ORDER_BREACHED_15C35_CHECK - - PREVIEW_MAX_SHARES_PER_ORDER_BREACHED_15C35_CHECK - - PREVIEW_INVALID_EQUITY_TRADING_SESSION - - PREVIEW_PRODUCT_TRADING_HALTED - - PREVIEW_TRADING_DISABLED - - PREVIEW_INVALID_BRACKET_LIMIT_PRICE_PRECISION - - PREVIEW_SCALED_PARAM_DISCREPANCY - - PREVIEW_STOP_LOSS_PRICE_TOO_LOW - - PREVIEW_PREDICTIONS_QUOTE_SIZE_BELOW_MIN_CONTRACT_PRICE - - PREVIEW_PREDICTIONS_HIGH_PRICE_CONTRACTS_BLOCKED - - PREVIEW_ATTACHED_STOP_LOSS_PRICE_TOO_LOW - - PREVIEW_BREACHED_RISK_LIMIT - - PREVIEW_STOP_LOSS_PRICE_TOO_HIGH - - PREVIEW_ATTACHED_STOP_LOSS_PRICE_TOO_HIGH - - PREVIEW_TAKE_PROFIT_PRICE_TOO_HIGH - - PREVIEW_ATTACHED_TAKE_PROFIT_PRICE_TOO_HIGH - - PREVIEW_TAKE_PROFIT_PRICE_TOO_LOW - - PREVIEW_ATTACHED_TAKE_PROFIT_PRICE_TOO_LOW - - PREVIEW_INVALID_UNSUPPORTED_INSTRUMENT - default: UNKNOWN_PREVIEW_FAILURE_REASON - coinbase.public_api.authed.retail_brokerage_api.PreviewWarningMsg: - type: string - enum: - - UNKNOWN - - BIG_ORDER - - SMALL_ORDER - - DURATION_EXTENDED_BY_MARKET_CLOSE - - OPEN_ORDERS_EXCEED_COMPLIANCE_PURCHASE_LIMIT_MAY_CANCEL - default: UNKNOWN - coinbase.public_api.authed.retail_brokerage_api.PriceBook: - type: object - properties: - product_id: - type: string - example: BTC-USD - description: The trading pair (e.g. 'BTC-USD'). - required: - - product_id - bids: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.L2Level' - required: - - bids - asks: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.L2Level' - required: - - asks - time: - type: string - format: RFC3339 Timestamp - required: - - product_id - - bids - - asks - coinbase.public_api.authed.retail_brokerage_api.Product: - type: object - properties: - product_id: - type: string - example: BTC-USD - description: The trading pair (e.g. 'BTC-USD'). - required: - - product_id - price: - type: string - example: '140.21' - description: The current price for the product, in quote currency. - required: - - price - price_percentage_change_24h: - type: string - example: 9.43% - description: The amount the price of the product has changed, in percent, - in the last 24 hours. - required: - - price_percentage_change_24h - volume_24h: - type: string - example: '1908432' - description: The trading volume for the product in the last 24 hours. - required: - - volume_24h - volume_percentage_change_24h: - type: string - example: 9.43% - description: The amount the volume of the product has changed, in percent, - in the last 24 hours. - required: - - volume_percentage_change_24h - base_increment: - type: string - example: '0.00000001' - description: Minimum amount base value can be increased or decreased at - once. - required: - - base_increment - quote_increment: - type: string - example: '0.00000001' - description: Minimum amount quote value can be increased or decreased at - once. - required: - - quote_increment - quote_min_size: - type: string - example: '0.00000001' - description: Minimum size that can be represented of quote currency. - required: - - quote_min_size - quote_max_size: - type: string - example: '1000' - description: Maximum size that can be represented of quote currency. - required: - - quote_max_size - base_min_size: - type: string - example: '0.00000001' - description: Minimum size that can be represented of base currency. - required: - - base_min_size - base_max_size: - type: string - example: '1000' - description: Maximum size that can be represented of base currency. - required: - - base_max_size - base_name: - type: string - example: Bitcoin - description: Name of the base currency. - required: - - base_name - quote_name: - type: string - example: US Dollar - description: Name of the quote currency. - required: - - quote_name - watched: - type: boolean - example: true - description: Whether or not the product is on the user's watchlist. - required: - - watched - is_disabled: - type: boolean - example: false - description: Whether or not the product is disabled for trading. - required: - - is_disabled - new: - type: boolean - example: true - description: Whether or not the product is 'new'. - required: - - new - status: - type: string - description: Status of the product. - required: - - status - cancel_only: - type: boolean - example: true - description: Whether or not orders of the product can only be cancelled, - not placed or edited. - required: - - cancel_only - limit_only: - type: boolean - example: true - description: Whether or not orders of the product can only be limit orders, - not market orders. - required: - - limit_only - post_only: - type: boolean - example: true - description: Whether or not orders of the product can only be posted, not - cancelled. - required: - - post_only - trading_disabled: - type: boolean - example: false - description: Whether or not the product is disabled for trading for all - market participants. - required: - - trading_disabled - auction_mode: - type: boolean - example: true - description: Whether or not the product is in auction mode. - required: - - auction_mode - product_type: - description: Type of the product. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ProductType' - quote_currency_id: - type: string - example: USD - description: Symbol of the quote currency. - base_currency_id: - type: string - example: BTC - description: Symbol of the base currency. - fcm_trading_session_details: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FcmTradingSessionDetails' - mid_market_price: - type: string - example: '140.22' - description: The current midpoint of the bid-ask spread, in quote currency. - alias: - type: string - example: BTC-USD - description: Product id for the corresponding unified book. - alias_to: - type: array - example: - - BTC-USDC - items: - type: string - description: Product ids that this product serves as an alias for. - base_display_symbol: - type: string - example: BTC - description: Symbol of the base display currency. - required: - - base_display_symbol - quote_display_symbol: - type: string - example: USD - description: Symbol of the quote display currency. - required: - - quote_display_symbol - view_only: - type: boolean - example: true - description: Reflects whether an FCM product has expired. For SPOT, set - get_tradability_status to get a return value here. Defaulted to false - for all other product types. - price_increment: - type: string - example: '0.00000001' - description: Minimum amount price can be increased or decreased at once. - display_name: - type: string - example: BTC PERP - description: Display name for the product e.g. BTC-PERP-INTX => BTC PERP - product_venue: - example: neptune - description: The sole venue id for the product. Defaults to CBE if the product - is not specific to a single venue - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ProductVenue' - approximate_quote_24h_volume: - type: string - example: '1908432' - description: The approximate trading volume for the product in the last - 24 hours based on the current quote. - new_at: - type: string - format: RFC3339 Timestamp - example: '2021-07-01T00:00:00Z' - description: The timestamp when the product was listed. This is only populated - if product has new tag. - market_cap: - type: string - example: '1500000000000' - description: The market capitalization of the product's base asset. - icon_color: - type: string - example: red - description: color for icon display - icon_url: - type: string - example: https://example.com - description: A URL to the icon image. - display_name_overwrite: - type: string - example: Bitcoin Perpetual - description: An alternative name to display for the product. - about_description: - type: string - example: nano Crude Oil Futures is a monthly cash-settled contract that - allows participants to manage risk, trade on margin, or speculate on the - price of oil. - description: description used in about section for an asset - best_bid_price: - type: string - best_ask_price: - type: string - high_24h: - type: string - low_24h: - type: string - future_product_details: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.FutureProductDetails' - equity_product_details: - description: Equity-specific identity, trading availability, session, and - sizing details. Populated when product_type is EQUITY. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityProductDetails' - title: Get Products - required: - - product_id - - price - - volume_24h - - price_percentage_change_24h - - volume_percentage_change_24h - - base_increment - - quote_increment - - quote_min_size - - quote_max_size - - base_min_size - - base_max_size - - base_name - - quote_name - - watched - - is_disabled - - new - - status - - cancel_only - - limit_only - - post_only - - trading_disabled - - auction_mode - - base_display_symbol - - quote_display_symbol - coinbase.public_api.authed.retail_brokerage_api.ProductDetails: - type: object - properties: - equity_details: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityOrderProductDetails' - title: 'Product details, where the oneof corresponds to the ProductType - - Currently skipping FutureProductDetails as it''s not used' - coinbase.public_api.authed.retail_brokerage_api.ProductType: - type: string - enum: - - UNKNOWN_PRODUCT_TYPE - - SPOT - - FUTURE - - EQUITY - - OPTION_GROUP - - FUTURE_GROUP - default: UNKNOWN_PRODUCT_TYPE - description: Defines the type of a product. - coinbase.public_api.authed.retail_brokerage_api.ProductVenue: - type: string - enum: - - UNKNOWN_VENUE_TYPE - - CBE - - FCM - - INTX - default: UNKNOWN_VENUE_TYPE - description: Defines the venue of a product. - coinbase.public_api.authed.retail_brokerage_api.Products: - type: object - properties: - products: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.Product' - description: Array of objects, each representing one product. - num_products: - type: integer - format: int32 - example: 100 - description: Number of products that were returned. - pagination: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PaginationMetadata' - coinbase.public_api.authed.retail_brokerage_api.RejectReason: - type: string - enum: - - REJECT_REASON_UNSPECIFIED - - HOLD_FAILURE - - TOO_MANY_OPEN_ORDERS - - REJECT_REASON_INSUFFICIENT_FUNDS - - RATE_LIMIT_EXCEEDED - default: REJECT_REASON_UNSPECIFIED - coinbase.public_api.authed.retail_brokerage_api.RiskManagementType: - type: string - enum: - - UNKNOWN_RISK_MANAGEMENT_TYPE - - MANAGED_BY_FCM - - MANAGED_BY_VENUE - default: UNKNOWN_RISK_MANAGEMENT_TYPE - description: Defines Risk management type. - coinbase.public_api.authed.retail_brokerage_api.ScaledLimitGtc: - type: object - properties: - orders: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.LimitLimitGtc' - quote_size: - type: string - base_size: - type: string - num_orders: - type: integer - format: int32 - min_price: - type: string - title: infer the start / end price of the scaled orders based on the min - / max price + distribution - max_price: - type: string - price_distribution: - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ScaledPriceDistribution' - size_distribution: - description: 'Size distribution across the child orders. ' - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ScaledSizeDistribution' - size_diff: - type: string - size_ratio: - type: string - title: scaled limit order allows user to specify the order size and price on - the child - coinbase.public_api.authed.retail_brokerage_api.ScaledOrderDistribution: - type: object - properties: - size: - type: string - price: - type: string - errs: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewFailureReason' - warning: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.PreviewWarningMsg' - title: represents size / price of a scaled order in core proto - coinbase.public_api.authed.retail_brokerage_api.ScaledOrderMetadata: - type: object - properties: - scaled_order_distribution: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.ScaledOrderDistribution' - title: a list of scaled order distributions - coinbase.public_api.authed.retail_brokerage_api.ScaledPriceDistribution: - type: string - enum: - - FLAT - - LINEAR_INCREASING - - LINEAR_DECREASING - - CUSTOM_PRICE_DISTRIBUTION - default: FLAT - title: Defines the distribution of prices for scaled orders - coinbase.public_api.authed.retail_brokerage_api.ScaledSizeDistribution: - type: string - enum: - - UNKNOWN_DISTRIBUTION - - INCREASING - - DECREASING - - EVENLY_SPLIT - - CUSTOM_SIZE_DISTRIBUTION - default: UNKNOWN_DISTRIBUTION - title: Defines the distribution of sizes for scaled orders - coinbase.public_api.authed.retail_brokerage_api.SorLimitIoc: - type: object - properties: - quote_size: - type: string - example: '10.00' - description: The amount of the second Asset in the Trading Pair. For example, - on the BTC/USD Order Book, USD is the Quote Asset. - base_size: - type: string - example: '0.001' - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - limit_price: - type: string - example: '10000.00' - description: The specified price, or better, that the Order should be executed - at. A Buy Order will execute at or lower than the limit price. A Sell - Order will execute at or higher than the limit price. - coinbase.public_api.authed.retail_brokerage_api.SorPreference: - type: string - enum: - - SOR_PREFERENCE_UNSPECIFIED - - SOR_ENABLED - - SOR_DISABLED - default: SOR_PREFERENCE_UNSPECIFIED - title: Defines the Smart Order Routing (SOR) preferences for an order - coinbase.public_api.authed.retail_brokerage_api.StopLimitStopLimitGtc: - type: object - properties: - base_size: - type: string - example: '0.001' - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - limit_price: - type: string - example: '10000.00' - description: The specified price, or better, that the Order should be executed - at. A Buy Order will execute at or lower than the limit price. A Sell - Order will execute at or higher than the limit price. - stop_price: - type: string - example: '20000.00' - description: The specified price that will trigger the placement of the - Order. - stop_direction: - example: '20000.00' - description: The direction of the stop limit Order. If Up, then the Order - will trigger when the last trade price goes above the stop_price. If Down, - then the Order will trigger when the last trade price goes below the stop_price. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.StopPriceDirection' - coinbase.public_api.authed.retail_brokerage_api.StopLimitStopLimitGtd: - type: object - properties: - base_size: - type: string - example: 0.001 - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - limit_price: - type: string - example: '10000.00' - description: The specified price, or better, that the Order should be executed - at. A Buy Order will execute at or lower than the limit price. A Sell - Order will execute at or higher than the limit price. - stop_price: - type: string - example: '20000.00' - description: The specified price that will trigger the placement of the - Order. - end_time: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: The time at which the order will be cancelled if it is not - Filled. - stop_direction: - example: '20000.00' - description: The direction of the stop limit Order. If Up, then the Order - will trigger when the last trade price goes above the stop_price. If Down, - then the Order will trigger when the last trade price goes below the stop_price. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.StopPriceDirection' - coinbase.public_api.authed.retail_brokerage_api.StopPriceDirection: - type: string - enum: - - STOP_DIRECTION_STOP_UP - - STOP_DIRECTION_STOP_DOWN - default: '' - title: "- STOP_DIRECTION_STOP_UP: Order will trigger if the last trade price\ - \ goes above the stop price\n - STOP_DIRECTION_STOP_DOWN: Order will trigger\ - \ if the last trade price goes below the stop price" - coinbase.public_api.authed.retail_brokerage_api.StopTriggerStatus: - type: string - enum: - - UNKNOWN_TRIGGER_STATUS - - INVALID_ORDER_TYPE - - STOP_PENDING - - STOP_TRIGGERED - default: UNKNOWN_TRIGGER_STATUS - coinbase.public_api.authed.retail_brokerage_api.TickSizeStep: - type: object - properties: - above_price: - type: string - description: The price from which the increased tick size applies. - tick_size: - type: string - description: The tick size to use above above_price. - description: 'A piecewise tick-size override that applies above a given price - threshold, - - for instruments whose tick size grows with price (Deribit tick_size_steps).' - coinbase.public_api.authed.retail_brokerage_api.TimeInForceType: - type: string - enum: - - UNKNOWN_TIME_IN_FORCE - - GOOD_UNTIL_DATE_TIME - - GOOD_UNTIL_CANCELLED - - IMMEDIATE_OR_CANCEL - - FILL_OR_KILL - default: UNKNOWN_TIME_IN_FORCE - description: " - GOOD_UNTIL_DATE_TIME: GTD\n - GOOD_UNTIL_CANCELLED: GTC: on\ - \ the books virtually forever\n - IMMEDIATE_OR_CANCEL: IOC: fill what you\ - \ can now, cancel the rest\n - FILL_OR_KILL: FOK: all or nothing, right now" - coinbase.public_api.authed.retail_brokerage_api.TradingDayData: - type: object - properties: - trading_days: - type: array - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.EquityTradingDayInfo' - title: TradingDayData provides recent historical trading day information for - downstream services to calculate timezone-aware price changes - coinbase.public_api.authed.retail_brokerage_api.TradingHoursType: - type: string - enum: - - TRADING_HOURS_TYPE_UNSPECIFIED - - TRADING_HOURS_TYPE_EQUITY_INDEX - default: TRADING_HOURS_TYPE_UNSPECIFIED - description: Trading hours schedule a futures product follows. - coinbase.public_api.authed.retail_brokerage_api.TriggerBracketGtc: - type: object - properties: - base_size: - type: string - example: 0.001 - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - limit_price: - type: string - example: '10000.00' - description: The specified price, or better, that the Order should be executed - at. A Buy Order will execute at or lower than the limit price. A Sell - Order will execute at or higher than the limit price. - stop_trigger_price: - type: string - example: '20000.00' - description: The price level (in quote currency) where the position will - be exited. When triggered, a stop limit order is automatically placed - with a limit price 5% higher for BUYS and 5% lower for SELLS. - coinbase.public_api.authed.retail_brokerage_api.TriggerBracketGtd: - type: object - properties: - base_size: - type: string - example: 0.001 - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - limit_price: - type: string - example: '10000.00' - description: The specified price, or better, that the Order should be executed - at. A Buy Order will execute at or lower than the limit price. A Sell - Order will execute at or higher than the limit price. - stop_trigger_price: - type: string - example: '20000.00' - description: The price level (in quote currency) where the position will - be exited. When triggered, a stop limit order is automatically placed - with a limit price 5% higher for BUYS and 5% lower for SELLS. - end_time: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: The time at which the order will be cancelled if it is not - Filled. - coinbase.public_api.authed.retail_brokerage_api.TriggerBracketPnl: - type: object - properties: - take_profit_pnl: - type: string - description: PNL if an attached order fills at the take profit price. - stop_loss_pnl: - type: string - description: PNL if an attached order fills at the stop loss price - title: PNL Configurations - coinbase.public_api.authed.retail_brokerage_api.TwapBucketMetadata: - type: object - properties: - bucket_duration: - type: string - bucket_size: - type: string - number_buckets: - type: string - start_time: - type: string - format: RFC3339 Timestamp - end_time: - type: string - format: RFC3339 Timestamp - title: Twap bucket metadata - size/duration of each suborder into which twap - is broken into - coinbase.public_api.authed.retail_brokerage_api.TwapLimitGtd: - type: object - properties: - quote_size: - type: string - example: '10.00' - description: The amount of the second Asset in the Trading Pair. For example, - on the BTC/USD Order Book, USD is the Quote Asset. - base_size: - type: string - example: '0.001' - description: The amount of the first Asset in the Trading Pair. For example, - on the BTC-USD Order Book, BTC is the Base Asset. - start_time: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T07:59:59Z' - description: Time at which the order should begin executing. - end_time: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: The time at which the order will be cancelled if it is not - Filled. - limit_price: - type: string - example: '10000.00' - description: The specified price, or better, that the Order should be executed - at. A Buy Order will execute at or lower than the limit price. A Sell - Order will execute at or higher than the limit price. - number_buckets: - type: string - example: '5' - description: The number of smaller buckets/suborders over which the entire - order will be broken into. Each suborder will be executed over a duration - calculated based on the end_time - bucket_size: - type: string - example: '2.00' - description: The size of each suborder. bucket_size multiplied by number_buckets - should match the size of the entire twap order) - bucket_duration: - type: string - example: 300s - description: The duration over which each sub order was executed - coinbase.public_api.authed.retail_brokerage_api.Volume: - type: object - properties: - volume_type: - example: VOLUME_TYPE_SPOT - description: Type of volume contributing to fee tier calculation. - allOf: - - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.VolumeType' - volume: - type: number - format: double - example: 1000 - description: Volume amount. - coinbase.public_api.authed.retail_brokerage_api.VolumeType: - type: string - enum: - - VOLUME_TYPE_UNKNOWN - - VOLUME_TYPE_SPOT - - VOLUME_TYPE_INTX_PERPS - - VOLUME_TYPE_US_DERIVATIVES - - VOLUME_TYPE_SIMPLE_SPOT - - VOLUME_TYPE_SIMPLE_FCM - - VOLUME_TYPE_SIMPLE_INTX_PERPS - - VOLUME_TYPE_EQUITY - - VOLUME_TYPE_OPTIONS - - VOLUME_TYPE_DATED_FUTURES - default: VOLUME_TYPE_UNKNOWN - title: "- VOLUME_TYPE_UNKNOWN: Unknown or unspecified volume type\n - VOLUME_TYPE_SPOT:\ - \ Spot trading volume\n - VOLUME_TYPE_INTX_PERPS: International exchange perpetual\ - \ contracts volume\n - VOLUME_TYPE_US_DERIVATIVES: US derivatives (futures)\ - \ trading volume\n - VOLUME_TYPE_SIMPLE_SPOT: Simple (RETAIL_SIMPLE) spot\ - \ trading volume\n - VOLUME_TYPE_SIMPLE_FCM: Simple (RETAIL_SIMPLE) FCM expiring\ - \ futures trading volume\n - VOLUME_TYPE_SIMPLE_INTX_PERPS: Simple (RETAIL_SIMPLE)\ - \ INTX perpetual futures trading volume\n - VOLUME_TYPE_EQUITY: Equity trading\ - \ volume (stocks/ETFs tracked independently from crypto spot)\n - VOLUME_TYPE_OPTIONS:\ - \ Derivatives options trading volume\n - VOLUME_TYPE_DATED_FUTURES: Dated\ - \ futures trading volume" - coinbase.public_api.authed.retail_brokerage_api.VolumeTypesAndRange: - type: object - properties: - volume_types: - type: array - example: - - VOLUME_TYPE_SPOT - - VOLUME_TYPE_US_DERIVATIVES - items: - $ref: '#/components/schemas/coinbase.public_api.authed.retail_brokerage_api.VolumeType' - description: Volume types to combine to contribute to this fee tier calculation. - vol_from: - type: string - example: '0' - description: Lower bound (inclusive) for the combined volume. - vol_to: - type: string - example: '50000' - description: Upper bound (exclusive) for the combined volume . - title: VolumeTypesAndRange defines volume-based fee tier configurations that - combine multiple volume types - coinbase.retail.rest.proxy.common.ExtendedTimestamp: - type: object - properties: - iso: - type: string - description: An ISO-8601 representation of the timestamp - epochSeconds: - type: string - format: int64 - description: A second-precision representation of the timestamp - epochMillis: - type: string - format: int64 - description: A millisecond-precision representation of the timestamp - coinbase.retail.rest.proxy.convert.CommitConvertTradeRequest: - type: object - properties: - from_account: - type: string - description: The currency of the account to convert from (e.g. USD). - to_account: - type: string - description: The currency of the account to convert to (e.g. USDC). - coinbase.retail.rest.proxy.convert.CommitConvertTradeResponse: - type: object - properties: - trade: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.RatConvertTrade' - coinbase.retail.rest.proxy.convert.CreateConvertQuoteRequest: - type: object - properties: - from_account: - type: string - description: The currency of the account to convert from (e.g. USD). - to_account: - type: string - description: The currency of the account to convert to (e.g. USDC). - amount: - type: string - description: The amount to be converted (denominated in the currency specified - in `from_account`). - trade_incentive_metadata: - description: Trade incentive to waive trade fees. - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.TradeIncentiveMetadata' - title: '' - coinbase.retail.rest.proxy.convert.CreateConvertQuoteResponse: - type: object - properties: - trade: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.RatConvertTrade' - coinbase.retail.rest.proxy.convert.GetConvertTradeResponse: - type: object - properties: - trade: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.convert.RatConvertTrade' - coinbase.retail.rest.proxy.convert.RatConvertTrade: - type: object - properties: - id: - type: string - description: The trade ID used to get and commit the trade. - status: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.TradeStatus' - user_entered_amount: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - amount: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - subtotal: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - total: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - fees: - type: array - items: - $ref: '#/components/schemas/coinbase.simple_trade.models.Fee' - description: List of fees associated with the trade - total_fee: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.Fee' - source: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PaymentMethod' - target: - allOf: - - $ref: '#/components/schemas/coinbase.payments.common.payment_methods.PaymentMethod' - unit_price: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.UnitPrice' - user_warnings: - type: array - items: - $ref: '#/components/schemas/coinbase.simple_trade.models.UserWarning' - user_reference: - type: string - source_currency: - type: string - description: The currency of the source account - target_currency: - type: string - description: The currency of the target account - cancellation_reason: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.Error' - source_id: - type: string - target_id: - type: string - subscription_info: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.SubscriptionInfo' - exchange_rate: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - tax_details: - type: array - items: - $ref: '#/components/schemas/coinbase.simple_trade.TaxInfo' - trade_incentive_info: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.TradeIncentiveInfo' - total_fee_without_tax: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.Fee' - fiat_denoted_total: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - title: '' - coinbase.retail.rest.proxy.fcm.CancelFCMSweepResponse: - type: object - properties: - success: - type: boolean - coinbase.retail.rest.proxy.fcm.FCMBalanceSummary: - type: object - properties: - futures_buying_power: - description: The amount of your cash balance that is available to trade - CFM futures - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - total_usd_balance: - description: Aggregate USD maintained across your CFTC-regulated futures - account and your Coinbase Inc. spot account - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - cbi_usd_balance: - description: USD maintained in your Coinbase Inc. spot account - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - cfm_usd_balance: - description: USD maintained in your CFTC-regulated futures account. Funds - held in your futures account are not available to trade spot - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - total_open_orders_hold_amount: - description: Your total balance on hold for spot and futures open orders - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - unrealized_pnl: - description: Your current unrealized PnL across all open positions - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - daily_realized_pnl: - description: Your realized PnL from the current trade date. May include - profit or loss from positions you've closed on the current trade date - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - initial_margin: - description: Margin required to initiate futures positions. Once futures - orders are placed, these funds cannot be used to trade spot. The actual - amount of funds necessary to support executed futures orders will be moved - to your futures account - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - available_margin: - description: Funds available to meet your anticipated margin requirement. - This includes your CBI spot USD, CFM futures USD, and Futures PnL, less - any holds for open spot or futures orders - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - liquidation_threshold: - description: When your available funds for collateral drop to the liquidation - threshold, some or all of your futures positions will be liquidated - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - liquidation_buffer_amount: - description: Funds available in excess of the liquidation threshold, calculated - as available margin minus liquidation threshold. If your liquidation buffer - amount reaches 0, your futures positions and/or open orders will be liquidated - as necessary - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - liquidation_buffer_percentage: - type: string - description: Funds available in excess of the liquidation threshold expressed - as a percentage. If your liquidation buffer percentage reaches 0%, your - futures positions and/or open orders will be liquidated as necessary - intraday_margin_window_measure: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.FcmMarginWindowMeasure' - overnight_margin_window_measure: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.FcmMarginWindowMeasure' - total_pending_transfers_amount: - description: Total value of pending transfers - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - funding_pnl: - description: Portfolio funding PnL (only for US Perpetuals Futures) - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - coinbase.retail.rest.proxy.fcm.FCMPosition: - type: object - properties: - product_id: - type: string - description: The ticker symbol (e.g. 'BIT-28JUL23-CDE'). - expiration_time: - type: string - format: RFC3339 Timestamp - description: The expiry of your position - side: - description: The side of your position - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.FCMPositionSide' - number_of_contracts: - type: string - description: The size of your position in contracts - current_price: - type: string - description: The current price of the product - avg_entry_price: - type: string - description: The average entry price at which you entered your current position - unrealized_pnl: - type: string - description: Your current unrealized PnL for your position - daily_realized_pnl: - type: string - description: Your realized PnL from your trades in this product on current - trade date - coinbase.retail.rest.proxy.fcm.FCMPositionSide: - type: string - enum: - - UNKNOWN - - LONG - - SHORT - default: UNKNOWN - coinbase.retail.rest.proxy.fcm.FCMSweep: - type: object - properties: - id: - type: string - description: The ID of the sweep request scheduled - requested_amount: - description: The requested sweep amount - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - should_sweep_all: - type: boolean - description: True if the request was to sweep all available funds from your - CFM futures account - status: - description: A pending sweep is a sweep that has not started processing - and can be cancelled. A processing sweep is a sweep that is currently - being processed and cannot be cancelled - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.FCMSweepStatus' - scheduled_time: - type: string - format: RFC3339 Timestamp - description: The timestamp at which the sweep request was submitted - coinbase.retail.rest.proxy.fcm.FCMSweepStatus: - type: string - enum: - - UNKNOWN_FCM_SWEEP_STATUS - - PENDING - - PROCESSING - default: UNKNOWN_FCM_SWEEP_STATUS - coinbase.retail.rest.proxy.fcm.FcmMarginWindowMeasure: - type: object - properties: - margin_window_type: - description: Your margin window - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.FcmMarginWindowType' - margin_level: - description: Margin level for liquidation purposes - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.MarginLevelType' - initial_margin: - type: string - description: Initial margin - maintenance_margin: - type: string - description: Maintenance margin - liquidation_buffer: - type: string - description: Liquidation buffer - total_hold: - type: string - description: Total Hold - futures_buying_power: - type: string - description: The amount of your cash balance that is available to trade - CFM futures - coinbase.retail.rest.proxy.fcm.FcmMarginWindowType: - type: string - enum: - - FCM_MARGIN_WINDOW_TYPE_UNSPECIFIED - - FCM_MARGIN_WINDOW_TYPE_OVERNIGHT - - FCM_MARGIN_WINDOW_TYPE_WEEKEND - - FCM_MARGIN_WINDOW_TYPE_INTRADAY - - FCM_MARGIN_WINDOW_TYPE_TRANSITION - default: FCM_MARGIN_WINDOW_TYPE_UNSPECIFIED - coinbase.retail.rest.proxy.fcm.GetCurrentMarginWindowResponse: - type: object - properties: - margin_window: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.MarginWindow' - is_intraday_margin_killswitch_enabled: - type: boolean - description: True if intraday margin killswitch is enabled - is_intraday_margin_enrollment_killswitch_enabled: - type: boolean - description: True if intraday margin enrollment killswitch is enabled - title: GetCurrentMarginWindowResponse - coinbase.retail.rest.proxy.fcm.GetFCMBalanceSummaryResponse: - type: object - properties: - balance_summary: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.FCMBalanceSummary' - coinbase.retail.rest.proxy.fcm.GetFCMPositionResponse: - type: object - properties: - position: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.FCMPosition' - coinbase.retail.rest.proxy.fcm.GetFCMPositionsResponse: - type: object - properties: - positions: - type: array - items: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.FCMPosition' - coinbase.retail.rest.proxy.fcm.GetFCMSweepsResponse: - type: object - properties: - sweeps: - type: array - items: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.FCMSweep' - coinbase.retail.rest.proxy.fcm.GetIntradayMarginSettingResponse: - type: object - properties: - setting: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.IntradayMarginSetting' - title: GetIntradayMarginSettingResponse - coinbase.retail.rest.proxy.fcm.IntradayMarginSetting: - type: string - enum: - - INTRADAY_MARGIN_SETTING_UNSPECIFIED - - INTRADAY_MARGIN_SETTING_STANDARD - - INTRADAY_MARGIN_SETTING_INTRADAY - default: INTRADAY_MARGIN_SETTING_UNSPECIFIED - title: '' - coinbase.retail.rest.proxy.fcm.MarginLevelType: - type: string - enum: - - MARGIN_LEVEL_TYPE_UNSPECIFIED - - MARGIN_LEVEL_TYPE_BASE - - MARGIN_LEVEL_TYPE_WARNING - - MARGIN_LEVEL_TYPE_DANGER - - MARGIN_LEVEL_TYPE_LIQUIDATION - default: MARGIN_LEVEL_TYPE_UNSPECIFIED - title: margin level for liquidation purposes - coinbase.retail.rest.proxy.fcm.MarginWindow: - type: object - properties: - margin_window_type: - description: Your margin window - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.MarginWindowType' - end_time: - type: string - format: RFC3339 Timestamp - description: The end time of the margin window - coinbase.retail.rest.proxy.fcm.MarginWindowType: - type: string - enum: - - MARGIN_WINDOW_TYPE_UNSPECIFIED - - MARGIN_WINDOW_TYPE_OVERNIGHT - - MARGIN_WINDOW_TYPE_WEEKEND - - MARGIN_WINDOW_TYPE_INTRADAY - - MARGIN_WINDOW_TYPE_TRANSITION - default: MARGIN_WINDOW_TYPE_UNSPECIFIED - title: '' - coinbase.retail.rest.proxy.fcm.ScheduleFCMSweepRequest: - type: object - properties: - usd_amount: - type: string - description: The amount of USD to be swept. By default, sweeps all available - excess funds. - title: '' - coinbase.retail.rest.proxy.fcm.ScheduleFCMSweepResponse: - type: object - properties: - success: - type: boolean - coinbase.retail.rest.proxy.fcm.SetIntradayMarginSettingRequest: - type: object - properties: - setting: - description: The margin setting for the account. Describes whether the account - is opted in to receive increased leverage during weekdays (8am-4pm ET), - excluding [market holidays](https://www.coinbase.com/derivatives/market-notices). - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.fcm.IntradayMarginSetting' - title: SetIntradayMarginSettingRequest - coinbase.retail.rest.proxy.fcm.SetIntradayMarginSettingResponse: - type: object - title: SetIntradayMarginSettingResponse - coinbase.retail.rest.proxy.intx.AllocatePortfolioRequest: - type: object - properties: - portfolio_uuid: - type: string - description: The portfolio UUID. - symbol: - type: string - description: The trading pair (e.g. 'BTC-PERP-INTX'). - amount: - type: string - description: The amount to be allocated for the specified isolated position. - currency: - type: string - description: The currency to be allocated for the specific isolated position - (e.g. USD, BTC, etc). - coinbase.retail.rest.proxy.intx.AllocatePortfolioResponse: - type: object - coinbase.retail.rest.proxy.intx.Amount: - type: object - properties: - value: - type: string - description: Value of the Amount - currency: - type: string - description: The currency to be allocated for the specific isolated position - (e.g. USD, BTC, etc). - title: Message that represents the monetary amount. - coinbase.retail.rest.proxy.intx.GetPortfoliosResponse: - type: object - properties: - portfolios: - type: array - items: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Portfolio' - summary: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.PortfoliosSummary' - coinbase.retail.rest.proxy.intx.GetPositionResponse: - type: object - properties: - position: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Position' - coinbase.retail.rest.proxy.intx.GetPositionsResponse: - type: object - properties: - positions: - type: array - items: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Position' - summary: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.PositionSummary' - coinbase.retail.rest.proxy.intx.MultiAssetCollateralRequest: - type: object - properties: - portfolio_uuid: - type: string - description: The portfolio UUID. - multi_asset_collateral_enabled: - type: boolean - description: Enable or disable Multi Asset Collateral. - title: Multi Asset Collateral - coinbase.retail.rest.proxy.intx.MultiAssetCollateralResponse: - type: object - properties: - multi_asset_collateral_enabled: - type: boolean - coinbase.retail.rest.proxy.intx.Portfolio: - type: object - properties: - portfolio_uuid: - type: string - description: The portfolio UUID. - collateral: - type: string - description: The total collateral value in USDC for the portfolio - position_notional: - type: string - description: The total position notional value in USDC for all positions - in the portfolio - open_position_notional: - type: string - description: The total position notional value in USDC for all open orders - and positions - pending_fees: - type: string - description: The accrued fees that has not been paid yet in USDC - borrow: - type: string - description: Total borrow amount in USDC (nets the USDC balance, position - PNL, held USDC, accured interest and rolling debt) - accrued_interest: - type: string - description: Interest charged for borrowed USDC balances - rolling_debt: - type: string - description: Amount of settled transactions that hasn't been paid - portfolio_initial_margin: - type: string - description: The weighted average of all the position's initial margin utilization - portfolio_im_notional: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - portfolio_maintenance_margin: - type: string - description: The maintenance margin of the portfolio - portfolio_mm_notional: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - liquidation_percentage: - type: string - description: The liquidation percentage of the portfolio - liquidation_buffer: - type: string - description: The liquidation buffer of the portfolio - margin_type: - allOf: - - $ref: '#/components/schemas/coinbase.intx_common.PortfolioMarginType' - margin_flags: - allOf: - - $ref: '#/components/schemas/coinbase.intx_common.PortfolioMarginFlags' - liquidation_status: - allOf: - - $ref: '#/components/schemas/coinbase.intx_common.PortfolioLiquidationStatus' - unrealized_pnl: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - total_balance: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - coinbase.retail.rest.proxy.intx.PortfoliosSummary: - type: object - properties: - unrealized_pnl: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - buying_power: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - total_balance: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - max_withdrawal_amount: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - coinbase.retail.rest.proxy.intx.Position: - type: object - properties: - product_id: - type: string - description: The unique identifier of the instrument the position is in. - product_uuid: - type: string - description: The unique identifier of the instrument the position is in. - portfolio_uuid: - type: string - description: The portfolio UUID. - symbol: - type: string - description: The trading pair (e.g. 'BTC-PERP-INTX'). - vwap: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - entry_vwap: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - position_side: - allOf: - - $ref: '#/components/schemas/coinbase.intx_common.PositionSide' - margin_type: - allOf: - - $ref: '#/components/schemas/coinbase.intx_common.PortfolioMarginType' - net_size: - type: string - description: The size of the position with positive values reflecting a - long position and negative values reflecting a short position. - buy_order_size: - type: string - description: Cumulative size of all the open buy orders - sell_order_size: - type: string - description: Cumulative size of all the open sell orders - im_contribution: - type: string - description: The amount this position contributes to the initial margin - unrealized_pnl: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - mark_price: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - liquidation_price: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - leverage: - type: string - description: The leverage of this position - im_notional: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - mm_notional: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - position_notional: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - aggregated_pnl: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - coinbase.retail.rest.proxy.intx.PositionSummary: - type: object - properties: - aggregated_pnl: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.intx.Amount' - coinbase.retail.rest.proxy.payment_method.GetPaymentMethodResponse: - type: object - properties: - payment_method: - allOf: - - $ref: '#/components/schemas/coinbase.retail.rest.proxy.payment_method.PaymentMethod' - coinbase.retail.rest.proxy.payment_method.GetPaymentMethodsResponse: - type: object - properties: - payment_methods: - type: array - items: - $ref: '#/components/schemas/coinbase.retail.rest.proxy.payment_method.PaymentMethod' - coinbase.retail.rest.proxy.payment_method.PaymentMethod: - type: object - properties: - id: - type: string - example: 8bfc20d7-f7c6-4422-bf07-8243ca4169fe - description: Unique identifier for the payment method. - type: - type: string - example: ACH - description: The payment method type. - name: - type: string - example: ALLY BANK ******1234 - description: Name for the payment method. - currency: - type: string - example: USD - description: Currency symbol for the payment method. - verified: - type: boolean - example: true - description: The verified status of the payment method. - allow_buy: - type: boolean - example: true - description: Whether or not this payment method can perform buys. - allow_sell: - type: boolean - example: true - description: Whether or not this payment method can perform sells. - allow_deposit: - type: boolean - example: true - description: Whether or not this payment method can perform deposits. - allow_withdraw: - type: boolean - example: true - description: Whether or not this payment method can perform withdrawals. - created_at: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: Time at which this payment method was created. - updated_at: - type: string - format: RFC3339 Timestamp - example: '2021-05-31T09:59:59Z' - description: Time at which this payment method was updated. - coinbase.retail.rest.proxy.utility.GetApiKeyPermissionsResponse: - type: object - properties: - can_view: - type: boolean - description: Indicates whether the API key has view permissions. - can_trade: - type: boolean - description: Indicates whether the API key has trade permissions. - can_transfer: - type: boolean - description: Indicates whether the API key has deposit/withdrawal permissions. - portfolio_uuid: - type: string - description: The portfolio ID associated with the API key. - portfolio_type: - description: The type of portfolio - allOf: - - $ref: '#/components/schemas/coinbase.portfolio_service.PortfolioType' - coinbase.simple_trade.SubscriptionInfo: - type: object - properties: - free_trading_reset_date: - type: string - format: RFC3339 Timestamp - used_zero_fee_trading: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - remaining_free_trading_volume: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - max_free_trading_volume: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - has_benefit_cap: - type: boolean - applied_subscription_benefit: - type: boolean - fee_without_subscription_benefit: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - payment_method_fee_without_subscription_benefit: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - title: SubscriptionInfo is the user's coinbase one subscription info for the - trade - coinbase.simple_trade.TaxInfo: - type: object - properties: - name: - type: string - amount: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - title: TaxInfo contains all the information of any tax which is applicable for - a trade - coinbase.simple_trade.TradeIncentiveInfo: - type: object - properties: - applied_incentive: - type: boolean - user_incentive_id: - type: string - code_val: - type: string - ends_at: - type: string - format: RFC3339 Timestamp - fee_without_incentive: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - redeemed: - type: boolean - title: TradeIncentiveInfo contains the user's simple trade incentive info for - the trade - coinbase.simple_trade.TradeIncentiveMetadata: - type: object - properties: - user_incentive_id: - type: string - description: The user incentive id. - code_val: - type: string - description: A promo code for waiving fees. - title: TradeIncentiveMetadata - coinbase.simple_trade.TradeStatus: - type: string - enum: - - TRADE_STATUS_UNSPECIFIED - - TRADE_STATUS_CREATED - - TRADE_STATUS_STARTED - - TRADE_STATUS_COMPLETED - - TRADE_STATUS_CANCELED - default: TRADE_STATUS_UNSPECIFIED - title: TradeStatus - coinbase.simple_trade.models.Disclosure: - type: object - properties: - title: - type: string - description: - type: string - link: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Link' - title: Disclosure represents a localized disclosure for a fee - coinbase.simple_trade.models.Error: - type: object - properties: - message: - type: string - code: - type: string - error_code: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.ErrorCodes' - error_cta: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.ErrorCta' - error_metadata: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.ErrorMetadata' - title: - type: string - description: these are errors which prevent us from creating trades. Ie, BlackListed - card - title: 'Error is a generic message/code response used for cancellation reasons. - - These include a CTA' - coinbase.simple_trade.models.ErrorCodes: - type: string - enum: - - ERROR_CODES_UNSPECIFIED - - ERROR_CODES_AUTHENTICATION_ERROR - - ERROR_CODES_PERMISSION_DENIED - - ERROR_CODES_NOT_FOUND - - ERROR_CODES_INTERNAL_SERVER_ERROR - - ERROR_CODES_SERVICE_UNAVAILABLE - - ERROR_CODES_INVALID - - ERROR_CODES_REJECTED - - ERROR_CODES_LIMIT_ERROR - - ERROR_CODES_LIMIT_ERROR_INCREASE_ELIGIBLE - - HIGH_RISK_SCORE_CANCELED - - ERROR_CODES_DEPOSIT_CHECK_QUESTIONNAIRE_REQUIRED - - ERROR_CODES_DEPOSIT_CHECK_FACEMATCH_REQUIRED - - ERROR_CODES_DEPOSIT_CHECK_FACEMATCH_AND_QUESTIONNAIRE_REQUIRED - - ERROR_CODES_INSUFFICIENT_BALANCE - - ERROR_CODES_RATE_LIMITED - - ERROR_CODES_ADDRESS_MISMATCH - - ERROR_CODES_TRANSACTION_NOT_ALLOWED - - DEPOSIT_NOT_AUTHORIZED - - PLAID_INSUFFICIENT_FUNDS - - ERROR_CODES_LIMIT_ERROR_IDV_MISSING - - ERROR_CODES_PAYMENT_REJECTED_BY_PROVIDER - - ERROR_CODES_MISSING_3DS_AUTHENTICATION - - ERROR_CODES_AUTH_OR_WITHDRAWAL_LIMIT - - ERROR_CODES_ACCOUNT_TOKEN_EXPIRY - - ERROR_CODES_UNIMPLEMENTED - - ERROR_CODES_ZERO_BALANCE - - ERROR_CODES_IN_LIQUIDATION - - ERROR_CODES_HIGH_RISK_TRANSFER_REJECTED - - ERROR_CODES_INSUFFICIENT_FIAT_BUT_SUFFICIENT_SAVINGS - - ERROR_CODES_TRADE_BLOCKED - - ERROR_CODES_TRANSFER_UNKNOWN_ERROR - - ERROR_CODES_TRANSFER_INVALID - - ERROR_CODES_TRANSFER_REJECTED - - ERROR_CODES_TRANSFERS_INTERNAL_ERROR - - ERROR_CODES_TRANSFERS_HEDGER_ERROR - - ERROR_CODES_BANK_ACCOUNT_VENDOR_CONNECTION_ISSUE - - ERROR_CODES_CARD_EXPIRED - - ERROR_CODES_FAILED_PAYMENT - - ERROR_CODES_PAYMENT_NOT_AUTHORIZED - - ERROR_CODES_PAYMENT_REJECTED - default: ERROR_CODES_UNSPECIFIED - description: '' - title: ErrorCodes - coinbase.simple_trade.models.ErrorCta: - type: string - enum: - - ERROR_CTA_UNSPECIFIED - - ERROR_CTA_BUY_MINIMUM - - ERROR_CTA_BUY_MAXIMUM - - ERROR_CTA_BUY_INSUFFICIENT_BALANCE - - ERROR_CTA_SELL_MINIMUM - - ERROR_CTA_SELL_ALL - - ERROR_CTA_SWITCH_PAYMENT - - ERROR_CTA_SELL_MAXIMUM - - ERROR_CTA_MAINTENANCE - - ERROR_CTA_INCREASE_POSITION_LIMIT - - ERROR_CTA_SWITCH_HIGHER_LIMIT_PAYMENT_METHOD - - ERROR_CTA_SG_PAYNOW_FAST_BANK_DEPOSIT - - ERROR_CTA_US_LINK_BANK_ACCOUNT - - ERROR_CTA_UK_BANK_ACCOUNT_DEPOSIT - - ERROR_CTA_US_WIRE_TRANSFER_DEPOSIT - - ERROR_CTA_UNTRADABLE_PRODUCT - - ERROR_CTA_NO_LIQUIDITY - - ERROR_CTA_DEPOSIT_INTO_PERPETUAL_PORTFOLIO - - ERROR_CTA_TRANSFER_INTO_PERPETUAL_FROM_PRIMARY - - ERROR_CTA_BANK_ACCOUNT_DEPOSIT - - ERROR_CTA_LINK_BANK_ACCOUNT - default: ERROR_CTA_UNSPECIFIED - description: "ErrorCTA indicates the call-to-action that should be shown to\ - \ users when errors occur during trading flows.\nUsed to guide users on how\ - \ to resolve specific error conditions like insufficient funds,\nexceeded\ - \ limits, or invalid payment methods.\n\n - ERROR_CTA_BANK_ACCOUNT_DEPOSIT:\ - \ ERROR_CTA_BANK_ACCOUNT_DEPOSIT is used to promote deposit with bank account\ - \ for Limit smart redirects feature.\nThis is shared for UK, DE, NL, AU. The\ - \ client needs to get user country code to render countries specific bank\ - \ deposit instructions.\n - ERROR_CTA_LINK_BANK_ACCOUNT: ERROR_CTA_LINK_BANK_ACCOUNT\ - \ is used for CA smart redirects when the user already has an EFT payment\ - \ method linked,\nprompting them to use their bank account to increase their\ - \ purchase limit." - coinbase.simple_trade.models.ErrorMetadata: - type: object - properties: - limit_amount: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - suggested_pm_uuid: - type: string - suggested_pm_obfuscated_name: - type: string - suggested_pm_category: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.SuggestedPaymentMethodCategory' - title: 'ErrorMetadata represents error metadata. ie: limit amount either from - insufficient fund or payment method limit' - coinbase.simple_trade.models.Fee: - type: object - properties: - title: - type: string - description: - type: string - amount: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - label: - type: string - disclosure: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.Disclosure' - waived_details: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.WaivedDetails' - metadata: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.FeeMetadata' - description: Fee represents a single fee type. A single trade may have multiple - fees. - coinbase.simple_trade.models.FeeMetadata: - type: object - properties: - netburn: - title: Netburn fee metadata (optional) - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.NetBurnFeeMetadata' - title: FeeMetadata provides mongo-compatible fee metadata (avoids oneof issues) - coinbase.simple_trade.models.NetBurnFeeMetadata: - type: object - properties: - threshold: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - netburn_value: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - title: NetBurnFeeMetadata contains metadata for net burn fee calculations - coinbase.simple_trade.models.ScaledAmount: - type: object - properties: - amount: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - scale: - type: integer - format: int32 - title: ScaledAmount provides a scale for reference with the common amount - coinbase.simple_trade.models.SuggestedPaymentMethodCategory: - type: string - enum: - - UNKNOWN - - ASSET - - ON_PLATFORM_FIAT - - OFF_PLATFORM_FIAT - default: UNKNOWN - coinbase.simple_trade.models.UnitPrice: - type: object - properties: - target_to_fiat: - description: e.g. for a BTC-ETH trade $3K / ETH. - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.ScaledAmount' - target_to_source: - description: 'e.g. for a BTC-ETH trade 25 ETH / BTC. - - Only set for C2C trades.' - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.ScaledAmount' - source_to_fiat: - description: 'e.g. for a BTC-ETH trade $6K / BTC - - Only set for C2C trades.' - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.ScaledAmount' - title: UnitPrice represents the price of a currency to fiat and to the source - of trade. For fiat trades target_to_fiat may be equivalent to target_to_source - coinbase.simple_trade.models.UserWarning: - type: object - properties: - id: - type: string - link: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Link' - context: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.UserWarningContext' - code: - type: string - message: - type: string - title: UserWarning provides context on the user warning and if it should be - visible to the user - coinbase.simple_trade.models.UserWarningContext: - type: object - properties: - details: - type: array - items: - type: string - title: - type: string - link_text: - type: string - title: UserWarningContext provides details into the user warning. Used for certain - payment warnings - coinbase.simple_trade.models.WaivedDetails: - type: object - properties: - amount: - allOf: - - $ref: '#/components/schemas/coinbase.consumer.shared.common.Amount' - source: - allOf: - - $ref: '#/components/schemas/coinbase.simple_trade.models.WaivedFeeSource' - title: WaivedDetails contains details when the fee is waived - coinbase.simple_trade.models.WaivedFeeSource: - type: string - enum: - - WAIVED_FEE_SOURCE_UNSPECIFIED - - WAIVED_FEE_SOURCE_TRADE_INCENTIVE - - WAIVED_FEE_SOURCE_COINBASE_ONE - - WAIVED_FEE_SOURCE_FEE_REDUCTION_BADGE - - WAIVED_FEE_SOURCE_TRADE_PROMOTION - default: WAIVED_FEE_SOURCE_UNSPECIFIED - grpc.gateway.runtime.Error: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - additionalProperties: true - securitySchemes: - ApiKey: - type: http - scheme: bearer - bearerFormat: JWT - description: A bearer token signed using your API Key Secret, see - [Creating API Keys](/coinbase-app/authentication-authorization/api-key-authentication) - section of our docs for more information. See - [Scope & Permissions](/coinbase-app/advanced-trade-apis/rest-scopes) - for the permission each endpoint requires. - OAuth2: - type: oauth2 - description: An OAuth 2.0 access token from the Coinbase App OAuth2 flow. See - [Scope & Permissions](/coinbase-app/advanced-trade-apis/rest-scopes) for the scope - each endpoint requires. - flows: - authorizationCode: - authorizationUrl: https://login.coinbase.com/oauth2/auth - tokenUrl: https://login.coinbase.com/oauth2/token - scopes: - "wallet:user:read": View your account information. - "wallet:user:update": Update your account information. - "wallet:accounts:read": View your accounts. - "wallet:buys:create": Place, edit, and cancel orders. - "wallet:trades:read": View your cryptocurrency conversions. - "wallet:trades:create": Convert cryptocurrencies. - "wallet:transactions:read": View your transactions. - "wallet:transactions:transfer": Transfer funds between accounts. - "wallet:payment-methods:read": View your payment methods. -security: -- ApiKey: [] -- OAuth2: [] - -================ -File: index.js -================ - - -================ -File: jest.config.ts -================ -/** - * For a detailed explanation regarding each configuration property, visit: - * https://jestjs.io/docs/configuration - */ -⋮---- -import type { Config } from 'jest'; -⋮---- -// All imported modules in your tests should be mocked automatically -// automock: false, -⋮---- -// Stop running tests after `n` failures -// bail: 0, -bail: false, // enable to stop test when an error occur, -⋮---- -// The directory where Jest should store its cached dependency information -// cacheDirectory: "/private/var/folders/kf/2k3sz4px6c9cbyzj1h_b192h0000gn/T/jest_dx", -⋮---- -// Automatically clear mock calls, instances, contexts and results before every test -⋮---- -// Indicates whether the coverage information should be collected while executing the test -⋮---- -// An array of glob patterns indicating a set of files for which coverage information should be collected -⋮---- -// The directory where Jest should output its coverage files -⋮---- -// An array of regexp pattern strings used to skip coverage collection -// coveragePathIgnorePatterns: [ -// "/node_modules/" -// ], -⋮---- -// Indicates which provider should be used to instrument code for coverage -⋮---- -// A list of reporter names that Jest uses when writing coverage reports -// coverageReporters: [ -// "json", -// "text", -// "lcov", -// "clover" -// ], -⋮---- -// An object that configures minimum threshold enforcement for coverage results -// coverageThreshold: undefined, -⋮---- -// A path to a custom dependency extractor -// dependencyExtractor: undefined, -⋮---- -// Make calling deprecated APIs throw helpful error messages -// errorOnDeprecated: false, -⋮---- -// The default configuration for fake timers -// fakeTimers: { -// "enableGlobally": false -// }, -⋮---- -// Force coverage collection from ignored files using an array of glob patterns -// forceCoverageMatch: [], -⋮---- -// A path to a module which exports an async function that is triggered once before all test suites -// globalSetup: undefined, -⋮---- -// A path to a module which exports an async function that is triggered once after all test suites -// globalTeardown: undefined, -⋮---- -// A set of global variables that need to be available in all test environments -// globals: {}, -⋮---- -// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. -// maxWorkers: "50%", -⋮---- -// An array of directory names to be searched recursively up from the requiring module's location -// moduleDirectories: [ -// "node_modules" -// ], -⋮---- -// An array of file extensions your modules use -⋮---- -// modulePaths: ['src'], -⋮---- -// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module -// moduleNameMapper: {}, -⋮---- -// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader -// modulePathIgnorePatterns: [], -⋮---- -// Activates notifications for test results -// notify: false, -⋮---- -// An enum that specifies notification mode. Requires { notify: true } -// notifyMode: "failure-change", -⋮---- -// A preset that is used as a base for Jest's configuration -// preset: undefined, -⋮---- -// Run tests from one or more projects -// projects: undefined, -⋮---- -// Use this configuration option to add custom reporters to Jest -// reporters: undefined, -⋮---- -// Automatically reset mock state before every test -// resetMocks: false, -⋮---- -// Reset the module registry before running each individual test -// resetModules: false, -⋮---- -// A path to a custom resolver -// resolver: undefined, -⋮---- -// Automatically restore mock state and implementation before every test -// restoreMocks: false, -⋮---- -// The root directory that Jest should scan for tests and modules within -// rootDir: undefined, -⋮---- -// A list of paths to directories that Jest should use to search for files in -// roots: [ -// "" -// ], -⋮---- -// Allows you to use a custom runner instead of Jest's default test runner -// runner: "jest-runner", -⋮---- -// The paths to modules that run some code to configure or set up the testing environment before each test -// setupFiles: [], -⋮---- -// A list of paths to modules that run some code to configure or set up the testing framework before each test -// setupFilesAfterEnv: [], -⋮---- -// The number of seconds after which a test is considered as slow and reported as such in the results. -// slowTestThreshold: 5, -⋮---- -// A list of paths to snapshot serializer modules Jest should use for snapshot testing -// snapshotSerializers: [], -⋮---- -// The test environment that will be used for testing -// testEnvironment: "jest-environment-node", -⋮---- -// Options that will be passed to the testEnvironment -// testEnvironmentOptions: {}, -⋮---- -// Adds a location field to test results -// testLocationInResults: false, -⋮---- -// The glob patterns Jest uses to detect test files -⋮---- -// "**/__tests__/**/*.[jt]s?(x)", -⋮---- -// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped -// testPathIgnorePatterns: [ -// "/node_modules/" -// ], +// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped +// testPathIgnorePatterns: [ +// "/node_modules/" +// ], ⋮---- // The regexp pattern or array of patterns that Jest uses to detect test files // testRegex: [], @@ -35725,6 +2360,17 @@ verbose: true, // report individual test // Whether to use watchman for file crawling // watchman: true, +================ +File: LICENSE.md +================ +Copyright 2025 Tiago Siebler + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + ================ File: postBuild.sh ================ @@ -35831,6 +2477,213 @@ File: tsconfig.linting.json ] } +================ +File: examples/AdvancedTrade/Private/getAccounts.ts +================ +import { CBAdvancedTradeClient } from '../../../src/index.js'; +⋮---- +/** + * import { CBAdvancedTradeClient } from 'coinbase-api'; + * const { CBAdvancedTradeClient } = require('coinbase-api'); + */ +⋮---- +// initialise the client +/** + * + * You can add both ED25519 and ECDSA keys, client will recognize both types of keys + * + * ECDSA: + * + * { + * apiKey: 'organizations/your_org_id/apiKeys/your_api_key_id', + * apiSecret: + * '-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIPT/TTZPxw0kDGvpuCENJp9A4/2INAt9/QKKfyidTWM8oAoGCCqGSM49\nAwEHoUQDQgAEd+cnxrKl536ly5eYBi+8dvXt1MJXYRo+/v38h9HrFKVGBRndU9DY\npV357xIfqeJEzb/MBuk3EW8cG9RTrYBwjg==\n-----END EC PRIVATE KEY-----\n', + * } + * + * ED25519: + * { + * apiKey: 'your-api-key-id', + * apiSecret: 'yourExampleApiSecretEd25519Version==', + * } + * + * + */ +⋮---- +async function getAccounts() +⋮---- +// Get all accounts +// List Accounts returns at most 250 per call. Follow cursor while has_next is true. +⋮---- +// Get specific account details + +================ +File: examples/AdvancedTradeGlobal/WebSockets/privateWs.ts +================ +import { + AdvTradeGlobalPrivateWSTopic, + CBAdvancedTradeGlobalPrivateWSEvent, + WebsocketClient, + WS_KEY_MAP, +} from '../../../src/index.js'; +⋮---- +// Authentication and renewal are automatic. Subscriptions wait for public/auth +// to succeed and are restored after authenticating a replacement connection. +⋮---- +// client.unsubscribe('user.portfolio.USDC', wsKey); + +================ +File: examples/AdvancedTradeGlobal/WebSockets/publicWs.ts +================ +import { + AdvTradeGlobalPublicWSTopic, + CBAdvancedTradeGlobalPublicWSEvent, + WebsocketClient, + WS_KEY_MAP, +} from '../../../src/index.js'; +⋮---- +// No credentials are required. Instrument and interval parameters go in the channel name. +// Use 100ms or agg2 on this public feed; raw intervals require authentication. +⋮---- +// Existing object-style requests work too, with the complete channel in topic: +// client.subscribe({ topic: 'platform_state' }, wsKey); +⋮---- +// Removing a topic also removes it from the automatic reconnect subscriptions: +// client.unsubscribe('quote.BTC-PERPETUAL', wsKey); + +================ +File: examples/AdvancedTradeGlobal/WebSockets/wsApi.ts +================ +import { WebsocketAPIClient, WS_KEY_MAP } from '../../../src/index.js'; +⋮---- +async function run() +⋮---- +// Public RPC calls open the connection automatically and need no credentials. +⋮---- +// The same typed promise interface is available without the named wrapper. +⋮---- +// Optional warm-up: await client.connectWSAPI(); +// Private calls share automatic authentication and session renewal. +⋮---- +// Logout has no JSON-RPC reply. This waits for the server to close the socket. + +================ +File: examples/CBInternationalExchange/WebSockets/privateWs.ts +================ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { WebsocketClient, WsTopicRequest } from '../../../src/index.js'; +⋮---- +/** + * import { WebsocketClient, WsTopicRequest } from 'coinbase-api'; + * const { WebsocketClient, WsTopicRequest } = require('coinbase-api'); + */ +⋮---- +async function start() +⋮---- +/** + * All websockets are available via the unified WebsocketClient. + * + * Below are examples specific to websockets in this product group. + */ +⋮---- +// Data received +⋮---- +// Something happened, attempting to reconenct +⋮---- +// Reconnect successful +⋮---- +// Connection closed. If unexpected, expect reconnect -> reconnected. +⋮---- +// Reply to a request, e.g. "subscribe"/"unsubscribe"/"authenticate" +⋮---- +// throw new Error('res?'); +⋮---- +/** + * Use the client subscribe(topic, market) pattern to subscribe to any websocket topic. + * + * - You can subscribe to topics one at a time or many one one request. + * - Topics can be sent as simple strings, if no parameters are required. + * - Coinbase Market Data is the traditional feed which is available without authentication. + * - To use this feed, use 'exchangeMarketData' as the wsKey for each subscription command: + */ +// client.subscribe('status', 'exchangeMarketData'); +⋮---- +/** + * Or send a more structured object with parameters, e.g. if parameters are required + */ +⋮---- +/** + * Anything in the payload will be merged into the subscribe "request", + * allowing you to send misc parameters supported by the exchange (such as `product_ids: string[]`) + */ +⋮---- +/** + * Subscribe to the "heartbeat" topic for a few symbols + */ +// client.subscribe( +// { +// topic: 'heartbeat', +// payload: { +// product_ids: ['ETH-USD', 'BTC-USD'], +// }, +// }, +// 'exchangeMarketData', +// ); +⋮---- +// client.subscribe( +// { +// topic: 'level2', +// payload: { +// product_ids: ['ETH-USD', 'BTC-USD'], +// }, +// }, +// 'exchangeMarketData', +// ); +⋮---- +// /** +// * Or, send an array of structured objects with parameters, if you wanted to send multiple in one request +// */ +// // client.subscribe([level2SubscribeRequest, anotherRequest, etc], 'advTradeMarketData'); +⋮---- +/** + * Other Coinbase Exchange public websocket topics: + */ +// client.subscribe( +// [ +// // https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#heartbeat-channel +// { +// topic: 'heartbeat', +// payload: { +// product_ids: ['ETH-EUR'], +// }, +// }, +// // https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#status-channel +// 'status', +// // https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#auction-channel +// { +// topic: 'auctionfeed', +// payload: { +// product_ids: ['LTC-USD'], +// }, +// }, +// // https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#matches-channel +// { +// topic: 'matches', +// payload: { +// product_ids: ['BTC-USD'], +// }, +// }, +// // https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#rfq-matches-channel +// { +// topic: 'rfq_matches', +// payload: { +// // Optional: +// // product_ids: ['ETH-USD', 'BTC-USD'], +// }, +// }, +// ], +// 'exchangeMarketData', +// ); + ================ File: examples/Institutional/CBExchange/Rest/cb-exchange-private.ts ================ @@ -35964,587 +2817,1153 @@ async function start() // client.subscribe('status', 'exchangeMarketData'); ⋮---- /** - * Or send a more structured object with parameters, e.g. if parameters are required - */ -// const tickerSubscribeRequest: WsTopicRequest = { -// topic: 'ticker', -// /** -// * Anything in the payload will be merged into the subscribe "request", -// * allowing you to send misc parameters supported by the exchange (such as `product_ids: string[]`) -// */ -// payload: { -// product_ids: ['ETH-USD', 'ETH-EUR'], -// }, -// }; -// client.subscribe(tickerSubscribeRequest, 'exchangeMarketData'); + * Or send a more structured object with parameters, e.g. if parameters are required + */ +// const tickerSubscribeRequest: WsTopicRequest = { +// topic: 'ticker', +// /** +// * Anything in the payload will be merged into the subscribe "request", +// * allowing you to send misc parameters supported by the exchange (such as `product_ids: string[]`) +// */ +// payload: { +// product_ids: ['ETH-USD', 'ETH-EUR'], +// }, +// }; +// client.subscribe(tickerSubscribeRequest, 'exchangeMarketData'); +⋮---- +/** + * Subscribe to the "heartbeat" topic for a few symbols + */ +// client.subscribe( +// { +// topic: 'heartbeat', +// payload: { +// product_ids: ['ETH-USD', 'BTC-USD'], +// }, +// }, +// 'exchangeMarketData', +// ); +⋮---- +// client.subscribe( +// { +// topic: 'level2', +// payload: { +// product_ids: ['ETH-USD', 'BTC-USD'], +// }, +// }, +// 'exchangeMarketData', +// ); +⋮---- +// /** +// * Or, send an array of structured objects with parameters, if you wanted to send multiple in one request +// */ +// // client.subscribe([level2SubscribeRequest, anotherRequest, etc], 'advTradeMarketData'); +⋮---- +/** + * Other Coinbase Exchange public websocket topics: + */ +⋮---- +// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#heartbeat-channel +⋮---- +// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#status-channel +⋮---- +// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#auction-channel +⋮---- +// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#matches-channel +⋮---- +// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#rfq-matches-channel +⋮---- +// Optional: +// product_ids: ['ETH-USD', 'BTC-USD'], +⋮---- +// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#ticker-channel +⋮---- +// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#ticker-batch-channel +⋮---- +// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#level2-batch-channel + +================ +File: examples/Institutional/CBInternationalExchange/cb-intx-public.ts +================ +import { CBInternationalClient } from '../../../src/index.js'; +⋮---- +/** + * import { CBInternationalClient } from 'coinbase-api'; + * const { CBInternationalClient } = require('coinbase-api'); + */ +⋮---- +// Initialize the client, you can pass in api keys here if you have them but they are not required for public endpoints +⋮---- +async function publicInternationalCalls() +⋮---- +// List assets +⋮---- +// Get asset details +⋮---- +// Get supported networks per asset +⋮---- +// List instruments +⋮---- +// Get instrument details +⋮---- +// Get quote per instrument +⋮---- +// Get daily trading volumes +⋮---- +// Get aggregated candles data per instrument +⋮---- +// Get historical funding rates +⋮---- +// List position offsets + +================ +File: examples/Institutional/CBInternationalExchange/cb-intx-ws.ts +================ +import { WebsocketClient, WsTopicRequest } from '../../../src/index.js'; +⋮---- +/** + * import { WebsocketClient, WsTopicRequest } from 'coinbase-api'; + * const { WebsocketClient, WsTopicRequest } = require('coinbase-api'); + */ +⋮---- +// logger, +⋮---- +// Data received +⋮---- +// Something happened, attempting to reconenct +⋮---- +// Reconnect successful +⋮---- +// Connection closed. If unexpected, expect reconnect -> reconnected. +⋮---- +// Reply to a request, e.g. "subscribe"/"unsubscribe"/"authenticate" +⋮---- +topic: 'LEVEL1', // ws topic +/** + * Anything in the payload will be merged into the subscribe "request", + * allowing you to send misc parameters supported by the exchange (such as `product_ids: string[]`) + */ + +================ +File: src/lib/AdvancedTradeGlobalAuth.ts +================ +import { AxiosError, AxiosHeaders, AxiosRequestConfig } from 'axios'; +⋮---- +import { AdvTradeGlobalAuthRequest } from '../types/request/advanced-trade-global-client.js'; +import { AdvTradeGlobalAuthResult } from '../types/response/advanced-trade-global-client.js'; +import { signJWT } from './jwtNode.js'; +⋮---- +interface GlobalAuthOptions { + baseUrl: string; + apiKey?: string; + apiSecret?: string; + jwtExpiresSeconds: number; + getSignTimestampMs: () => number; + traceLogs?: boolean; +} +⋮---- +/** Remove credentials from gateway error data, including credentials echoed in strings. */ +function redactCredentials(value: any, secrets: string[]): any +⋮---- +/** + * Global derivatives use a CDP JWT exchange followed by a reusable Bearer token. + * Keep token state here; send the exchange through the client's public POST path. + * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/technical + */ +export class AdvancedTradeGlobalAuth +⋮---- +constructor( +⋮---- +getAccessToken(): Promise +⋮---- +private async authenticate(): Promise +⋮---- +// Bind the JWT to the authentication POST, not the subsequent private call. +⋮---- +// Coinbase recommends renewing HTTP auth every 15 minutes. Respect shorter +// server lifetimes, allow a margin, and include time spent on the exchange. +⋮---- +/** Invalidate only the rejected token, without replaying the failed request. */ +handleRequestError(error: any, options: AxiosRequestConfig): AxiosError +⋮---- +// 13009 means the token is invalid or expired, even over HTTP 200. +⋮---- +// Strip Axios config/request objects, which contain authentication material, +// even when the client has parseExceptions disabled. + +================ +File: src/types/request/coinbase-exchange.ts +================ +/** + * + * Accounts Endpoints + * + */ +export interface GetCBExchAccountHoldsRequest { + account_id: string; + before?: string; + after?: string; + limit?: number; +} +export interface GetCBExchAccountLedgerRequest { + account_id: string; + start_date?: string; + end_date?: string; + before?: string; + after?: string; + limit?: number; + profile_id?: string; +} +⋮---- +export interface GetCBExchAccountTransfersRequest { + account_id: string; + before?: string; + after?: string; + limit?: number; + type?: string; +} +⋮---- +/** + * + * Address book Endpoints + * + */ +⋮---- +export interface GetCBExchAddressBookRequest { + addresses: { + currency: string; + to: { + address: string; + destination_tag?: string; + }; + label?: string; + network?: string; + is_verified_self_hosted_wallet?: boolean; + vasp_id?: string; + }[]; +} +⋮---- +export interface UpdateCBExchAddressBookEntryRequest { + id: string; + label?: string; + is_certified_self_send?: boolean; + vasp_id?: string; + is_verified_self_hosted_wallet?: boolean; + business_name?: string; + business_country_code?: string; +} +⋮---- +/** + * + * Coinbase Account Endpoints + * + */ +⋮---- +export interface CreateCBExchNewCryptoAddress { + account_id: string; + profile_id?: string; + network?: string; +} ⋮---- /** - * Subscribe to the "heartbeat" topic for a few symbols - */ -// client.subscribe( -// { -// topic: 'heartbeat', -// payload: { -// product_ids: ['ETH-USD', 'BTC-USD'], -// }, -// }, -// 'exchangeMarketData', -// ); + * + * Conversions Endpoints + * + */ ⋮---- -// client.subscribe( -// { -// topic: 'level2', -// payload: { -// product_ids: ['ETH-USD', 'BTC-USD'], -// }, -// }, -// 'exchangeMarketData', -// ); +export interface ConvertCBExchCurrencyRequest { + profile_id: string; + from: string; + to: string; + amount: string; + nonce: string; +} ⋮---- -// /** -// * Or, send an array of structured objects with parameters, if you wanted to send multiple in one request -// */ -// // client.subscribe([level2SubscribeRequest, anotherRequest, etc], 'advTradeMarketData'); +/** + * + * Currencies Endpoints + * + */ ⋮---- /** - * Other Coinbase Exchange public websocket topics: - */ + * + * Transfers Endpoints + * + */ ⋮---- -// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#heartbeat-channel +export interface CBExchDepositFromCoinbaseAccount { + profile_id: string; + amount: string; + coinbase_account_id: string; + currency: string; +} ⋮---- -// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#status-channel +export interface CBExchDepositFromPaymentMethod { + profile_id: string; + amount: string; + payment_method_id: string; + currency: string; +} ⋮---- -// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#auction-channel +export interface CBExchGetTransfersRequest { + profile_id?: string; + before?: string; + after?: string; + limit?: number; + type?: string; + currency_type?: string; + transfer_reason?: string; + currency?: string; +} ⋮---- -// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#matches-channel +export interface SubmitCBExchTravelInformation { + transfer_id: string; + originator_name: string; + originator_country: string; +} ⋮---- -// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#rfq-matches-channel +export interface CBExchWithdrawToCBAccount { + profile_id: string; + amount: string; + coinbase_account_id: string; + currency: string; +} ⋮---- -// Optional: -// product_ids: ['ETH-USD', 'BTC-USD'], +export interface CBExchWithdrawToCryptoAddress { + profile_id: string; + amount: string; + currency: string; + crypto_address: string; + destination_tag?: string; + no_destination_tag?: boolean; + nonce?: number; + network?: string; + add_network_fee_to_total?: boolean; + is_intermediary?: boolean; + intermediary_jurisdiction?: string; + travel_rule_data?: object; +} ⋮---- -// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#ticker-channel +export interface CBExchGetCryptoWithdrawalFeeEstimate { + currency: string; + crypto_address: string; + network?: string; +} ⋮---- -// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#ticker-batch-channel +export interface CBExchWithdrawToPaymentMethod { + profile_id: string; + amount: string; + payment_method_id: string; + currency: string; +} ⋮---- -// https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#level2-batch-channel - -================ -File: examples/Institutional/CBInternationalExchange/cb-intx-public.ts -================ -import { CBInternationalClient } from '../../../src/index.js'; +/** + * + * Fees Endpoints + * + */ ⋮---- /** - * import { CBInternationalClient } from 'coinbase-api'; - * const { CBInternationalClient } = require('coinbase-api'); + * + * Orders Endpoints + * */ ⋮---- -// Initialize the client, you can pass in api keys here if you have them but they are not required for public endpoints +export interface GetCBExchFillsRequest { + order_id?: string; + product_id?: string; + limit?: number; + before?: string; + after?: string; + market_type?: string; + start_date?: string; + end_date?: string; +} ⋮---- -async function publicInternationalCalls() +export interface GetCBExchOrdersRequest { + profile_id?: string; + product_id?: string; + sortedBy?: string; + sorting?: string; + start_date?: string; + end_date?: string; + before?: string; + after?: string; + limit: number; + status: string[]; + market_type?: string; +} ⋮---- -// List assets +export interface SubmitCBExchOrderRequest { + profile_id?: string; + type: string; + side: string; + product_id: string; + stp?: string; + stop?: string; + stop_price?: string; + price?: string; + size?: string; + funds?: string; + time_in_force?: string; + cancel_after?: string; + post_only?: boolean; + client_oid?: string; + max_floor?: string; + stop_limit_price?: string; +} ⋮---- -// Get asset details +export interface CancelCBExchOrderRequest { + order_id: string; + profile_id?: string; + product_id?: string; +} ⋮---- -// Get supported networks per asset +/** + * + * Loans Endpoints + * + */ ⋮---- -// List instruments +export interface SubmitCBExchNewLoan { + loan_id: string; + currency: string; + native_amount: string; + interest_rate: string; + term_start_date: string; + term_end_date: string; + profile_id: string; +} ⋮---- -// Get instrument details +export interface RepayCBExchLoanInterest { + idem: string; + from_profile_id: string; + currency: string; + native_amount: string; +} ⋮---- -// Get quote per instrument +export interface RepayCBExchLoanPrincipal { + loan_id: string; + idem: string; + from_profile_id: string; + currency: string; + native_amount: string; +} ⋮---- -// Get daily trading volumes +export interface GetCBExchPrincipalRepaymentPreview { + loan_id: string; + currency: string; + native_amount: string; +} +/** + * + * Coinbase Price Oracle Endpoints + * + */ ⋮---- -// Get aggregated candles data per instrument +/** + * + * Products Endpoints + * + */ ⋮---- -// Get historical funding rates +export interface GetCBExchProductCandles { + product_id: string; + granularity: number; + start?: string; + end?: string; +} ⋮---- -// List position offsets - -================ -File: examples/Institutional/CBInternationalExchange/cb-intx-ws.ts -================ -import { WebsocketClient, WsTopicRequest } from '../../../src/index.js'; +export interface GetCBExchProductTrades { + product_id: string; + limit?: number; + before?: string; + after?: string; +} ⋮---- /** - * import { WebsocketClient, WsTopicRequest } from 'coinbase-api'; - * const { WebsocketClient, WsTopicRequest } = require('coinbase-api'); + * + * Profiles Endpoints + * */ ⋮---- -// logger, +export interface TransferCBExchFundsBetweenProfiles { + from: string; + to: string; + currency: string; + amount: string; +} ⋮---- -// Data received +/** + * + * Reports Endpoints + * + */ ⋮---- -// Something happened, attempting to reconenct +export interface GetAllCBExchReports { + profile_id?: string; + after?: string; + limit?: number; + type?: string; + ignore_expired?: boolean; +} ⋮---- -// Reconnect successful +export interface CreateCBExchReport { + type: string; + year?: string; + format?: string; + email?: string; + profile_id?: string; + balance?: { datetime?: string; group_by_profile?: boolean }; + fills?: { start_date?: string; end_date?: string; product_id?: string }; + account?: { start_date?: string; end_date?: string; account_id?: string }; + otc_fills?: { start_date?: string; end_date?: string; product_id?: string }; + tax_invoice?: { + start_date?: string; + end_date?: string; + product_id?: string; + }; + rfq_fills?: { start_date?: string; end_date?: string; product_id?: string }; +} ⋮---- -// Connection closed. If unexpected, expect reconnect -> reconnected. +/** + * + * Travel Rule Endpoints + * + */ ⋮---- -// Reply to a request, e.g. "subscribe"/"unsubscribe"/"authenticate" +export interface GetCBExchTravelRuleInformation { + before?: string; + after?: string; + limit?: number; + address?: string; +} +/** + * + * Users Endpoints + * + */ ⋮---- -topic: 'LEVEL1', // ws topic /** - * Anything in the payload will be merged into the subscribe "request", - * allowing you to send misc parameters supported by the exchange (such as `product_ids: string[]`) - */ + * + * Wrapped Assets Endpoints + * + */ +⋮---- +export interface GetCBExchAllStakeWraps { + before?: string; + after?: string; + limit?: number; + from?: string; + to?: string; + status?: string; +} ================ -File: src/lib/websocket/WsStore.ts +File: src/types/request/coinbase-international.ts ================ -import WebSocket from 'isomorphic-ws'; -⋮---- -import { DefaultLogger } from './logger.js'; -import { - DeferredPromise, - WSConnectedResult, - WsConnectionStateEnum, - WsStoredState, -} from './WsStore.types.js'; -⋮---- /** - * Simple comparison of two objects, recursive for nested objects + * + * Assets Endpoints + * */ -export function isDeepObjectMatch(object1: unknown, object2: unknown): boolean -⋮---- -type DeferredPromiseRef = - (typeof DEFERRED_PROMISE_REF)[keyof typeof DEFERRED_PROMISE_REF]; -⋮---- -export class WsStore< -WsKey extends string, -⋮---- -constructor(logger: typeof DefaultLogger) -⋮---- -/** Get WS stored state for key, optionally create if missing */ -get( - key: WsKey, - createIfMissing?: true, - ): WsStoredState; -⋮---- -get( - key: WsKey, - createIfMissing?: false, - ): WsStoredState | undefined; -⋮---- -get( - key: WsKey, - createIfMissing?: boolean, -): WsStoredState | undefined -⋮---- -getKeys(): WsKey[] -⋮---- -create(key: WsKey): WsStoredState | undefined -⋮---- -delete(key: WsKey): void -⋮---- -// TODO: should we allow this at all? Perhaps block this from happening... -⋮---- -/* connection websocket */ -⋮---- -hasExistingActiveConnection(key: WsKey): boolean -⋮---- -getWs(key: WsKey): WebSocket | undefined -⋮---- -setWs(key: WsKey, wsConnection: WebSocket): WebSocket ⋮---- -getDeferredPromise( - wsKey: WsKey, - promiseRef: string | DeferredPromiseRef, -): DeferredPromise | undefined +/** + * + * Index Endpoints + * + */ ⋮---- -createDeferredPromise( - wsKey: WsKey, - promiseRef: string | DeferredPromiseRef, - throwIfExists: boolean, -): DeferredPromise +export interface GetINTXIndexCompositionHistory { + index: string; + time_from?: string; + result_limit?: number; + result_offset?: number; +} ⋮---- -// console.log('existing promise'); +export interface GetINTXIndexCandlesRequest { + index: string; + granularity: string; + start: string; + end?: string; +} ⋮---- -// console.log('create promise'); +/** + * + * Instruments Endpoints + * + */ ⋮---- -// TODO: Once stable, use Promise.withResolvers in future +/** Values for `underlying_type` on INTX instruments (REST, WebSocket INSTRUMENTS channel) */ +export type INTXUnderlyingType = + | 'PREIPO' + | 'COMMOD' + | 'COMMOD_INDEX' + | 'COMMOD_ETF' + | string; ⋮---- -resolveDeferredPromise( - wsKey: WsKey, - promiseRef: string | DeferredPromiseRef, - value: unknown, - removeAfter: boolean, -): void +export interface GetINTXDailyTradingVolumes { + instruments: string; + result_limit?: number; + result_offset?: number; + time_from?: string; + show_other?: boolean; +} ⋮---- -rejectDeferredPromise( - wsKey: WsKey, - promiseRef: string | DeferredPromiseRef, - value: unknown, - removeAfter: boolean, -): void +export interface GetINTXAggregatedCandlesData { + instrument: string; + granularity: string; + start: string; + end?: string; +} +/** + * + * Position Offsets Endpoints + * + */ ⋮---- -removeDeferredPromise( - wsKey: WsKey, - promiseRef: string | DeferredPromiseRef, -): void +/** + * + * Orders Endpoints + * + */ ⋮---- -// Just in case it's pending +export interface SubmitINTXOrderRequest { + client_order_id?: string; + side: string; + size: string; + tif: string; + instrument: string; + type: string; + price?: string; + stop_price?: string; + stop_limit_price?: string; + expire_time?: string; + portfolio?: string; + user?: string; + stp_mode?: string; + post_only?: boolean; + close_only?: boolean; + algo_strategy?: boolean; +} ⋮---- -rejectAllDeferredPromises(wsKey: WsKey, reason: string): void +export interface GetINTXOpenOrdersRequest { + portfolio?: string; + instrument?: string; + instrument_type?: string; + client_order_id?: string; + event_type?: string; + order_type?: string; + side?: string; + ref_datetime?: string; + result_limit?: number; + result_offset?: number; +} ⋮---- -// Skip reserved keys, such as the connection promise +export interface CancelINTXOrdersRequest { + portfolio: string; + instrument?: string; + side?: string; + instrument_type?: string; +} ⋮---- -/** Get promise designed to track a connection attempt in progress. Resolves once connected. */ -getConnectionInProgressPromise( - wsKey: WsKey, -): DeferredPromise | undefined +export interface UpdateINTXOpenOrderRequest { + id: string; + client_order_id?: string; + portfolio?: string; + price?: string; + stop_price?: string; + size?: string; +} ⋮---- /** - * Create a deferred promise designed to track a connection attempt in progress. - * - * Will throw if existing promise is found. - */ -createConnectionInProgressPromise( - wsKey: WsKey, - throwIfExists: boolean, -): DeferredPromise -⋮---- -/** Remove promise designed to track a connection attempt in progress */ -removeConnectingInProgressPromise(wsKey: WsKey): void + * + * Portfolios Endpoints + * + */ ⋮---- -/* connection state */ +export interface UpdateINTXPortfolioParametersRequest { + auto_margin_enabled?: boolean; + cross_collateral_enabled?: boolean; + position_offsets_enabled?: boolean; + pre_launch_trading_enabled?: boolean; + portfolio_name?: string; +} ⋮---- -isWsOpen(key: WsKey): boolean +export interface GetINTXFillsByPortfoliosRequest { + portfolios?: string; + order_id?: string; + client_order_id?: string; + ref_datetime?: string; + result_limit?: number; + result_offset?: number; + time_from?: string; +} ⋮---- -getConnectionState(key: WsKey): WsConnectionStateEnum +export interface GetINTXPortfolioFillsRequest { + portfolio: string; + order_id?: string; + client_order_id?: string; + ref_datetime?: string; + result_limit?: number; + result_offset?: number; + time_from?: string; +} ⋮---- -setConnectionState(key: WsKey, state: WsConnectionStateEnum) +export interface TransferINTXFundsBetweenPortfoliosRequest { + from: string; + to: string; + asset: string; + amount: string; +} ⋮---- -// console.log(new Date(), `setConnectionState(${key}, ${state})`); +export interface TransferINTXPositionsBetweenPortfoliosRequest { + from: string; + to: string; + instrument: string; + quantity: string; + side: string; +} ⋮---- -isConnectionState(key: WsKey, state: WsConnectionStateEnum): boolean +/** + * + * Rankings Endpoints + * + */ ⋮---- /** - * Check if we're currently in the process of opening a connection for any reason. Safer than only checking "CONNECTING" as the state - * @param key - * @returns - */ -isConnectionAttemptInProgress(key: WsKey): boolean + * + * Transfers Endpoints + * + */ ⋮---- -/* subscribed topics */ +export interface GetINTXMatchingTransfersRequest { + portfolio?: string; + portfolios?: string; + time_from?: string; + time_to?: string; + result_limit?: number; + result_offset?: number; + status?: string; + type?: string; +} ⋮---- -getTopics(key: WsKey): Set +export interface INTXWithdrawToCryptoAddressRequest { + portfolio: string; + asset: string; + amount: string; + add_network_fee_to_total?: boolean; + network_arn_id: string; + address: string; + nonce: number; +} ⋮---- -getTopicsByKey(): Record> +export interface INTXWithdrawToCounterpartyIdRequest { + portfolio: string; + counterparty_id: string; + asset: string; + amount: string; + nonce: number; +} +/** + * + * Fee Rates Endpoints + * + */ + +================ +File: src/types/response/coinbase-app-client.ts +================ +export interface CBAppPagination { + ending_before?: string | null; + starting_after?: string | null; + limit?: number; + order?: string; + previous_uri: string | null; + next_uri: string | null; +} ⋮---- -// Since topics are objects we can't rely on the set to detect duplicates /** - * Find matching "topic" request from the store - * @param key - * @param topic - * @returns - */ -getMatchingTopic(key: WsKey, topic: TWSTopicSubscribeEventArgs) + * + * Account Endpoints + * + */ ⋮---- -// if (typeof topic === 'string') { -// return this.getMatchingTopic(key, { channel: topic }); -// } +interface AccountCurrency { + address_regex: string; + asset_id: string; + code: string; + color: string; + exponent: number; + name: string; + slug: string; + sort_index: number; + type: string; +} ⋮---- -addTopic(key: WsKey, topic: TWSTopicSubscribeEventArgs) +interface AccountBalance { + amount: string; + currency: string; +} ⋮---- -// console.log(`wsStore.addTopic(${key}, ${topic})`); -// Check for duplicate topic. If already tracked, don't store this one +export interface CBAppAccount { + id: string; + name: string; + primary: boolean; + type: string; + currency: AccountCurrency; + balance: AccountBalance; + created_at: string; + updated_at: string; + resource: string; + resource_path: string; + ready: boolean; +} ⋮---- -deleteTopic(key: WsKey, topic: TWSTopicSubscribeEventArgs) +/** + * + * Address Endpoints + * + */ +⋮---- +export interface CBAppAddress { + id: string; + address: string; + name?: string; + network: string; + created_at: string; + updated_at: string; + resource: string; + resource_path: string; +} ⋮---- -// Check if we're subscribed to a topic like this - -================ -File: src/types/request/coinbase-exchange.ts -================ /** * - * Accounts Endpoints + * Transactions Endpoints * */ -export interface GetCBExchAccountHoldsRequest { - account_id: string; - before?: string; - after?: string; - limit?: number; +⋮---- +interface TransactionAmount { + amount: string; + currency: string; } -export interface GetCBExchAccountLedgerRequest { - account_id: string; - start_date?: string; - end_date?: string; - before?: string; - after?: string; - limit?: number; - profile_id?: string; +⋮---- +interface TransactionNetwork { + status: string; + name: string; + hash?: string; + transaction_fee?: TransactionAmount; + transaction_amount?: TransactionAmount; + network_name?: string; + status_description?: string | null; +} +⋮---- +interface TransactionFrom { + id: string; + resource: string; + resource_path?: string; +} +⋮---- +interface TransactionTo { + resource: string; + address?: string; + email?: string; + id?: string; + resource_path?: string; } ⋮---- -export interface GetCBExchAccountTransfersRequest { - account_id: string; - before?: string; - after?: string; - limit?: number; - type?: string; +interface TransactionDetails { + title: string; + subtitle: string; + header?: string; + health?: string; + subsidebar_label?: string | null; } ⋮---- -/** - * - * Address book Endpoints - * - */ -⋮---- -export interface GetCBExchAddressBookRequest { - addresses: { - currency: string; - to: { - address: string; - destination_tag?: string; - }; - label?: string; - network?: string; - is_verified_self_hosted_wallet?: boolean; - vasp_id?: string; - }[]; +interface AdvancedTradeFill { + fill_price: string; + product_id: string; + order_id: string; + commission: string; + order_side: 'BUY' | 'SELL'; } ⋮---- -export interface UpdateCBExchAddressBookEntryRequest { +export interface CBAppTransaction { id: string; - label?: string; - is_certified_self_send?: boolean; - vasp_id?: string; - is_verified_self_hosted_wallet?: boolean; - business_name?: string; - business_country_code?: string; + type: string; + status: string; + amount: TransactionAmount; + native_amount: TransactionAmount; + description: string | null; + created_at: string; + updated_at: string; + resource: string; + resource_path: string; + network?: TransactionNetwork; + from?: TransactionFrom; + to?: TransactionTo; + details?: TransactionDetails; + instant_exchange?: boolean; + advanced_trade_fill?: AdvancedTradeFill; + cancelable?: boolean; + idem?: string; } ⋮---- /** * - * Coinbase Account Endpoints + * Deposits/Withdrawal Endpoints * */ ⋮---- -export interface CreateCBExchNewCryptoAddress { - account_id: string; - profile_id?: string; - network?: string; +interface DepositWithdrawalPaymentMethod { + id: string; + resource: string; + resource_path: string; } ⋮---- -/** - * - * Conversions Endpoints - * - */ +interface DepositWithdrawalTransaction { + id: string; + resource: string; + resource_path: string; +} ⋮---- -export interface ConvertCBExchCurrencyRequest { - profile_id: string; - from: string; - to: string; +interface DepositWithdrawalAmountCurrency { amount: string; - nonce: string; + currency: string; } ⋮---- -/** - * - * Currencies Endpoints - * - */ +export interface CBAppDepositWithdrawal { + id: string; + status: string; + payment_method: DepositWithdrawalPaymentMethod; + transaction: DepositWithdrawalTransaction; + amount: DepositWithdrawalAmountCurrency; + subtotal: DepositWithdrawalAmountCurrency; + created_at: string; + updated_at: string; + resource: string; + resource_path: string; + committed: boolean; + fee: DepositWithdrawalAmountCurrency; + payout_at: string; +} ⋮---- -/** - * - * Transfers Endpoints - * - */ +interface TransferAmount { + value: string; + currency: string; +} ⋮---- -export interface CBExchDepositFromCoinbaseAccount { - profile_id: string; - amount: string; - coinbase_account_id: string; +interface TransferOwner { + id: string; + uuid: string; + user_uuid: string; + type: string; +} +⋮---- +interface TransferLedgerAccount { + account_id: string; currency: string; + owner: TransferOwner; } ⋮---- -export interface CBExchDepositFromPaymentMethod { - profile_id: string; - amount: string; +interface TransferExternalPaymentMethod { payment_method_id: string; - currency: string; } ⋮---- -export interface CBExchGetTransfersRequest { - profile_id?: string; - before?: string; - after?: string; - limit?: number; - type?: string; - currency_type?: string; - transfer_reason?: string; - currency?: string; +interface TransferSource { + type: string; + network: string; + payment_method_id: string; + external_payment_method: TransferExternalPaymentMethod; } ⋮---- -export interface SubmitCBExchTravelInformation { - transfer_id: string; - originator_name: string; - originator_country: string; +interface TransferTarget { + type: string; + network: string; + payment_method_id: string; + ledger_account: TransferLedgerAccount; } ⋮---- -export interface CBExchWithdrawToCBAccount { - profile_id: string; - amount: string; - coinbase_account_id: string; - currency: string; +interface TransferFee { + title: string; + description: string; + amount: TransferAmount; + type: string; } ⋮---- -export interface CBExchWithdrawToCryptoAddress { - profile_id: string; - amount: string; - currency: string; - crypto_address: string; - destination_tag?: string; - no_destination_tag?: boolean; - nonce?: number; - network?: string; - add_network_fee_to_total?: boolean; - is_intermediary?: boolean; - intermediary_jurisdiction?: string; - travel_rule_data?: object; +export interface CBAppTransferDepositWithdrawal { + user_entered_amount: TransferAmount; + amount: TransferAmount; + total: TransferAmount; + subtotal: TransferAmount; + idem: string; + committed: boolean; + id: string; + instant: boolean; + source: TransferSource; + target: TransferTarget; + payout_at: string; + status: string; + user_reference: string; + type: string; + created_at: string | null; + updated_at: string | null; + user_warnings: any[]; + fees: any[]; + total_fee: TransferFee; + cancellation_reason: string | null; + hold_days: number; + nextStep: any | null; + checkout_url: string; + requires_completion_step: boolean; } ⋮---- -export interface CBExchGetCryptoWithdrawalFeeEstimate { - currency: string; - crypto_address: string; - network?: string; +export interface CBAppTransfer { + transfer: CBAppTransferDepositWithdrawal; } +/** + * + * Subscriptions Endpoints + * + */ ⋮---- -export interface CBExchWithdrawToPaymentMethod { - profile_id: string; - amount: string; - payment_method_id: string; - currency: string; +export interface CBAppCoinbaseOneSubscription { + status: string; + tier: string; + current_period_end: string; +} +⋮---- +/** + * + * DATA - Currencies Endpoints + * + */ +⋮---- +export interface CBAppFiatCurrency { + id: string; + name: string; + min_size: string; +} +⋮---- +export interface CBAppCryptocurrency { + code: string; + name: string; + color: string; + sort_index: number; + exponent: number; + type: string; + address_regex: string; + asset_id: string; } ⋮---- /** * - * Fees Endpoints + * DATA- Exchange rates Endpoints + * + */ +⋮---- +/** + * + * DATA - Prices Endpoints * */ ⋮---- /** * - * Orders Endpoints + * DATA - Time Endpoints + * + */ + +================ +File: src/types/response/coinbase-exchange.ts +================ +/** + * + * Accounts Endpoints * */ ⋮---- -export interface GetCBExchFillsRequest { - order_id?: string; - product_id?: string; - limit?: number; - before?: string; - after?: string; - market_type?: string; - start_date?: string; - end_date?: string; -} +/** + * + * Address book Endpoints + * + */ ⋮---- -export interface GetCBExchOrdersRequest { - profile_id?: string; - product_id?: string; - sortedBy?: string; - sorting?: string; - start_date?: string; - end_date?: string; - before?: string; - after?: string; - limit: number; - status: string[]; - market_type?: string; +export interface CBExchCounterpartyAddress { + id: string; + address: string; + label: string; + added_at: string; } ⋮---- -export interface SubmitCBExchOrderRequest { - profile_id?: string; - type: string; - side: string; - product_id: string; - stp?: string; - stop?: string; - stop_price?: string; - price?: string; - size?: string; - funds?: string; - time_in_force?: string; - cancel_after?: string; - post_only?: boolean; - client_oid?: string; - max_floor?: string; - stop_limit_price?: string; +export interface CBExchCurrencySupportedNetwork { + id: string; + name: string; + status: string; + contract_address?: string; + crypto_address_link?: string; + tx_link?: string; + min_withdrawal_amount?: number; + max_withdrawal_amount?: number; + network_confirmations?: number; + processing_time_seconds?: number; + destination_tag_regex?: string; + is_evm_network?: boolean; } ⋮---- -export interface CancelCBExchOrderRequest { - order_id: string; - profile_id?: string; - product_id?: string; -} +/** + * + * Coinbase Account Endpoints + * + */ ⋮---- /** * - * Loans Endpoints + * Conversions Endpoints * */ ⋮---- -export interface SubmitCBExchNewLoan { - loan_id: string; - currency: string; - native_amount: string; - interest_rate: string; - term_start_date: string; - term_end_date: string; - profile_id: string; -} +/** + * + * Currencies Endpoints + * + */ ⋮---- -export interface RepayCBExchLoanInterest { - idem: string; - from_profile_id: string; - currency: string; - native_amount: string; -} +/** + * + * Transfers Endpoints + * + */ ⋮---- -export interface RepayCBExchLoanPrincipal { - loan_id: string; - idem: string; - from_profile_id: string; - currency: string; - native_amount: string; -} +/** + * + * Fees Endpoints + * + */ ⋮---- -export interface GetCBExchPrincipalRepaymentPreview { - loan_id: string; - currency: string; - native_amount: string; -} /** * - * Coinbase Price Oracle Endpoints + * Orders Endpoints * */ ⋮---- /** * - * Products Endpoints + * Loans Endpoints * */ ⋮---- -export interface GetCBExchProductCandles { - product_id: string; - granularity: number; - start?: string; - end?: string; -} +/** + * + * Coinbase Price Oracle Endpoints + * + */ ⋮---- -export interface GetCBExchProductTrades { - product_id: string; - limit?: number; - before?: string; - after?: string; -} +/** + * + * Products Endpoints + * + */ ⋮---- /** * @@ -36552,57 +3971,18 @@ export interface GetCBExchProductTrades { * */ ⋮---- -export interface TransferCBExchFundsBetweenProfiles { - from: string; - to: string; - currency: string; - amount: string; -} -⋮---- /** * * Reports Endpoints * */ ⋮---- -export interface GetAllCBExchReports { - profile_id?: string; - after?: string; - limit?: number; - type?: string; - ignore_expired?: boolean; -} -⋮---- -export interface CreateCBExchReport { - type: string; - year?: string; - format?: string; - email?: string; - profile_id?: string; - balance?: { datetime?: string; group_by_profile?: boolean }; - fills?: { start_date?: string; end_date?: string; product_id?: string }; - account?: { start_date?: string; end_date?: string; account_id?: string }; - otc_fills?: { start_date?: string; end_date?: string; product_id?: string }; - tax_invoice?: { - start_date?: string; - end_date?: string; - product_id?: string; - }; - rfq_fills?: { start_date?: string; end_date?: string; product_id?: string }; -} -⋮---- /** * * Travel Rule Endpoints * */ ⋮---- -export interface GetCBExchTravelRuleInformation { - before?: string; - after?: string; - limit?: number; - address?: string; -} /** * * Users Endpoints @@ -36614,2547 +3994,2726 @@ export interface GetCBExchTravelRuleInformation { * Wrapped Assets Endpoints * */ -⋮---- -export interface GetCBExchAllStakeWraps { - before?: string; - after?: string; - limit?: number; - from?: string; - to?: string; - status?: string; -} ================ -File: src/types/request/coinbase-international.ts +File: src/CBAdvancedTradeClient.ts ================ -/** - * - * Assets Endpoints - * - */ +import { AxiosRequestConfig } from 'axios'; +⋮---- +import { BaseRestClient } from './lib/BaseRestClient.js'; +import { + REST_CLIENT_TYPE_ENUM, + RestClientOptions, + RestClientType, +} from './lib/requestUtils.js'; +import { + AllocateAdvTradePortfolioRequest, + CloseAdvTradePositionRequest, + GetAdvTradeFillsRequest, + GetAdvTradeMarketTradesRequest, + GetAdvTradeOrdersRequest, + GetAdvTradeProductCandlesRequest, + GetAdvTradeProductsRequest, + GetAdvTradePublicMarketTradesRequest, + GetAdvTradePublicProductCandlesRequest, + GetAdvTradePublicProductsRequest, + GetAdvTradeTransactionSummaryRequest, + MoveAdvTradePortfolioFundsRequest, + PreviewAdvTradeOrderRequest, + SubmitAdvTradeConvertQuoteRequest, + SubmitAdvTradeOrderRequest, + UpdateAdvTradeOrderRequest, +} from './types/request/advanced-trade-client.js'; +import { + AdvTradeAccount, + AdvTradeAccountsList, + AdvTradeApiKeyPermissions, + AdvTradeCancelOrdersResponse, + AdvTradeCandle, + AdvTradeClosePositionResponse, + AdvTradeCurrentMarginWindow, + AdvTradeEditOrderPreviewResponse, + AdvTradeEditOrderResponse, + AdvTradeFill, + AdvTradeFuturesBalance, + AdvTradeFuturesPosition, + AdvTradeFuturesSweep, + AdvTradeMarketTrades, + AdvTradeOrder, + AdvTradeOrderPreview, + AdvTradePaymentMethod, + AdvTradePerpetualsPortfolio, + AdvTradePerpetualsPosition, + AdvTradePerpetualsPositionSummary, + AdvTradePortfolio, + AdvTradePortfolioBalance, + AdvTradePortfolioBreakdown, + AdvTradePricebook, + AdvTradeProduct, + AdvTradePublicProduct, + AdvTradeSubmitOrderResponse, + AdvTradeTransactionSummary, +} from './types/response/advanced-trade-client.js'; ⋮---- /** - * - * Index Endpoints - * + * REST client for Coinbase's Advanced Trade API: + * https://docs.cdp.coinbase.com/advanced-trade/docs/api-overview/ */ +export class CBAdvancedTradeClient extends BaseRestClient ⋮---- -export interface GetINTXIndexCompositionHistory { - index: string; - time_from?: string; - result_limit?: number; - result_offset?: number; -} +constructor( + restClientOptions: RestClientOptions = {}, + requestOptions: AxiosRequestConfig = {}, +) ⋮---- -export interface GetINTXIndexCandlesRequest { - index: string; - granularity: string; - start: string; - end?: string; -} +/** + * + * Custom SDK functions + * + */ ⋮---- /** - * - * Instruments Endpoints - * - */ + * This method is used to get the latency and time sync between the client and the server. + * This is not official API endpoint and is only used for internal testing purposes. + * Use this method to check the latency and time sync between the client and the server. + * Final values might vary slightly, but it should be within few ms difference. + * If you have any suggestions or improvements to this measurement, please create an issue or pull request on GitHub. + */ +async fetchLatencySummary(): Promise ⋮---- -/** Values for `underlying_type` on INTX instruments (REST, WebSocket INSTRUMENTS channel) */ -export type INTXUnderlyingType = - | 'PREIPO' - | 'COMMOD' - | 'COMMOD_INDEX' - | 'COMMOD_ETF' - | string; +// Adjust server time by adding estimated one-way latency ⋮---- -export interface GetINTXDailyTradingVolumes { - instruments: string; - result_limit?: number; - result_offset?: number; - time_from?: string; - show_other?: boolean; -} +// Calculate time difference between adjusted server time and local time +⋮---- +getClientType(): RestClientType ⋮---- -export interface GetINTXAggregatedCandlesData { - instrument: string; - granularity: string; - start: string; - end?: string; -} /** - * - * Position Offsets Endpoints - * - */ + * + * Account Endpoints + * + */ ⋮---- /** - * - * Orders Endpoints - * - */ + * List Accounts + * + * Get a list of authenticated accounts for the current user. + */ +getAccounts(params?: { + limit?: number; + cursor?: string; + retail_portfolio_id?: string; // deprecated +}): Promise ⋮---- -export interface SubmitINTXOrderRequest { - client_order_id?: string; - side: string; - size: string; - tif: string; - instrument: string; - type: string; - price?: string; - stop_price?: string; - stop_limit_price?: string; - expire_time?: string; - portfolio?: string; - user?: string; - stp_mode?: string; - post_only?: boolean; - close_only?: boolean; - algo_strategy?: boolean; -} +retail_portfolio_id?: string; // deprecated ⋮---- -export interface GetINTXOpenOrdersRequest { - portfolio?: string; - instrument?: string; - instrument_type?: string; - client_order_id?: string; - event_type?: string; - order_type?: string; - side?: string; - ref_datetime?: string; - result_limit?: number; - result_offset?: number; -} +/** + * Get Account + * + * Get a list of information about single account, given an account UUID. + * Tip: Use List Accounts (getAccounts funcion) to find account UUIDs. + */ +getAccount(params: ⋮---- -export interface CancelINTXOrdersRequest { - portfolio: string; - instrument?: string; - side?: string; - instrument_type?: string; -} +/** + * + * Products Endpoints + * + */ ⋮---- -export interface UpdateINTXOpenOrderRequest { - id: string; - client_order_id?: string; - portfolio?: string; - price?: string; - stop_price?: string; - size?: string; -} +/** + * Get Best Bid/Ask + * + * Get the best bid/ask for all products. A subset of all products can be returned instead by using the product_ids input. + */ +getBestBidAsk(params?: ⋮---- /** - * - * Portfolios Endpoints - * - */ + * Get Product Book + * + * Get a list of bids/asks for a single product. The amount of detail shown can be customized with the limit parameter. + */ +getProductBook(params: { + product_id: string; + limit?: number; + aggregation_price_increment?: string; +}): Promise< ⋮---- -export interface UpdateINTXPortfolioParametersRequest { - auto_margin_enabled?: boolean; - cross_collateral_enabled?: boolean; - position_offsets_enabled?: boolean; - pre_launch_trading_enabled?: boolean; - portfolio_name?: string; -} +/** + * List Products + * + * Get a list of the available currency pairs for trading. + * + */ +getProducts(params?: GetAdvTradeProductsRequest): Promise< ⋮---- -export interface GetINTXFillsByPortfoliosRequest { - portfolios?: string; - order_id?: string; - client_order_id?: string; - ref_datetime?: string; - result_limit?: number; - result_offset?: number; - time_from?: string; -} +/** + * Get Product + * + * Get information on a single product by product ID. + */ +getProduct(params: { + product_id: string; + get_tradability_status?: boolean; +}): Promise ⋮---- -export interface GetINTXPortfolioFillsRequest { - portfolio: string; - order_id?: string; - client_order_id?: string; - ref_datetime?: string; - result_limit?: number; - result_offset?: number; - time_from?: string; -} +/** + * Get Product Candles + * + * Get rates for a single product by product ID, grouped in buckets. + */ +getProductCandles(params: GetAdvTradeProductCandlesRequest): Promise< ⋮---- -export interface TransferINTXFundsBetweenPortfoliosRequest { - from: string; - to: string; - asset: string; - amount: string; -} +/** + * Get Market Trades + * + * Get snapshot information by product ID about the last trades (ticks) and best bid/ask. + */ +getMarketTrades( + params: GetAdvTradeMarketTradesRequest, +): Promise ⋮---- -export interface TransferINTXPositionsBetweenPortfoliosRequest { - from: string; - to: string; - instrument: string; - quantity: string; - side: string; -} +/** + * + * Orders Endpoints + * + */ ⋮---- /** - * - * Rankings Endpoints - * - */ + * Create Order + * + * Create an order with a specified product_id (asset-pair), side (buy/sell), etc. + * + */ +submitOrder( + params: SubmitAdvTradeOrderRequest, +): Promise ⋮---- /** - * - * Transfers Endpoints - * - */ -⋮---- -export interface GetINTXMatchingTransfersRequest { - portfolio?: string; - portfolios?: string; - time_from?: string; - time_to?: string; - result_limit?: number; - result_offset?: number; - status?: string; - type?: string; -} -⋮---- -export interface INTXWithdrawToCryptoAddressRequest { - portfolio: string; - asset: string; - amount: string; - add_network_fee_to_total?: boolean; - network_arn_id: string; - address: string; - nonce: number; -} + * Cancel Orders + * + * Initiate cancel requests for one or more orders. + * The maximum number of order_ids that can be cancelled per request is 100. + * This number may be subject to change in emergency, but if a request exceeds the max, + * then an InvalidArgument error code will be returned with an error message denoting the limit. + */ +cancelOrders(params: { + order_ids: string[]; +}): Promise ⋮---- -export interface INTXWithdrawToCounterpartyIdRequest { - portfolio: string; - counterparty_id: string; - asset: string; - amount: string; - nonce: number; -} /** - * - * Fee Rates Endpoints - * - */ - -================ -File: src/types/response/coinbase-app-client.ts -================ -export interface CBAppPagination { - ending_before?: string | null; - starting_after?: string | null; - limit?: number; - order?: string; - previous_uri: string | null; - next_uri: string | null; -} + * Edit Order + * + * Edit an order with a specified new size, or new price. + * + * - Your request moves to the back of the queue if you increase the size or increase or decrease the price. + * - If you decrease the size, you keep your place in line. + * - A client can only send an Edit Order request after the previous request for the same order has been fully processed. + */ +updateOrder( + params: UpdateAdvTradeOrderRequest, +): Promise ⋮---- /** - * - * Account Endpoints - * - */ + * Edit Order Preview + * + * Preview an edit order request with a specified new size, or new price. + * + */ +updateOrderPreview( + params: UpdateAdvTradeOrderRequest, +): Promise ⋮---- -interface AccountCurrency { - address_regex: string; - asset_id: string; - code: string; - color: string; - exponent: number; - name: string; - slug: string; - sort_index: number; - type: string; -} +/** + * List Orders + * + * Get a list of orders filtered by optional query parameters. + * + * - The maximum number of OPEN orders returned is 1000. + * - The parameters start_date and end_date don't apply to open orders. + * - You cannot pair open orders with other order types. + * - You cannot query for OPEN orders with other order types. + */ +getOrders(params?: GetAdvTradeOrdersRequest): Promise< ⋮---- -interface AccountBalance { - amount: string; - currency: string; -} +/** + * List Fills + * + * Get a list of fills filtered by optional query parameters (product_id, order_id, etc). + * + */ +getFills(params?: GetAdvTradeFillsRequest): Promise< ⋮---- -export interface CBAppAccount { - id: string; - name: string; - primary: boolean; - type: string; - currency: AccountCurrency; - balance: AccountBalance; - created_at: string; - updated_at: string; - resource: string; - resource_path: string; - ready: boolean; -} +/** + * Get Order + * + * Get a single order by order ID. + */ +getOrder(params: { + order_id: string; + client_order_id?: string; + user_native_currency?: string; +}): Promise< ⋮---- /** - * - * Address Endpoints - * - */ + * Preview Order + * + * Preview an order. + * + */ +previewOrder( + params: PreviewAdvTradeOrderRequest, +): Promise ⋮---- -export interface CBAppAddress { - id: string; - address: string; - name?: string; - network: string; - created_at: string; - updated_at: string; - resource: string; - resource_path: string; -} +/** + * Close Position + * + * Places an order to close any open positions for a specified product_id. + * + */ +closePosition( + params: CloseAdvTradePositionRequest, +): Promise ⋮---- /** - * - * Transactions Endpoints - * - */ + * + * Portfolios Endpoints + * + */ ⋮---- -interface TransactionAmount { - amount: string; - currency: string; -} +/** + * List Portfolios + * + * Get all portfolios of a user. + */ +getPortfolios(params?: { + portfolio_type?: 'UNDEFINED' | 'DEFAULT' | 'CONSUMER' | 'INTX'; +}): Promise< ⋮---- -interface TransactionNetwork { - status: string; - name: string; - hash?: string; - transaction_fee?: TransactionAmount; - transaction_amount?: TransactionAmount; - network_name?: string; - status_description?: string | null; -} +/** + * Create Portfolio + * + * Create a portfolio. + */ +createPortfolio(params: ⋮---- -interface TransactionFrom { - id: string; - resource: string; - resource_path?: string; -} +/** + * Move Portfolio Funds + * + * Move funds between portfolios. + */ +movePortfolioFunds(params: MoveAdvTradePortfolioFundsRequest): Promise< ⋮---- -interface TransactionTo { - resource: string; - address?: string; - email?: string; - id?: string; - resource_path?: string; -} +/** + * Get Portfolio Breakdown + * + * Get the breakdown of a portfolio. + */ +getPortfolioBreakdown(params: { + portfolio_uuid: string; + currency?: string; +}): Promise< ⋮---- -interface TransactionDetails { - title: string; - subtitle: string; - header?: string; - health?: string; - subsidebar_label?: string | null; -} +/** + * Delete Portfolio + * + * Delete a portfolio. + */ +deletePortfolio(params: ⋮---- -interface AdvancedTradeFill { - fill_price: string; - product_id: string; - order_id: string; - commission: string; - order_side: 'BUY' | 'SELL'; -} +/** + * Edit Portfolio + * + * Edit a portfolio. + * + */ +updatePortfolio(params: { + portfolio_uuid: string; + name: string; +}): Promise< ⋮---- -export interface CBAppTransaction { - id: string; - type: string; - status: string; - amount: TransactionAmount; - native_amount: TransactionAmount; - description: string | null; - created_at: string; - updated_at: string; - resource: string; - resource_path: string; - network?: TransactionNetwork; - from?: TransactionFrom; - to?: TransactionTo; - details?: TransactionDetails; - instant_exchange?: boolean; - advanced_trade_fill?: AdvancedTradeFill; - cancelable?: boolean; - idem?: string; -} +/** + * + * Futures Endpoints + * + */ ⋮---- /** - * - * Deposits/Withdrawal Endpoints - * - */ + * Get Futures Balance Summary + * + * Get a summary of balances for CFM trading. + * + * Futures vs Spot Accounts: + * - Futures and spot balances are held in different accounts. + * - Cash is always deposited into your Coinbase Inc. (CBI) spot account. + * - Cash is automatically transferred to your Coinbase Financial Markets (CFM) futures account to satisfy margin requirements. + * - You can transfer cash that isn't being used to margin or maintain futures positions into your CBI spot account. + * - Funds held in a CBI spot account do not receive the preferential treatment given to funds held in a regulated futures account. + * + * Intraday vs. Overnight Margin Health: + * - If you are opted in to receive increased leverage on futures trades during the intraday window (from 8am-4pm ET), this endpoint will return your intraday and overnight margin health. + */ +getFuturesBalanceSummary(): Promise< ⋮---- -interface DepositWithdrawalPaymentMethod { - id: string; - resource: string; - resource_path: string; -} +/** + * Get Intraday Margin Setting + * + * Get the futures intraday margin setting. + */ +getIntradayMarginSetting(): Promise< ⋮---- -interface DepositWithdrawalTransaction { - id: string; - resource: string; - resource_path: string; -} +/** + * Set Intraday Margin Setting + * + * Set the futures intraday margin setting. + */ +setIntradayMarginSetting(params?: { + setting?: + | 'INTRADAY_MARGIN_SETTING_UNSPECIFIED' + | 'INTRADAY_MARGIN_SETTING_STANDARD' + | 'INTRADAY_MARGIN_SETTING_INTRADAY'; +}): Promise ⋮---- -interface DepositWithdrawalAmountCurrency { - amount: string; - currency: string; -} +/** + * Get Current Margin Window + * + * Get the futures current margin window. + */ +getCurrentMarginWindow(params?: { + margin_profile_type?: + | 'MARGIN_PROFILE_TYPE_UNSPECIFIED' + | 'MARGIN_PROFILE_TYPE_RETAIL_REGULAR' + | 'MARGIN_PROFILE_TYPE_RETAIL_INTRADAY_MARGIN_1'; +}): Promise ⋮---- -export interface CBAppDepositWithdrawal { - id: string; - status: string; - payment_method: DepositWithdrawalPaymentMethod; - transaction: DepositWithdrawalTransaction; - amount: DepositWithdrawalAmountCurrency; - subtotal: DepositWithdrawalAmountCurrency; - created_at: string; - updated_at: string; - resource: string; - resource_path: string; - committed: boolean; - fee: DepositWithdrawalAmountCurrency; - payout_at: string; -} +/** + * List Futures Positions + * + * Get a list of positions in CFM products. + */ +getFuturesPositions(): Promise< ⋮---- -interface TransferAmount { - value: string; - currency: string; -} +/** + * Get Futures Position + * + * Get positions for a specific CFM product. + */ +getFuturesPosition(params: { + product_id: string; +}): Promise< ⋮---- -interface TransferOwner { - id: string; - uuid: string; - user_uuid: string; - type: string; -} +/** + * Schedule Futures Sweep + * + * Schedules a sweep of funds from FCM wallet to USD Spot wallet. + * + * Futures Sweep Processing: + * - Sweep requests submitted before 5PM ET each day are processed the following business day. + * - Sweep requests submitted after 5PM ET each day are processed in 2 business days. + * - You can have at most one pending sweep request at a time. + * + * Market movements related to your open positions may impact the final amount that is transferred into your spot account. + * The final funds transferred, up to your specified amount, depend on the available excess in your futures account. + */ +scheduleFuturesSweep(params?: { + usd_amount?: string; +}): Promise< ⋮---- -interface TransferLedgerAccount { - account_id: string; - currency: string; - owner: TransferOwner; -} +/** + * List Futures Sweeps + * + * Get pending and processing sweeps of funds from FCM wallet to USD Spot wallet. + * + * Pending vs. Processing Sweeps: + * - A pending sweep is a sweep that has not started processing and can be cancelled. + * - A processing sweep is a sweep that is currently being processed and cannot be cancelled. + * - Once a sweep is complete, it no longer appears in the list of sweeps. + */ +getFuturesSweeps(): Promise< ⋮---- -interface TransferExternalPaymentMethod { - payment_method_id: string; -} +/** + * Cancel Pending Futures Sweep + * + * Cancel the pending sweep of funds from FCM wallet to USD Spot wallet. + */ +cancelPendingFuturesSweep(): Promise< ⋮---- -interface TransferSource { - type: string; - network: string; - payment_method_id: string; - external_payment_method: TransferExternalPaymentMethod; -} +/** + * + * Perpetuals Endpoints + * + */ ⋮---- -interface TransferTarget { - type: string; - network: string; - payment_method_id: string; - ledger_account: TransferLedgerAccount; -} +/** + * Allocate Portfolio + * + * Allocate portfolio funds to a sub-portfolio on Intx Portfolio. + * + */ +allocatePortfolio(params: AllocateAdvTradePortfolioRequest): Promise ⋮---- -interface TransferFee { - title: string; - description: string; - amount: TransferAmount; - type: string; -} +/** + * Get Perpetuals Portfolio Summary + * + * Get a summary of your Perpetuals portfolio. + */ +getPerpetualsPortfolioSummary(params: { + portfolio_uuid: string; +}): Promise ⋮---- -export interface CBAppTransferDepositWithdrawal { - user_entered_amount: TransferAmount; - amount: TransferAmount; - total: TransferAmount; - subtotal: TransferAmount; - idem: string; - committed: boolean; - id: string; - instant: boolean; - source: TransferSource; - target: TransferTarget; - payout_at: string; - status: string; - user_reference: string; - type: string; - created_at: string | null; - updated_at: string | null; - user_warnings: any[]; - fees: any[]; - total_fee: TransferFee; - cancellation_reason: string | null; - hold_days: number; - nextStep: any | null; - checkout_url: string; - requires_completion_step: boolean; -} +/** + * List Perpetuals Positions + * + * Get a list of open positions in your Perpetuals portfolio. + */ +getPerpetualsPositions(params: { + portfolio_uuid: string; +}): Promise ⋮---- -export interface CBAppTransfer { - transfer: CBAppTransferDepositWithdrawal; -} /** - * - * Subscriptions Endpoints - * - */ + * Get Perpetuals Position + * + * Get a specific open position on Intx. + * + */ +getPerpetualsPosition(params: { + portfolio_uuid: string; + symbol: string; +}): Promise< ⋮---- -export interface CBAppCoinbaseOneSubscription { - status: string; - tier: string; - current_period_end: string; -} +/** + * Get Portfolios Balances + * + * Get a list of asset balances on Intx for a given Portfolio. + */ +getPortfoliosBalances(params: ⋮---- /** - * - * DATA - Currencies Endpoints - * - */ + * Opt In or Out of Multi Asset Collateral + * + * Enable or Disable Multi Asset Collateral for a given Portfolio. + */ +updateMultiAssetCollateral(params?: { + portfolio_uuid?: string; + multi_asset_collateral_enabled?: boolean; +}): Promise< ⋮---- -export interface CBAppFiatCurrency { - id: string; - name: string; - min_size: string; -} +/** + * + * Fees Endpoints + * + */ ⋮---- -export interface CBAppCryptocurrency { - code: string; - name: string; - color: string; - sort_index: number; - exponent: number; - type: string; - address_regex: string; - asset_id: string; -} +/** + * Get Transaction Summary + * + * Get a summary of transactions with fee tiers, total volume, and fees. + */ +getTransactionSummary( + params?: GetAdvTradeTransactionSummaryRequest, +): Promise ⋮---- /** - * - * DATA- Exchange rates Endpoints - * - */ + * + * Converts Endpoints + * + */ ⋮---- /** - * - * DATA - Prices Endpoints - * - */ + * Create Convert Quote + * + * Create a convert quote with a specified source account, target account, and amount. + * Convert is applicable for USDC-USD and EURC-EUR conversion. + */ +submitConvertQuote(params: SubmitAdvTradeConvertQuoteRequest): Promise ⋮---- /** - * - * DATA - Time Endpoints - * - */ - -================ -File: src/types/response/coinbase-exchange.ts -================ + * Get Convert Trade + * + * Gets a list of information about a convert trade with a specified trade id, source account, and target account. + */ +getConvertTrade(params: { + trade_id: string; + from_account: string; + to_account: string; +}): Promise +⋮---- /** - * - * Accounts Endpoints - * - */ + * Commit Convert Trade + * + * Commits a convert trade with a specified trade id, source account, and target account. + */ +commitConvertTrade(params: { + trade_id: string; + from_account: string; + to_account: string; +}): Promise ⋮---- /** - * - * Address book Endpoints - * - */ + * + * Public Endpoints + * + */ ⋮---- -export interface CBExchCounterpartyAddress { - id: string; - address: string; - label: string; - added_at: string; -} +getServerTime(): Promise< ⋮---- -export interface CBExchCurrencySupportedNetwork { - id: string; - name: string; - status: string; - contract_address?: string; - crypto_address_link?: string; - tx_link?: string; - min_withdrawal_amount?: number; - max_withdrawal_amount?: number; - network_confirmations?: number; - processing_time_seconds?: number; - destination_tag_regex?: string; - is_evm_network?: boolean; -} +/** + * Get Public Product Book + * + * Get a list of bids/asks for a single product. The amount of detail shown can be customized with the limit parameter. + */ +getPublicProductBook(params: { + product_id: string; + limit?: number; + aggregation_price_increment?: string; +}): Promise< ⋮---- /** - * - * Coinbase Account Endpoints - * - */ + * List Public Products + * + * Get a list of the available currency pairs for trading. + */ +getPublicProducts(params?: GetAdvTradePublicProductsRequest): Promise< ⋮---- /** - * - * Conversions Endpoints - * - */ + * Get Public Product + * + * Get information on a single product by product ID. + */ +getPublicProduct(params: { + product_id: string; +}): Promise ⋮---- /** - * - * Currencies Endpoints - * - */ + * Get Public Product Candles + * + * Get rates for a single product by product ID, grouped in buckets. + */ +getPublicProductCandles( + params: GetAdvTradePublicProductCandlesRequest, +): Promise< ⋮---- /** - * - * Transfers Endpoints - * - */ + * Get Public Market Trades + * + * Get snapshot information by product ID about the last trades (ticks) and best bid/ask. + */ +getPublicMarketTrades( + params: GetAdvTradePublicMarketTradesRequest, +): Promise ⋮---- /** - * - * Fees Endpoints - * - */ + * + * Payment Methods Endpoints + * + */ ⋮---- /** - * - * Orders Endpoints - * - */ + * List Payment Methods + * + * Get a list of payment methods for the current user. + */ +getPaymentMethods(): Promise< ⋮---- /** - * - * Loans Endpoints - * - */ + * Get Payment Method + * + * Get information about a payment method for the current user. + */ +getPaymentMethod(params: ⋮---- /** - * - * Coinbase Price Oracle Endpoints - * - */ + * + * Data API Endpoints + * + */ ⋮---- /** - * - * Products Endpoints - * - */ + * Get API Key Permissions + * + * Get information about your CDP API key permissions. + */ +getApiKeyPermissions(): Promise + +================ +File: src/CBAppClient.ts +================ +import { AxiosRequestConfig } from 'axios'; +⋮---- +import { BaseRestClient } from './lib/BaseRestClient.js'; +import { + getParamsFromURL, + REST_CLIENT_TYPE_ENUM, + RestClientOptions, + RestClientType, +} from './lib/requestUtils.js'; +import { + CBAppDepositFundsRequest, + CBAppSendMoneyRequest, + CBAppTransferMoneyRequest, + CBAppWithdrawFundsRequest, +} from './types/request/coinbase-app-client.js'; +import { + CBAppAccount, + CBAppAddress, + CBAppCoinbaseOneSubscription, + CBAppCryptocurrency, + CBAppDepositWithdrawal, + CBAppFiatCurrency, + CBAppPagination, + CBAppTransaction, + CBAppTransfer, +} from './types/response/coinbase-app-client.js'; ⋮---- /** - * - * Profiles Endpoints - * + * REST client for Coinbase's Coinbase App API: + * https://docs.cdp.coinbase.com/coinbase-app/docs/welcome */ +export class CBAppClient extends BaseRestClient ⋮---- -/** - * - * Reports Endpoints - * - */ +constructor( + restClientOptions: RestClientOptions = {}, + requestOptions: AxiosRequestConfig = {}, +) ⋮---- -/** - * - * Travel Rule Endpoints - * - */ +// Some endpoints return a warning if a version header isn't included: https://docs.cdp.coinbase.com/coinbase-app/docs/versioning +// Currently set to a date from the changelog: https://docs.cdp.coinbase.com/coinbase-app/docs/changelog ⋮---- -/** - * - * Users Endpoints - * - */ +getClientType(): RestClientType ⋮---- /** - * - * Wrapped Assets Endpoints - * - */ - -================ -File: src/types/websockets/requests.ts -================ -/* eslint-disable @typescript-eslint/no-unused-vars */ -export type WsOperation = 'subscribe' | 'unsubscribe'; + * + * Account Endpoints + * + */ ⋮---- /** - * This is the format used for commands sent upstream for this websocket connection. - * - * Docs: - * - Adv Trade: https://docs.cdp.coinbase.com/advanced-trade/docs/ws-auth#subscribing - */ -export interface WsAdvTradeRequestOperation { - type: WsOperation; - channel: TWSTopic; - product_ids?: string[]; - jwt?: string; -} -⋮---- -export interface WsExchangeChannelWithParams { - name: TWSTopic; - product_ids: string[]; -} + * List Accounts + * + * List a current user's accounts to which the authentication method has access to. + * + * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. + * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of accounts. + */ +getAccounts(params?: { + paginationURL?: string; + starting_after?: string; +}): Promise< ⋮---- /** - * Public subscribe/unsubscribe requests for the Coinbase Exchange product group - */ -export interface WsExchangeRequestOperation { - type: WsOperation; - channels: (TWSTopic | WsExchangeChannelWithParams)[]; - product_ids?: string[]; -} + * Show Account + * + * Get a current user's account by account ID or currency string. + */ +getAccount(params: ⋮---- /** - * Private (authenticated) subscribe/unsubscribe requests for the Coinbase Exchange product group - * https://docs.cdp.coinbase.com/exchange/docs/websocket-auth - */ -export type WsExchangeAuthenticatedRequestOperation< - TWSTopic extends string = string, -> = WsExchangeRequestOperation & { - signature: string; - key: string; - passphrase: string; - timestamp: string; -}; + * + * Address Endpoints + * + */ ⋮---- /** - * Public subscribe/unsubscribe requests for the Coinbase International product group - */ -export interface WsInternationalRequestOperation< - TWSTopic extends string = string, -> { - type: Uppercase; - channels: TWSTopic[]; - product_ids?: string[]; -} + * Create Address + * + * Creates a new address for an account. Addresses can be created for wallet account types. + */ +createAddress(params: ⋮---- /** - * Private (authenticated) subscribe/unsubscribe requests for the Coinbase International product group - * https://docs.cdp.coinbase.com/intx/docs/websocket-auth - */ -export type WsInternationalAuthenticatedRequestOperation< - TWSTopic extends string = string, -> = WsInternationalRequestOperation & { - time: string; - key: string; - passphrase: string; - signature: string; -}; + * List Addresses + * + * Lists addresses for an account. + * + * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. + * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of addresses. + */ +getAddresses(params: { + account_id: string; + paginationURL?: string; +}): Promise< ⋮---- /** - * Public subscribe/unsubscribe requests for the Coinbase Prime product group - */ -export interface WsPrimeRequestOperation { - type: WsOperation; - channel: TWSTopic; - // these should be provided as a payload with the request, else auth will fail - svcAccountId: string; - portfolio_id: string; - product_ids: string[]; - /** Not included in the signature payload. Case-sensitive. */ - product_type?: - | 'SPOT' - | 'FUTURE' - | 'OPTION' - | 'PREDICTION_MARKET' - | 'UNKNOWN_PRODUCT_TYPE'; -} -⋮---- -// these should be provided as a payload with the request, else auth will fail + * Show Address + * + * Get an single address for an account. + * A regular cryptocurrency address can be used in place of address_id but the address must be associated with the correct account. + * + * !! An address can only be associated with one account. See Create Address to create new addresses. + */ +getAddress(params: ⋮---- -/** Not included in the signature payload. Case-sensitive. */ +/** + * List Address Transactions + * + * List transactions that have been sent to a specific address. + * A regular cryptocurrency address can be used in place of address_id but the address must be associated with the correct account. + * + * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. + * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of transactions. + */ +getAddressTransactions(params: { + account_id: string; + addressId: string; + paginationURL?: string; +}): Promise< ⋮---- /** - * Private (authenticated) subscribe/unsubscribe requests for the Coinbase Prime product group - * - * - https://docs.cdp.coinbase.com/prime/docs/websocket-feed#signing-messages - * - https://docs.cdp.coinbase.com/prime/docs/websocket-channels - */ -export type WsPrimeAuthenticatedRequestOperation< - TWSTopic extends string = string, -> = WsPrimeRequestOperation & { - access_key: string; - api_key_id: string; - passphrase: string; - signature: string; - timestamp: string; -}; - -================ -File: src/CBAdvancedTradeClient.ts -================ -import { AxiosRequestConfig } from 'axios'; + * + * Transactions Endpoints + * + */ ⋮---- -import { BaseRestClient } from './lib/BaseRestClient.js'; -import { - REST_CLIENT_TYPE_ENUM, - RestClientOptions, - RestClientType, -} from './lib/requestUtils.js'; -import { - AllocateAdvTradePortfolioRequest, - CloseAdvTradePositionRequest, - GetAdvTradeFillsRequest, - GetAdvTradeMarketTradesRequest, - GetAdvTradeOrdersRequest, - GetAdvTradeProductCandlesRequest, - GetAdvTradeProductsRequest, - GetAdvTradePublicMarketTradesRequest, - GetAdvTradePublicProductCandlesRequest, - GetAdvTradePublicProductsRequest, - GetAdvTradeTransactionSummaryRequest, - MoveAdvTradePortfolioFundsRequest, - PreviewAdvTradeOrderRequest, - SubmitAdvTradeConvertQuoteRequest, - SubmitAdvTradeOrderRequest, - UpdateAdvTradeOrderRequest, -} from './types/request/advanced-trade-client.js'; -import { - AdvTradeAccount, - AdvTradeAccountsList, - AdvTradeApiKeyPermissions, - AdvTradeCancelOrdersResponse, - AdvTradeCandle, - AdvTradeClosePositionResponse, - AdvTradeCurrentMarginWindow, - AdvTradeEditOrderPreviewResponse, - AdvTradeEditOrderResponse, - AdvTradeFill, - AdvTradeFuturesBalance, - AdvTradeFuturesPosition, - AdvTradeFuturesSweep, - AdvTradeMarketTrades, - AdvTradeOrder, - AdvTradeOrderPreview, - AdvTradePaymentMethod, - AdvTradePerpetualsPortfolio, - AdvTradePerpetualsPosition, - AdvTradePerpetualsPositionSummary, - AdvTradePortfolio, - AdvTradePortfolioBalance, - AdvTradePortfolioBreakdown, - AdvTradePricebook, - AdvTradeProduct, - AdvTradePublicProduct, - AdvTradeSubmitOrderResponse, - AdvTradeTransactionSummary, -} from './types/response/advanced-trade-client.js'; +/** + * Send Money + * + * Send funds to a network address for any Coinbase supported asset, or email address of the recipient. + * No transaction fees are required for off-blockchain cryptocurrency transactions. + * + * TRAVEL RULE DATA GUIDE: https://docs.cdp.coinbase.com/coinbase-app/docs/coinbase-app-travel-rule + */ +sendMoney( + params: CBAppSendMoneyRequest, +): Promise< ⋮---- /** - * REST client for Coinbase's Advanced Trade API: - * https://docs.cdp.coinbase.com/advanced-trade/docs/api-overview/ - */ -export class CBAdvancedTradeClient extends BaseRestClient -⋮---- -constructor( - restClientOptions: RestClientOptions = {}, - requestOptions: AxiosRequestConfig = {}, -) + * Transfer Money + * + * Transfer any Coinbase supported digital asset between two of a single user's accounts. + * Accounts must support the same currency for transfers to be successful. + */ +transferMoney( + params: CBAppTransferMoneyRequest, +): Promise< ⋮---- /** + * List Transactions * - * Custom SDK functions + * Lists the transactions of an account by account ID. * + * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. + * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of transactions. */ +getTransactions(params: { + account_id: string; + paginationURL?: string; +}): Promise< ⋮---- /** - * This method is used to get the latency and time sync between the client and the server. - * This is not official API endpoint and is only used for internal testing purposes. - * Use this method to check the latency and time sync between the client and the server. - * Final values might vary slightly, but it should be within few ms difference. - * If you have any suggestions or improvements to this measurement, please create an issue or pull request on GitHub. + * Show Transaction + * + * Get a single transaction for an account. */ -async fetchLatencySummary(): Promise +getTransaction(params: { + account_id: string; + transactionId: string; +}): Promise< ⋮---- -// Adjust server time by adding estimated one-way latency +/** + * + * Deposits Endpoints + * + */ ⋮---- -// Calculate time difference between adjusted server time and local time +/** + * Deposit Funds + * + * Deposits user-defined amount of funds to a fiat account. + */ +depositFunds(params: CBAppDepositFundsRequest): Promise ⋮---- -getClientType(): RestClientType +/** + * Commit Deposit + * + * Completes a deposit that is created in commit: false state. + */ +commitDeposit(params: { + account_id: string; + deposit_id: string; +}): Promise ⋮---- /** + * List Deposits * - * Account Endpoints + * Lists fiat deposits for an account. * + * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. + * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of deposits. */ +getDeposits(params: ⋮---- /** - * List Accounts + * Show Deposit * - * Get a list of authenticated accounts for the current user. + * Get one deposit by deposit Id. */ -getAccounts(params?: { - limit?: number; - cursor?: string; - retail_portfolio_id?: string; // deprecated -}): Promise -⋮---- -retail_portfolio_id?: string; // deprecated +getDeposit(params: ⋮---- /** - * Get Account * - * Get a list of information about single account, given an account UUID. - * Tip: Use List Accounts (getAccounts funcion) to find account UUIDs. + * Withdrawals Endpoints + * */ -getAccount(params: ⋮---- /** + * Withdraw Funds * - * Products Endpoints + * Withdraws a user-defined amount of funds from a fiat account. + */ +withdrawFunds(params: CBAppWithdrawFundsRequest): Promise +⋮---- +/** + * Commit Withdrawal * + * Completes a withdrawal that is created in commit: false state. */ +commitWithdrawal(params: { + account_id: string; + withdrawal_id: string; +}): Promise ⋮---- /** - * Get Best Bid/Ask + * List Withdrawals * - * Get the best bid/ask for all products. A subset of all products can be returned instead by using the product_ids input. + * Lists withdrawals for an account. + * + * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. + * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of withdrawals. */ -getBestBidAsk(params?: +getWithdrawals(params: { + account_id: string; + paginationURL?: string; +}): Promise< ⋮---- /** - * Get Product Book + * Show Withdrawal * - * Get a list of bids/asks for a single product. The amount of detail shown can be customized with the limit parameter. + * Get a single withdrawal. */ -getProductBook(params: { - product_id: string; - limit?: number; - aggregation_price_increment?: string; +getWithdrawal(params: { + account_id: string; + withdrawal_id: string; }): Promise< ⋮---- /** - * List Products * - * Get a list of the available currency pairs for trading. + * Subscriptions Endpoints * */ -getProducts(params?: GetAdvTradeProductsRequest): Promise< ⋮---- /** - * Get Product + * Get Coinbase One Subscription * - * Get information on a single product by product ID. + * Returns a user's Coinbase One subscription status, tier, and current period end. + * Requires OAuth2 scope: wallet:subscription:read */ -getProduct(params: { - product_id: string; - get_tradability_status?: boolean; -}): Promise +getCoinbaseOneSubscription(): Promise< ⋮---- /** - * Get Product Candles * - * Get rates for a single product by product ID, grouped in buckets. + * DATA - Currencies Endpoints + * */ -getProductCandles(params: GetAdvTradeProductCandlesRequest): Promise< ⋮---- /** - * Get Market Trades + * Get Fiat Currencies * - * Get snapshot information by product ID about the last trades (ticks) and best bid/ask. + * Lists known fiat currencies. Currency codes conform to the ISO 4217 standard where possible. + * Currencies with no representation in ISO 4217 may use a custom code. */ -getMarketTrades( - params: GetAdvTradeMarketTradesRequest, -): Promise +getFiatCurrencies(): Promise< ⋮---- /** + * Get Cryptocurrencies * - * Orders Endpoints - * + * Lists known cryptocurrencies. */ +getCryptocurrencies(): Promise ⋮---- /** - * Create Order * - * Create an order with a specified product_id (asset-pair), side (buy/sell), etc. + * DATA- Exchange rates Endpoints * */ -submitOrder( - params: SubmitAdvTradeOrderRequest, -): Promise ⋮---- /** - * Cancel Orders + * Get Exchange Rates * - * Initiate cancel requests for one or more orders. - * The maximum number of order_ids that can be cancelled per request is 100. - * This number may be subject to change in emergency, but if a request exceeds the max, - * then an InvalidArgument error code will be returned with an error message denoting the limit. + * Get current exchange rates. Default base currency is USD but it can be defined as any supported currency. + * Returned rates will define the exchange rate for one unit of the base currency. */ -cancelOrders(params: { - order_ids: string[]; -}): Promise +getExchangeRates(params?: ⋮---- /** - * Edit Order * - * Edit an order with a specified new size, or new price. + * DATA - Prices Endpoints * - * - Your request moves to the back of the queue if you increase the size or increase or decrease the price. - * - If you decrease the size, you keep your place in line. - * - A client can only send an Edit Order request after the previous request for the same order has been fully processed. */ -updateOrder( - params: UpdateAdvTradeOrderRequest, -): Promise ⋮---- /** - * Edit Order Preview - * - * Preview an edit order request with a specified new size, or new price. + * Get Buy Price * + * Get the total price to buy one bitcoin or ether. + * This endpoint doesn't require authentication. */ -updateOrderPreview( - params: UpdateAdvTradeOrderRequest, -): Promise +getBuyPrice(params: ⋮---- /** - * List Orders + * Get Sell Price * - * Get a list of orders filtered by optional query parameters. + * Get the total price to sell one bitcoin or ether. + * This endpoint doesn't require authentication. + */ +getSellPrice(params: +⋮---- +/** + * Get Spot Price * - * - The maximum number of OPEN orders returned is 1000. - * - The parameters start_date and end_date don't apply to open orders. - * - You cannot pair open orders with other order types. - * - You cannot query for OPEN orders with other order types. + * Get the current market price for bitcoin. This is usually somewhere in between the buy and sell price. + * This endpoint doesn't require authentication. */ -getOrders(params?: GetAdvTradeOrdersRequest): Promise< +getSpotPrice(params: ⋮---- /** - * List Fills * - * Get a list of fills filtered by optional query parameters (product_id, order_id, etc). + * DATA - Time Endpoints * */ -getFills(params?: GetAdvTradeFillsRequest): Promise< ⋮---- /** - * Get Order + * Get Current Time * - * Get a single order by order ID. + * Get the API server time. + * This endpoint doesn't require authentication. */ -getOrder(params: { - order_id: string; - client_order_id?: string; - user_native_currency?: string; -}): Promise< +getCurrentTime(): Promise< + +================ +File: src/CBExchangeClient.ts +================ +import { AxiosRequestConfig } from 'axios'; +⋮---- +import { BaseRestClient } from './lib/BaseRestClient.js'; +import { + REST_CLIENT_TYPE_ENUM, + RestClientOptions, + RestClientType, +} from './lib/requestUtils.js'; +import { + CancelCBExchOrderRequest, + CBExchDepositFromCoinbaseAccount, + CBExchDepositFromPaymentMethod, + CBExchGetCryptoWithdrawalFeeEstimate, + CBExchGetTransfersRequest, + CBExchWithdrawToCBAccount, + CBExchWithdrawToCryptoAddress, + CBExchWithdrawToPaymentMethod, + ConvertCBExchCurrencyRequest, + CreateCBExchNewCryptoAddress, + CreateCBExchReport, + GetAllCBExchReports, + GetCBExchAccountHoldsRequest, + GetCBExchAccountLedgerRequest, + GetCBExchAccountTransfersRequest, + GetCBExchAddressBookRequest, + GetCBExchAllStakeWraps, + GetCBExchFillsRequest, + GetCBExchOrdersRequest, + GetCBExchPrincipalRepaymentPreview, + GetCBExchProductCandles, + GetCBExchProductTrades, + GetCBExchTravelRuleInformation, + RepayCBExchLoanInterest, + RepayCBExchLoanPrincipal, + SubmitCBExchNewLoan, + SubmitCBExchOrderRequest, + SubmitCBExchTravelInformation, + TransferCBExchFundsBetweenProfiles, + UpdateCBExchAddressBookEntryRequest, +} from './types/request/coinbase-exchange.js'; +import { CBExchCounterpartyAddress } from './types/response/coinbase-exchange.js'; ⋮---- /** - * Preview Order - * - * Preview an order. - * - */ -previewOrder( - params: PreviewAdvTradeOrderRequest, -): Promise + * REST client for Coinbase's Institutional Exchange API: + * https://docs.cdp.coinbase.com/exchange/docs/welcome + */ +export class CBExchangeClient extends BaseRestClient ⋮---- -/** - * Close Position - * - * Places an order to close any open positions for a specified product_id. - * - */ -closePosition( - params: CloseAdvTradePositionRequest, -): Promise +constructor( + restClientOptions: RestClientOptions = {}, + requestOptions: AxiosRequestConfig = {}, +) ⋮---- -/** - * - * Portfolios Endpoints - * - */ +getClientType(): RestClientType ⋮---- /** - * List Portfolios * - * Get all portfolios of a user. - */ -getPortfolios(params?: { - portfolio_type?: 'UNDEFINED' | 'DEFAULT' | 'CONSUMER' | 'INTX'; -}): Promise< -⋮---- -/** - * Create Portfolio + * Accounts Endpoints * - * Create a portfolio. */ -createPortfolio(params: ⋮---- /** - * Move Portfolio Funds + * Get all accounts for a profile * - * Move funds between portfolios. + * Get a list of trading accounts from the profile of the API key. + * Your trading accounts are separate from your Coinbase accounts. See Deposit from Coinbase account for documentation on how to deposit funds to begin trading. */ -movePortfolioFunds(params: MoveAdvTradePortfolioFundsRequest): Promise< +getAccounts(): Promise ⋮---- /** - * Get Portfolio Breakdown + * Get a single account by id * - * Get the breakdown of a portfolio. + * Information for a single account. Use this endpoint when you know the account_id. API key must belong to the same profile as the account. */ -getPortfolioBreakdown(params: { - portfolio_uuid: string; - currency?: string; -}): Promise< +getAccount(params: ⋮---- /** - * Delete Portfolio + * Get a single account's holds * - * Delete a portfolio. + * List the holds of an account that belong to the same profile as the API key. Holds are placed on an account for any active orders or + * pending withdraw requests. As an order is filled, the hold amount is updated. + * If an order is canceled, any remaining hold is removed. For withdrawals, the hold is removed after it is completed. */ -deletePortfolio(params: +getAccountHolds(params: GetCBExchAccountHoldsRequest): Promise ⋮---- /** - * Edit Portfolio + * Get a single account's ledger * - * Edit a portfolio. + * Lists ledger activity for an account. This includes anything that would affect the account's balance - transfers, trades, fees, etc. + * If neither start_date nor end_date is set, the endpoint will return ledger activity for the past 1 day only. + * List account activity of the API key's profile. Account activity either increases or decreases your account balance. * + * Entry Types: + * - transfer: Funds moved to/from Coinbase to Coinbase Exchange + * - match: Funds moved as a result of a trade + * - fee: Fee as a result of a trade + * - rebate: Fee rebate as per our fee schedule + * - conversion: Funds converted between fiat currency and a stablecoin */ -updatePortfolio(params: { - portfolio_uuid: string; - name: string; -}): Promise< +getAccountLedger(params: GetCBExchAccountLedgerRequest): Promise ⋮---- /** + * Get a single account's transfers * - * Futures Endpoints - * + * Lists past withdrawals and deposits for an account. */ +getAccountTransfers(params: GetCBExchAccountTransfersRequest): Promise ⋮---- /** - * Get Futures Balance Summary - * - * Get a summary of balances for CFM trading. * - * Futures vs Spot Accounts: - * - Futures and spot balances are held in different accounts. - * - Cash is always deposited into your Coinbase Inc. (CBI) spot account. - * - Cash is automatically transferred to your Coinbase Financial Markets (CFM) futures account to satisfy margin requirements. - * - You can transfer cash that isn't being used to margin or maintain futures positions into your CBI spot account. - * - Funds held in a CBI spot account do not receive the preferential treatment given to funds held in a regulated futures account. - * - * Intraday vs. Overnight Margin Health: - * - If you are opted in to receive increased leverage on futures trades during the intraday window (from 8am-4pm ET), this endpoint will return your intraday and overnight margin health. - */ -getFuturesBalanceSummary(): Promise< -⋮---- -/** - * Get Intraday Margin Setting + * Address book Endpoints * - * Get the futures intraday margin setting. */ -getIntradayMarginSetting(): Promise< ⋮---- /** - * Set Intraday Margin Setting + * Get address book * - * Set the futures intraday margin setting. + * Get all addresses stored in the address book. */ -setIntradayMarginSetting(params?: { - setting?: - | 'INTRADAY_MARGIN_SETTING_UNSPECIFIED' - | 'INTRADAY_MARGIN_SETTING_STANDARD' - | 'INTRADAY_MARGIN_SETTING_INTRADAY'; -}): Promise +getAddressBook(): Promise ⋮---- /** - * Get Current Margin Window + * Add addresses * - * Get the futures current margin window. + * Add new addresses to address book. */ -getCurrentMarginWindow(params?: { - margin_profile_type?: - | 'MARGIN_PROFILE_TYPE_UNSPECIFIED' - | 'MARGIN_PROFILE_TYPE_RETAIL_REGULAR' - | 'MARGIN_PROFILE_TYPE_RETAIL_INTRADAY_MARGIN_1'; -}): Promise +addAddresses(params: GetCBExchAddressBookRequest): Promise ⋮---- /** - * List Futures Positions + * Delete address * - * Get a list of positions in CFM products. + * Delete address from address book. */ -getFuturesPositions(): Promise< +deleteAddress(params: ⋮---- /** - * Get Futures Position + * Get counterparty address book * - * Get positions for a specific CFM product. + * Get all counterparty addresses stored in the address book. */ -getFuturesPosition(params: { - product_id: string; -}): Promise< +getCounterpartyAddressBook(): Promise ⋮---- /** - * Schedule Futures Sweep - * - * Schedules a sweep of funds from FCM wallet to USD Spot wallet. - * - * Futures Sweep Processing: - * - Sweep requests submitted before 5PM ET each day are processed the following business day. - * - Sweep requests submitted after 5PM ET each day are processed in 2 business days. - * - You can have at most one pending sweep request at a time. + * Update address book entry * - * Market movements related to your open positions may impact the final amount that is transferred into your spot account. - * The final funds transferred, up to your specified amount, depend on the available excess in your futures account. + * Edit an existing address book entry. Useful for travel rule jurisdictions. */ -scheduleFuturesSweep(params?: { - usd_amount?: string; -}): Promise< +updateAddressBookEntry( + params: UpdateCBExchAddressBookEntryRequest, +): Promise ⋮---- /** - * List Futures Sweeps * - * Get pending and processing sweeps of funds from FCM wallet to USD Spot wallet. + * Coinbase Accounts Endpoints * - * Pending vs. Processing Sweeps: - * - A pending sweep is a sweep that has not started processing and can be cancelled. - * - A processing sweep is a sweep that is currently being processed and cannot be cancelled. - * - Once a sweep is complete, it no longer appears in the list of sweeps. */ -getFuturesSweeps(): Promise< ⋮---- /** - * Cancel Pending Futures Sweep + * Get all Coinbase wallets * - * Cancel the pending sweep of funds from FCM wallet to USD Spot wallet. + * Gets all the user's available Coinbase wallets. These are the wallets/accounts that are used for buying and selling on www.coinbase.com. */ -cancelPendingFuturesSweep(): Promise< +getCoinbaseWallets(): Promise ⋮---- /** + * Generate crypto address * - * Perpetuals Endpoints - * + * Generates a one-time crypto address for depositing crypto. */ +createNewCryptoAddress(params: CreateCBExchNewCryptoAddress): Promise ⋮---- /** - * Allocate Portfolio - * - * Allocate portfolio funds to a sub-portfolio on Intx Portfolio. * - */ -allocatePortfolio(params: AllocateAdvTradePortfolioRequest): Promise -⋮---- -/** - * Get Perpetuals Portfolio Summary + * Conversions Endpoints * - * Get a summary of your Perpetuals portfolio. */ -getPerpetualsPortfolioSummary(params: { - portfolio_uuid: string; -}): Promise ⋮---- /** - * List Perpetuals Positions + * Convert currency * - * Get a list of open positions in your Perpetuals portfolio. + * Converts funds from one currency to another. Funds are converted on the from account in the profile_id profile. */ -getPerpetualsPositions(params: { - portfolio_uuid: string; -}): Promise +convertCurrency(params: ConvertCBExchCurrencyRequest): Promise ⋮---- /** - * Get Perpetuals Position - * - * Get a specific open position on Intx. + * Get conversion fee rates * + * Gets a list of current conversion fee rates and trailing 30 day volume by currency pair. */ -getPerpetualsPosition(params: { - portfolio_uuid: string; - symbol: string; -}): Promise< +getConversionFeeRates(): Promise ⋮---- /** - * Get Portfolios Balances + * Get a conversion * - * Get a list of asset balances on Intx for a given Portfolio. + * Gets a currency conversion by id (i.e. USD -> USDC). */ -getPortfoliosBalances(params: +getConversion(params: { + conversion_id: string; + profile_id?: string; +}): Promise ⋮---- /** - * Opt In or Out of Multi Asset Collateral + * Get all conversions * - * Enable or Disable Multi Asset Collateral for a given Portfolio. + * Get all conversions associated with the profile tied to the API key used to make the request. */ -updateMultiAssetCollateral(params?: { - portfolio_uuid?: string; - multi_asset_collateral_enabled?: boolean; -}): Promise< +getAllConversions(params: { + profile_id: string; + before?: string; + after?: string; + limit?: number; +}): Promise ⋮---- /** * - * Fees Endpoints + * Currencies Endpoints * */ ⋮---- /** - * Get Transaction Summary + * Get all known currencies * - * Get a summary of transactions with fee tiers, total volume, and fees. + * Gets a list of all known currencies. Note: Not all currencies may be currently in use for trading. */ -getTransactionSummary( - params?: GetAdvTradeTransactionSummaryRequest, -): Promise +getCurrencies(): Promise ⋮---- /** + * Get a currency * - * Converts Endpoints - * + * Gets a single currency by id. */ +getCurrency(currency_id: string): Promise ⋮---- /** - * Create Convert Quote * - * Create a convert quote with a specified source account, target account, and amount. - * Convert is applicable for USDC-USD and EURC-EUR conversion. + * Transfers Endpoints + * */ -submitConvertQuote(params: SubmitAdvTradeConvertQuoteRequest): Promise ⋮---- /** - * Get Convert Trade + * Deposit from Coinbase account * - * Gets a list of information about a convert trade with a specified trade id, source account, and target account. + * Deposits funds from a www.coinbase.com wallet to the specified profile_id. */ -getConvertTrade(params: { - trade_id: string; - from_account: string; - to_account: string; -}): Promise +depositFromCoinbaseAccount( + params: CBExchDepositFromCoinbaseAccount, +): Promise ⋮---- /** - * Commit Convert Trade + * Deposit from payment method * - * Commits a convert trade with a specified trade id, source account, and target account. + * Deposits funds from a linked external payment method to the specified profile_id. + * See Get all payment methods. The SEPA payment method is not allowed for depositing funds because it is a push payment method. */ -commitConvertTrade(params: { - trade_id: string; - from_account: string; - to_account: string; -}): Promise +depositFromPaymentMethod( + params: CBExchDepositFromPaymentMethod, +): Promise ⋮---- /** + * Get all payment methods * - * Public Endpoints - * + * Gets a list of the user's linked payment methods. */ -⋮---- -getServerTime(): Promise< +getPaymentMethods(): Promise ⋮---- /** - * Get Public Product Book + * Get all transfers * - * Get a list of bids/asks for a single product. The amount of detail shown can be customized with the limit parameter. + * Gets a list of in-progress and completed transfers of funds in/out of any of the user's accounts. */ -getPublicProductBook(params: { - product_id: string; - limit?: number; - aggregation_price_increment?: string; -}): Promise< +getTransfers(params?: CBExchGetTransfersRequest): Promise ⋮---- /** - * List Public Products + * Get a single transfer * - * Get a list of the available currency pairs for trading. + * Get information on a single transfer. */ -getPublicProducts(params?: GetAdvTradePublicProductsRequest): Promise< +getTransfer(params: ⋮---- /** - * Get Public Product + * Submit travel information for a transfer * - * Get information on a single product by product ID. + * Submit travel information for a transfer. */ -getPublicProduct(params: { - product_id: string; -}): Promise +submitTravelInformation(params: SubmitCBExchTravelInformation): Promise ⋮---- /** - * Get Public Product Candles + * Withdraw to Coinbase account * - * Get rates for a single product by product ID, grouped in buckets. + * Withdraws funds from the specified profile_id to a www.coinbase.com wallet. + * You can move funds between your Coinbase accounts and your Coinbase Exchange trading accounts within your daily limits. Moving funds between Coinbase and Coinbase Exchange is instant and free. + * See the Coinbase Accounts section for retrieving your Coinbase accounts. */ -getPublicProductCandles( - params: GetAdvTradePublicProductCandlesRequest, -): Promise< +withdrawToCoinbaseAccount(params: CBExchWithdrawToCBAccount): Promise ⋮---- /** - * Get Public Market Trades + * Withdraw to crypto address * - * Get snapshot information by product ID about the last trades (ticks) and best bid/ask. + * Withdraws funds from the specified profile_id to an external crypto address. */ -getPublicMarketTrades( - params: GetAdvTradePublicMarketTradesRequest, -): Promise +withdrawToCryptoAddress(params: CBExchWithdrawToCryptoAddress): Promise ⋮---- /** + * Get fee estimate for crypto withdrawal * - * Payment Methods Endpoints - * + * Gets the fee estimate for the crypto withdrawal to a crypto address. */ +getCryptoWithdrawalFeeEstimate( + params: CBExchGetCryptoWithdrawalFeeEstimate, +): Promise ⋮---- /** - * List Payment Methods + * Withdraw to payment method * - * Get a list of payment methods for the current user. + * Withdraws funds from the specified profile_id to a linked external payment method. + * See the Payment Methods section for retrieving your payment methods. */ -getPaymentMethods(): Promise< +withdrawToPaymentMethod(params: CBExchWithdrawToPaymentMethod): Promise ⋮---- /** - * Get Payment Method * - * Get information about a payment method for the current user. + * Fees Endpoints + * */ -getPaymentMethod(params: ⋮---- /** + * Get fees * - * Data API Endpoints - * + * Get fee rates and 30 days trailing volume. + * This request returns your current maker & taker fee rates, as well as your 30-day trailing volume. Quoted rates are subject to change. */ +getFees(): Promise ⋮---- /** - * Get API Key Permissions * - * Get information about your CDP API key permissions. + * Orders Endpoints + * */ -getApiKeyPermissions(): Promise - -================ -File: src/CBAppClient.ts -================ -import { AxiosRequestConfig } from 'axios'; -⋮---- -import { BaseRestClient } from './lib/BaseRestClient.js'; -import { - getParamsFromURL, - REST_CLIENT_TYPE_ENUM, - RestClientOptions, - RestClientType, -} from './lib/requestUtils.js'; -import { - CBAppDepositFundsRequest, - CBAppSendMoneyRequest, - CBAppTransferMoneyRequest, - CBAppWithdrawFundsRequest, -} from './types/request/coinbase-app-client.js'; -import { - CBAppAccount, - CBAppAddress, - CBAppCoinbaseOneSubscription, - CBAppCryptocurrency, - CBAppDepositWithdrawal, - CBAppFiatCurrency, - CBAppPagination, - CBAppTransaction, - CBAppTransfer, -} from './types/response/coinbase-app-client.js'; ⋮---- /** - * REST client for Coinbase's Coinbase App API: - * https://docs.cdp.coinbase.com/coinbase-app/docs/welcome - */ -export class CBAppClient extends BaseRestClient -⋮---- -constructor( - restClientOptions: RestClientOptions = {}, - requestOptions: AxiosRequestConfig = {}, -) -⋮---- -// Some endpoints return a warning if a version header isn't included: https://docs.cdp.coinbase.com/coinbase-app/docs/versioning -// Currently set to a date from the changelog: https://docs.cdp.coinbase.com/coinbase-app/docs/changelog -⋮---- -getClientType(): RestClientType + * Get all fills + * + * Get a list of recent fills of the API key's profile. A fill is a partial or complete match on a specific order. + */ +getFills(params?: GetCBExchFillsRequest): Promise ⋮---- /** + * Get all orders * - * Account Endpoints - * + * List your current open orders. Only open or un-settled orders are returned by default. As soon as an order is no longer open and settled, it will no longer appear in the default request. + * Open orders may change state between the request and the response depending on market conditions. */ +getOrders(params?: GetCBExchOrdersRequest): Promise ⋮---- /** - * List Accounts - * - * List a current user's accounts to which the authentication method has access to. + * Cancel all orders * - * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. - * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of accounts. + * With best effort, cancel all open orders. This may require you to make the request multiple times until all of the open orders are deleted. */ -getAccounts(params?: { - paginationURL?: string; - starting_after?: string; -}): Promise< +cancelAllOrders(params?: { + profile_id?: string; + product_id?: string; +}): Promise ⋮---- /** - * Show Account + * Create a new order * - * Get a current user's account by account ID or currency string. + * Create an order. You can place two types of orders: limit and market. Orders can only be placed if your account has sufficient funds. + * Once an order is placed, your account funds will be put on hold for the duration of the order. */ -getAccount(params: +submitOrder(params: SubmitCBExchOrderRequest): Promise ⋮---- /** + * Get single order * - * Address Endpoints - * + * Get a single order by id. */ +getOrder(params: ⋮---- /** - * Create Address + * Cancel an order * - * Creates a new address for an account. Addresses can be created for wallet account types. + * Cancel a single open order by id. */ -createAddress(params: +cancelOrder(params: CancelCBExchOrderRequest): Promise ⋮---- /** - * List Addresses * - * Lists addresses for an account. + * Loans Endpoints * - * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. - * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of addresses. */ -getAddresses(params: { - account_id: string; - paginationURL?: string; -}): Promise< ⋮---- /** - * Show Address - * - * Get an single address for an account. - * A regular cryptocurrency address can be used in place of address_id but the address must be associated with the correct account. + * List loans * - * !! An address can only be associated with one account. See Create Address to create new addresses. + * Accepts zero or more loan IDs as input. If no loan IDs are specified, it returns all loans for the user. Otherwise, it returns only the loan IDs specified. */ -getAddress(params: +getLoans(params?: ⋮---- /** - * List Address Transactions + * List loan assets * - * List transactions that have been sent to a specific address. - * A regular cryptocurrency address can be used in place of address_id but the address must be associated with the correct account. + * Get a list of lendable assets, a map of assets we accept as collateral for loans, and the haircut weight. + */ +getLoanAssets(): Promise +⋮---- +/** + * List interest summaries * - * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. - * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of transactions. + * List summaries of interest owed by asset. */ -getAddressTransactions(params: { - account_id: string; - addressId: string; - paginationURL?: string; -}): Promise< +getInterestSummaries(): Promise ⋮---- /** + * List interest rate history * - * Transactions Endpoints + * List interest rate history for a loan. + */ +getInterestRateHistory(params: +⋮---- +/** + * List interest charges * + * List interest charges for a loan. */ +getInterestCharges(params: ⋮---- /** - * Send Money + * Get lending overview * - * Send funds to a network address for any Coinbase supported asset, or email address of the recipient. - * No transaction fees are required for off-blockchain cryptocurrency transactions. + * This API summarizes lending for a given client. It calculates the overall loan balance, collateral level, and amounts available to borrow. + * It also returns any withdrawal restrictions in force on the client. * - * TRAVEL RULE DATA GUIDE: https://docs.cdp.coinbase.com/coinbase-app/docs/coinbase-app-travel-rule + * Get lending overview returns all amounts in USD notional values, except available_per_asset mappings which are returned in both notional and native values. */ -sendMoney( - params: CBAppSendMoneyRequest, -): Promise< +getLendingOverview(): Promise ⋮---- /** - * Transfer Money + * Get new loan preview * - * Transfer any Coinbase supported digital asset between two of a single user's accounts. - * Accounts must support the same currency for transfers to be successful. + * This API is similar to lending-overview but is used to preview the results of opening a new loan. + * The values returned in the preview response take the existing loans, collateral and the potential change being previewed into account. + * Note the preview request accepts native currency amounts as input. */ -transferMoney( - params: CBAppTransferMoneyRequest, -): Promise< +getNewLoanPreview(params: { + currency: string; + native_amount: string; +}): Promise ⋮---- /** - * List Transactions - * - * Lists the transactions of an account by account ID. + * Open new loan * - * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. - * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of transactions. + * This API triggers a loan open request. Funding is not necessarily instantaneous and there is no SLA. + * You are notified when funds have settled in your Exchange account. Loan open requests, once initiated, cannot be canceled. */ -getTransactions(params: { - account_id: string; - paginationURL?: string; -}): Promise< +submitNewLoan(params: SubmitCBExchNewLoan): Promise ⋮---- /** - * Show Transaction + * List new loan options * - * Get a single transaction for an account. + * Get available currencies and interest rates for new loans. All amounts returned by this API are notional values (i.e., USD). */ -getTransaction(params: { - account_id: string; - transactionId: string; -}): Promise< +getNewLoanOptions(): Promise ⋮---- /** + * Repay loan interest * - * Deposits Endpoints - * + * Submit an interest repayment for a loan. */ +repayLoanInterest(params: RepayCBExchLoanInterest): Promise ⋮---- /** - * Deposit Funds + * Repay loan principal * - * Deposits user-defined amount of funds to a fiat account. + * Submit a principal repayment for a loan. */ -depositFunds(params: CBAppDepositFundsRequest): Promise +repayLoanPrincipal(params: RepayCBExchLoanPrincipal): Promise ⋮---- /** - * Commit Deposit + * Get principal repayment preview * - * Completes a deposit that is created in commit: false state. + * Preview the results of a loan principal repayment. + * Like the Get lending overview API, all values are notional except available_per_asset which returns both notional and native values per currency. */ -commitDeposit(params: { - account_id: string; - deposit_id: string; -}): Promise +getPrincipalRepaymentPreview( + params: GetCBExchPrincipalRepaymentPreview, +): Promise ⋮---- /** - * List Deposits * - * Lists fiat deposits for an account. + * Coinbase Price Oracle Endpoints * - * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. - * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of deposits. */ -getDeposits(params: ⋮---- /** - * Show Deposit + * Get signed prices * - * Get one deposit by deposit Id. + * Get cryptographically signed prices ready to be posted on-chain using Compound's Open Oracle smart contract. */ -getDeposit(params: +getSignedPrices(): Promise ⋮---- /** * - * Withdrawals Endpoints + * Products Endpoints * */ ⋮---- /** - * Withdraw Funds + * Get all known trading pairs * - * Withdraws a user-defined amount of funds from a fiat account. + * Gets a list of available currency pairs for trading. */ -withdrawFunds(params: CBAppWithdrawFundsRequest): Promise +getAllTradingPairs(params?: ⋮---- /** - * Commit Withdrawal + * Get all product volume * - * Completes a withdrawal that is created in commit: false state. + * Gets 30-day and 24-hour volume for all products and market types. */ -commitWithdrawal(params: { - account_id: string; - withdrawal_id: string; -}): Promise +getAllProductVolume(): Promise ⋮---- /** - * List Withdrawals - * - * Lists withdrawals for an account. + * Get single product * - * This endpoint is paginated. In case you are calling it first time, leave paginationURL empty. - * If you are paginating, provide the paginationURL value from the previous response and you will receive the next page of withdrawals. + * Get information on a single product. */ -getWithdrawals(params: { - account_id: string; - paginationURL?: string; -}): Promise< +getProduct(params: ⋮---- /** - * Show Withdrawal + * Get product book * - * Get a single withdrawal. + * Get a list of open orders for a product. The amount of detail shown can be customized with the level parameter. + * By default, only the inside (i.e., the best) bid and ask are returned. This is equivalent to a book depth of 1 level. + * To see a larger order book, specify the level query parameter. */ -getWithdrawal(params: { - account_id: string; - withdrawal_id: string; -}): Promise< +getProductBook(params: ⋮---- /** + * Get product candles * - * Subscriptions Endpoints - * + * Historic rates for a product. Rates are returned in grouped buckets. + * Candle schema is of the form [timestamp, price_low, price_high, price_open, price_close]. */ +getProductCandles(params: GetCBExchProductCandles): Promise ⋮---- /** - * Get Coinbase One Subscription + * Get product stats * - * Returns a user's Coinbase One subscription status, tier, and current period end. - * Requires OAuth2 scope: wallet:subscription:read + * Gets 30-day and 24-hour stats for a product. */ -getCoinbaseOneSubscription(): Promise< +getProductStats(params: ⋮---- /** + * Get product ticker * - * DATA - Currencies Endpoints - * + * Gets snapshot information about the last trade (tick), best bid/ask, and 24h volume. */ +getProductTicker(params: ⋮---- /** - * Get Fiat Currencies + * Get product trades * - * Lists known fiat currencies. Currency codes conform to the ISO 4217 standard where possible. - * Currencies with no representation in ISO 4217 may use a custom code. + * Gets a list of the latest trades for a product. */ -getFiatCurrencies(): Promise< +getProductTrades(params: GetCBExchProductTrades): Promise ⋮---- /** - * Get Cryptocurrencies * - * Lists known cryptocurrencies. + * Profiles Endpoints + * */ -getCryptocurrencies(): Promise ⋮---- /** + * Get profiles * - * DATA- Exchange rates Endpoints - * + * Gets a list of all of the current user's profiles. */ +getProfiles(params?: ⋮---- /** - * Get Exchange Rates + * Create a profile * - * Get current exchange rates. Default base currency is USD but it can be defined as any supported currency. - * Returned rates will define the exchange rate for one unit of the base currency. + * Create a new profile. Will fail if no name is provided or if user already has max number of profiles. */ -getExchangeRates(params?: +createProfile(params: ⋮---- /** + * Transfer funds between profiles * - * DATA - Prices Endpoints - * + * Transfer an amount of currency from one profile to another. */ +transferFundsBetweenProfiles( + params: TransferCBExchFundsBetweenProfiles, +): Promise ⋮---- /** - * Get Buy Price + * Get profile by id * - * Get the total price to buy one bitcoin or ether. - * This endpoint doesn't require authentication. + * Information for a single profile. Use this endpoint when you know the profile_id. */ -getBuyPrice(params: +getProfileById(params: { + profile_id: string; + active?: boolean; +}): Promise ⋮---- /** - * Get Sell Price + * Rename a profile * - * Get the total price to sell one bitcoin or ether. - * This endpoint doesn't require authentication. + * Rename a profile. Names 'default' and 'margin' are reserved. */ -getSellPrice(params: +renameProfile(params: ⋮---- /** - * Get Spot Price + * Delete a profile * - * Get the current market price for bitcoin. This is usually somewhere in between the buy and sell price. - * This endpoint doesn't require authentication. + * Deletes the profile specified by profile_id and transfers all funds to the profile specified by to. + * Fails if there are any open orders on the profile to be deleted. */ -getSpotPrice(params: +deleteProfile(params: ⋮---- /** * - * DATA - Time Endpoints + * Reports Endpoints * */ ⋮---- /** - * Get Current Time + * Get all reports * - * Get the API server time. - * This endpoint doesn't require authentication. + * Gets a list of all user-generated reports. */ -getCurrentTime(): Promise< - -================ -File: src/CBExchangeClient.ts -================ -import { AxiosRequestConfig } from 'axios'; +getAllReports(params?: GetAllCBExchReports): Promise ⋮---- -import { BaseRestClient } from './lib/BaseRestClient.js'; -import { - REST_CLIENT_TYPE_ENUM, - RestClientOptions, - RestClientType, -} from './lib/requestUtils.js'; -import { - CancelCBExchOrderRequest, - CBExchDepositFromCoinbaseAccount, - CBExchDepositFromPaymentMethod, - CBExchGetCryptoWithdrawalFeeEstimate, - CBExchGetTransfersRequest, - CBExchWithdrawToCBAccount, - CBExchWithdrawToCryptoAddress, - CBExchWithdrawToPaymentMethod, - ConvertCBExchCurrencyRequest, - CreateCBExchNewCryptoAddress, - CreateCBExchReport, - GetAllCBExchReports, - GetCBExchAccountHoldsRequest, - GetCBExchAccountLedgerRequest, - GetCBExchAccountTransfersRequest, - GetCBExchAddressBookRequest, - GetCBExchAllStakeWraps, - GetCBExchFillsRequest, - GetCBExchOrdersRequest, - GetCBExchPrincipalRepaymentPreview, - GetCBExchProductCandles, - GetCBExchProductTrades, - GetCBExchTravelRuleInformation, - RepayCBExchLoanInterest, - RepayCBExchLoanPrincipal, - SubmitCBExchNewLoan, - SubmitCBExchOrderRequest, - SubmitCBExchTravelInformation, - TransferCBExchFundsBetweenProfiles, - UpdateCBExchAddressBookEntryRequest, -} from './types/request/coinbase-exchange.js'; -import { CBExchCounterpartyAddress } from './types/response/coinbase-exchange.js'; +/** + * Create a report + * + * Generates a report. You can create reports with historical data for all report types. + * Balance reports can be snapshots of historical or current data. + */ +createReport(params: CreateCBExchReport): Promise ⋮---- /** - * REST client for Coinbase's Institutional Exchange API: - * https://docs.cdp.coinbase.com/exchange/docs/welcome - */ -export class CBExchangeClient extends BaseRestClient -⋮---- -constructor( - restClientOptions: RestClientOptions = {}, - requestOptions: AxiosRequestConfig = {}, -) + * Get a report + * + * Get a specific report by report_id. + */ +getReport(params: ⋮---- -getClientType(): RestClientType +/** + * + * Travel Rule Endpoints + * + */ ⋮---- /** + * Get all travel rule information * - * Accounts Endpoints + * Return a list of all stored travel rule information. + */ +getTravelRuleInformation( + params?: GetCBExchTravelRuleInformation, +): Promise +⋮---- +/** + * Create travel rule entry * + * Create travel rule entry for sending address. */ +createTravelRuleEntry(params: { + address: string; + originator_name: string; + originator_country: string; +}): Promise ⋮---- /** - * Get all accounts for a profile + * Delete existing travel rule entry * - * Get a list of trading accounts from the profile of the API key. - * Your trading accounts are separate from your Coinbase accounts. See Deposit from Coinbase account for documentation on how to deposit funds to begin trading. + * Delete existing travel rule entry. */ -getAccounts(): Promise +deleteTravelRuleEntry(params: ⋮---- /** - * Get a single account by id * - * Information for a single account. Use this endpoint when you know the account_id. API key must belong to the same profile as the account. + * Users Endpoints + * */ -getAccount(params: ⋮---- /** - * Get a single account's holds + * Get user exchange limits * - * List the holds of an account that belong to the same profile as the API key. Holds are placed on an account for any active orders or - * pending withdraw requests. As an order is filled, the hold amount is updated. - * If an order is canceled, any remaining hold is removed. For withdrawals, the hold is removed after it is completed. + * Gets exchange limits information for a single user. */ -getAccountHolds(params: GetCBExchAccountHoldsRequest): Promise +getUserExchangeLimits(params: ⋮---- /** - * Get a single account's ledger + * Update settlement preference * - * Lists ledger activity for an account. This includes anything that would affect the account's balance - transfers, trades, fees, etc. - * If neither start_date nor end_date is set, the endpoint will return ledger activity for the past 1 day only. - * List account activity of the API key's profile. Account activity either increases or decreases your account balance. + * Updates the settlement preference to hold funds in either USDC or USD. + */ +updateSettlementPreference(params: { + user_id: string; + settlement_preference: string; +}): Promise +⋮---- +/** + * Get user trading volume * - * Entry Types: - * - transfer: Funds moved to/from Coinbase to Coinbase Exchange - * - match: Funds moved as a result of a trade - * - fee: Fee as a result of a trade - * - rebate: Fee rebate as per our fee schedule - * - conversion: Funds converted between fiat currency and a stablecoin + * Gets aggregated and individual trading volumes for users. */ -getAccountLedger(params: GetCBExchAccountLedgerRequest): Promise +getUserTradingVolume(params: ⋮---- /** - * Get a single account's transfers * - * Lists past withdrawals and deposits for an account. + * Wrapped Assets Endpoints + * */ -getAccountTransfers(params: GetCBExchAccountTransfersRequest): Promise ⋮---- /** + * Get all wrapped assets * - * Address book Endpoints + * Returns a list of all supported wrapped assets details objects. + */ +getAllWrappedAssets(): Promise +⋮---- +/** + * Get all stake-wraps * + * Get details for all stake-wraps in the profile associated with the API key. */ +getAllStakeWraps(params?: GetCBExchAllStakeWraps): Promise ⋮---- /** - * Get address book + * Create a new stake-wrap * - * Get all addresses stored in the address book. + * Stakes and wraps from_currency to to_currency. Funds are stake-wrapped in the profile associated with the API key. */ -getAddressBook(): Promise +createStakeWrap(params: { + from_currency: string; + to_currency: string; + amount: string; +}): Promise ⋮---- /** - * Add addresses + * Get a single stake-wrap * - * Add new addresses to address book. + * Get details for a specific stake-wrap in the profile associated with the API key. */ -addAddresses(params: GetCBExchAddressBookRequest): Promise +getStakeWrap(params: ⋮---- /** - * Delete address + * Get wrapped asset details * - * Delete address from address book. + * Returns the circulating and total supply of a wrapped asset, and its conversion rate. */ -deleteAddress(params: +getWrappedAssetDetails(params: ⋮---- /** - * Get counterparty address book + * Get wrapped asset conversion rate * - * Get all counterparty addresses stored in the address book. + * Returns the conversion rate of a wrapped asset. */ -getCounterpartyAddressBook(): Promise +getWrappedAssetConversionRate(params: { + wrapped_asset_id: string; +}): Promise + +================ +File: src/WebsocketAPIClient.ts +================ +import { DefaultLogger } from './lib/websocket/logger.js'; +import { WS_KEY_MAP } from './lib/websocket/websocket-util.js'; +import { WSClientConfigurableOptions } from './types/websockets/client.js'; +import { + WsAPITopicRequestParamMap, + WsAPITopicResponseMap, +} from './types/websockets/wsAPI.js'; +import { WebsocketClient } from './WebsocketClient.js'; +⋮---- +export interface WSAPIClientConfigurableOptions { + /** Attach connection/auth/error logging. Defaults to true. */ + attachEventListeners: boolean; +} +⋮---- +/** Attach connection/auth/error logging. Defaults to true. */ +⋮---- +/** Thin REST-style wrapper around WebsocketClient.sendWSAPIRequest(), following the Bybit SDK. */ +export class WebsocketAPIClient +⋮---- +constructor( + options?: WSClientConfigurableOptions & + Partial, + logger?: typeof DefaultLogger, +) +⋮---- +public getWSClient(): WebsocketClient +⋮---- +/** Optional warm-up before making private requests. */ +public connectWSAPI(): Promise +⋮---- +/** public/auth. Generates a fresh CDP JWT automatically. */ +auth(): Promise +⋮---- +/** public/get_announcements */ +getAnnouncements( + params?: WsAPITopicRequestParamMap['public/get_announcements'], +): Promise +⋮---- +/** public/get_book_summary_by_currency */ +getBookSummaryByCurrency( + params: WsAPITopicRequestParamMap['public/get_book_summary_by_currency'], +): Promise +⋮---- +/** public/get_book_summary_by_instrument */ +getBookSummaryByInstrument( + params: WsAPITopicRequestParamMap['public/get_book_summary_by_instrument'], +): Promise +⋮---- +/** public/get_combo_details */ +getComboDetails( + params: WsAPITopicRequestParamMap['public/get_combo_details'], +): Promise +⋮---- +/** public/get_combo_ids */ +getComboIds( + params: WsAPITopicRequestParamMap['public/get_combo_ids'], +): Promise +⋮---- +/** public/get_combos */ +getCombos( + params: WsAPITopicRequestParamMap['public/get_combos'], +): Promise +⋮---- +/** public/get_contract_size */ +getContractSize( + params: WsAPITopicRequestParamMap['public/get_contract_size'], +): Promise +⋮---- +/** public/get_currencies */ +getCurrencies(): Promise +⋮---- +/** public/get_delivery_prices */ +getDeliveryPrices( + params: WsAPITopicRequestParamMap['public/get_delivery_prices'], +): Promise +⋮---- +/** public/get_expirations */ +getExpirations( + params: WsAPITopicRequestParamMap['public/get_expirations'], +): Promise +⋮---- +/** public/get_funding_chart_data */ +getFundingChartData( + params: WsAPITopicRequestParamMap['public/get_funding_chart_data'], +): Promise +⋮---- +/** public/get_funding_rate_history */ +getFundingRateHistory( + params: WsAPITopicRequestParamMap['public/get_funding_rate_history'], +): Promise +⋮---- +/** public/get_funding_rate_value */ +getFundingRateValue( + params: WsAPITopicRequestParamMap['public/get_funding_rate_value'], +): Promise +⋮---- +/** public/get_historical_volatility */ +getHistoricalVolatility( + params: WsAPITopicRequestParamMap['public/get_historical_volatility'], +): Promise +⋮---- +/** public/get_index_chart_data */ +getIndexChartData( + params: WsAPITopicRequestParamMap['public/get_index_chart_data'], +): Promise +⋮---- +/** public/get_index_price */ +getIndexPrice( + params: WsAPITopicRequestParamMap['public/get_index_price'], +): Promise +⋮---- +/** public/get_index_price_names */ +getIndexPriceNames( + params?: WsAPITopicRequestParamMap['public/get_index_price_names'], +): Promise +⋮---- +/** public/get_instrument */ +getInstrument( + params: WsAPITopicRequestParamMap['public/get_instrument'], +): Promise +⋮---- +/** public/get_instruments */ +getInstruments( + params: WsAPITopicRequestParamMap['public/get_instruments'], +): Promise +⋮---- +/** public/get_last_settlements_by_currency */ +getLastSettlementsByCurrency( + params: WsAPITopicRequestParamMap['public/get_last_settlements_by_currency'], +): Promise +⋮---- +/** public/get_last_settlements_by_instrument */ +getLastSettlementsByInstrument( + params: WsAPITopicRequestParamMap['public/get_last_settlements_by_instrument'], + ): Promise< + WsAPITopicResponseMap['public/get_last_settlements_by_instrument'] + > { + return this.wsClient.sendWSAPIRequest( + WS_KEY_MAP.advTradeGlobalWSAPI, + 'public/get_last_settlements_by_instrument', + params, + ); +⋮---- +/** public/get_last_trades_by_currency */ +getLastTradesByCurrency( + params: WsAPITopicRequestParamMap['public/get_last_trades_by_currency'], +): Promise +⋮---- +/** public/get_last_trades_by_currency_and_time */ +getLastTradesByCurrencyAndTime( + params: WsAPITopicRequestParamMap['public/get_last_trades_by_currency_and_time'], + ): Promise< + WsAPITopicResponseMap['public/get_last_trades_by_currency_and_time'] + > { + return this.wsClient.sendWSAPIRequest( + WS_KEY_MAP.advTradeGlobalWSAPI, + 'public/get_last_trades_by_currency_and_time', + params, + ); +⋮---- +/** public/get_last_trades_by_instrument */ +getLastTradesByInstrument( + params: WsAPITopicRequestParamMap['public/get_last_trades_by_instrument'], +): Promise +⋮---- +/** public/get_last_trades_by_instrument_and_time */ +getLastTradesByInstrumentAndTime( + params: WsAPITopicRequestParamMap['public/get_last_trades_by_instrument_and_time'], + ): Promise< + WsAPITopicResponseMap['public/get_last_trades_by_instrument_and_time'] + > { + return this.wsClient.sendWSAPIRequest( + WS_KEY_MAP.advTradeGlobalWSAPI, + 'public/get_last_trades_by_instrument_and_time', + params, + ); +⋮---- +/** public/get_mark_price_history */ +getMarkPriceHistory( + params: WsAPITopicRequestParamMap['public/get_mark_price_history'], +): Promise +⋮---- +/** public/get_order_book */ +getOrderBook( + params: WsAPITopicRequestParamMap['public/get_order_book'], +): Promise +⋮---- +/** public/get_order_book_by_instrument_id */ +getOrderBookByInstrumentId( + params: WsAPITopicRequestParamMap['public/get_order_book_by_instrument_id'], +): Promise +⋮---- +/** public/get_supported_index_names */ +getSupportedIndexNames( + params?: WsAPITopicRequestParamMap['public/get_supported_index_names'], +): Promise +⋮---- +/** public/get_time */ +getTime(): Promise +⋮---- +/** public/get_trade_volumes */ +getTradeVolumes( + params?: WsAPITopicRequestParamMap['public/get_trade_volumes'], +): Promise +⋮---- +/** public/get_tradingview_chart_data */ +getTradingviewChartData( + params: WsAPITopicRequestParamMap['public/get_tradingview_chart_data'], +): Promise +⋮---- +/** public/get_volatility_index_data */ +getVolatilityIndexData( + params: WsAPITopicRequestParamMap['public/get_volatility_index_data'], +): Promise +⋮---- +/** public/status */ +getStatus(): Promise +⋮---- +/** public/test */ +testConnection( + params?: WsAPITopicRequestParamMap['public/test'], +): Promise +⋮---- +/** public/ticker */ +getTicker( + params: WsAPITopicRequestParamMap['public/ticker'], +): Promise +⋮---- +/** private/buy */ +submitBuy( + params: WsAPITopicRequestParamMap['private/buy'], +): Promise +⋮---- +/** private/sell */ +submitSell( + params: WsAPITopicRequestParamMap['private/sell'], +): Promise +⋮---- +/** private/edit */ +updateOrder( + params: WsAPITopicRequestParamMap['private/edit'], +): Promise +⋮---- +/** private/edit_by_label */ +updateOrderByLabel( + params: WsAPITopicRequestParamMap['private/edit_by_label'], +): Promise +⋮---- +/** private/cancel */ +cancelOrder( + params: WsAPITopicRequestParamMap['private/cancel'], +): Promise +⋮---- +/** private/cancel_by_label */ +cancelByLabel( + params: WsAPITopicRequestParamMap['private/cancel_by_label'], +): Promise +⋮---- +/** private/cancel_all */ +cancelAll( + params?: WsAPITopicRequestParamMap['private/cancel_all'], +): Promise +⋮---- +/** private/cancel_all_by_currency */ +cancelAllByCurrency( + params: WsAPITopicRequestParamMap['private/cancel_all_by_currency'], +): Promise +⋮---- +/** private/cancel_all_by_currency_pair */ +cancelAllByCurrencyPair( + params: WsAPITopicRequestParamMap['private/cancel_all_by_currency_pair'], +): Promise +⋮---- +/** private/cancel_all_by_instrument */ +cancelAllByInstrument( + params: WsAPITopicRequestParamMap['private/cancel_all_by_instrument'], +): Promise +⋮---- +/** private/cancel_all_by_kind_or_type */ +cancelAllByKindOrType( + params: WsAPITopicRequestParamMap['private/cancel_all_by_kind_or_type'], +): Promise +⋮---- +/** private/close_position */ +closePosition( + params: WsAPITopicRequestParamMap['private/close_position'], +): Promise +⋮---- +/** private/get_open_orders */ +getOpenOrders( + params?: WsAPITopicRequestParamMap['private/get_open_orders'], +): Promise +⋮---- +/** private/get_open_orders_by_currency */ +getOpenOrdersByCurrency( + params: WsAPITopicRequestParamMap['private/get_open_orders_by_currency'], +): Promise +⋮---- +/** private/get_open_orders_by_instrument */ +getOpenOrdersByInstrument( + params: WsAPITopicRequestParamMap['private/get_open_orders_by_instrument'], +): Promise +⋮---- +/** private/get_open_orders_by_label */ +getOpenOrdersByLabel( + params: WsAPITopicRequestParamMap['private/get_open_orders_by_label'], +): Promise +⋮---- +/** private/get_order_state */ +getOrderState( + params: WsAPITopicRequestParamMap['private/get_order_state'], +): Promise +⋮---- +/** private/get_order_state_by_label */ +getOrderStateByLabel( + params: WsAPITopicRequestParamMap['private/get_order_state_by_label'], +): Promise +⋮---- +/** private/get_order_history_by_currency */ +getOrderHistoryByCurrency( + params: WsAPITopicRequestParamMap['private/get_order_history_by_currency'], +): Promise +⋮---- +/** private/get_order_history_by_instrument */ +getOrderHistoryByInstrument( + params: WsAPITopicRequestParamMap['private/get_order_history_by_instrument'], +): Promise ⋮---- -/** - * Update address book entry - * - * Edit an existing address book entry. Useful for travel rule jurisdictions. - */ -updateAddressBookEntry( - params: UpdateCBExchAddressBookEntryRequest, -): Promise +/** private/get_order_margin_by_ids */ +getOrderMarginByIds( + params: WsAPITopicRequestParamMap['private/get_order_margin_by_ids'], +): Promise ⋮---- -/** - * - * Coinbase Accounts Endpoints - * - */ +/** private/get_trigger_order_history */ +getTriggerOrderHistory( + params: WsAPITopicRequestParamMap['private/get_trigger_order_history'], +): Promise ⋮---- -/** - * Get all Coinbase wallets - * - * Gets all the user's available Coinbase wallets. These are the wallets/accounts that are used for buying and selling on www.coinbase.com. - */ -getCoinbaseWallets(): Promise +/** private/get_user_trades_by_currency */ +getUserTradesByCurrency( + params: WsAPITopicRequestParamMap['private/get_user_trades_by_currency'], +): Promise ⋮---- -/** - * Generate crypto address - * - * Generates a one-time crypto address for depositing crypto. - */ -createNewCryptoAddress(params: CreateCBExchNewCryptoAddress): Promise +/** private/get_user_trades_by_currency_and_time */ +getUserTradesByCurrencyAndTime( + params: WsAPITopicRequestParamMap['private/get_user_trades_by_currency_and_time'], + ): Promise< + WsAPITopicResponseMap['private/get_user_trades_by_currency_and_time'] + > { + return this.wsClient.sendWSAPIRequest( + WS_KEY_MAP.advTradeGlobalWSAPI, + 'private/get_user_trades_by_currency_and_time', + params, + ); ⋮---- -/** - * - * Conversions Endpoints - * - */ +/** private/get_user_trades_by_instrument */ +getUserTradesByInstrument( + params: WsAPITopicRequestParamMap['private/get_user_trades_by_instrument'], +): Promise ⋮---- -/** - * Convert currency - * - * Converts funds from one currency to another. Funds are converted on the from account in the profile_id profile. - */ -convertCurrency(params: ConvertCBExchCurrencyRequest): Promise +/** private/get_user_trades_by_instrument_and_time */ +getUserTradesByInstrumentAndTime( + params: WsAPITopicRequestParamMap['private/get_user_trades_by_instrument_and_time'], + ): Promise< + WsAPITopicResponseMap['private/get_user_trades_by_instrument_and_time'] + > { + return this.wsClient.sendWSAPIRequest( + WS_KEY_MAP.advTradeGlobalWSAPI, + 'private/get_user_trades_by_instrument_and_time', + params, + ); ⋮---- -/** - * Get conversion fee rates - * - * Gets a list of current conversion fee rates and trailing 30 day volume by currency pair. - */ -getConversionFeeRates(): Promise +/** private/get_user_trades_by_order */ +getUserTradesByOrder( + params: WsAPITopicRequestParamMap['private/get_user_trades_by_order'], +): Promise ⋮---- -/** - * Get a conversion - * - * Gets a currency conversion by id (i.e. USD -> USDC). - */ -getConversion(params: { - conversion_id: string; - profile_id?: string; -}): Promise +/** private/get_margins */ +getMargins( + params: WsAPITopicRequestParamMap['private/get_margins'], +): Promise ⋮---- -/** - * Get all conversions - * - * Get all conversions associated with the profile tied to the API key used to make the request. - */ -getAllConversions(params: { - profile_id: string; - before?: string; - after?: string; - limit?: number; -}): Promise +/** private/get_account_summaries */ +getAccountSummaries( + params?: WsAPITopicRequestParamMap['private/get_account_summaries'], +): Promise ⋮---- -/** - * - * Currencies Endpoints - * - */ +/** private/get_account_summary */ +getAccountSummary( + params: WsAPITopicRequestParamMap['private/get_account_summary'], +): Promise ⋮---- -/** - * Get all known currencies - * - * Gets a list of all known currencies. Note: Not all currencies may be currently in use for trading. - */ -getCurrencies(): Promise +/** private/get_position */ +getPosition( + params: WsAPITopicRequestParamMap['private/get_position'], +): Promise ⋮---- -/** - * Get a currency - * - * Gets a single currency by id. - */ -getCurrency(currency_id: string): Promise +/** private/get_positions */ +getPositions( + params?: WsAPITopicRequestParamMap['private/get_positions'], +): Promise ⋮---- -/** - * - * Transfers Endpoints - * - */ +/** private/change_margin_model */ +changeMarginModel( + params: WsAPITopicRequestParamMap['private/change_margin_model'], +): Promise ⋮---- -/** - * Deposit from Coinbase account - * - * Deposits funds from a www.coinbase.com wallet to the specified profile_id. - */ -depositFromCoinbaseAccount( - params: CBExchDepositFromCoinbaseAccount, -): Promise +/** private/get_access_log */ +getAccessLog( + params?: WsAPITopicRequestParamMap['private/get_access_log'], +): Promise ⋮---- -/** - * Deposit from payment method - * - * Deposits funds from a linked external payment method to the specified profile_id. - * See Get all payment methods. The SEPA payment method is not allowed for depositing funds because it is a push payment method. - */ -depositFromPaymentMethod( - params: CBExchDepositFromPaymentMethod, -): Promise +/** private/get_transaction_log */ +getTransactionLog( + params: WsAPITopicRequestParamMap['private/get_transaction_log'], +): Promise ⋮---- -/** - * Get all payment methods - * - * Gets a list of the user's linked payment methods. - */ -getPaymentMethods(): Promise +/** private/get_settlement_history_by_currency */ +getSettlementHistoryByCurrency( + params: WsAPITopicRequestParamMap['private/get_settlement_history_by_currency'], + ): Promise< + WsAPITopicResponseMap['private/get_settlement_history_by_currency'] + > { + return this.wsClient.sendWSAPIRequest( + WS_KEY_MAP.advTradeGlobalWSAPI, + 'private/get_settlement_history_by_currency', + params, + ); ⋮---- -/** - * Get all transfers - * - * Gets a list of in-progress and completed transfers of funds in/out of any of the user's accounts. - */ -getTransfers(params?: CBExchGetTransfersRequest): Promise +/** private/get_settlement_history_by_instrument */ +getSettlementHistoryByInstrument( + params: WsAPITopicRequestParamMap['private/get_settlement_history_by_instrument'], + ): Promise< + WsAPITopicResponseMap['private/get_settlement_history_by_instrument'] + > { + return this.wsClient.sendWSAPIRequest( + WS_KEY_MAP.advTradeGlobalWSAPI, + 'private/get_settlement_history_by_instrument', + params, + ); ⋮---- -/** - * Get a single transfer - * - * Get information on a single transfer. - */ -getTransfer(params: +/** private/simulate_portfolio */ +simulatePortfolio( + params: WsAPITopicRequestParamMap['private/simulate_portfolio'], +): Promise ⋮---- -/** - * Submit travel information for a transfer - * - * Submit travel information for a transfer. - */ -submitTravelInformation(params: SubmitCBExchTravelInformation): Promise +/** private/pme/simulate */ +simulatePme( + params: WsAPITopicRequestParamMap['private/pme/simulate'], +): Promise ⋮---- -/** - * Withdraw to Coinbase account - * - * Withdraws funds from the specified profile_id to a www.coinbase.com wallet. - * You can move funds between your Coinbase accounts and your Coinbase Exchange trading accounts within your daily limits. Moving funds between Coinbase and Coinbase Exchange is instant and free. - * See the Coinbase Accounts section for retrieving your Coinbase accounts. - */ -withdrawToCoinbaseAccount(params: CBExchWithdrawToCBAccount): Promise +/** private/enable_cancel_on_disconnect */ +enableCancelOnDisconnect( + params?: WsAPITopicRequestParamMap['private/enable_cancel_on_disconnect'], +): Promise ⋮---- -/** - * Withdraw to crypto address - * - * Withdraws funds from the specified profile_id to an external crypto address. - */ -withdrawToCryptoAddress(params: CBExchWithdrawToCryptoAddress): Promise +/** private/disable_cancel_on_disconnect */ +disableCancelOnDisconnect( + params?: WsAPITopicRequestParamMap['private/disable_cancel_on_disconnect'], +): Promise ⋮---- -/** - * Get fee estimate for crypto withdrawal - * - * Gets the fee estimate for the crypto withdrawal to a crypto address. - */ -getCryptoWithdrawalFeeEstimate( - params: CBExchGetCryptoWithdrawalFeeEstimate, -): Promise +/** private/get_cancel_on_disconnect */ +getCancelOnDisconnect( + params?: WsAPITopicRequestParamMap['private/get_cancel_on_disconnect'], +): Promise ⋮---- -/** - * Withdraw to payment method - * - * Withdraws funds from the specified profile_id to a linked external payment method. - * See the Payment Methods section for retrieving your payment methods. - */ -withdrawToPaymentMethod(params: CBExchWithdrawToPaymentMethod): Promise +/** private/create_combo */ +createCombo( + params: WsAPITopicRequestParamMap['private/create_combo'], +): Promise ⋮---- -/** - * - * Fees Endpoints - * - */ +/** private/get_leg_prices */ +getLegPrices( + params: WsAPITopicRequestParamMap['private/get_leg_prices'], +): Promise +⋮---- +/** public/tickers_by_currency */ +getTickersByCurrency( + params: WsAPITopicRequestParamMap['public/tickers_by_currency'], +): Promise +⋮---- +/** private/get_leverage */ +getLeverage( + params?: WsAPITopicRequestParamMap['private/get_leverage'], +): Promise +⋮---- +/** private/set_leverage */ +setLeverage( + params: WsAPITopicRequestParamMap['private/set_leverage'], +): Promise +⋮---- +/** private/get_max_order_size */ +getMaxOrderSize( + params: WsAPITopicRequestParamMap['private/get_max_order_size'], +): Promise +⋮---- +/** private/get_pme_params */ +getPmeParams( + params: WsAPITopicRequestParamMap['private/get_pme_params'], +): Promise +⋮---- +/** private/get_risk_profile */ +getRiskProfile(): Promise +⋮---- +/** private/get_subaccounts */ +getSubaccounts( + params?: WsAPITopicRequestParamMap['private/get_subaccounts'], +): Promise +⋮---- +/** private/get_subaccounts_details */ +getSubaccountsDetails( + params: WsAPITopicRequestParamMap['private/get_subaccounts_details'], +): Promise +⋮---- +/** private/get_trading_limits */ +getTradingLimits( + params: WsAPITopicRequestParamMap['private/get_trading_limits'], +): Promise +⋮---- +/** private/get_user_locks */ +getUserLocks(): Promise +⋮---- +/** private/submit_transfer_between_subaccounts */ +submitTransferBetweenSubaccounts( + params: WsAPITopicRequestParamMap['private/submit_transfer_between_subaccounts'], + ): Promise< + WsAPITopicResponseMap['private/submit_transfer_between_subaccounts'] + > { + return this.wsClient.sendWSAPIRequest( + WS_KEY_MAP.advTradeGlobalWSAPI, + 'private/submit_transfer_between_subaccounts', + params, + ); ⋮---- -/** - * Get fees - * - * Get fee rates and 30 days trailing volume. - * This request returns your current maker & taker fee rates, as well as your 30-day trailing volume. Quoted rates are subject to change. - */ -getFees(): Promise +/** public/set_heartbeat */ +setHeartbeat( + params: WsAPITopicRequestParamMap['public/set_heartbeat'], +): Promise +⋮---- +/** public/disable_heartbeat */ +disableHeartbeat(): Promise< + WsAPITopicResponseMap['public/disable_heartbeat'] + > { + return this.wsClient.sendWSAPIRequest( + WS_KEY_MAP.advTradeGlobalWSAPI, + 'public/disable_heartbeat', + ); ⋮---- -/** - * - * Orders Endpoints - * - */ +/** public/hello */ +hello( + params: WsAPITopicRequestParamMap['public/hello'], +): Promise ⋮---- -/** - * Get all fills - * - * Get a list of recent fills of the API key's profile. A fill is a partial or complete match on a specific order. - */ -getFills(params?: GetCBExchFillsRequest): Promise +/** private/logout. Resolves on the server close; prevents automatic reconnect. */ +logout( + params?: WsAPITopicRequestParamMap['private/logout'], +): Promise ⋮---- -/** - * Get all orders - * - * List your current open orders. Only open or un-settled orders are returned by default. As soon as an order is no longer open and settled, it will no longer appear in the default request. - * Open orders may change state between the request and the response depending on market conditions. - */ -getOrders(params?: GetCBExchOrdersRequest): Promise +private setupDefaultEventListeners() + +================ +File: .npmrc +================ +min-release-age=30 +save-exact=true + +================ +File: .nvmrc +================ +v24.18.0 + +================ +File: src/lib/websocket/websocket-util.ts +================ +import WebSocket from 'isomorphic-ws'; ⋮---- -/** - * Cancel all orders - * - * With best effort, cancel all open orders. This may require you to make the request multiple times until all of the open orders are deleted. - */ -cancelAllOrders(params?: { - profile_id?: string; - product_id?: string; -}): Promise +import { + WsExchangeRequestOperation, + WsInternationalRequestOperation, +} from '../../types/websockets/requests.js'; +import { signMessage } from '../webCryptoAPI.js'; ⋮---- /** - * Create a new order - * - * Create an order. You can place two types of orders: limit and market. Orders can only be placed if your account has sufficient funds. - * Once an order is placed, your account funds will be put on hold for the duration of the order. - */ -submitOrder(params: SubmitCBExchOrderRequest): Promise + * Each websocket connection is represented as a "WS Key". Authentication is handled automatically if required. + */ ⋮---- /** - * Get single order + * Market Data is the traditional feed that provides updates for both orders and trades. + * Most channels are now available without authentication. * - * Get a single order by id. + * https://docs.cdp.coinbase.com/advanced-trade/docs/ws-overview */ -getOrder(params: ⋮---- /** - * Cancel an order + * Coinbase Advanced Trade User Order Data provides updates for the orders of the user. * - * Cancel a single open order by id. + * https://docs.cdp.coinbase.com/advanced-trade/docs/ws-overview */ -cancelOrder(params: CancelCBExchOrderRequest): Promise ⋮---- /** + * Unauthenticated Coinbase Global Derivatives market data on the public streams host. + * Channel parameters are part of the topic name. See Global Derivatives > Public: * - * Loans Endpoints - * + * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/websocket/websocket-endpoints */ ⋮---- /** - * List loans + * Coinbase Global Derivatives private subscriptions on the main DRB gateway. + * Uses public/auth followed by private/subscribe. See Global Derivatives > Private: * - * Accepts zero or more loan IDs as input. If no loan IDs are specified, it returns all loans for the user. Otherwise, it returns only the loan IDs specified. + * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/websocket/websocket-endpoints */ -getLoans(params?: ⋮---- /** - * List loan assets + * Dedicated Global JSON-RPC API connection to the same main DRB gateway as private subscriptions. + * Uses a separate connection. See Global Derivatives > Private: * - * Get a list of lendable assets, a map of assets we accept as collateral for loans, and the haircut weight. + * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/websocket/websocket-endpoints */ -getLoanAssets(): Promise ⋮---- /** - * List interest summaries + * Coinbase Market Data (part of Coinbase Exchange API) is the traditional feed which is available without authentication. * - * List summaries of interest owed by asset. + * https://docs.cdp.coinbase.com/exchange/docs/websocket-overview */ -getInterestSummaries(): Promise ⋮---- /** - * List interest rate history + * Coinbase Direct Market Data has direct access to Coinbase Exchange servers and requires Authentication. * - * List interest rate history for a loan. + * https://docs.cdp.coinbase.com/exchange/docs/websocket-overview */ -getInterestRateHistory(params: ⋮---- /** - * List interest charges + * The INTX WebSocket feed is publicly available and provides real-time market data updates for orders and trades. + * The SDK must authenticate when subscribing to the WebSocket Feed the very first time. * - * List interest charges for a loan. + * https://docs.cdp.coinbase.com/intx/docs/websocket-overview */ -getInterestCharges(params: ⋮---- /** - * Get lending overview - * - * This API summarizes lending for a given client. It calculates the overall loan balance, collateral level, and amounts available to borrow. - * It also returns any withdrawal restrictions in force on the client. + * The Prime WebSocket feed provides real-time market data updates for orders and trades. To begin + * receiving feed messages, you must send a signed subscribe message to the server indicating + * which channels and products to receive. The SDK will handle this automatically. * - * Get lending overview returns all amounts in USD notional values, except available_per_asset mappings which are returned in both notional and native values. + * https://docs.cdp.coinbase.com/prime/docs/websocket-feed */ -getLendingOverview(): Promise +⋮---- +/** This is used to differentiate between each of the available websocket streams */ +export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; ⋮---- /** - * Get new loan preview - * - * This API is similar to lending-overview but is used to preview the results of opening a new loan. - * The values returned in the preview response take the existing loans, collateral and the potential change being previewed into account. - * Note the preview request accepts native currency amounts as input. + * Normalised internal format for a request (subscribe/unsubscribe/etc) on a topic, with optional parameters. + * + * - Topic: the topic this event is for + * - Payload: the parameters to include, optional. E.g. auth requires key + sign. Some topics allow configurable parameters. + */ +export interface WsTopicRequest< + TWSTopic extends string = string, + TWSPayload = any, +> { + topic: TWSTopic; + /** + * Any parameters to include with the request. These are automatically merged into the request. */ -getNewLoanPreview(params: { - currency: string; - native_amount: string; -}): Promise + payload?: TWSPayload; +} ⋮---- /** - * Open new loan - * - * This API triggers a loan open request. Funding is not necessarily instantaneous and there is no SLA. - * You are notified when funds have settled in your Exchange account. Loan open requests, once initiated, cannot be canceled. + * Any parameters to include with the request. These are automatically merged into the request. */ -submitNewLoan(params: SubmitCBExchNewLoan): Promise ⋮---- /** - * List new loan options - * - * Get available currencies and interest rates for new loans. All amounts returned by this API are notional values (i.e., USD). - */ -getNewLoanOptions(): Promise + * Conveniently allow users to request a topic either as string topics or objects (containing string topic + params) + */ +export type WsTopicRequestOrStringTopic< + TWSTopic extends string, + TWSPayload = any, +> = WsTopicRequest | string; +⋮---- +export interface MessageEventLike { + target: WebSocket; + type: 'message'; + data: string; +} +⋮---- +export function isMessageEvent(msg: unknown): msg is MessageEventLike ⋮---- /** - * Repay loan interest - * - * Submit an interest repayment for a loan. - */ -repayLoanInterest(params: RepayCBExchLoanInterest): Promise + * Some exchanges have two livenet environments, some have test environments, some dont. This allows easy flexibility for different exchanges. + * Examples: + * - One livenet and one testnet: NetworkMap<'livenet' | 'testnet'> + * - One livenet, sometimes two, one testnet: NetworkMap<'livenet' | 'testnet', 'livenet2'> + * - Only one livenet, no other networks: NetworkMap<'livenet'> + */ +type NetworkMap< + TRequiredKeys extends string, + TOptionalKeys extends string | undefined = undefined, +> = Record & + (TOptionalKeys extends string + ? Record + : Record); +⋮---- +/** Global JSON-RPC request IDs are unique within each connection. Replies omit the method. */ +export function getPromiseRefForWSAPIRequest(request: { + id: string | number; +}): string +⋮---- +export function isAdvancedTradeGlobalWsKey( + wsKey: WsKey, +): wsKey is + | typeof WS_KEY_MAP.advTradeGlobalMarketData + | typeof WS_KEY_MAP.advTradeGlobalUserData + | typeof WS_KEY_MAP.advTradeGlobalWSAPI { + return ( + wsKey === WS_KEY_MAP.advTradeGlobalMarketData || + wsKey === WS_KEY_MAP.advTradeGlobalUserData || + wsKey === WS_KEY_MAP.advTradeGlobalWSAPI + ); ⋮---- /** - * Repay loan principal - * - * Submit a principal repayment for a loan. - */ -repayLoanPrincipal(params: RepayCBExchLoanPrincipal): Promise + * Merge one or more WS Request operations (e.g. subscribe request) for + * CB Exchange into one, allowing them to be sent as one request + */ +export function getMergedCBExchangeWSRequestOperations< + TWSTopic extends string = string, +>(operations: WsExchangeRequestOperation[]) +⋮---- +// The CB Exchange WS supports sending multiple topics in one request. +// Merge all requests into one ⋮---- /** - * Get principal repayment preview - * - * Preview the results of a loan principal repayment. - * Like the Get lending overview API, all values are notional except available_per_asset which returns both notional and native values per currency. - */ -getPrincipalRepaymentPreview( - params: GetCBExchPrincipalRepaymentPreview, -): Promise + * Merge one or more WS Request operations (e.g. subscribe request) for + * CB Exchange into one, allowing them to be sent as one request + */ +export function getMergedCBINTXRequestOperations< + TWSTopic extends string = string, +>(operations: WsInternationalRequestOperation[]) +⋮---- +// The CB Exchange WS supports sending multiple topics in one request. +// Merge all requests into one ⋮---- /** - * - * Coinbase Price Oracle Endpoints - * - */ + * Return sign used to authenticate CB Exchange WS requests + */ +export async function getCBExchangeWSSign(apiSecret: string): Promise< ⋮---- /** - * Get signed prices - * - * Get cryptographically signed prices ready to be posted on-chain using Compound's Open Oracle smart contract. - */ -getSignedPrices(): Promise + * Return sign used to authenticate CB INTX WS requests + */ +export async function getCBInternationalWSSign( + apiKey: string, + apiSecret: string, + apiPassphrase: string, +): Promise< ⋮---- /** - * - * Products Endpoints - * - */ + * Return sign used to authenticate CB Prime WS requests + */ +export async function getCBPrimeWSSign(params: { + channelName: string; + svcAccountId: string; + portfolioId: string; + apiKey: string; + apiSecret: string; + product_ids?: string[]; +}): Promise< +⋮---- +// channelName + accessKey + svcAccountId + timestamp + portfolioId + products ⋮---- /** - * Get all known trading pairs - * - * Gets a list of available currency pairs for trading. - */ -getAllTradingPairs(params?: + * ws.terminate() is undefined in browsers. + * This only works in node.js, not in browsers. + * Does nothing if `ws` is undefined. Does nothing in browsers. + */ +export function safeTerminateWs( + ws?: WebSocket | any, + fallbackToClose?: boolean, +): boolean + +================ +File: src/lib/websocket/WsStore.ts +================ +import WebSocket from 'isomorphic-ws'; +⋮---- +import { DefaultLogger } from './logger.js'; +import { + DeferredPromise, + WSConnectedResult, + WsConnectionStateEnum, + WsStoredState, +} from './WsStore.types.js'; ⋮---- /** - * Get all product volume - * - * Gets 30-day and 24-hour volume for all products and market types. - */ -getAllProductVolume(): Promise + * Simple comparison of two objects, recursive for nested objects + */ +export function isDeepObjectMatch(object1: unknown, object2: unknown): boolean +⋮---- +type DeferredPromiseRef = + (typeof DEFERRED_PROMISE_REF)[keyof typeof DEFERRED_PROMISE_REF]; +⋮---- +export class WsStore< +WsKey extends string, +⋮---- +constructor(logger: typeof DefaultLogger) +⋮---- +/** Get WS stored state for key, optionally create if missing */ +get( + key: WsKey, + createIfMissing?: true, + ): WsStoredState; +⋮---- +get( + key: WsKey, + createIfMissing?: false, + ): WsStoredState | undefined; +⋮---- +get( + key: WsKey, + createIfMissing?: boolean, +): WsStoredState | undefined +⋮---- +getKeys(): WsKey[] +⋮---- +create(key: WsKey): WsStoredState | undefined +⋮---- +delete(key: WsKey): void +⋮---- +// TODO: should we allow this at all? Perhaps block this from happening... +⋮---- +/* connection websocket */ +⋮---- +hasExistingActiveConnection(key: WsKey): boolean +⋮---- +getWs(key: WsKey): WebSocket | undefined +⋮---- +setWs(key: WsKey, wsConnection: WebSocket): WebSocket +⋮---- +getDeferredPromise( + wsKey: WsKey, + promiseRef: string | DeferredPromiseRef, +): DeferredPromise | undefined ⋮---- -/** - * Get single product - * - * Get information on a single product. - */ -getProduct(params: +createDeferredPromise( + wsKey: WsKey, + promiseRef: string | DeferredPromiseRef, + throwIfExists: boolean, +): DeferredPromise ⋮---- -/** - * Get product book - * - * Get a list of open orders for a product. The amount of detail shown can be customized with the level parameter. - * By default, only the inside (i.e., the best) bid and ask are returned. This is equivalent to a book depth of 1 level. - * To see a larger order book, specify the level query parameter. - */ -getProductBook(params: +// console.log('existing promise'); ⋮---- -/** - * Get product candles - * - * Historic rates for a product. Rates are returned in grouped buckets. - * Candle schema is of the form [timestamp, price_low, price_high, price_open, price_close]. - */ -getProductCandles(params: GetCBExchProductCandles): Promise +// console.log('create promise'); ⋮---- -/** - * Get product stats - * - * Gets 30-day and 24-hour stats for a product. - */ -getProductStats(params: +// TODO: Once stable, use Promise.withResolvers in future ⋮---- -/** - * Get product ticker - * - * Gets snapshot information about the last trade (tick), best bid/ask, and 24h volume. - */ -getProductTicker(params: +resolveDeferredPromise( + wsKey: WsKey, + promiseRef: string | DeferredPromiseRef, + value: unknown, + removeAfter: boolean, +): void ⋮---- -/** - * Get product trades - * - * Gets a list of the latest trades for a product. - */ -getProductTrades(params: GetCBExchProductTrades): Promise +rejectDeferredPromise( + wsKey: WsKey, + promiseRef: string | DeferredPromiseRef, + value: unknown, + removeAfter: boolean, +): void ⋮---- -/** - * - * Profiles Endpoints - * - */ +removeDeferredPromise( + wsKey: WsKey, + promiseRef: string | DeferredPromiseRef, +): void ⋮---- -/** - * Get profiles - * - * Gets a list of all of the current user's profiles. - */ -getProfiles(params?: +// Just in case it's pending ⋮---- -/** - * Create a profile - * - * Create a new profile. Will fail if no name is provided or if user already has max number of profiles. - */ -createProfile(params: +rejectAllDeferredPromises(wsKey: WsKey, reason: string): void ⋮---- -/** - * Transfer funds between profiles - * - * Transfer an amount of currency from one profile to another. - */ -transferFundsBetweenProfiles( - params: TransferCBExchFundsBetweenProfiles, -): Promise +// Skip reserved keys, such as the connection promise ⋮---- -/** - * Get profile by id - * - * Information for a single profile. Use this endpoint when you know the profile_id. - */ -getProfileById(params: { - profile_id: string; - active?: boolean; -}): Promise +/** Get promise designed to track a connection attempt in progress. Resolves once connected. */ +getConnectionInProgressPromise( + wsKey: WsKey, +): DeferredPromise | undefined ⋮---- /** - * Rename a profile + * Create a deferred promise designed to track a connection attempt in progress. * - * Rename a profile. Names 'default' and 'margin' are reserved. + * Will throw if existing promise is found. */ -renameProfile(params: +createConnectionInProgressPromise( + wsKey: WsKey, + throwIfExists: boolean, +): DeferredPromise ⋮---- -/** - * Delete a profile - * - * Deletes the profile specified by profile_id and transfers all funds to the profile specified by to. - * Fails if there are any open orders on the profile to be deleted. - */ -deleteProfile(params: +/** Remove promise designed to track a connection attempt in progress */ +removeConnectingInProgressPromise(wsKey: WsKey): void ⋮---- -/** - * - * Reports Endpoints - * - */ +getAuthenticationInProgressPromise( + wsKey: WsKey, +): DeferredPromise | undefined ⋮---- -/** - * Get all reports - * - * Gets a list of all user-generated reports. - */ -getAllReports(params?: GetAllCBExchReports): Promise +createAuthenticationInProgressPromise( + wsKey: WsKey, + throwIfExists: boolean, +): DeferredPromise ⋮---- -/** - * Create a report - * - * Generates a report. You can create reports with historical data for all report types. - * Balance reports can be snapshots of historical or current data. - */ -createReport(params: CreateCBExchReport): Promise +resolveAuthenticationInProgressPromise(wsKey: WsKey, value: unknown): void ⋮---- -/** - * Get a report - * - * Get a specific report by report_id. - */ -getReport(params: +rejectAuthenticationInProgressPromise(wsKey: WsKey, reason: unknown): void ⋮---- -/** - * - * Travel Rule Endpoints - * - */ +/* connection state */ ⋮---- -/** - * Get all travel rule information - * - * Return a list of all stored travel rule information. - */ -getTravelRuleInformation( - params?: GetCBExchTravelRuleInformation, -): Promise +isWsOpen(key: WsKey): boolean ⋮---- -/** - * Create travel rule entry - * - * Create travel rule entry for sending address. - */ -createTravelRuleEntry(params: { - address: string; - originator_name: string; - originator_country: string; -}): Promise +getConnectionState(key: WsKey): WsConnectionStateEnum ⋮---- -/** - * Delete existing travel rule entry - * - * Delete existing travel rule entry. - */ -deleteTravelRuleEntry(params: +setConnectionState(key: WsKey, state: WsConnectionStateEnum) ⋮---- -/** - * - * Users Endpoints - * - */ +// console.log(new Date(), `setConnectionState(${key}, ${state})`); ⋮---- -/** - * Get user exchange limits - * - * Gets exchange limits information for a single user. - */ -getUserExchangeLimits(params: +isConnectionState(key: WsKey, state: WsConnectionStateEnum): boolean ⋮---- /** - * Update settlement preference - * - * Updates the settlement preference to hold funds in either USDC or USD. + * Check if we're currently in the process of opening a connection for any reason. Safer than only checking "CONNECTING" as the state + * @param key + * @returns */ -updateSettlementPreference(params: { - user_id: string; - settlement_preference: string; -}): Promise +isConnectionAttemptInProgress(key: WsKey): boolean ⋮---- -/** - * Get user trading volume - * - * Gets aggregated and individual trading volumes for users. - */ -getUserTradingVolume(params: +/* subscribed topics */ ⋮---- -/** - * - * Wrapped Assets Endpoints - * - */ +getTopics(key: WsKey): Set ⋮---- -/** - * Get all wrapped assets - * - * Returns a list of all supported wrapped assets details objects. - */ -getAllWrappedAssets(): Promise +getTopicsByKey(): Record> ⋮---- +// Since topics are objects we can't rely on the set to detect duplicates /** - * Get all stake-wraps - * - * Get details for all stake-wraps in the profile associated with the API key. + * Find matching "topic" request from the store + * @param key + * @param topic + * @returns */ -getAllStakeWraps(params?: GetCBExchAllStakeWraps): Promise +getMatchingTopic(key: WsKey, topic: TWSTopicSubscribeEventArgs) ⋮---- -/** - * Create a new stake-wrap - * - * Stakes and wraps from_currency to to_currency. Funds are stake-wrapped in the profile associated with the API key. - */ -createStakeWrap(params: { - from_currency: string; - to_currency: string; - amount: string; -}): Promise +// if (typeof topic === 'string') { +// return this.getMatchingTopic(key, { channel: topic }); +// } ⋮---- -/** - * Get a single stake-wrap - * - * Get details for a specific stake-wrap in the profile associated with the API key. - */ -getStakeWrap(params: +addTopic(key: WsKey, topic: TWSTopicSubscribeEventArgs) ⋮---- -/** - * Get wrapped asset details - * - * Returns the circulating and total supply of a wrapped asset, and its conversion rate. - */ -getWrappedAssetDetails(params: +// console.log(`wsStore.addTopic(${key}, ${topic})`); +// Check for duplicate topic. If already tracked, don't store this one ⋮---- -/** - * Get wrapped asset conversion rate - * - * Returns the conversion rate of a wrapped asset. - */ -getWrappedAssetConversionRate(params: { - wrapped_asset_id: string; -}): Promise - -================ -File: src/index.ts -================ - - -================ -File: .npmrc -================ -min-release-age=30 -save-exact=true - -================ -File: .nvmrc -================ -v24.18.0 - -================ -File: LICENSE.md -================ -Copyright 2025 Tiago Siebler - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +deleteTopic(key: WsKey, topic: TWSTopicSubscribeEventArgs) +⋮---- +// Check if we're subscribed to a topic like this ================ File: src/types/request/advanced-trade-client.ts @@ -48203,142 +15762,758 @@ export interface AdvTradeGlobalGetAccountSummariesResult { username: string; } ⋮---- -/** Affiliate promotion fee (if greater than 0.0) */ +/** Affiliate promotion fee (if greater than 0.0) */ +⋮---- +/** + * When enabled, Block RFQ self-match prevention stops RFQ execution between accounts + * under the same legal entity. Independent of general self-match prevention + * (available when parameter extended = true). + */ +⋮---- +/** + * Time at which the account was created (milliseconds since the Unix epoch; available + * when parameter extended = true) + */ +⋮---- +/** User email (available when parameter extended = true) */ +⋮---- +/** Account id (available when parameter extended = true) */ +⋮---- +/** + * true when the inter-user transfers are enabled for user (available when parameter + * extended = true) + */ +⋮---- +/** + * List of account summaries for active isolated-margin subaccounts, present only when + * include_isolated=true. Each entry includes the subaccount ID (id) and a nested + * summaries array containing per-currency account balances and risk metrics. + */ +⋮---- +/** + * Whether account is loginable using email and password (available when parameter + * extended = true and account is a subaccount) + */ +⋮---- +/** Whether MMP is enabled (available when parameter extended = true) */ +⋮---- +/** Whether the account receives notifications */ +⋮---- +/** + * Optional identifier of the referrer (of the affiliation program, and available when + * parameter extended = true), which link was used by this account at registration. It + * coincides with suffix of the affiliation link path after /reg- + */ +⋮---- +/** Whether Security Key authentication is enabled (available when parameter extended = true) */ +⋮---- +/** + * true if self trading rejection behavior is applied to trades between subaccounts + * (available when parameter extended = true) + */ +⋮---- +/** + * Self trading rejection behavior - reject_taker or cancel_maker (available when + * parameter extended = true) + */ +⋮---- +/** Aggregated list of per-currency account summaries */ +⋮---- +/** System generated user nickname (available when parameter extended = true) */ +⋮---- +/** Which trading products are enabled or can be overwritten for the account */ +⋮---- +/** Account type (available when parameter extended = true) */ +⋮---- +/** Account name (given by user) (available when parameter extended = true) */ +⋮---- +export interface AdvTradeGlobalPositionWithOpenOrdersMargin + extends AdvTradeGlobalPosition { + /** + * [DEPRECATED] Estimated liquidation price, present only for futures positions and + * always null - the value is no longer computed. The Estimated Liquidation Price + * (ELP) remains available via the Position Builder API. + */ + estimated_liquidation_price?: number | null; + /** Open orders margin, present only for future positions */ + open_orders_margin?: number; +} +⋮---- +/** + * [DEPRECATED] Estimated liquidation price, present only for futures positions and + * always null - the value is no longer computed. The Estimated Liquidation Price + * (ELP) remains available via the Position Builder API. + */ +⋮---- +/** Open orders margin, present only for future positions */ +⋮---- +export interface AdvTradeGlobalGetTransactionLogResult { + /** Continuation token for pagination. NULL when no continuation. */ + continuation: number; + logs: AdvTradeGlobalTransactionLog[]; +} +⋮---- +/** Continuation token for pagination. NULL when no continuation. */ +⋮---- +export interface AdvTradeGlobalBuyResult { + order: AdvTradeGlobalOrder; + trades: AdvTradeGlobalUserTrade[]; +} +⋮---- +export interface AdvTradeGlobalSellResult { + order: AdvTradeGlobalOrder; + trades: AdvTradeGlobalUserTrade[]; +} +⋮---- +export interface AdvTradeGlobalEditResult { + order: AdvTradeGlobalOrder; + trades: AdvTradeGlobalUserTrade[]; +} +⋮---- +export interface AdvTradeGlobalEditByLabelResult { + order: AdvTradeGlobalOrder; + trades: AdvTradeGlobalUserTrade[]; +} +⋮---- +export interface AdvTradeGlobalClosePositionResult { + order: AdvTradeGlobalOrder; + trades: AdvTradeGlobalUserTrade[]; +} +⋮---- +export interface AdvTradeGlobalGetUserTradesByCurrencyResult { + has_more: boolean; + trades: AdvTradeGlobalUserTrade[]; +} +⋮---- +export interface AdvTradeGlobalGetUserTradesByCurrencyAndTimeResult { + has_more: boolean; + trades: AdvTradeGlobalUserTrade[]; +} +⋮---- +export interface AdvTradeGlobalGetUserTradesByInstrumentResult { + has_more: boolean; + trades: AdvTradeGlobalUserTrade[]; +} +⋮---- +export interface AdvTradeGlobalGetUserTradesByInstrumentAndTimeResult { + has_more: boolean; + trades: AdvTradeGlobalUserTrade[]; +} + +================ +File: src/types/websockets/wsAPI.ts +================ +import { WS_KEY_MAP } from '../../lib/websocket/websocket-util.js'; +import { + AdvTradeGlobalCancelAllByCurrencyPairRequest, + AdvTradeGlobalCancelAllByCurrencyRequest, + AdvTradeGlobalCancelAllByInstrumentRequest, + AdvTradeGlobalCancelAllByKindOrTypeRequest, + AdvTradeGlobalCancelAllRequest, + AdvTradeGlobalCancelByLabelRequest, + AdvTradeGlobalCancelRequest, + AdvTradeGlobalChangeMarginModelRequest, + AdvTradeGlobalClosePositionRequest, + AdvTradeGlobalCreateComboRequest, + AdvTradeGlobalDisableCancelOnDisconnectRequest, + AdvTradeGlobalEditByLabelRequest, + AdvTradeGlobalEditRequest, + AdvTradeGlobalEnableCancelOnDisconnectRequest, + AdvTradeGlobalGetAccessLogRequest, + AdvTradeGlobalGetAccountSummariesRequest, + AdvTradeGlobalGetAccountSummaryRequest, + AdvTradeGlobalGetAnnouncementsRequest, + AdvTradeGlobalGetBookSummaryByCurrencyRequest, + AdvTradeGlobalGetBookSummaryByInstrumentRequest, + AdvTradeGlobalGetCancelOnDisconnectRequest, + AdvTradeGlobalGetComboDetailsRequest, + AdvTradeGlobalGetComboIdsRequest, + AdvTradeGlobalGetCombosRequest, + AdvTradeGlobalGetContractSizeRequest, + AdvTradeGlobalGetDeliveryPricesRequest, + AdvTradeGlobalGetExpirationsRequest, + AdvTradeGlobalGetFundingChartDataRequest, + AdvTradeGlobalGetFundingRateHistoryRequest, + AdvTradeGlobalGetFundingRateValueRequest, + AdvTradeGlobalGetHistoricalVolatilityRequest, + AdvTradeGlobalGetIndexChartDataRequest, + AdvTradeGlobalGetIndexPriceNamesRequest, + AdvTradeGlobalGetIndexPriceRequest, + AdvTradeGlobalGetInstrumentRequest, + AdvTradeGlobalGetInstrumentsRequest, + AdvTradeGlobalGetLastSettlementsByCurrencyRequest, + AdvTradeGlobalGetLastSettlementsByInstrumentRequest, + AdvTradeGlobalGetLastTradesByCurrencyAndTimeRequest, + AdvTradeGlobalGetLastTradesByCurrencyRequest, + AdvTradeGlobalGetLastTradesByInstrumentAndTimeRequest, + AdvTradeGlobalGetLastTradesByInstrumentRequest, + AdvTradeGlobalGetLegPricesRequest, + AdvTradeGlobalGetMarginsRequest, + AdvTradeGlobalGetMarkPriceHistoryRequest, + AdvTradeGlobalGetOpenOrdersByCurrencyRequest, + AdvTradeGlobalGetOpenOrdersByInstrumentRequest, + AdvTradeGlobalGetOpenOrdersByLabelRequest, + AdvTradeGlobalGetOpenOrdersRequest, + AdvTradeGlobalGetOrderBookByInstrumentIdRequest, + AdvTradeGlobalGetOrderBookRequest, + AdvTradeGlobalGetOrderHistoryByCurrencyRequest, + AdvTradeGlobalGetOrderHistoryByInstrumentRequest, + AdvTradeGlobalGetOrderMarginByIdsRequest, + AdvTradeGlobalGetOrderStateByLabelRequest, + AdvTradeGlobalGetOrderStateRequest, + AdvTradeGlobalGetPositionRequest, + AdvTradeGlobalGetPositionsRequest, + AdvTradeGlobalGetSettlementHistoryByCurrencyRequest, + AdvTradeGlobalGetSettlementHistoryByInstrumentRequest, + AdvTradeGlobalGetSupportedIndexNamesRequest, + AdvTradeGlobalGetTickerRequest, + AdvTradeGlobalGetTradeVolumesRequest, + AdvTradeGlobalGetTradingviewChartDataRequest, + AdvTradeGlobalGetTransactionLogRequest, + AdvTradeGlobalGetTriggerOrderHistoryRequest, + AdvTradeGlobalGetUserTradesByCurrencyAndTimeRequest, + AdvTradeGlobalGetUserTradesByCurrencyRequest, + AdvTradeGlobalGetUserTradesByInstrumentAndTimeRequest, + AdvTradeGlobalGetUserTradesByInstrumentRequest, + AdvTradeGlobalGetUserTradesByOrderRequest, + AdvTradeGlobalGetVolatilityIndexDataRequest, + AdvTradeGlobalPlaceOrderRequest, + AdvTradeGlobalSimulatePmeRequest, + AdvTradeGlobalSimulatePortfolioRequest, + AdvTradeGlobalTestRequest, +} from '../request/advanced-trade-global-client.js'; +import { + AdvTradeGlobalAccessLog, + AdvTradeGlobalBookSummary, + AdvTradeGlobalBuyResult, + AdvTradeGlobalChangeMarginModelItem, + AdvTradeGlobalClosePositionResult, + AdvTradeGlobalCombo, + AdvTradeGlobalCurrencyWithApr, + AdvTradeGlobalEditByLabelResult, + AdvTradeGlobalEditResult, + AdvTradeGlobalExpirations, + AdvTradeGlobalGetAccountSummariesResult, + AdvTradeGlobalGetAccountSummaryResult, + AdvTradeGlobalGetAnnouncementsItem, + AdvTradeGlobalGetCancelOnDisconnectResult, + AdvTradeGlobalGetContractSizeResult, + AdvTradeGlobalGetDeliveryPricesResult, + AdvTradeGlobalGetFundingChartDataResult, + AdvTradeGlobalGetFundingRateHistoryItem, + AdvTradeGlobalGetHistoricalVolatilityItem, + AdvTradeGlobalGetIndexPriceNamesItem, + AdvTradeGlobalGetIndexPriceResult, + AdvTradeGlobalGetLastSettlementsByCurrencyResult, + AdvTradeGlobalGetLastSettlementsByInstrumentResult, + AdvTradeGlobalGetLastTradesByCurrencyAndTimeResult, + AdvTradeGlobalGetLastTradesByCurrencyResult, + AdvTradeGlobalGetLastTradesByInstrumentAndTimeResult, + AdvTradeGlobalGetLastTradesByInstrumentResult, + AdvTradeGlobalGetLegPricesResult, + AdvTradeGlobalGetMarginsResult, + AdvTradeGlobalGetSettlementHistoryByCurrencyResult, + AdvTradeGlobalGetSettlementHistoryByInstrumentResult, + AdvTradeGlobalGetStatusResult, + AdvTradeGlobalGetSupportedIndexNamesItem, + AdvTradeGlobalGetTradingviewChartDataResult, + AdvTradeGlobalGetTransactionLogResult, + AdvTradeGlobalGetTriggerOrderHistoryResult, + AdvTradeGlobalGetUserTradesByCurrencyAndTimeResult, + AdvTradeGlobalGetUserTradesByCurrencyResult, + AdvTradeGlobalGetUserTradesByInstrumentAndTimeResult, + AdvTradeGlobalGetUserTradesByInstrumentResult, + AdvTradeGlobalGetVolatilityIndexDataResult, + AdvTradeGlobalInstrument, + AdvTradeGlobalKind, + AdvTradeGlobalOrder, + AdvTradeGlobalOrderIdInitialMarginPair, + AdvTradeGlobalPosition, + AdvTradeGlobalPositionWithOpenOrdersMargin, + AdvTradeGlobalSellResult, + AdvTradeGlobalSimulatePmeResult, + AdvTradeGlobalSimulatePortfolioResult, + AdvTradeGlobalTestResult, + AdvTradeGlobalTickerNotification, + AdvTradeGlobalTickerNotificationWithBidsAndAsks, + AdvTradeGlobalTradesVolumes, + AdvTradeGlobalUserTrade, +} from '../response/advanced-trade-global-client.js'; +import { AdvTradeGlobalWSAuthResult } from './advanced-trade-global.js'; +⋮---- +export interface AdvTradeGlobalWSGetTickersByCurrencyRequest { + currency: string; + kind?: AdvTradeGlobalKind | 'any' | AdvTradeGlobalKind[]; + depth?: 1 | 3 | 10; +} ⋮---- -/** - * When enabled, Block RFQ self-match prevention stops RFQ execution between accounts - * under the same legal entity. Independent of general self-match prevention - * (available when parameter extended = true). - */ +export type AdvTradeGlobalWSGetTickersByCurrencyResult = ( + | AdvTradeGlobalTickerNotification + | AdvTradeGlobalTickerNotificationWithBidsAndAsks +)[]; ⋮---- -/** - * Time at which the account was created (milliseconds since the Unix epoch; available - * when parameter extended = true) - */ +export interface AdvTradeGlobalWSGetLeverageRequest { + instrument_name?: string; + subaccount_id?: number; + isolated?: boolean; +} ⋮---- -/** User email (available when parameter extended = true) */ +export interface AdvTradeGlobalWSLeverage { + instrument_name: string; + leverage?: number | null; + max_leverage: number; +} ⋮---- -/** Account id (available when parameter extended = true) */ +export type AdvTradeGlobalWSGetLeverageResult = + | AdvTradeGlobalWSLeverage + | AdvTradeGlobalWSLeverage[] + | Record; ⋮---- -/** - * true when the inter-user transfers are enabled for user (available when parameter - * extended = true) - */ +export interface AdvTradeGlobalWSSetLeverageRequest { + instrument_name: string; + leverage: number | null; + subaccount_id?: number; + isolated?: boolean; +} ⋮---- -/** - * List of account summaries for active isolated-margin subaccounts, present only when - * include_isolated=true. Each entry includes the subaccount ID (id) and a nested - * summaries array containing per-currency account balances and risk metrics. - */ +export type AdvTradeGlobalWSSetLeverageResult = number | null; ⋮---- -/** - * Whether account is loginable using email and password (available when parameter - * extended = true and account is a subaccount) - */ +export interface AdvTradeGlobalWSGetMaxOrderSizeRequest { + instrument_name: string; + subaccount_id?: number; + isolated?: boolean; + leverage?: number; + taker_fee_rate?: number; + price?: number; +} ⋮---- -/** Whether MMP is enabled (available when parameter extended = true) */ +export type AdvTradeGlobalWSGetMaxOrderSizeResult = { + buy_price: number; + max_tradable_amount: { + buy_notional: number; + sell_notional: number; + }; + max_tradable_amount_reduce_only: { + buy_notional: number; + sell_notional: number; + }; + sell_price: number; +}; ⋮---- -/** Whether the account receives notifications */ +export interface AdvTradeGlobalWSGetPmeParamsRequest { + currency: string; +} ⋮---- -/** - * Optional identifier of the referrer (of the affiliation program, and available when - * parameter extended = true), which link was used by this account at registration. It - * coincides with suffix of the affiliation link path after /reg- - */ +export type AdvTradeGlobalWSGetPmeParamsResult = + | { + enabled: true; + max_future_open_orders: number; + max_future_open_orders_size: number; + max_option_open_orders: number; + max_option_open_orders_size: number; + max_risk_reducing_orders: number; + max_total_open_orders: number; + } + | { + enabled: false; + }; ⋮---- -/** Whether Security Key authentication is enabled (available when parameter extended = true) */ +export type AdvTradeGlobalWSGetRiskProfileResult = { + max_leverage?: number | null; + portfolio_margining_allowed: boolean; + short_option_allowed: boolean; +}; ⋮---- -/** - * true if self trading rejection behavior is applied to trades between subaccounts - * (available when parameter extended = true) - */ +export interface AdvTradeGlobalWSGetSubaccountsRequest { + with_portfolio?: boolean; + include_isolated?: boolean; +} ⋮---- -/** - * Self trading rejection behavior - reject_taker or cancel_maker (available when - * parameter extended = true) - */ +export type AdvTradeGlobalWSGetSubaccountsResult = { + email: string; + id: number; + is_password: boolean; + isolated?: boolean | null; + isolated_margin_instrument?: string | null; + login_enabled?: boolean; + margin_model?: string; + not_confirmed_email?: string; + portfolio?: Record< + string, + { + additional_reserve: number; + available_funds: number; + available_withdrawal_funds: number; + balance: number; + currency: string; + equity: number; + initial_margin: number; + maintenance_margin: number; + margin_balance: number; + spot_reserve: number; + } + >; + proof_id?: string; + proof_id_signature?: string; + receive_notifications: boolean; + security_keys_assignments?: unknown[]; + security_keys_enabled?: boolean; + system_name: string; + type: 'main' | 'subaccount'; + username: string; +}[]; ⋮---- -/** Aggregated list of per-currency account summaries */ +export interface AdvTradeGlobalWSGetSubaccountsDetailsRequest { + currency: string; + with_open_orders?: boolean; + include_isolated?: boolean; +} ⋮---- -/** System generated user nickname (available when parameter extended = true) */ +export type AdvTradeGlobalWSGetSubaccountsDetailsResult = { + open_orders?: AdvTradeGlobalOrder[]; + positions: AdvTradeGlobalPosition[]; + uid: number; +}[]; ⋮---- -/** Which trading products are enabled or can be overwritten for the account */ +export interface AdvTradeGlobalWSGetTradingLimitsRequest { + currency: string; +} ⋮---- -/** Account type (available when parameter extended = true) */ +export type AdvTradeGlobalWSGetTradingLimitsResult = { + currency: string; + max_future_open_orders?: number; + max_future_open_orders_size?: number; + max_future_position_size?: number; + max_open_orders_in_instrument?: number; + max_option_open_orders?: number; + max_option_open_orders_size?: number; + max_risk_reducing_orders?: number; + max_total_open_orders?: number; + max_total_short_options_positions?: number; + portfolio_margining_enabled: boolean; +}; ⋮---- -/** Account name (given by user) (available when parameter extended = true) */ +export type AdvTradeGlobalWSGetUserLocksResult = { + currency: string; + enabled: boolean; + message?: string; +}[]; ⋮---- -export interface AdvTradeGlobalPositionWithOpenOrdersMargin - extends AdvTradeGlobalPosition { - /** - * [DEPRECATED] Estimated liquidation price, present only for futures positions and - * always null - the value is no longer computed. The Estimated Liquidation Price - * (ELP) remains available via the Position Builder API. - */ - estimated_liquidation_price?: number | null; - /** Open orders margin, present only for future positions */ - open_orders_margin?: number; +export interface AdvTradeGlobalWSSubmitTransferBetweenSubaccountsRequest { + currency: string; + amount: number; + destination: number; + source?: number; + nonce?: string; } ⋮---- -/** - * [DEPRECATED] Estimated liquidation price, present only for futures positions and - * always null - the value is no longer computed. The Estimated Liquidation Price - * (ELP) remains available via the Position Builder API. - */ -⋮---- -/** Open orders margin, present only for future positions */ +export type AdvTradeGlobalWSSubmitTransferBetweenSubaccountsResult = { + amount: number; + created_timestamp: number; + currency: string; + direction?: 'payment' | 'income'; + id: number; + nonce?: string; + other_side: string; + state: string; + type: 'user' | 'subaccount'; + updated_timestamp: number; +}; ⋮---- -export interface AdvTradeGlobalGetTransactionLogResult { - /** Continuation token for pagination. NULL when no continuation. */ - continuation: number; - logs: AdvTradeGlobalTransactionLog[]; +export interface AdvTradeGlobalWSSetHeartbeatRequest { + interval: number; } ⋮---- -/** Continuation token for pagination. NULL when no continuation. */ +export type AdvTradeGlobalWSSetHeartbeatResult = 'ok'; ⋮---- -export interface AdvTradeGlobalBuyResult { - order: AdvTradeGlobalOrder; - trades: AdvTradeGlobalUserTrade[]; -} +export type AdvTradeGlobalWSDisableHeartbeatResult = 'ok'; ⋮---- -export interface AdvTradeGlobalSellResult { - order: AdvTradeGlobalOrder; - trades: AdvTradeGlobalUserTrade[]; +export interface AdvTradeGlobalWSHelloRequest { + client_name: string; + client_version: string; } ⋮---- -export interface AdvTradeGlobalEditResult { - order: AdvTradeGlobalOrder; - trades: AdvTradeGlobalUserTrade[]; -} +export type AdvTradeGlobalWSHelloResult = { + version: string; +}; ⋮---- -export interface AdvTradeGlobalEditByLabelResult { - order: AdvTradeGlobalOrder; - trades: AdvTradeGlobalUserTrade[]; +export interface AdvTradeGlobalWSLogoutRequest { + invalidate_token?: boolean; } ⋮---- -export interface AdvTradeGlobalClosePositionResult { - order: AdvTradeGlobalOrder; - trades: AdvTradeGlobalUserTrade[]; +export interface WsAPITopicRequestParamMap { + 'public/auth': undefined; + 'public/get_announcements': AdvTradeGlobalGetAnnouncementsRequest | undefined; + 'public/get_book_summary_by_currency': AdvTradeGlobalGetBookSummaryByCurrencyRequest; + 'public/get_book_summary_by_instrument': AdvTradeGlobalGetBookSummaryByInstrumentRequest; + 'public/get_combo_details': AdvTradeGlobalGetComboDetailsRequest; + 'public/get_combo_ids': AdvTradeGlobalGetComboIdsRequest; + 'public/get_combos': AdvTradeGlobalGetCombosRequest; + 'public/get_contract_size': AdvTradeGlobalGetContractSizeRequest; + 'public/get_currencies': undefined; + 'public/get_delivery_prices': AdvTradeGlobalGetDeliveryPricesRequest; + 'public/get_expirations': AdvTradeGlobalGetExpirationsRequest; + 'public/get_funding_chart_data': AdvTradeGlobalGetFundingChartDataRequest; + 'public/get_funding_rate_history': AdvTradeGlobalGetFundingRateHistoryRequest; + 'public/get_funding_rate_value': AdvTradeGlobalGetFundingRateValueRequest; + 'public/get_historical_volatility': AdvTradeGlobalGetHistoricalVolatilityRequest; + 'public/get_index_chart_data': AdvTradeGlobalGetIndexChartDataRequest; + 'public/get_index_price': AdvTradeGlobalGetIndexPriceRequest; + 'public/get_index_price_names': + | AdvTradeGlobalGetIndexPriceNamesRequest + | undefined; + 'public/get_instrument': AdvTradeGlobalGetInstrumentRequest; + 'public/get_instruments': AdvTradeGlobalGetInstrumentsRequest; + 'public/get_last_settlements_by_currency': AdvTradeGlobalGetLastSettlementsByCurrencyRequest; + 'public/get_last_settlements_by_instrument': AdvTradeGlobalGetLastSettlementsByInstrumentRequest; + 'public/get_last_trades_by_currency': AdvTradeGlobalGetLastTradesByCurrencyRequest; + 'public/get_last_trades_by_currency_and_time': AdvTradeGlobalGetLastTradesByCurrencyAndTimeRequest; + 'public/get_last_trades_by_instrument': AdvTradeGlobalGetLastTradesByInstrumentRequest; + 'public/get_last_trades_by_instrument_and_time': AdvTradeGlobalGetLastTradesByInstrumentAndTimeRequest; + 'public/get_mark_price_history': AdvTradeGlobalGetMarkPriceHistoryRequest; + 'public/get_order_book': AdvTradeGlobalGetOrderBookRequest; + 'public/get_order_book_by_instrument_id': AdvTradeGlobalGetOrderBookByInstrumentIdRequest; + 'public/get_supported_index_names': + | AdvTradeGlobalGetSupportedIndexNamesRequest + | undefined; + 'public/get_time': undefined; + 'public/get_trade_volumes': AdvTradeGlobalGetTradeVolumesRequest | undefined; + 'public/get_tradingview_chart_data': AdvTradeGlobalGetTradingviewChartDataRequest; + 'public/get_volatility_index_data': AdvTradeGlobalGetVolatilityIndexDataRequest; + 'public/status': undefined; + 'public/test': AdvTradeGlobalTestRequest | undefined; + 'public/ticker': AdvTradeGlobalGetTickerRequest; + 'private/buy': AdvTradeGlobalPlaceOrderRequest; + 'private/sell': AdvTradeGlobalPlaceOrderRequest; + 'private/edit': AdvTradeGlobalEditRequest; + 'private/edit_by_label': AdvTradeGlobalEditByLabelRequest; + 'private/cancel': AdvTradeGlobalCancelRequest; + 'private/cancel_by_label': AdvTradeGlobalCancelByLabelRequest; + 'private/cancel_all': AdvTradeGlobalCancelAllRequest | undefined; + 'private/cancel_all_by_currency': AdvTradeGlobalCancelAllByCurrencyRequest; + 'private/cancel_all_by_currency_pair': AdvTradeGlobalCancelAllByCurrencyPairRequest; + 'private/cancel_all_by_instrument': AdvTradeGlobalCancelAllByInstrumentRequest; + 'private/cancel_all_by_kind_or_type': AdvTradeGlobalCancelAllByKindOrTypeRequest; + 'private/close_position': AdvTradeGlobalClosePositionRequest; + 'private/get_open_orders': AdvTradeGlobalGetOpenOrdersRequest | undefined; + 'private/get_open_orders_by_currency': AdvTradeGlobalGetOpenOrdersByCurrencyRequest; + 'private/get_open_orders_by_instrument': AdvTradeGlobalGetOpenOrdersByInstrumentRequest; + 'private/get_open_orders_by_label': AdvTradeGlobalGetOpenOrdersByLabelRequest; + 'private/get_order_state': AdvTradeGlobalGetOrderStateRequest; + 'private/get_order_state_by_label': AdvTradeGlobalGetOrderStateByLabelRequest; + 'private/get_order_history_by_currency': AdvTradeGlobalGetOrderHistoryByCurrencyRequest; + 'private/get_order_history_by_instrument': AdvTradeGlobalGetOrderHistoryByInstrumentRequest; + 'private/get_order_margin_by_ids': AdvTradeGlobalGetOrderMarginByIdsRequest; + 'private/get_trigger_order_history': AdvTradeGlobalGetTriggerOrderHistoryRequest; + 'private/get_user_trades_by_currency': AdvTradeGlobalGetUserTradesByCurrencyRequest; + 'private/get_user_trades_by_currency_and_time': AdvTradeGlobalGetUserTradesByCurrencyAndTimeRequest; + 'private/get_user_trades_by_instrument': AdvTradeGlobalGetUserTradesByInstrumentRequest; + 'private/get_user_trades_by_instrument_and_time': AdvTradeGlobalGetUserTradesByInstrumentAndTimeRequest; + 'private/get_user_trades_by_order': AdvTradeGlobalGetUserTradesByOrderRequest; + 'private/get_margins': AdvTradeGlobalGetMarginsRequest; + 'private/get_account_summaries': + | AdvTradeGlobalGetAccountSummariesRequest + | undefined; + 'private/get_account_summary': AdvTradeGlobalGetAccountSummaryRequest; + 'private/get_position': AdvTradeGlobalGetPositionRequest; + 'private/get_positions': AdvTradeGlobalGetPositionsRequest | undefined; + 'private/change_margin_model': AdvTradeGlobalChangeMarginModelRequest; + 'private/get_access_log': AdvTradeGlobalGetAccessLogRequest | undefined; + 'private/get_transaction_log': AdvTradeGlobalGetTransactionLogRequest; + 'private/get_settlement_history_by_currency': AdvTradeGlobalGetSettlementHistoryByCurrencyRequest; + 'private/get_settlement_history_by_instrument': AdvTradeGlobalGetSettlementHistoryByInstrumentRequest; + 'private/simulate_portfolio': AdvTradeGlobalSimulatePortfolioRequest; + 'private/pme/simulate': AdvTradeGlobalSimulatePmeRequest; + 'private/enable_cancel_on_disconnect': + | AdvTradeGlobalEnableCancelOnDisconnectRequest + | undefined; + 'private/disable_cancel_on_disconnect': + | AdvTradeGlobalDisableCancelOnDisconnectRequest + | undefined; + 'private/get_cancel_on_disconnect': + | AdvTradeGlobalGetCancelOnDisconnectRequest + | undefined; + 'private/create_combo': AdvTradeGlobalCreateComboRequest; + 'private/get_leg_prices': AdvTradeGlobalGetLegPricesRequest; + 'public/tickers_by_currency': AdvTradeGlobalWSGetTickersByCurrencyRequest; + 'private/get_leverage': AdvTradeGlobalWSGetLeverageRequest | undefined; + 'private/set_leverage': AdvTradeGlobalWSSetLeverageRequest; + 'private/get_max_order_size': AdvTradeGlobalWSGetMaxOrderSizeRequest; + 'private/get_pme_params': AdvTradeGlobalWSGetPmeParamsRequest; + 'private/get_risk_profile': undefined; + 'private/get_subaccounts': AdvTradeGlobalWSGetSubaccountsRequest | undefined; + 'private/get_subaccounts_details': AdvTradeGlobalWSGetSubaccountsDetailsRequest; + 'private/get_trading_limits': AdvTradeGlobalWSGetTradingLimitsRequest; + 'private/get_user_locks': undefined; + 'private/submit_transfer_between_subaccounts': AdvTradeGlobalWSSubmitTransferBetweenSubaccountsRequest; + 'public/set_heartbeat': AdvTradeGlobalWSSetHeartbeatRequest; + 'public/disable_heartbeat': undefined; + 'public/hello': AdvTradeGlobalWSHelloRequest; + 'private/logout': AdvTradeGlobalWSLogoutRequest | undefined; +} +⋮---- +export type WSAPIWsKey = typeof WS_KEY_MAP.advTradeGlobalWSAPI; +export interface WSAPIRequest { + jsonrpc: '2.0'; + id: number; + method: keyof WsAPITopicRequestParamMap; + params: TParams; } -⋮---- -export interface AdvTradeGlobalGetUserTradesByCurrencyResult { - has_more: boolean; - trades: AdvTradeGlobalUserTrade[]; +/** WS API promises preserve the gateway envelope, as in the other exchange SDKs. */ +export interface WSAPIResponse { + wsKey: WSAPIWsKey; + jsonrpc: '2.0'; + id: number; + result: TResult; + usIn?: number; + usOut?: number; + usDiff?: number; + testnet?: boolean; + isWSAPIResponse: true; + request?: WSAPIRequest & { wsKey: WSAPIWsKey }; +} +export interface WSAPIErrorResponse { + wsKey: WSAPIWsKey; + jsonrpc: '2.0'; + id: number; + error: { code: number; message: string; data?: unknown }; + isWSAPIResponse: true; + request?: WSAPIRequest & { wsKey: WSAPIWsKey }; } -⋮---- -export interface AdvTradeGlobalGetUserTradesByCurrencyAndTimeResult { - has_more: boolean; - trades: AdvTradeGlobalUserTrade[]; +export interface WSAPIRequestFlags { + /** Skip the local authentication requirement. Public methods already skip it. */ + authIsOptional?: boolean; + /** Override the RPC reply timeout in milliseconds. Does not apply to connection/authentication. */ + requestTimeout?: number; } ⋮---- -export interface AdvTradeGlobalGetUserTradesByInstrumentResult { - has_more: boolean; - trades: AdvTradeGlobalUserTrade[]; +/** Skip the local authentication requirement. Public methods already skip it. */ +⋮---- +/** Override the RPC reply timeout in milliseconds. Does not apply to connection/authentication. */ +⋮---- +export interface WsAPIWsKeyTopicMap { + [WS_KEY_MAP.advTradeGlobalWSAPI]: keyof WsAPITopicRequestParamMap; } ⋮---- -export interface AdvTradeGlobalGetUserTradesByInstrumentAndTimeResult { - has_more: boolean; - trades: AdvTradeGlobalUserTrade[]; +export interface WsAPITopicResponseMap { + 'public/auth': WSAPIResponse; + 'public/get_announcements': WSAPIResponse< + AdvTradeGlobalGetAnnouncementsItem[] + >; + 'public/get_book_summary_by_currency': WSAPIResponse< + AdvTradeGlobalBookSummary[] + >; + 'public/get_book_summary_by_instrument': WSAPIResponse< + AdvTradeGlobalBookSummary[] + >; + 'public/get_combo_details': WSAPIResponse; + 'public/get_combo_ids': WSAPIResponse; + 'public/get_combos': WSAPIResponse; + 'public/get_contract_size': WSAPIResponse; + 'public/get_currencies': WSAPIResponse; + 'public/get_delivery_prices': WSAPIResponse; + 'public/get_expirations': WSAPIResponse; + 'public/get_funding_chart_data': WSAPIResponse; + 'public/get_funding_rate_history': WSAPIResponse< + AdvTradeGlobalGetFundingRateHistoryItem[] + >; + 'public/get_funding_rate_value': WSAPIResponse; + 'public/get_historical_volatility': WSAPIResponse< + AdvTradeGlobalGetHistoricalVolatilityItem[] + >; + 'public/get_index_chart_data': WSAPIResponse; + 'public/get_index_price': WSAPIResponse; + 'public/get_index_price_names': WSAPIResponse< + AdvTradeGlobalGetIndexPriceNamesItem[] + >; + 'public/get_instrument': WSAPIResponse; + 'public/get_instruments': WSAPIResponse; + 'public/get_last_settlements_by_currency': WSAPIResponse; + 'public/get_last_settlements_by_instrument': WSAPIResponse; + 'public/get_last_trades_by_currency': WSAPIResponse; + 'public/get_last_trades_by_currency_and_time': WSAPIResponse; + 'public/get_last_trades_by_instrument': WSAPIResponse; + 'public/get_last_trades_by_instrument_and_time': WSAPIResponse; + 'public/get_mark_price_history': WSAPIResponse; + 'public/get_order_book': WSAPIResponse; + 'public/get_order_book_by_instrument_id': WSAPIResponse; + 'public/get_supported_index_names': WSAPIResponse< + AdvTradeGlobalGetSupportedIndexNamesItem[] + >; + 'public/get_time': WSAPIResponse; + 'public/get_trade_volumes': WSAPIResponse; + 'public/get_tradingview_chart_data': WSAPIResponse; + 'public/get_volatility_index_data': WSAPIResponse; + 'public/status': WSAPIResponse; + 'public/test': WSAPIResponse; + 'public/ticker': WSAPIResponse; + 'private/buy': WSAPIResponse; + 'private/sell': WSAPIResponse; + 'private/edit': WSAPIResponse; + 'private/edit_by_label': WSAPIResponse; + 'private/cancel': WSAPIResponse; + 'private/cancel_by_label': WSAPIResponse; + 'private/cancel_all': WSAPIResponse; + 'private/cancel_all_by_currency': WSAPIResponse; + 'private/cancel_all_by_currency_pair': WSAPIResponse; + 'private/cancel_all_by_instrument': WSAPIResponse; + 'private/cancel_all_by_kind_or_type': WSAPIResponse; + 'private/close_position': WSAPIResponse; + 'private/get_open_orders': WSAPIResponse; + 'private/get_open_orders_by_currency': WSAPIResponse; + 'private/get_open_orders_by_instrument': WSAPIResponse; + 'private/get_open_orders_by_label': WSAPIResponse; + 'private/get_order_state': WSAPIResponse; + 'private/get_order_state_by_label': WSAPIResponse; + 'private/get_order_history_by_currency': WSAPIResponse; + 'private/get_order_history_by_instrument': WSAPIResponse< + AdvTradeGlobalOrder[] + >; + 'private/get_order_margin_by_ids': WSAPIResponse< + AdvTradeGlobalOrderIdInitialMarginPair[] + >; + 'private/get_trigger_order_history': WSAPIResponse; + 'private/get_user_trades_by_currency': WSAPIResponse; + 'private/get_user_trades_by_currency_and_time': WSAPIResponse; + 'private/get_user_trades_by_instrument': WSAPIResponse; + 'private/get_user_trades_by_instrument_and_time': WSAPIResponse; + 'private/get_user_trades_by_order': WSAPIResponse; + 'private/get_margins': WSAPIResponse; + 'private/get_account_summaries': WSAPIResponse; + 'private/get_account_summary': WSAPIResponse; + 'private/get_position': WSAPIResponse; + 'private/get_positions': WSAPIResponse< + AdvTradeGlobalPositionWithOpenOrdersMargin[] + >; + 'private/change_margin_model': WSAPIResponse< + AdvTradeGlobalChangeMarginModelItem[] + >; + 'private/get_access_log': WSAPIResponse; + 'private/get_transaction_log': WSAPIResponse; + 'private/get_settlement_history_by_currency': WSAPIResponse; + 'private/get_settlement_history_by_instrument': WSAPIResponse; + 'private/simulate_portfolio': WSAPIResponse; + 'private/pme/simulate': WSAPIResponse; + 'private/enable_cancel_on_disconnect': WSAPIResponse<'ok'>; + 'private/disable_cancel_on_disconnect': WSAPIResponse<'ok'>; + 'private/get_cancel_on_disconnect': WSAPIResponse; + 'private/create_combo': WSAPIResponse; + 'private/get_leg_prices': WSAPIResponse; + 'public/tickers_by_currency': WSAPIResponse; + 'private/get_leverage': WSAPIResponse; + 'private/set_leverage': WSAPIResponse; + 'private/get_max_order_size': WSAPIResponse; + 'private/get_pme_params': WSAPIResponse; + 'private/get_risk_profile': WSAPIResponse; + 'private/get_subaccounts': WSAPIResponse; + 'private/get_subaccounts_details': WSAPIResponse; + 'private/get_trading_limits': WSAPIResponse; + 'private/get_user_locks': WSAPIResponse; + 'private/submit_transfer_between_subaccounts': WSAPIResponse; + 'public/set_heartbeat': WSAPIResponse; + 'public/disable_heartbeat': WSAPIResponse; + 'public/hello': WSAPIResponse; + 'private/logout': void; } ================ @@ -48470,36 +16645,7 @@ function generateConfig(name) // Node.js core modules not available in browsers // The REST client's https.Agent (for keepAlive) is Node.js-only and won't work in browsers ⋮---- -// Code is already transpiled from TypeScript, no additional loaders needed - -================ -File: .gitignore -================ -examples/futures-private-test.ts -examples/spot-private-test.ts -node_modules - -rest-spot-private-ts-test.ts - -localtest.sh -testfile.ts -dist -cbtests.sh -doc - -coverage -ts-adv-trade-test-private.ts -examples/ts-app-priv.ts -examples/ts-commerce.ts -ts-exchange-priv.ts -testfile-cbexch.ts -restClientRegex.ts -privaterepotracker.txt -examples/_TiagoTests -examples/ignored/ -testfile.ts -cbapidocs.txt -repomix.sh +// Code is already transpiled from TypeScript, no additional loaders needed ================ File: src/lib/BaseWSClient.ts @@ -48609,7 +16755,7 @@ function getNormalisedTopicRequests( ⋮---- // passed as string, convert to object ⋮---- -// already a normalised object, thanks to user +// Match the string form even when an object omits its optional payload. ⋮---- type WSTopic = string; ⋮---- @@ -48634,9 +16780,9 @@ protected abstract sendPingEvent(wsKey: TWSKey, ws: WebSocket): void; ⋮---- protected abstract sendPongEvent(wsKey: TWSKey, ws: WebSocket): void; ⋮---- -protected abstract isWsPong(data: any): boolean; +protected abstract isWsPong(data: any, wsKey: TWSKey): boolean; ⋮---- -protected abstract isWsPing(data: any): boolean; +protected abstract isWsPing(data: any, wsKey: TWSKey): boolean; ⋮---- protected abstract getWsAuthRequestEvent(wsKey: TWSKey): Promise; ⋮---- @@ -48677,6 +16823,9 @@ protected abstract connectAll(): Promise<(WSConnectedResult | undefined)[]>; ⋮---- protected isPrivateWsKey(wsKey: TWSKey): boolean ⋮---- +/** Whether this connection needs a separate authentication exchange before subscribing. */ +protected authPrivateConnectionsOnConnect(wsKey: TWSKey): boolean +⋮---- /** Returns auto-incrementing request ID, used to track promise references for async requests */ protected getNewRequestId(): string ⋮---- @@ -48733,7 +16882,7 @@ protected unsubscribeTopicsForWsKey( wsKey: TWSKey, ) ⋮---- -// Store topics, so future automation (post-auth, post-reconnect) has everything needed to resubscribe automatically +// Remove topics before checking the connection, so reconnect cannot restore cancelled subscriptions. ⋮---- // If not connected, don't need to do anything. // Removing the topic from the store is enough to stop it from being resubscribed to on reconnect. @@ -48746,931 +16895,1434 @@ protected unsubscribeTopicsForWsKey( */ ⋮---- // Finally, request subscription to topics if the connection is healthy and ready -⋮---- -/** - * Splits topic requests into two groups, public & private topic requests - */ -private sortTopicRequestsIntoPublicPrivate( - wsTopicRequests: WsTopicRequest[], - wsKey: TWSKey, -): -⋮---- -/** Get the WsStore that tracks websockets & topics */ -public getWsStore(): WsStore> -⋮---- -public close(wsKey: TWSKey, force?: boolean) -⋮---- -public closeAll(force?: boolean) -⋮---- -public isConnected(wsKey: TWSKey): boolean -⋮---- -/** - * Request connection to a specific websocket, instead of waiting for automatic connection. - */ -public async connect(wsKey: TWSKey): Promise -⋮---- -// Important: don't check for RECONNECTING here, or this clashes with reconnectWithDelay()! -⋮---- -private connectToWsUrl(url: string, wsKey: TWSKey): WebSocket -⋮---- -private parseWsError(context: string, error: any, wsKey: TWSKey) -⋮---- -/** Get a signature, build the auth request and send it */ -private async sendAuthRequest(wsKey: TWSKey): Promise -⋮---- -private reconnectWithDelay(wsKey: TWSKey, connectionDelayMs: number) -⋮---- -private ping(wsKey: TWSKey) -⋮---- -private clearTimers(wsKey: TWSKey) -⋮---- -// Send a ping at intervals -private clearPingTimer(wsKey: TWSKey) -⋮---- -// Expect a pong within a time limit -private clearPongTimer(wsKey: TWSKey) -⋮---- -// this.logger.trace(`Cleared pong timeout for "${wsKey}"`); -⋮---- -// this.logger.trace(`No active pong timer for "${wsKey}"`); -⋮---- -/** - * Simply builds and sends subscribe events for a list of topics for a ws key - * - * @private Use the `subscribe(topics)` or `subscribeTopicsForWsKey(topics, wsKey)` method to subscribe to topics. Send WS message to subscribe to topics. - */ -private async requestSubscribeTopics( - wsKey: TWSKey, - topics: WsTopicRequest[], -) -⋮---- -// Automatically splits requests into smaller batches, if needed -⋮---- -// `Subscribing to ${topics.length} "${wsKey}" topics in ${subscribeWsMessages.length} batches.`, // Events: "${JSON.stringify(topics)}" -⋮---- -/** - * Simply builds and sends unsubscribe events for a list of topics for a ws key - * - * @private Use the `unsubscribe(topics)` method to unsubscribe from topics. Send WS message to unsubscribe from topics. - */ -private async requestUnsubscribeTopics( - wsKey: TWSKey, - wsTopicRequests: WsTopicRequest[], -) -⋮---- -/** - * Try sending a string event on a WS connection (identified by the WS Key) - */ -public tryWsSend(wsKey: TWSKey, wsMessage: string) -⋮---- -private async onWsOpen(event: any, wsKey: TWSKey) -⋮---- -private onWsPing(_event: any, wsKey: TWSKey, ws: WebSocket, source: string) -⋮---- -private onWsPong(_event: any, wsKey: TWSKey, source: string) -⋮---- -/** - * Called automatically once a connection is ready. - * - Some exchanges are ready immediately after the connections open. - * - Some exchanges send an event to confirm the connection is ready for us. - * - * This method is called to act when the connection is ready. Use `requireConnectionReadyConfirmation` to control how this is called. - */ -private async onWsReadyForEvents(wsKey: TWSKey) -⋮---- -// Resolve & cleanup deferred "connection attempt in progress" promise -⋮---- -// Remove before resolving, in case there's more requests queued -⋮---- -// Some websockets require an auth packet to be sent after opening the connection -⋮---- -// Reconnect to topics known before it connected -⋮---- -// Request sub to public topics, if any -⋮---- -// Request sub to private topics, if auth on connect isn't needed -⋮---- -/** - * Handle subscription to private topics _after_ authentication successfully completes asynchronously. - * - * Only used for exchanges that require auth before sending private topic subscription requests - */ -private onWsAuthenticated( - wsKey: TWSKey, - event: { isWSAPI?: boolean; WSAPIAuthChannel?: string }, -) -⋮---- -private onWsMessage(event: unknown, wsKey: TWSKey, ws: WebSocket) -⋮---- -// any message can clear the pong timer - wouldn't get a message if the ws wasn't working -⋮---- -// console.log(`raw event: `, { data, dataType, emittableEvents }); -⋮---- -private onWsClose(event: unknown, wsKey: TWSKey) -⋮---- -// clean up any pending promises for this connection -⋮---- -// clean up any pending promises for this connection -⋮---- -// This was an intentional close, delete all state for this connection, as if it never existed: -⋮---- -private getWs(wsKey: TWSKey) -⋮---- -private setWsState(wsKey: TWSKey, state: WsConnectionStateEnum) -⋮---- -/** - * Promise-driven method to assert that a ws has successfully connected (will await until connection is open) - */ -protected async assertIsConnected(wsKey: TWSKey): Promise -⋮---- -// Already in progress? Await shared promise and retry -⋮---- -// Start connection, it should automatically store/return a promise. - -================ -File: src/lib/requestUtils.ts -================ -import { CustomOrderIdProperty } from '../types/shared.types.js'; -⋮---- -/** - * Used to switch how authentication/requests work under the hood - */ -⋮---- -/** Coinbase Advanced Trade API */ -⋮---- -/** - * Coinbase Advanced Trade global derivatives on Advanced Trade: - * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/overview - * - * Technical migration guide regarding Coinbase's new Deribit-powered gateway running on the Starbase platform: - * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/technical - */ -⋮---- -/** Coinbase App API */ -⋮---- -/** Coinbase Exchange API */ -⋮---- -/** Coinbase Prime API */ -⋮---- -/** Coinbase International API */ -⋮---- -/** Coinbase Commerce API */ -⋮---- -export type RestClientType = - (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM]; -⋮---- -// Global Derivatives JSON-RPC gateway. Methods are POST /api/v2. -// https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/introduction -⋮---- -// Static Advanced Trade sandbox (mocked accounts/orders). No matching engine / WebSocket sandbox. -// https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/sandbox -⋮---- -export interface RestClientOptions { - /** - * Your API key name. - * - * - For the Advanced Trade or App APIs, this is your API Key Name. - */ - apiKey?: string; - - /** - * Your API key secret. - * - * - For the Advanced Trade or App APIs, this is your API private key (including the -----BEGIN EC PRIVATE KEY-----\n etc). - */ - apiSecret?: string; - - /** - * Your API passphrase (NOT your account password). Only used for the API groups that use an API passphrase: - * - Coinbase Exchange API - * - Coinbase International API - * - Coinbase Prime API - */ - apiPassphrase?: string; - - /** - * For the Advanced Trade or App APIs, instead of passing the key name and - * private key, you can also parse the exported "cdp_api_key.json" into an object and pass it here. - * - * It will automatically get parsed into the apiKey & apiSecret configuration parameters. - */ - cdpApiKey?: { - name: string; - privateKey: string; - }; - - /** - * https://docs.cdp.coinbase.com/coinbase-app/docs/localization - * - * The Coinbase App API supports localization for error messages and other strings. - * Localization is defined in each request with Accept-Language header. - * - * Accepted values are currently as below. Note: this may not work for all coinbase product groups. - */ - localisation?: - | 'de' - | 'en' - | 'es' - | 'es-mx' - | 'fr' - | 'id' - | 'it' - | 'nl' - | 'pt' - | 'pt-br'; - - /** - * Connect to the sandbox for supported products - * - * - Coinbase Advanced Trade: static REST sandbox (mocked accounts/orders, no matching engine): - * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/sandbox - * - Coinbase Exchange: https://docs.cdp.coinbase.com/exchange/docs/sandbox - * - Coinbase International: https://docs.cdp.coinbase.com/intx/docs/sandbox - * - * - Coinbase App: No sandbox available. - * - Coinbase Prime: No sandbox available. - * - Coinbase Commerce: No sandbox available. - */ - useSandbox?: boolean; - - /** - * Enable keep alive for REST API requests (via axios). - * See: https://github.com/tiagosiebler/bybit-api/issues/368 - */ - keepAlive?: boolean; - - /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - * Default: 1000 (defaults comes from https agent) +⋮---- +/** + * Splits topic requests into two groups, public & private topic requests */ - keepAliveMsecs?: number; - - /** - * For JWT auth (adv trade & app API), seconds until jwt expires. Defaults to 120 seconds. +private sortTopicRequestsIntoPublicPrivate( + wsTopicRequests: WsTopicRequest[], + wsKey: TWSKey, +): +⋮---- +/** Get the WsStore that tracks websockets & topics */ +public getWsStore(): WsStore> +⋮---- +public close(wsKey: TWSKey, force?: boolean) +⋮---- +public closeAll(force?: boolean) +⋮---- +public isConnected(wsKey: TWSKey): boolean +⋮---- +/** + * Request connection to a specific websocket, instead of waiting for automatic connection. */ - jwtExpiresSeconds?: number; - - /** Default: false. If true, we'll throw errors if any params are undefined */ - strictParamValidation?: boolean; - - /** - * Optionally override API protocol + domain - * e.g baseUrl: 'https://api.differentUrl.com' - **/ - baseUrl?: string; - - /** Default: true. whether to try and post-process request exceptions (and throw them). */ - parseExceptions?: boolean; -} +public async connect(wsKey: TWSKey): Promise +⋮---- +// Important: don't check for RECONNECTING here, or this clashes with reconnectWithDelay()! +⋮---- +private connectToWsUrl(url: string, wsKey: TWSKey): WebSocket +⋮---- +private parseWsError(context: string, error: any, wsKey: TWSKey) +⋮---- +/** Get a signature, build the auth request and send it */ +protected async sendAuthRequest(wsKey: TWSKey): Promise +⋮---- +// Create before signing, so concurrent callers await the same exchange. +⋮---- +// Automatic auth is also used without a promise consumer. +⋮---- +// Signing is asynchronous. Never send an old connection's auth on a new socket. +⋮---- +private reconnectWithDelay(wsKey: TWSKey, connectionDelayMs: number) +⋮---- +private ping(wsKey: TWSKey) +⋮---- +protected clearTimers(wsKey: TWSKey) +⋮---- +// Send a ping at intervals +private clearPingTimer(wsKey: TWSKey) +⋮---- +// Expect a pong within a time limit +private clearPongTimer(wsKey: TWSKey) +⋮---- +// this.logger.trace(`Cleared pong timeout for "${wsKey}"`); +⋮---- +// this.logger.trace(`No active pong timer for "${wsKey}"`); ⋮---- /** - * Your API key name. + * Simply builds and sends subscribe events for a list of topics for a ws key * - * - For the Advanced Trade or App APIs, this is your API Key Name. + * @private Use the `subscribe(topics)` or `subscribeTopicsForWsKey(topics, wsKey)` method to subscribe to topics. Send WS message to subscribe to topics. */ +private async requestSubscribeTopics( + wsKey: TWSKey, + topics: WsTopicRequest[], +) +⋮---- +// Automatically splits requests into smaller batches, if needed +⋮---- +// `Subscribing to ${topics.length} "${wsKey}" topics in ${subscribeWsMessages.length} batches.`, // Events: "${JSON.stringify(topics)}" ⋮---- /** - * Your API key secret. + * Simply builds and sends unsubscribe events for a list of topics for a ws key * - * - For the Advanced Trade or App APIs, this is your API private key (including the -----BEGIN EC PRIVATE KEY-----\n etc). + * @private Use the `unsubscribe(topics)` method to unsubscribe from topics. Send WS message to unsubscribe from topics. */ +private async requestUnsubscribeTopics( + wsKey: TWSKey, + wsTopicRequests: WsTopicRequest[], +) ⋮---- /** - * Your API passphrase (NOT your account password). Only used for the API groups that use an API passphrase: - * - Coinbase Exchange API - * - Coinbase International API - * - Coinbase Prime API + * Try sending a string event on a WS connection (identified by the WS Key) */ +public tryWsSend(wsKey: TWSKey, wsMessage: string, throwExceptions = false) +⋮---- +private async onWsOpen(event: any, wsKey: TWSKey) +⋮---- +private onWsPing(_event: any, wsKey: TWSKey, ws: WebSocket, source: string) +⋮---- +private onWsPong(_event: any, wsKey: TWSKey, source: string) ⋮---- /** - * For the Advanced Trade or App APIs, instead of passing the key name and - * private key, you can also parse the exported "cdp_api_key.json" into an object and pass it here. + * Called automatically once a connection is ready. + * - Some exchanges are ready immediately after the connections open. + * - Some exchanges send an event to confirm the connection is ready for us. * - * It will automatically get parsed into the apiKey & apiSecret configuration parameters. + * This method is called to act when the connection is ready. Use `requireConnectionReadyConfirmation` to control how this is called. */ +private async onWsReadyForEvents(wsKey: TWSKey) +⋮---- +// Resolve & cleanup deferred "connection attempt in progress" promise +⋮---- +// Remove before resolving, in case there's more requests queued +⋮---- +// Some websockets require an auth packet to be sent after opening the connection +⋮---- +// Errors are surfaced by the auth parser or sender; automatic connections +// have no caller to consume a rejected auth promise. +⋮---- +// Reconnect to topics known before it connected +⋮---- +// Request sub to public topics, if any +⋮---- +// Request sub to private topics, if auth on connect isn't needed ⋮---- /** - * https://docs.cdp.coinbase.com/coinbase-app/docs/localization - * - * The Coinbase App API supports localization for error messages and other strings. - * Localization is defined in each request with Accept-Language header. + * Handle subscription to private topics _after_ authentication successfully completes asynchronously. * - * Accepted values are currently as below. Note: this may not work for all coinbase product groups. + * Only used for exchanges that require auth before sending private topic subscription requests */ +private onWsAuthenticated( + wsKey: TWSKey, + event: { isWSAPI?: boolean; WSAPIAuthChannel?: string }, +) +⋮---- +private onWsMessage(event: unknown, wsKey: TWSKey, ws: WebSocket) +⋮---- +// any message can clear the pong timer - wouldn't get a message if the ws wasn't working +⋮---- +// console.log(`raw event: `, { data, dataType, emittableEvents }); +⋮---- +protected onWsClose(event: unknown, wsKey: TWSKey) +⋮---- +// clean up any pending promises for this connection +⋮---- +// clean up any pending promises for this connection +⋮---- +// This was an intentional close, delete all state for this connection, as if it never existed: +⋮---- +private getWs(wsKey: TWSKey) +⋮---- +private setWsState(wsKey: TWSKey, state: WsConnectionStateEnum) ⋮---- /** - * Connect to the sandbox for supported products - * - * - Coinbase Advanced Trade: static REST sandbox (mocked accounts/orders, no matching engine): - * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/sandbox - * - Coinbase Exchange: https://docs.cdp.coinbase.com/exchange/docs/sandbox - * - Coinbase International: https://docs.cdp.coinbase.com/intx/docs/sandbox - * - * - Coinbase App: No sandbox available. - * - Coinbase Prime: No sandbox available. - * - Coinbase Commerce: No sandbox available. + * Promise-driven method to assert that a ws has successfully connected (will await until connection is open) */ +protected async assertIsConnected(wsKey: TWSKey): Promise +⋮---- +// Already in progress? Await shared promise and retry +⋮---- +// Start connection, it should automatically store/return a promise. ⋮---- /** - * Enable keep alive for REST API requests (via axios). - * See: https://github.com/tiagosiebler/bybit-api/issues/368 + * Wait for the shared authentication exchange, starting it only when needed. + * Explicit auth calls can force renewal; an in-progress exchange is still shared. */ +public async assertIsAuthenticated( + wsKey: TWSKey, + forceReauth = false, +): Promise + +================ +File: src/types/request/coinbase-prime.ts +================ +/** + * + * Allocation Endpoints + * + */ +⋮---- +export interface CreatePrimePortfolioAllocationsRequest { + allocation_id?: string; + source_portfolio_id?: string; + product_id?: string; + order_ids?: string[]; + allocation_legs: { + allocation_leg_id: string; + destination_portfolio_id: string; + amount: string; + }[]; + size_type?: 'BASE' | 'QUOTE' | 'PERCENT'; + remainder_destination_portfolio?: string; +} +⋮---- +export interface CreatePrimePortfolioNetAllocationsRequest { + netting_id?: string; + source_portfolio_id?: string; + product_id?: string; + order_ids?: string[]; + allocation_legs: { + allocation_leg_id: string; + destination_portfolio_id: string; + amount: string; + }[]; + size_type?: 'BASE' | 'QUOTE' | 'PERCENT'; + remainder_destination_portfolio?: string; +} ⋮---- +export interface GetPrimePortfolioAllocationsRequest { + portfolio_id: string; + product_ids?: string[]; + order_side?: 'BUY' | 'SELL'; + start_date?: string; + end_date?: string; + cursor?: string; + limit?: number; + sort_direction?: 'DESC' | 'ASC'; +} /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - * Default: 1000 (defaults comes from https agent) - */ + * + * Invoice Endpoints + * + */ +⋮---- +export interface GetPrimeInvoicesRequest { + entity_id: string; + states?: string[]; + billing_year?: number; + billing_month?: number; + cursor?: number; + limit?: number; +} +/** + * + * Assets Endpoints + * + */ +⋮---- +/** + * + * Payment Methods Endpoints + * + */ +⋮---- +/** + * + * Users Endpoints + * + */ +⋮---- +export interface GetPrimeUsersRequest { + entity_id: string; + cursor?: string; + limit?: number; + sort_direction?: 'ASC' | 'DESC'; +} ⋮---- +export interface GetPrimePortfolioUsersRequest { + portfolio_id: string; + cursor?: string; + limit?: number; + sort_direction?: string; +} /** - * For JWT auth (adv trade & app API), seconds until jwt expires. Defaults to 120 seconds. - */ -⋮---- -/** Default: false. If true, we'll throw errors if any params are undefined */ + * + * Portfolios Endpoints + * + */ ⋮---- /** - * Optionally override API protocol + domain - * e.g baseUrl: 'https://api.differentUrl.com' - **/ + * + * Activities Endpoints + * + */ ⋮---- -/** Default: true. whether to try and post-process request exceptions (and throw them). */ +export interface GetPrimeActivitiesRequest { + portfolio_id: string; + symbols?: string[]; + categories?: string[]; + statuses?: string[]; + start_time?: string; + end_time?: string; + cursor?: string; + limit?: number; + sort_direction?: 'ASC' | 'DESC'; +} ⋮---- -export function serializeParams | undefined = {}>( - params: T, - strict_validation: boolean | undefined, - encodeValues: boolean, - prefixWith: string, - explodeArrayParameters: boolean, -): string +export interface GetPrimeEntityActivitiesRequest { + entity_id: string; + activity_level?: 'ACTIVITY_LEVEL_ALL'; + symbols?: string[]; + categories?: string[]; + statuses?: string[]; + start_time?: string; + end_time?: string; + cursor?: string; + limit?: number; + sort_direction?: 'ASC' | 'DESC'; +} ⋮---- +export interface GetPrimePortfolioActivityByIdRequest { + portfolio_id: string; + activity_id: string; +} /** - * Coinbase expected array parameters to be sent individually in GET requests, e.g: - * ?order_side=SELL&order_status=OPEN&product_ids=BTC-USDC&product_ids=ETH-USDC - * - * This handles that repetition instead of sending arrays as-is - */ + * + * Address Book Endpoints + * + */ ⋮---- -// Only prefix if there's a value... +export interface GetPrimeAddressBookRequest { + portfolio_id: string; + currency_symbol?: string; + search?: string; + cursor?: string; + limit?: number; + sort_direction?: 'DESC' | 'ASC'; +} ⋮---- -export function logInvalidOrderId( - orderIdProperty: CustomOrderIdProperty, - expectedOrderIdPrefix: string, - params: unknown, -) +export interface CreatePrimeAddressBookEntryRequest { + portfolio_id: string; + address: string; + currency_symbol: string; + name: string; + account_identifier?: string; +} +/** + * + * Balances Endpoints + * + */ ⋮---- -export function getRestBaseUrl( - restClientOptions: RestClientOptions, - restClientType: RestClientType, -): string +export interface GetPrimeWeb3WalletBalancesRequest { + portfolio_id: string; + wallet_id: string; + visibility_statuses?: string[]; + cursor?: string; + limit?: number; +} ⋮---- /** - * Extract and separate request parameters in query string from the rest of the endpoint, to prevent sign issues. * - * @param url endpoint containing params in query string; "/v2/accounts/123123213?someParam=xyz" - * @returns + * Commission Endpoints + * */ -export function getParamsFromURL(url: string): - -================ -File: src/types/request/coinbase-prime.ts -================ +⋮---- /** * - * Allocation Endpoints + * Orders Endpoints * */ ⋮---- -export interface CreatePrimePortfolioAllocationsRequest { - allocation_id?: string; - source_portfolio_id?: string; - product_id?: string; - order_ids?: string[]; - allocation_legs: { - allocation_leg_id: string; - destination_portfolio_id: string; - amount: string; - }[]; - size_type?: 'BASE' | 'QUOTE' | 'PERCENT'; - remainder_destination_portfolio?: string; +export interface GetPrimePortfolioFillsRequest { + portfolio_id: string; + start_date: string; + end_date?: string; + limit?: number; + cursor?: string; + sort_direction?: 'DESC' | 'ASC'; } ⋮---- -export interface CreatePrimePortfolioNetAllocationsRequest { - netting_id?: string; - source_portfolio_id?: string; +export interface GetPrimeOpenOrdersRequest { + portfolio_id: string; + product_ids?: string[]; + order_type?: + | 'MARKET' + | 'LIMIT' + | 'TWAP' + | 'BLOCK' + | 'VWAP' + | 'STOP_LIMIT' + | 'PEG'; + sort_direction?: 'DESC' | 'ASC'; + start_date: string; + order_side?: 'BUY' | 'SELL'; + end_date?: string; +} +⋮---- +export interface SubmitPrimeOrderRequest { + portfolio_id: string; + product_id: string; + side: 'BUY' | 'SELL'; + client_order_id?: string; + type?: 'MARKET' | 'LIMIT' | 'TWAP' | 'VWAP' | 'STOP_LIMIT' | 'PEG'; + base_quantity?: string; + quote_value?: string; + limit_price?: string; + stop_price?: string; + start_time?: string; + expiry_time?: string; + time_in_force?: + | 'FILL_OR_KILL' + | 'GOOD_UNTIL_DATE_TIME' + | 'GOOD_UNTIL_CANCELLED' + | 'IMMEDIATE_OR_CANCEL'; + stp_id?: string; + display_quote_size?: string; + display_base_size?: string; + is_raise_exact?: boolean; + historical_pov?: string; + peg_offset_type?: + | 'PEG_OFFSET_TYPE_PRICE' + | 'PEG_OFFSET_TYPE_BPS' + | 'PEG_OFFSET_TYPE_BASIS_POINTS' + | 'PEG_OFFSET_TYPE_DEPTH' + | 'PEG_OFFSET_TYPE_CUMULATIVE_DEPTH_IN_BASE_UNITS'; + offset?: string; + wig_level?: string; +} +⋮---- +export interface EditPrimeOrderRequest { + portfolio_id: string; + order_id: string; + orig_client_order_id: string; + client_order_id: string; product_id?: string; - order_ids?: string[]; - allocation_legs: { - allocation_leg_id: string; - destination_portfolio_id: string; - amount: string; - }[]; - size_type?: 'BASE' | 'QUOTE' | 'PERCENT'; - remainder_destination_portfolio?: string; + base_quantity?: string; + quote_value?: string; + limit_price?: string; + expiry_time?: string; + display_quote_size?: string; + display_base_size?: string; + stop_price?: string; + offset?: string; + wig_level?: string; } ⋮---- -export interface GetPrimePortfolioAllocationsRequest { +export interface RotatePrimeApiKeyRequest { + api_key_id?: string; +} +⋮---- +export interface GetPrimeOrderPreviewRequest { + portfolio_id: string; + product_id: string; + side: 'BUY' | 'SELL'; + type?: 'MARKET' | 'LIMIT' | 'TWAP' | 'BLOCK' | 'VWAP' | 'STOP_LIMIT' | 'PEG'; + base_quantity?: string; + quote_value?: string; + limit_price?: string; + stop_price?: string; + start_time?: string; + expiry_time?: string; + time_in_force?: + | 'FILL_OR_KILL' + | 'GOOD_UNTIL_DATE_TIME' + | 'GOOD_UNTIL_CANCELLED' + | 'IMMEDIATE_OR_CANCEL'; + is_raise_exact?: boolean; + historical_pov?: string; + peg_offset_type?: + | 'PEG_OFFSET_TYPE_PRICE' + | 'PEG_OFFSET_TYPE_BPS' + | 'PEG_OFFSET_TYPE_BASIS_POINTS' + | 'PEG_OFFSET_TYPE_DEPTH' + | 'PEG_OFFSET_TYPE_CUMULATIVE_DEPTH_IN_BASE_UNITS'; + offset?: string; + wig_level?: string; +} +⋮---- +export interface GetPrimePortfolioOrdersRequest { portfolio_id: string; + order_statuses?: ( + | 'FILLED' + | 'CANCELLED' + | 'EXPIRED' + | 'FAILED' + | 'PENDING' + )[]; product_ids?: string[]; + order_type?: + | 'MARKET' + | 'LIMIT' + | 'TWAP' + | 'BLOCK' + | 'VWAP' + | 'STOP_LIMIT' + | 'PEG'; + cursor?: string; + limit?: number; + sort_direction?: 'DESC' | 'ASC'; order_side?: 'BUY' | 'SELL'; start_date?: string; end_date?: string; +} +⋮---- +export interface GetPrimeOrderFillsRequest { + portfolio_id: string; + order_id: string; cursor?: string; limit?: number; sort_direction?: 'DESC' | 'ASC'; } /** * - * Invoice Endpoints + * Products Endpoints * */ ⋮---- -export interface GetPrimeInvoicesRequest { - entity_id: string; - states?: string[]; - billing_year?: number; - billing_month?: number; - cursor?: number; +export interface GetPrimePortfolioProductsRequest { + portfolio_id: string; + cursor?: string; + /** Must be between 0 and 1000 (defaults to 10 when unset). Values > 1000 are rejected. */ limit?: number; + sort_direction?: 'DESC' | 'ASC'; + /** If unset, returns all product types available for the portfolio (including FUTURE). */ + product_type?: + | 'SPOT' + | 'FUTURE' + | 'OPTION' + | 'PREDICTION_MARKET' + | 'UNKNOWN_PRODUCT_TYPE'; + /** Only applicable when product_type = FUTURE. */ + contract_expiry_type?: + | 'CONTRACT_EXPIRY_TYPE_EXPIRING' + | 'CONTRACT_EXPIRY_TYPE_PERPETUAL'; + /** Filter by expiry status for expiring futures. */ + expiring_contract_status?: + | 'EXPIRING_CONTRACT_STATUS_UNEXPIRED' + | 'EXPIRING_CONTRACT_STATUS_EXPIRED' + | 'EXPIRING_CONTRACT_STATUS_ALL'; } +⋮---- +/** Must be between 0 and 1000 (defaults to 10 when unset). Values > 1000 are rejected. */ +⋮---- +/** If unset, returns all product types available for the portfolio (including FUTURE). */ +⋮---- +/** Only applicable when product_type = FUTURE. */ +⋮---- +/** Filter by expiry status for expiring futures. */ +⋮---- /** * - * Assets Endpoints + * Travel Rule Endpoints * */ ⋮---- +export interface GetPrimeTransactionTravelRuleDataRequest { + portfolio_id: string; + transaction_id: string; +} +⋮---- /** * - * Payment Methods Endpoints + * Transactions Endpoints * */ ⋮---- +export interface GetPrimePortfolioTransactionsRequest { + portfolio_id: string; + symbols?: string[]; + types?: string[]; + start_time?: string; + end_time?: string; + cursor?: string; + limit?: number; + sort_direction?: 'DESC' | 'ASC'; +} +⋮---- +export interface CreatePrimeConversionRequest { + portfolio_id: string; + wallet_id: string; + amount: string; + destination: string; + idempotency_key: string; + source_symbol: string; + destination_symbol: string; +} +⋮---- +export interface GetPrimeWalletTransactionsRequest { + portfolio_id: string; + wallet_id: string; + types?: string[]; + start_time?: string; + end_time?: string; + cursor?: string; + limit?: number; + sort_direction?: 'DESC' | 'ASC'; +} +⋮---- +export interface CreatePrimeTransferRequest { + portfolio_id: string; + wallet_id: string; + amount: string; + destination: string; + idempotency_key: string; + currency_symbol: string; +} +⋮---- +export interface CreatePrimeWithdrawalRequest { + portfolio_id: string; + wallet_id: string; + amount: string; + destination_type: 'DESTINATION_PAYMENT_METHOD' | 'DESTINATION_BLOCKCHAIN'; + idempotency_key: string; + currency_symbol: string; + payment_method?: { + payment_method_id: string; + }; + blockchain_address?: { + address: string; + account_identifier?: string; + }; +} /** * - * Users Endpoints + * Wallets Endpoints * */ ⋮---- -export interface GetPrimeUsersRequest { - entity_id: string; +export interface GetPrimePortfolioWalletsRequest { + portfolio_id: string; + type: 'VAULT' | 'TRADING' | 'WALLET_TYPE_OTHER' | 'WEB3'; cursor?: string; limit?: number; - sort_direction?: 'ASC' | 'DESC'; + sort_direction?: 'DESC' | 'ASC'; + symbols?: string[]; } ⋮---- -export interface GetPrimePortfolioUsersRequest { +export interface CreatePrimeWalletRequest { portfolio_id: string; - cursor?: string; - limit?: number; - sort_direction?: string; + name: string; + symbol: string; + wallet_type: 'VAULT' | 'TRADING' | 'WALLET_TYPE_OTHER' | 'WEB3'; +} +⋮---- +export interface GetPrimeWalletDepositInstructionsRequest { + portfolio_id: string; + wallet_id: string; + deposit_type?: + | 'UNKNOWN_WALLET_DEPOSIT_TYPE' + | 'CRYPTO' + | 'WIRE' + | 'SEN' + | 'SWIFT'; } +⋮---- /** * - * Portfolios Endpoints + * Financing Endpoints * */ ⋮---- +export interface GetPrimeEntityAccrualsRequest { + entity_id: string; + portfolio_id?: string; + start_date?: string; + end_date?: string; +} +⋮---- +export interface GetPrimeEntityLocateAvailabilitiesRequest { + entity_id: string; + conversion_date?: string; + locate_date?: string; +} +⋮---- +export interface GetPrimeEntityMarginSummariesRequest { + entity_id: string; + start_date?: string; + end_date?: string; +} +⋮---- +export interface GetPrimeEntityTFTieredFeesRequest { + entity_id: string; + effective_at?: string; +} +⋮---- +export interface GetPrimePortfolioAccrualsRequest { + portfolio_id: string; + start_date?: string; + end_date?: string; +} +⋮---- +export interface GetPrimePortfolioBuyingPowerRequest { + portfolio_id: string; + base_currency: string; + quote_currency: string; +} +⋮---- +export interface GetPrimePortfolioLocatesRequest { + portfolio_id: string; + locate_ids?: string[]; + conversion_date?: string; + locate_date?: string; +} +⋮---- +export interface GetPrimePortfolioMarginConversionsRequest { + portfolio_id: string; + start_date?: string; + end_date?: string; +} +⋮---- +export interface GetPrimePortfolioWithdrawalPowerRequest { + portfolio_id: string; + symbol: string; +} +⋮---- /** * - * Activities Endpoints + * Futures Endpoints * */ ⋮---- -export interface GetPrimeActivitiesRequest { +export interface GetPrimePortfolioDerivativePositionsRequest { portfolio_id: string; - symbols?: string[]; - categories?: string[]; - statuses?: string[]; - start_time?: string; - end_time?: string; - cursor?: string; - limit?: number; - sort_direction?: 'ASC' | 'DESC'; + product_id?: string; } ⋮---- -export interface GetPrimeEntityActivitiesRequest { - entity_id: string; - activity_level?: 'ACTIVITY_LEVEL_ALL'; - symbols?: string[]; - categories?: string[]; - statuses?: string[]; - start_time?: string; - end_time?: string; - cursor?: string; - limit?: number; - sort_direction?: 'ASC' | 'DESC'; +export interface GetPrimePortfolioDerivativesCurrencySummaryRequest { + portfolio_id: string; +} + +================ +File: src/types/websockets/advanced-trade-global.ts +================ +import { WS_KEY_MAP } from '../../lib/websocket/websocket-util.js'; +import { + AdvTradeGlobalAuthResult, + AdvTradeGlobalBookState, + AdvTradeGlobalGetAnnouncementsItem, + AdvTradeGlobalInstrument, + AdvTradeGlobalKind, + AdvTradeGlobalOrder, + AdvTradeGlobalPosition, + AdvTradeGlobalPublicTrade, + AdvTradeGlobalTestResult, + AdvTradeGlobalTickerNotification, + AdvTradeGlobalUserTrade, +} from '../response/advanced-trade-global-client.js'; +⋮---- +/** Public Global Derivatives channels. The raw interval requires authentication. */ +export type AdvTradeGlobalPublicWSInterval = '100ms' | 'agg2'; +export type AdvTradeGlobalPrivateWSInterval = + | AdvTradeGlobalPublicWSInterval + | 'raw'; +export type AdvTradeGlobalWsKey = + | typeof WS_KEY_MAP.advTradeGlobalMarketData + | typeof WS_KEY_MAP.advTradeGlobalUserData + | typeof WS_KEY_MAP.advTradeGlobalWSAPI; +export type AdvTradeGlobalWSBookGroup = + | 'none' + | 1 + | 2 + | 5 + | 10 + | 25 + | 100 + | 250; +export type AdvTradeGlobalWSBookDepth = 1 | 10 | 20; +export type AdvTradeGlobalWSChartResolution = + | 1 + | 3 + | 5 + | 10 + | 15 + | 30 + | 60 + | 120 + | 180 + | 360 + | 720 + | '1D'; +⋮---- +export type AdvTradeGlobalPublicWSTopic = + | 'announcements' + | `book.${string}.${AdvTradeGlobalWSBookGroup}.${AdvTradeGlobalWSBookDepth}.${AdvTradeGlobalPublicWSInterval}` + | `book.${string}.${AdvTradeGlobalPublicWSInterval}` + | `chart.trades.${string}.${AdvTradeGlobalWSChartResolution}` + | `deribit_price_index.${string}` + | `deribit_price_ranking.${string}` + | `deribit_price_statistics.${string}` + | `deribit_volatility_index.${string}` + | `estimated_expiration_price.${string}` + | `incremental_ticker.${string}` + | `instrument.creation.${AdvTradeGlobalKind}.${string}` + | `instrument.state.${AdvTradeGlobalKind}.${string}` + | `markprice.options.${string}` + | `perpetual.${string}.${AdvTradeGlobalPublicWSInterval}` + | 'platform_state' + | 'platform_state.public_methods_state' + | `quote.${string}` + | `ticker.${string}.${AdvTradeGlobalPublicWSInterval}` + | `trades.${string}.${AdvTradeGlobalPublicWSInterval}` + | `trades.${AdvTradeGlobalKind}.${string}.${AdvTradeGlobalPublicWSInterval}`; +⋮---- +/** The update event preserves Coinbase's JSON-RPC envelope and adds the SDK wsKey. */ +export interface CBAdvancedTradeGlobalSubscriptionEvent< + TData = unknown, + TChannel extends string = AdvTradeGlobalPublicWSTopic, + TWSKey extends + AdvTradeGlobalWsKey = typeof WS_KEY_MAP.advTradeGlobalMarketData, +> { + wsKey: TWSKey; + jsonrpc: '2.0'; + method: 'subscription'; + params: { channel: TChannel; data: TData }; +} +⋮---- +/** Subscription acknowledgements contain channels; liveness and heartbeat setup have other results. */ +export interface CBAdvancedTradeGlobalResponseEvent< + TResult = string[] | AdvTradeGlobalTestResult | 'ok', + TWSKey extends AdvTradeGlobalWsKey = AdvTradeGlobalWsKey, +> { + wsKey: TWSKey; + jsonrpc: '2.0'; + id: string | number; + result: TResult; + usIn?: number; + usOut?: number; + usDiff?: number; + testnet?: boolean; +} +⋮---- +export interface CBAdvancedTradeGlobalErrorEvent { + wsKey: AdvTradeGlobalWsKey; + jsonrpc: '2.0'; + id: string | number | null; + error: { code: number; message: string; data?: unknown }; +} +⋮---- +export interface CBAdvancedTradeGlobalHeartbeatEvent { + wsKey: AdvTradeGlobalWsKey; + jsonrpc: '2.0'; + method: 'heartbeat'; + params: { type: 'heartbeat' | 'test_request' }; +} +⋮---- +/** + * Public payloads from Coinbase's Global AsyncAPI and notification examples. + * Trades, price rankings and option mark prices are arrays of the corresponding items. + * Currency, index and instrument catalogs remain open strings. + * https://docs.cdp.coinbase.com/api-reference/coinbase-deribit-app-api/adv-starbase-asyncapi.json + */ +export interface AdvTradeGlobalWSAnnouncement + extends AdvTradeGlobalGetAnnouncementsItem { + action: 'deleted' | 'new'; + unread?: number; +} +⋮---- +export interface AdvTradeGlobalWSGroupedBook { + asks: [price: number, amount: number][]; + bids: [price: number, amount: number][]; + change_id: number; + instrument_name: string; + timestamp?: number; +} +⋮---- +export type AdvTradeGlobalWSBookLevel = [ + action: 'new' | 'change' | 'delete', + price: number, + amount: number, +]; +⋮---- +export interface AdvTradeGlobalWSBook { + asks: AdvTradeGlobalWSBookLevel[]; + bids: AdvTradeGlobalWSBookLevel[]; + change_id: number; + instrument_name: string; + /** Absent on the initial snapshot. Compare with the last change_id to detect gaps. */ + prev_change_id?: number; + timestamp?: number; + type?: 'change' | 'snapshot'; +} +⋮---- +/** Absent on the initial snapshot. Compare with the last change_id to detect gaps. */ +⋮---- +export interface AdvTradeGlobalWSChart { + close: number; + cost: number; + high: number; + low: number; + open: number; + tick: number; + volume: number; } ⋮---- -export interface GetPrimePortfolioActivityByIdRequest { - portfolio_id: string; - activity_id: string; +export interface AdvTradeGlobalWSPriceIndex { + index_name: string; + price: number; + timestamp: number; } -/** - * - * Address Book Endpoints - * - */ ⋮---- -export interface GetPrimeAddressBookRequest { - portfolio_id: string; - currency_symbol?: string; - search?: string; - cursor?: string; - limit?: number; - sort_direction?: 'DESC' | 'ASC'; +export interface AdvTradeGlobalWSPriceRanking { + enabled?: boolean; + identifier?: string; + original_price?: number | null; + price?: number | null; + timestamp?: number; + weight?: number; } ⋮---- -export interface CreatePrimeAddressBookEntryRequest { - portfolio_id: string; - address: string; - currency_symbol: string; - name: string; - account_identifier?: string; +export interface AdvTradeGlobalWSPriceStatistics { + change24h: number; + fast_market?: boolean; + high24h: number; + index_name: string; + low24h: number; } -/** - * - * Balances Endpoints - * - */ ⋮---- -export interface GetPrimeWeb3WalletBalancesRequest { - portfolio_id: string; - wallet_id: string; - visibility_statuses?: string[]; - cursor?: string; - limit?: number; +export interface AdvTradeGlobalWSVolatilityIndex { + index_name: string; + timestamp: number; + volatility: number; } ⋮---- -/** - * - * Commission Endpoints - * - */ +export interface AdvTradeGlobalWSEstimatedExpirationPrice { + is_estimated: boolean; + left_ticks?: number; + price: number; + seconds: number; + total_ticks?: number; +} ⋮---- -/** - * - * Orders Endpoints - * - */ +export type AdvTradeGlobalWSIncrementalTicker = + Partial & + Pick & { + type?: 'change' | 'snapshot'; + }; ⋮---- -export interface GetPrimePortfolioFillsRequest { - portfolio_id: string; - start_date: string; - end_date?: string; - limit?: number; - cursor?: string; - sort_direction?: 'DESC' | 'ASC'; +/** The creation schema is open; its example contains instrument details and lifecycle fields. */ +export interface AdvTradeGlobalWSInstrumentCreated + extends Partial { + state?: AdvTradeGlobalBookState; + timestamp?: number; + lot_size?: number; + [key: string]: unknown; } ⋮---- -export interface GetPrimeOpenOrdersRequest { - portfolio_id: string; - product_ids?: string[]; - order_type?: - | 'MARKET' - | 'LIMIT' - | 'TWAP' - | 'BLOCK' - | 'VWAP' - | 'STOP_LIMIT' - | 'PEG'; - sort_direction?: 'DESC' | 'ASC'; - start_date: string; - order_side?: 'BUY' | 'SELL'; - end_date?: string; +export interface AdvTradeGlobalWSInstrumentState { + instrument_name?: string; + state?: AdvTradeGlobalBookState; + timestamp?: number; } ⋮---- -export interface SubmitPrimeOrderRequest { - portfolio_id: string; - product_id: string; - side: 'BUY' | 'SELL'; - client_order_id?: string; - type?: 'MARKET' | 'LIMIT' | 'TWAP' | 'VWAP' | 'STOP_LIMIT' | 'PEG'; - base_quantity?: string; - quote_value?: string; - limit_price?: string; - stop_price?: string; - start_time?: string; - expiry_time?: string; - time_in_force?: - | 'FILL_OR_KILL' - | 'GOOD_UNTIL_DATE_TIME' - | 'GOOD_UNTIL_CANCELLED' - | 'IMMEDIATE_OR_CANCEL'; - stp_id?: string; - display_quote_size?: string; - display_base_size?: string; - is_raise_exact?: boolean; - historical_pov?: string; - peg_offset_type?: - | 'PEG_OFFSET_TYPE_PRICE' - | 'PEG_OFFSET_TYPE_BPS' - | 'PEG_OFFSET_TYPE_BASIS_POINTS' - | 'PEG_OFFSET_TYPE_DEPTH' - | 'PEG_OFFSET_TYPE_CUMULATIVE_DEPTH_IN_BASE_UNITS'; - offset?: string; - wig_level?: string; +export interface AdvTradeGlobalWSOptionMarkPrice { + instrument_name?: string; + iv?: number; + mark_price?: number; + timestamp?: number; } ⋮---- -export interface EditPrimeOrderRequest { - portfolio_id: string; - order_id: string; - orig_client_order_id: string; - client_order_id: string; - product_id?: string; - base_quantity?: string; - quote_value?: string; - limit_price?: string; - expiry_time?: string; - display_quote_size?: string; - display_base_size?: string; - stop_price?: string; - offset?: string; - wig_level?: string; +export interface AdvTradeGlobalWSPerpetual { + index_price: number; + interest: number; + timestamp: number; } ⋮---- -export interface RotatePrimeApiKeyRequest { - api_key_id?: string; +export interface AdvTradeGlobalWSPlatformState { + locked?: boolean; + maintenance?: boolean; + price_index?: string; } ⋮---- -export interface GetPrimeOrderPreviewRequest { - portfolio_id: string; - product_id: string; - side: 'BUY' | 'SELL'; - type?: 'MARKET' | 'LIMIT' | 'TWAP' | 'BLOCK' | 'VWAP' | 'STOP_LIMIT' | 'PEG'; - base_quantity?: string; - quote_value?: string; - limit_price?: string; - stop_price?: string; - start_time?: string; - expiry_time?: string; - time_in_force?: - | 'FILL_OR_KILL' - | 'GOOD_UNTIL_DATE_TIME' - | 'GOOD_UNTIL_CANCELLED' - | 'IMMEDIATE_OR_CANCEL'; - is_raise_exact?: boolean; - historical_pov?: string; - peg_offset_type?: - | 'PEG_OFFSET_TYPE_PRICE' - | 'PEG_OFFSET_TYPE_BPS' - | 'PEG_OFFSET_TYPE_BASIS_POINTS' - | 'PEG_OFFSET_TYPE_DEPTH' - | 'PEG_OFFSET_TYPE_CUMULATIVE_DEPTH_IN_BASE_UNITS'; - offset?: string; - wig_level?: string; +export interface AdvTradeGlobalWSPublicMethodsState { + allow_unauthenticated_public_requests: boolean; } ⋮---- -export interface GetPrimePortfolioOrdersRequest { - portfolio_id: string; - order_statuses?: ( - | 'FILLED' - | 'CANCELLED' - | 'EXPIRED' - | 'FAILED' - | 'PENDING' - )[]; - product_ids?: string[]; - order_type?: - | 'MARKET' - | 'LIMIT' - | 'TWAP' - | 'BLOCK' - | 'VWAP' - | 'STOP_LIMIT' - | 'PEG'; - cursor?: string; - limit?: number; - sort_direction?: 'DESC' | 'ASC'; - order_side?: 'BUY' | 'SELL'; - start_date?: string; - end_date?: string; +export interface AdvTradeGlobalWSQuote { + best_ask_amount?: number | null; + best_ask_price?: number | null; + best_bid_amount: number | null; + best_bid_price: number | null; + instrument_name: string; + timestamp: number; } ⋮---- -export interface GetPrimeOrderFillsRequest { - portfolio_id: string; - order_id: string; - cursor?: string; - limit?: number; - sort_direction?: 'DESC' | 'ASC'; +export type CBAdvancedTradeGlobalPublicWSEvent = + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSAnnouncement, + 'announcements' + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSGroupedBook, + `book.${string}.${AdvTradeGlobalWSBookGroup}.${AdvTradeGlobalWSBookDepth}.${AdvTradeGlobalPublicWSInterval}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSBook, + `book.${string}.${AdvTradeGlobalPublicWSInterval}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSChart, + `chart.trades.${string}.${AdvTradeGlobalWSChartResolution}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSPriceIndex, + `deribit_price_index.${string}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSPriceRanking[], + `deribit_price_ranking.${string}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSPriceStatistics, + `deribit_price_statistics.${string}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSVolatilityIndex, + `deribit_volatility_index.${string}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSEstimatedExpirationPrice, + `estimated_expiration_price.${string}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSIncrementalTicker, + `incremental_ticker.${string}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSInstrumentCreated, + `instrument.creation.${AdvTradeGlobalKind}.${string}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSInstrumentState, + `instrument.state.${AdvTradeGlobalKind}.${string}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSOptionMarkPrice[], + `markprice.options.${string}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSPerpetual, + `perpetual.${string}.${AdvTradeGlobalPublicWSInterval}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSPlatformState, + 'platform_state' + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSPublicMethodsState, + 'platform_state.public_methods_state' + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalWSQuote, + `quote.${string}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalTickerNotification, + `ticker.${string}.${AdvTradeGlobalPublicWSInterval}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalPublicTrade[], + `trades.${string}.${AdvTradeGlobalPublicWSInterval}` + > + | CBAdvancedTradeGlobalSubscriptionEvent< + AdvTradeGlobalPublicTrade[], + `trades.${AdvTradeGlobalKind}.${string}.${AdvTradeGlobalPublicWSInterval}` + >; +⋮---- +/** Private payloads from the Global AsyncAPI. Currency and instrument catalogs remain open strings. */ +export interface AdvTradeGlobalWSAccessLog { + city: string; + country: string; + data?: unknown; + id: number; + ip: string; + log: string; + timestamp: number; } -/** - * - * Products Endpoints - * - */ ⋮---- -export interface GetPrimePortfolioProductsRequest { - portfolio_id: string; - cursor?: string; - /** Must be between 0 and 1000 (defaults to 10 when unset). Values > 1000 are rejected. */ - limit?: number; - sort_direction?: 'DESC' | 'ASC'; - /** If unset, returns all product types available for the portfolio (including FUTURE). */ - product_type?: - | 'SPOT' - | 'FUTURE' - | 'OPTION' - | 'PREDICTION_MARKET' - | 'UNKNOWN_PRODUCT_TYPE'; - /** Only applicable when product_type = FUTURE. */ - contract_expiry_type?: - | 'CONTRACT_EXPIRY_TYPE_EXPIRING' - | 'CONTRACT_EXPIRY_TYPE_PERPETUAL'; - /** Filter by expiry status for expiring futures. */ - expiring_contract_status?: - | 'EXPIRING_CONTRACT_STATUS_UNEXPIRED' - | 'EXPIRING_CONTRACT_STATUS_EXPIRED' - | 'EXPIRING_CONTRACT_STATUS_ALL'; +export interface AdvTradeGlobalWSPortfolio { + additional_reserve?: number; + available_funds: number; + available_withdrawal_funds: number; + balance: number; + close_out_margin?: number; + cross_collateral_enabled: boolean; + currency: string; + delta_total?: number; + delta_total_map: Record; + equity: number; + fee_balance?: number; + futures_pl: number; + futures_session_rpl: number; + futures_session_upl: number; + initial_margin: number; + locked_balance?: number; + maintenance_margin: number; + margin_balance: number; + margin_model: string; + options_delta: number; + options_gamma: number; + options_gamma_map: Record; + options_pl: number; + options_session_rpl: number; + options_session_upl: number; + options_theta: number; + options_theta_map: Record; + options_value: number; + options_vega: number; + options_vega_map: Record; + portfolio_margining_enabled: boolean; + projected_close_out_margin?: number; + projected_delta_total: number; + projected_initial_margin?: number; + projected_maintenance_margin: number; + session_rpl: number; + session_upl: number; + total_delta_total_usd?: number; + total_equity_usd?: number; + total_initial_margin_usd?: number; + total_maintenance_margin_usd?: number; + total_margin_balance_usd?: number; + total_pl: number; } ⋮---- -/** Must be between 0 and 1000 (defaults to 10 when unset). Values > 1000 are rejected. */ -⋮---- -/** If unset, returns all product types available for the portfolio (including FUTURE). */ -⋮---- -/** Only applicable when product_type = FUTURE. */ -⋮---- -/** Filter by expiry status for expiring futures. */ -⋮---- -/** - * - * Travel Rule Endpoints - * - */ -⋮---- -export interface GetPrimeTransactionTravelRuleDataRequest { - portfolio_id: string; - transaction_id: string; +export interface AdvTradeGlobalWSIsolatedOrder { + amount: number; + average_price?: number; + creation_timestamp?: number; + direction: string; + filled_amount?: number; + instrument_name: string; + isolated: boolean; + last_update_timestamp?: number; + main_uid: number; + order_id: string; + order_state: string; + order_type?: string; + price?: number; + user_id: number; } ⋮---- -/** - * - * Transactions Endpoints - * - */ -⋮---- -export interface GetPrimePortfolioTransactionsRequest { - portfolio_id: string; - symbols?: string[]; - types?: string[]; - start_time?: string; - end_time?: string; - cursor?: string; - limit?: number; - sort_direction?: 'DESC' | 'ASC'; +export interface AdvTradeGlobalWSIsolatedTrade { + amount: number; + direction: string; + fee?: number; + instrument_name: string; + isolated: boolean; + main_uid: number; + order_id: string; + price: number; + timestamp?: number; + trade_id: string; + user_id: number; } ⋮---- -export interface CreatePrimeConversionRequest { - portfolio_id: string; - wallet_id: string; - amount: string; - destination: string; - idempotency_key: string; - source_symbol: string; - destination_symbol: string; +export interface AdvTradeGlobalWSIsolatedPortfolio { + available_funds?: number; + currency: string; + equity: number; + initial_margin?: number; + main_uid?: number; + maintenance_margin?: number; + margin_balance: number; + user_id: number; } ⋮---- -export interface GetPrimeWalletTransactionsRequest { - portfolio_id: string; - wallet_id: string; - types?: string[]; - start_time?: string; - end_time?: string; - cursor?: string; - limit?: number; - sort_direction?: 'DESC' | 'ASC'; +export interface AdvTradeGlobalWSIsolatedLiquidation { + amount?: number; + close_out_margin?: number; + commission?: number; + currency?: string; + direction?: 'buy' | 'sell'; + equity?: number; + initial_margin?: number; + instrument_name?: string; + isolated?: boolean; + maintenance_margin?: number; + margin_balance?: number; + price?: number; + state: + | 'adl_transfer' + | 'adl_transfer_received' + | 'close_out_liquidation_completed' + | 'close_out_liquidation_started' + | 'liquidation_completed' + | 'liquidation_started' + | 'lsp_transfer'; + timestamp: number; + user_id: number; } ⋮---- -export interface CreatePrimeTransferRequest { - portfolio_id: string; - wallet_id: string; - amount: string; - destination: string; - idempotency_key: string; - currency_symbol: string; +/** WS examples use booleans and null here, despite string fields in the shared schema. */ +export interface AdvTradeGlobalWSUserTrade + extends Omit< + AdvTradeGlobalUserTrade, + 'post_only' | 'reduce_only' | 'matching_id' | 'legs' + > { + post_only?: boolean; + reduce_only?: boolean; + matching_id: string | null; + legs?: AdvTradeGlobalWSUserTrade[]; } ⋮---- -export interface CreatePrimeWithdrawalRequest { - portfolio_id: string; - wallet_id: string; - amount: string; - destination_type: 'DESTINATION_PAYMENT_METHOD' | 'DESTINATION_BLOCKCHAIN'; - idempotency_key: string; - currency_symbol: string; - payment_method?: { - payment_method_id: string; - }; - blockchain_address?: { - address: string; - account_identifier?: string; - }; +/** Changes contain arrays, including positions (plural), as shown in the notification examples. */ +export interface AdvTradeGlobalWSUserChanges { + instrument_name?: string; + orders?: AdvTradeGlobalOrder[]; + positions?: AdvTradeGlobalPosition[]; + trades?: AdvTradeGlobalWSUserTrade[]; } -/** - * - * Wallets Endpoints - * - */ ⋮---- -export interface GetPrimePortfolioWalletsRequest { - portfolio_id: string; - type: 'VAULT' | 'TRADING' | 'WALLET_TYPE_OTHER' | 'WEB3'; - cursor?: string; - limit?: number; - sort_direction?: 'DESC' | 'ASC'; - symbols?: string[]; +export interface AdvTradeGlobalWSIsolatedChanges { + instrument_name: string; + isolated: boolean; + main_uid: number; + user_id: number; + // The isolated change schema leaves the nested objects open. + orders?: Record[]; + positions?: Record[]; + trades?: Record[]; } ⋮---- -export interface CreatePrimeWalletRequest { - portfolio_id: string; - name: string; - symbol: string; - wallet_type: 'VAULT' | 'TRADING' | 'WALLET_TYPE_OTHER' | 'WEB3'; -} +// The isolated change schema leaves the nested objects open. ⋮---- -export interface GetPrimeWalletDepositInstructionsRequest { - portfolio_id: string; - wallet_id: string; - deposit_type?: - | 'UNKNOWN_WALLET_DEPOSIT_TYPE' - | 'CRYPTO' - | 'WIRE' - | 'SEN' - | 'SWIFT'; +export interface AdvTradeGlobalWSUserLock { + currency: string; + locked: boolean; +} +⋮---- +export interface AdvTradeGlobalWSPositionLock { + locked: boolean; +} +⋮---- +/** Keys identify trailing orders; values are their current trigger prices. */ +export type AdvTradeGlobalWSTrailingOrderPrices = Record; +⋮---- +/** All 23 private channel templates, including separate raw order notifications. */ +export type AdvTradeGlobalPrivateWSTopic = + | 'user.access_log' + | `user.changes.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.changes.${AdvTradeGlobalKind}.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.combo_trades.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.combo_trades.${AdvTradeGlobalKind}.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.isolated.changes.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.isolated.changes.${'future' | 'any'}.${string}.${AdvTradeGlobalPrivateWSInterval}` + | 'user.isolated.liquidation' + | `user.isolated.orders.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.isolated.orders.${'future' | 'any'}.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.isolated.portfolio.${string}` + | `user.isolated.trades.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.isolated.trades.${'future' | 'any'}.${string}.${AdvTradeGlobalPrivateWSInterval}` + | 'user.lock' + | `user.orders.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.orders.${AdvTradeGlobalKind}.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.portfolio.${string}` + | 'user.position_lock' + | `user.trades.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.trades.${AdvTradeGlobalKind}.${string}.${AdvTradeGlobalPrivateWSInterval}` + | `user.trailing_orders.trigger_price.${string}`; +⋮---- +export type CBAdvancedTradeGlobalPrivateSubscriptionEvent< + TData = unknown, + TChannel extends string = AdvTradeGlobalPrivateWSTopic, +> = CBAdvancedTradeGlobalSubscriptionEvent< + TData, + TChannel, + typeof WS_KEY_MAP.advTradeGlobalUserData +>; +⋮---- +/** WebSocket authentication authorizes the session without requiring a bearer token. */ +export interface AdvTradeGlobalWSAuthResult + extends Omit { + access_token?: string; +} +⋮---- +export type CBAdvancedTradeGlobalAuthenticatedEvent = + CBAdvancedTradeGlobalResponseEvent< + AdvTradeGlobalWSAuthResult, + | typeof WS_KEY_MAP.advTradeGlobalUserData + | typeof WS_KEY_MAP.advTradeGlobalWSAPI + >; +⋮---- +export type CBAdvancedTradeGlobalPrivateWSEvent = + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSAccessLog, + 'user.access_log' + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSUserChanges, + `user.changes.${string}.${AdvTradeGlobalPrivateWSInterval}` + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSUserTrade[], + `user.combo_trades.${string}.${AdvTradeGlobalPrivateWSInterval}` + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSIsolatedChanges, + `user.isolated.changes.${string}.${AdvTradeGlobalPrivateWSInterval}` + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSIsolatedLiquidation, + 'user.isolated.liquidation' + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSIsolatedOrder, + `user.isolated.orders.${string}.${AdvTradeGlobalPrivateWSInterval}` + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSIsolatedPortfolio, + `user.isolated.portfolio.${string}` + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSIsolatedTrade[], + `user.isolated.trades.${string}.${AdvTradeGlobalPrivateWSInterval}` + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSUserLock, + 'user.lock' + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalOrder[], + `user.orders.${string}.${AdvTradeGlobalPublicWSInterval}` + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalOrder, + `user.orders.${string}.raw` + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSPortfolio, + `user.portfolio.${string}` + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSPositionLock, + 'user.position_lock' + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSUserTrade[], + `user.trades.${string}.${AdvTradeGlobalPrivateWSInterval}` + > + | CBAdvancedTradeGlobalPrivateSubscriptionEvent< + AdvTradeGlobalWSTrailingOrderPrices, + `user.trailing_orders.trigger_price.${string}` + >; + +================ +File: src/types/websockets/requests.ts +================ +/* eslint-disable @typescript-eslint/no-unused-vars */ +export type WsOperation = 'subscribe' | 'unsubscribe'; +⋮---- +/** Global Derivatives subscriptions use complete channel names in params.channels. */ +export interface WsAdvTradeGlobalRequestOperation { + jsonrpc: '2.0'; + id: number; + method: `${'public' | 'private'}/${WsOperation}`; + params: { channels: string[] }; } ⋮---- /** + * This is the format used for commands sent upstream for this websocket connection. * - * Financing Endpoints - * + * Docs: + * - Adv Trade: https://docs.cdp.coinbase.com/advanced-trade/docs/ws-auth#subscribing */ -⋮---- -export interface GetPrimeEntityAccrualsRequest { - entity_id: string; - portfolio_id?: string; - start_date?: string; - end_date?: string; +export interface WsAdvTradeRequestOperation { + type: WsOperation; + channel: TWSTopic; + product_ids?: string[]; + jwt?: string; } ⋮---- -export interface GetPrimeEntityLocateAvailabilitiesRequest { - entity_id: string; - conversion_date?: string; - locate_date?: string; +export interface WsExchangeChannelWithParams { + name: TWSTopic; + product_ids: string[]; } ⋮---- -export interface GetPrimeEntityMarginSummariesRequest { - entity_id: string; - start_date?: string; - end_date?: string; +/** + * Public subscribe/unsubscribe requests for the Coinbase Exchange product group + */ +export interface WsExchangeRequestOperation { + type: WsOperation; + channels: (TWSTopic | WsExchangeChannelWithParams)[]; + product_ids?: string[]; } ⋮---- -export interface GetPrimeEntityTFTieredFeesRequest { - entity_id: string; - effective_at?: string; -} +/** + * Private (authenticated) subscribe/unsubscribe requests for the Coinbase Exchange product group + * https://docs.cdp.coinbase.com/exchange/docs/websocket-auth + */ +export type WsExchangeAuthenticatedRequestOperation< + TWSTopic extends string = string, +> = WsExchangeRequestOperation & { + signature: string; + key: string; + passphrase: string; + timestamp: string; +}; ⋮---- -export interface GetPrimePortfolioAccrualsRequest { - portfolio_id: string; - start_date?: string; - end_date?: string; +/** + * Public subscribe/unsubscribe requests for the Coinbase International product group + */ +export interface WsInternationalRequestOperation< + TWSTopic extends string = string, +> { + type: Uppercase; + channels: TWSTopic[]; + product_ids?: string[]; } ⋮---- -export interface GetPrimePortfolioBuyingPowerRequest { - portfolio_id: string; - base_currency: string; - quote_currency: string; -} +/** + * Private (authenticated) subscribe/unsubscribe requests for the Coinbase International product group + * https://docs.cdp.coinbase.com/intx/docs/websocket-auth + */ +export type WsInternationalAuthenticatedRequestOperation< + TWSTopic extends string = string, +> = WsInternationalRequestOperation & { + time: string; + key: string; + passphrase: string; + signature: string; +}; ⋮---- -export interface GetPrimePortfolioLocatesRequest { +/** + * Public subscribe/unsubscribe requests for the Coinbase Prime product group + */ +export interface WsPrimeRequestOperation { + type: WsOperation; + channel: TWSTopic; + // these should be provided as a payload with the request, else auth will fail + svcAccountId: string; portfolio_id: string; - locate_ids?: string[]; - conversion_date?: string; - locate_date?: string; + product_ids: string[]; + /** Not included in the signature payload. Case-sensitive. */ + product_type?: + | 'SPOT' + | 'FUTURE' + | 'OPTION' + | 'PREDICTION_MARKET' + | 'UNKNOWN_PRODUCT_TYPE'; } ⋮---- -export interface GetPrimePortfolioMarginConversionsRequest { - portfolio_id: string; - start_date?: string; - end_date?: string; -} +// these should be provided as a payload with the request, else auth will fail ⋮---- -export interface GetPrimePortfolioWithdrawalPowerRequest { - portfolio_id: string; - symbol: string; -} +/** Not included in the signature payload. Case-sensitive. */ ⋮---- /** + * Private (authenticated) subscribe/unsubscribe requests for the Coinbase Prime product group * - * Futures Endpoints - * + * - https://docs.cdp.coinbase.com/prime/docs/websocket-feed#signing-messages + * - https://docs.cdp.coinbase.com/prime/docs/websocket-channels */ -⋮---- -export interface GetPrimePortfolioDerivativePositionsRequest { - portfolio_id: string; - product_id?: string; -} -⋮---- -export interface GetPrimePortfolioDerivativesCurrencySummaryRequest { - portfolio_id: string; -} +export type WsPrimeAuthenticatedRequestOperation< + TWSTopic extends string = string, +> = WsPrimeRequestOperation & { + access_key: string; + api_key_id: string; + passphrase: string; + signature: string; + timestamp: string; +}; ================ File: src/CBPrimeClient.ts @@ -49935,436 +18587,804 @@ getConversionFees(): Promise /** * List Invoices * - * Retrieve a list of invoices belonging to an entity. + * Retrieve a list of invoices belonging to an entity. + */ +getInvoices(params: GetPrimeInvoicesRequest): Promise +⋮---- +/** + * + * Position Endpoints + * + */ +⋮---- +/** + * List Aggregate Entity Positions + * + * List paginated aggregate positions for a specific entity. + */ +getEntityAggregatePositions(params: { + entity_id: string; + cursor?: string; + limit?: number; +}): Promise +⋮---- +/** + * List Entity Positions + * + * List paginated positions for a specific entity. + */ +getEntityPositions(params: { + entity_id: string; + cursor?: string; + limit?: number; +}): Promise +⋮---- +/** + * + * Futures Endpoints + * + */ +⋮---- +/** + * List Portfolio Derivative Positions + * + * Retrieve all active derivative positions for a given portfolio across US Futures, prediction markets, and international derivatives. + * Required scope: prime.futures.get_derivative_positions.read + */ +getPortfolioDerivativePositions( + params: GetPrimePortfolioDerivativePositionsRequest, +): Promise +⋮---- +/** + * Get Portfolio Derivatives Currency Summary + * + * Retrieve per-currency international derivatives balances for a given portfolio. + * Required scope: prime.futures.get_derivatives_balance_summary.read + */ +getPortfolioDerivativesCurrencySummary( + params: GetPrimePortfolioDerivativesCurrencySummaryRequest, +): Promise +⋮---- +/** + * + * Assets Endpoints + * + */ +⋮---- +/** + * List Assets + * + * List all assets available for a given entity. + */ +getAssets(params: +⋮---- +/** + * + * Payment Methods Endpoints + * + */ +⋮---- +/** + * List Entity Payment Methods + * + * Retrieve all payment methods for a given entity. + */ +getEntityPaymentMethods(params: +⋮---- +/** + * Get Entity Payment Method + * + * Get payment method details by id for a given entity. + */ +getEntityPaymentMethod(params: { + entity_id: string; + payment_method_id: string; +}): Promise +⋮---- +/** + * + * Users Endpoints + * + */ +⋮---- +/** + * List Users + * + * List all users associated with a given entity. + */ +getUsers(params: GetPrimeUsersRequest): Promise +⋮---- +/** + * List Portfolio Users + * + * List all users associated with a given portfolio. + */ +getPortfolioUsers(params: GetPrimePortfolioUsersRequest): Promise +⋮---- +/** + * + * Portfolios Endpoints + * + */ +⋮---- +/** + * List Portfolios + * + * List all portfolios for which the current API key has read access. + */ +getPortfolios(): Promise +⋮---- +/** + * Get Portfolio by Portfolio ID + * + * Retrieve a given portfolio by its portfolio ID. + */ +getPortfolioById(params: +⋮---- +/** + * Get Portfolio Credit Information + * + * Retrieve a portfolio's post-trade credit information. + */ +getPortfolioCreditInformation(params: { + portfolio_id: string; +}): Promise +⋮---- +/** + * + * Address Book Endpoints + * + */ +⋮---- +/** + * Get Address Book + * + * Gets a list of address book addresses. + */ +getAddressBook(params: GetPrimeAddressBookRequest): Promise +⋮---- +/** + * Create Address Book Entry + * + * Creates an entry for a portfolio's trusted addresses. + */ +createAddressBookEntry( + params: CreatePrimeAddressBookEntryRequest, +): Promise +⋮---- +/** + * + * Balances Endpoints + * + */ +⋮---- +/** + * List Portfolio Balances + * + * List all balances for a specific portfolio. + */ +getPortfolioBalances(params: { + portfolio_id: string; + symbols?: string[]; + balance_type?: 'TRADING_BALANCES' | 'VAULT_BALANCES' | 'TOTAL_BALANCES'; +}): Promise +⋮---- +/** + * Get Wallet Balance + * + * Query balance for a specific wallet. + */ +getWalletBalance(params: { + portfolio_id: string; + wallet_id: string; +}): Promise +⋮---- +/** + * List Web3 Wallet Balances + * + * Query balances for a specific web3 wallet. + */ +getWeb3WalletBalances( + params: GetPrimeWeb3WalletBalancesRequest, +): Promise +⋮---- +/** + * + * Commission Endpoints + * + */ +⋮---- +/** + * Get Portfolio Commission + * + * Retrieve commission associated with a given portfolio. + */ +getPortfolioCommission(params: +⋮---- +/** + * + * Orders Endpoints + * */ -getInvoices(params: GetPrimeInvoicesRequest): Promise ⋮---- /** + * List Portfolio Fills * - * Position Endpoints + * Retrieve fills on a given portfolio. * + * Note: This endpoint requires a start_date and returns a payload with a default + * limit of 100 if not specified. The maximum allowed limit is 3000. */ +getPortfolioFills(params: GetPrimePortfolioFillsRequest): Promise ⋮---- /** - * List Aggregate Entity Positions + * List Open Orders * - * List paginated aggregate positions for a specific entity. + * List all open orders for a given portfolio. */ -getEntityAggregatePositions(params: { - entity_id: string; - cursor?: string; - limit?: number; -}): Promise +getOpenOrders(params: GetPrimeOpenOrdersRequest): Promise ⋮---- /** - * List Entity Positions + * Create Order * - * List paginated positions for a specific entity. + * Create an order for a given portfolio. */ -getEntityPositions(params: { - entity_id: string; - cursor?: string; - limit?: number; -}): Promise +submitOrder(params: SubmitPrimeOrderRequest): Promise ⋮---- /** + * Get Order Preview * - * Futures Endpoints - * + * Retrieve an order preview for a given portfolio. */ +getOrderPreview(params: GetPrimeOrderPreviewRequest): Promise ⋮---- /** - * List Portfolio Derivative Positions + * List Portfolio Orders * - * Retrieve all active derivative positions for a given portfolio across US Futures, prediction markets, and international derivatives. - * Required scope: prime.futures.get_derivative_positions.read + * List historical orders for a given portfolio. */ -getPortfolioDerivativePositions( - params: GetPrimePortfolioDerivativePositionsRequest, -): Promise +getPortfolioOrders(params: GetPrimePortfolioOrdersRequest): Promise ⋮---- /** - * Get Portfolio Derivatives Currency Summary + * Get Order by Order ID * - * Retrieve per-currency international derivatives balances for a given portfolio. - * Required scope: prime.futures.get_derivatives_balance_summary.read + * Retrieve an order by order ID. */ -getPortfolioDerivativesCurrencySummary( - params: GetPrimePortfolioDerivativesCurrencySummaryRequest, -): Promise +getOrderById(params: { + portfolio_id: string; + order_id: string; +}): Promise ⋮---- /** + * Cancel Order * - * Assets Endpoints - * + * Cancel an order. (Filled orders cannot be canceled.) */ +cancelOrder(params: { + portfolio_id: string; + order_id: string; +}): Promise ⋮---- /** - * List Assets + * List Order Fills * - * List all assets available for a given entity. + * Retrieve fills on a given order. */ -getAssets(params: +getOrderFills(params: GetPrimeOrderFillsRequest): Promise ⋮---- /** + * Edit Order (Beta) * - * Payment Methods Endpoints + * Edit an open order. Supports LIMIT, STOP-LIMIT, TWAP, VWAP, and PEG orders. + */ +editOrder(params: EditPrimeOrderRequest): Promise +⋮---- +/** + * Rotate API Key * + * Rotate an API key programmatically, generating a new key with the same configuration. + * Required scope: prime.api_keys.rotate_api_key.write */ +rotateApiKey(params?: RotatePrimeApiKeyRequest): Promise ⋮---- /** - * List Entity Payment Methods * - * Retrieve all payment methods for a given entity. + * Products Endpoints + * */ -getEntityPaymentMethods(params: ⋮---- /** - * Get Entity Payment Method + * List Portfolio Products * - * Get payment method details by id for a given entity. + * List tradable products for a given portfolio. */ -getEntityPaymentMethod(params: { - entity_id: string; - payment_method_id: string; -}): Promise +getPortfolioProducts(params: GetPrimePortfolioProductsRequest): Promise ⋮---- /** * - * Users Endpoints + * Transactions Endpoints * */ ⋮---- /** - * List Users + * List Portfolio Transactions * - * List all users associated with a given entity. + * List transactions for a given portfolio (only transactions that affect balances are accessible). */ -getUsers(params: GetPrimeUsersRequest): Promise +getPortfolioTransactions( + params: GetPrimePortfolioTransactionsRequest, +): Promise ⋮---- /** - * List Portfolio Users + * Get Transaction by Transaction ID * - * List all users associated with a given portfolio. + * Retrieve a specific transaction by its transaction ID (only transactions that affect balances are accessible). */ -getPortfolioUsers(params: GetPrimePortfolioUsersRequest): Promise +getTransactionById(params: { + portfolio_id: string; + transaction_id: string; +}): Promise ⋮---- /** * - * Portfolios Endpoints + * Travel Rule Endpoints * */ ⋮---- /** - * List Portfolios + * Get Transaction Travel Rule Data * - * List all portfolios for which the current API key has read access. + * (Beta) Get fulfilled travel rule data for a transaction. */ -getPortfolios(): Promise +getTransactionTravelRuleData( + params: GetPrimeTransactionTravelRuleDataRequest, +): Promise ⋮---- /** - * Get Portfolio by Portfolio ID + * Create Conversion * - * Retrieve a given portfolio by its portfolio ID. + * Perform a conversion between 2 assets. */ -getPortfolioById(params: +createConversion(params: CreatePrimeConversionRequest): Promise ⋮---- /** - * Get Portfolio Credit Information + * List Wallet Transactions * - * Retrieve a portfolio's post-trade credit information. + * Retrieve transactions for a given wallet (only transactions that affect balances are accessible). */ -getPortfolioCreditInformation(params: { - portfolio_id: string; -}): Promise +getWalletTransactions( + params: GetPrimeWalletTransactionsRequest, +): Promise ⋮---- /** + * Create Transfer * - * Address Book Endpoints - * + * Create a wallet transfer. */ +createTransfer(params: CreatePrimeTransferRequest): Promise ⋮---- /** - * Get Address Book + * Create Withdrawal * - * Gets a list of address book addresses. + * Create a withdrawal. */ -getAddressBook(params: GetPrimeAddressBookRequest): Promise +createWithdrawal(params: CreatePrimeWithdrawalRequest): Promise ⋮---- /** - * Create Address Book Entry * - * Creates an entry for a portfolio's trusted addresses. + * Wallets Endpoints + * */ -createAddressBookEntry( - params: CreatePrimeAddressBookEntryRequest, -): Promise ⋮---- /** + * List Portfolio Wallets * - * Balances Endpoints - * + * List all wallets associated with a given portfolio. */ +getPortfolioWallets(params: GetPrimePortfolioWalletsRequest): Promise ⋮---- /** - * List Portfolio Balances + * Create Wallet * - * List all balances for a specific portfolio. + * Create a wallet. */ -getPortfolioBalances(params: { - portfolio_id: string; - symbols?: string[]; - balance_type?: 'TRADING_BALANCES' | 'VAULT_BALANCES' | 'TOTAL_BALANCES'; -}): Promise +createWallet(params: CreatePrimeWalletRequest): Promise ⋮---- /** - * Get Wallet Balance + * Get Wallet by Wallet ID * - * Query balance for a specific wallet. + * Retrieve a specific wallet by Wallet ID. */ -getWalletBalance(params: { +getWalletById(params: { portfolio_id: string; wallet_id: string; }): Promise ⋮---- /** - * List Web3 Wallet Balances + * Get Wallet Deposit Instructions * - * Query balances for a specific web3 wallet. + * Retrieve a specific wallet's deposit instructions. */ -getWeb3WalletBalances( - params: GetPrimeWeb3WalletBalancesRequest, +getWalletDepositInstructions( + params: GetPrimeWalletDepositInstructionsRequest, ): Promise + +================ +File: src/WebsocketClient.ts +================ +import { BaseWebsocketClient, EmittableEvent } from './lib/BaseWSClient.js'; +import { signWSJWT } from './lib/jwtNode.js'; +import { neverGuard } from './lib/misc-util.js'; +import { + isCBAdvancedTradeErrorEvent, + isCBAdvancedTradeWSEvent, + isCBExchangeWSEvent, + isCBExchangeWSRequestOperation, + isCBINTXWSRequestOperation, + isCBPrimeWSRequestOperation, +} from './lib/websocket/typeGuards.js'; +import { + getCBExchangeWSSign, + getCBInternationalWSSign, + getCBPrimeWSSign, + getMergedCBExchangeWSRequestOperations, + getPromiseRefForWSAPIRequest, + isAdvancedTradeGlobalWsKey, + isMessageEvent, + MessageEventLike, + WS_KEY_MAP, + WS_URL_MAP, + WsKey, + WsTopicRequest, +} from './lib/websocket/websocket-util.js'; +import { + WSConnectedResult, + WsConnectionStateEnum, +} from './lib/websocket/WsStore.types.js'; +import { AdvTradeGlobalAuthRequest } from './types/request/advanced-trade-global-client.js'; +import { AdvTradeGlobalWSAuthResult } from './types/websockets/advanced-trade-global.js'; +import { WsMarket } from './types/websockets/client.js'; +import { + WsAdvTradeGlobalRequestOperation, + WsAdvTradeRequestOperation, + WsExchangeAuthenticatedRequestOperation, + WsExchangeRequestOperation, + WsInternationalAuthenticatedRequestOperation, + WsInternationalRequestOperation, + WsOperation, + WsPrimeAuthenticatedRequestOperation, + WsPrimeRequestOperation, +} from './types/websockets/requests.js'; +import { + WSAPIRequest, + WSAPIRequestFlags, + WsAPITopicRequestParamMap, + WsAPITopicResponseMap, + WsAPIWsKeyTopicMap, +} from './types/websockets/wsAPI.js'; ⋮---- /** - * - * Commission Endpoints - * - */ + * Any WS keys in this list will trigger automatic auth as required, if credentials are available + */ +⋮---- +// Account data (fills), requires auth. +⋮---- +// Coinbase Direct Market Data has direct access to Coinbase Exchange servers and requires auth. +⋮---- +// The INTX feed always requires auth. +⋮---- +// The Prime feed always requires auth. +⋮---- +/** + * Any WS keys in this list will ALWAYS skip the authentication process, even if credentials are available + */ +⋮---- +/** + * WS topics are always a string for this exchange. Some exchanges use complex objects. + */ +type WsTopic = string; +⋮---- +export class WebsocketClient extends BaseWebsocketClient ⋮---- -/** - * Get Portfolio Commission - * - * Retrieve commission associated with a given portfolio. - */ -getPortfolioCommission(params: +/** Tracks either the pending auth reply or the next session renewal. */ ⋮---- /** - * - * Orders Endpoints - * + * Preconnect the original product feeds, preserving the existing connection set. + * Global connections open on demand and are excluded from this method. + * Use connect(wsKey) to preconnect a specific feed, or connectWSAPI() for an authenticated Global WS API session. */ +public connectAll(): Promise<(WSConnectedResult | undefined)[]> ⋮---- /** - * List Portfolio Fills + * Request subscription to one or more topics. Pass topics as either an array of strings, or array of objects (if the topic has parameters). + * Objects should be formatted as {topic: string, params: object}. * - * Retrieve fills on a given portfolio. + * - Subscriptions are automatically routed to the correct websocket connection. + * - Authentication/connection is automatic. + * - Resubscribe after network issues is automatic. * - * Note: This endpoint requires a start_date and returns a payload with a default - * limit of 100 if not specified. The maximum allowed limit is 3000. + * Call `unsubscribe(topics)` to remove topics */ -getPortfolioFills(params: GetPrimePortfolioFillsRequest): Promise +public subscribe( + requests: + | (WsTopicRequest | WsTopic) + | (WsTopicRequest | WsTopic)[], + wsKey: WsKey, +) ⋮---- /** - * List Open Orders + * Unsubscribe from one or more topics. Similar to subscribe() but in reverse. * - * List all open orders for a given portfolio. + * - Requests are automatically routed to the correct websocket connection. + * - These topics will be removed from the topic cache, so they won't be subscribed to again. */ -getOpenOrders(params: GetPrimeOpenOrdersRequest): Promise +public unsubscribe( + requests: + | (WsTopicRequest | WsTopic) + | (WsTopicRequest | WsTopic)[], + wsKey: WsKey, +) ⋮---- -/** - * Create Order - * - * Create an order for a given portfolio. - */ -submitOrder(params: SubmitPrimeOrderRequest): Promise +/** Prepare the Global WS API connection and authenticate before the first private call. */ +public connectWSAPI(): Promise ⋮---- /** - * Get Order Preview - * - * Retrieve an order preview for a given portfolio. + * Send a Global JSON-RPC method and await its matching reply. Public methods do not require auth. + * Pending calls reject on API errors, timeout or disconnect. + * The reply timeout starts after sending; connection/authentication use their own lifecycle handling. + * public/auth signs automatically and uses the authentication timeout. + * private/logout resolves on the server's normal close. */ -getOrderPreview(params: GetPrimeOrderPreviewRequest): Promise +public sendWSAPIRequest< + TWSKey extends keyof WsAPIWsKeyTopicMap, + TMethod extends WsAPIWsKeyTopicMap[TWSKey], + >( + wsKey: TWSKey, + method: TMethod, + ...args: undefined extends WsAPITopicRequestParamMap[TMethod] + ? [ + params?: WsAPITopicRequestParamMap[TMethod], + requestFlags?: WSAPIRequestFlags, + ] + : [ + params: WsAPITopicRequestParamMap[TMethod], + requestFlags?: WSAPIRequestFlags, + ] + ): Promise; ⋮---- -/** - * List Portfolio Orders - * - * List historical orders for a given portfolio. - */ -getPortfolioOrders(params: GetPrimePortfolioOrdersRequest): Promise +public async sendWSAPIRequest( + wsKey: keyof WsAPIWsKeyTopicMap, + method: keyof WsAPITopicRequestParamMap, + params?: unknown, + requestFlags?: WSAPIRequestFlags, +): Promise ⋮---- -/** - * Get Order by Order ID - * - * Retrieve an order by order ID. - */ -getOrderById(params: { - portfolio_id: string; - order_id: string; -}): Promise +// An explicit auth call renews the session even if already authenticated. ⋮---- -/** - * Cancel Order - * - * Cancel an order. (Filled orders cannot be canceled.) - */ -cancelOrder(params: { - portfolio_id: string; - order_id: string; -}): Promise +// Let the server process logout and close. Sending our own close first +// could trigger cancel-on-disconnect before logout has been processed. ⋮---- /** - * List Order Fills * - * Retrieve fills on a given order. + * Internal methods + * */ -getOrderFills(params: GetPrimeOrderFillsRequest): Promise ⋮---- /** - * Edit Order (Beta) - * - * Edit an open order. Supports LIMIT, STOP-LIMIT, TWAP, VWAP, and PEG orders. + * Return a websocket URL, which is connected to as-is. + * If a token or anything else is needed in the URL, this is a good place to add it. */ -editOrder(params: EditPrimeOrderRequest): Promise +protected async getWsUrl(wsKey: WsKey): Promise +⋮---- +protected sendPingEvent(wsKey: WsKey) +⋮---- +protected sendPongEvent(wsKey: WsKey) +⋮---- +// Reply to the gateway's JSON-RPC test_request. Protocol ping frames are handled by BaseWSClient. +⋮---- +// Send a protocol layer pong +⋮---- +protected isWsPing(msg: any, wsKey: WsKey): boolean +⋮---- +// Let the normal message parser report malformed JSON. +⋮---- +protected isWsPong(msg: any, wsKey: WsKey): boolean +⋮---- +// Global uses native pong frames. JSON payloads can contain "pong" in +// tokens, order labels or other user data and must reach the normal parser. +⋮---- +// this.logger.info(`Not a pong: `, msg); +⋮---- +protected resolveEmittableEvents( + wsKey: WsKey, + event: MessageEventLike, +): EmittableEvent[] +⋮---- +// Renew on the same socket with a fresh CDP JWT. The session, rather than +// an access token attached to each subscription, authorizes requests. +⋮---- +// Passive heartbeat notification. test_request is handled by the ping/pong hooks. +⋮---- +// Preserve the JSON-RPC envelope for subscription acknowledgements and liveness replies. +⋮---- +// E.g. {"type":"error","message":"rate limit exceeded","wsKey":"advTradeMarketData"} +⋮---- +// Parse Advanced Trade WS events (update & response) +⋮---- +// These are request/reply pattern events (e.g. after subscribing to topics or authenticating) +⋮---- +// Generic data for a channel +⋮---- +// Parse CB Exchange WS events +⋮---- +// Generic data for a channel ⋮---- /** - * Rotate API Key - * - * Rotate an API key programmatically, generating a new key with the same configuration. - * Required scope: prime.api_keys.rotate_api_key.write + * Determines if a topic is for a private channel, using a hardcoded list of strings */ -rotateApiKey(params?: RotatePrimeApiKeyRequest): Promise +protected isPrivateTopicRequest( + request: WsTopicRequest, + wsKey: WsKey, +): boolean +⋮---- +protected getWsKeyForMarket(market: WsMarket, isPrivate: boolean): WsKey +⋮---- +protected getWsMarketForWsKey(wsKey: WsKey): WsMarket +⋮---- +protected getPrivateWSKeys(): WsKey[] +⋮---- +protected authPrivateConnectionsOnConnect(wsKey: WsKey): boolean +⋮---- +protected clearTimers(wsKey: WsKey) +⋮---- +protected onWsClose(event: unknown, wsKey: WsKey) +⋮---- +private handleGlobalAuthFailure(wsKey: WsKey, error: unknown) +⋮---- +// A failed renewal cannot leave a stale session looking healthy. Reconnect +// and authenticate again; initial auth failures are surfaced without looping. +⋮---- +/** Force subscription requests to be sent in smaller batches, if a number is returned */ +protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null +⋮---- +// Technically, INTX supports request batching but not with nested parameters, so we'll send one at a time +⋮---- +// Exchange supports request batching, no known limit to max topics per request ⋮---- /** - * - * Products Endpoints - * + * Map one or more topics into fully prepared "subscribe request" events (already stringified and ready to send) */ +protected async getWsOperationEventsForTopics( + topicRequests: WsTopicRequest[], + wsKey: WsKey, + operation: WsOperation, +): Promise +⋮---- +// Unlike the older Advanced Trade feed, Global accepts all channels in one request. ⋮---- /** - * List Portfolio Products - * - * List tradable products for a given portfolio. - */ -getPortfolioProducts(params: GetPrimePortfolioProductsRequest): Promise + * Operations need to be structured in a way that this exchange understands. + * Parse the internal format into the format expected by the exchange. One request per operation. + */ +⋮---- +// In case there's ever more operation types than "subscribe" and "unsubscribe" +⋮---- +// As of Sep 2024, parameters (such as product_id[]) cannot be nested with the channels array +⋮---- +// This merges parametrs (such as product_id[]) into the top level request object ⋮---- /** - * - * Transactions Endpoints - * - */ + * - Merge commands into one if the exchange supports batch requests, + * - Apply auth/sign, if needed, + * - Apply any final formatting to return a string array, ready to be sent upstream. + */ +⋮---- +// Events that are ready to send (usually stringified JSON) +// ADV trade only supports sending one at a time, so we don't try to merge them +// These are already signed, if needed. ⋮---- /** - * List Portfolio Transactions - * - * List transactions for a given portfolio (only transactions that affect balances are accessible). - */ -getPortfolioTransactions( - params: GetPrimePortfolioTransactionsRequest, -): Promise + * No batching is supported for this product group, so we can already + * handle sign here and return it as is + */ +⋮---- +// Don't expect this to ever happen, but just to please typescript... +⋮---- +// We're under the max topics per request limit. +// Send operation requests as one merged request +⋮---- +// We're over the max topics per request limit. Break into batches. +⋮---- +// Don't expect this to ever happen, but just to please typescript... +⋮---- +// We're over the max topics per request limit. Break into batches. +⋮---- +// throw new Error( +// 'CB INTX is not fully implemented yet - awaiting test environment... if you need this, please get in touch.', +// ); +⋮---- +// Don't expect this to ever happen, but just to please typescript... +⋮---- +// throw new Error( +// 'CB Prime is not fully implemented yet - awaiting test environment... if you need this, please get in touch.', +// ); +⋮---- +// throw new Error(`Not implemented for "${wsKey}" yet`); ⋮---- /** - * Get Transaction by Transaction ID - * - * Retrieve a specific transaction by its transaction ID (only transactions that affect balances are accessible). + * Global authenticates the socket session; older Coinbase feeds sign per request. */ -getTransactionById(params: { - portfolio_id: string; - transaction_id: string; -}): Promise +protected async getWsAuthRequestEvent(wsKey: WsKey): Promise + +================ +File: .gitignore +================ +examples/futures-private-test.ts +examples/spot-private-test.ts +node_modules + +rest-spot-private-ts-test.ts + +localtest.sh +testfile.ts +dist +cbtests.sh +doc + +coverage +ts-adv-trade-test-private.ts +examples/ts-app-priv.ts +examples/ts-commerce.ts +ts-exchange-priv.ts +testfile-cbexch.ts +restClientRegex.ts +privaterepotracker.txt +examples/_TiagoTests +examples/ignored/ +testfile.ts +cbapidocs.txt +repomix.sh +tmp + +================ +File: src/lib/requestUtils.ts +================ +import { CustomOrderIdProperty } from '../types/shared.types.js'; ⋮---- /** - * - * Travel Rule Endpoints - * - */ + * Used to switch how authentication/requests work under the hood + */ ⋮---- -/** - * Get Transaction Travel Rule Data - * - * (Beta) Get fulfilled travel rule data for a transaction. - */ -getTransactionTravelRuleData( - params: GetPrimeTransactionTravelRuleDataRequest, -): Promise +/** Coinbase Advanced Trade API */ ⋮---- /** - * Create Conversion + * Coinbase Advanced Trade global derivatives on Advanced Trade: + * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/overview * - * Perform a conversion between 2 assets. + * Technical migration guide regarding Coinbase's new Deribit-powered gateway running on the Starbase platform: + * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/technical */ -createConversion(params: CreatePrimeConversionRequest): Promise ⋮---- -/** - * List Wallet Transactions - * - * Retrieve transactions for a given wallet (only transactions that affect balances are accessible). - */ -getWalletTransactions( - params: GetPrimeWalletTransactionsRequest, -): Promise +/** Coinbase App API */ ⋮---- -/** - * Create Transfer - * - * Create a wallet transfer. - */ -createTransfer(params: CreatePrimeTransferRequest): Promise +/** Coinbase Exchange API */ ⋮---- -/** - * Create Withdrawal - * - * Create a withdrawal. - */ -createWithdrawal(params: CreatePrimeWithdrawalRequest): Promise +/** Coinbase Prime API */ ⋮---- -/** - * - * Wallets Endpoints - * - */ +/** Coinbase International API */ ⋮---- -/** - * List Portfolio Wallets - * - * List all wallets associated with a given portfolio. - */ -getPortfolioWallets(params: GetPrimePortfolioWalletsRequest): Promise +/** Coinbase Commerce API */ ⋮---- -/** - * Create Wallet - * - * Create a wallet. - */ -createWallet(params: CreatePrimeWalletRequest): Promise +export type RestClientType = + (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM]; ⋮---- -/** - * Get Wallet by Wallet ID - * - * Retrieve a specific wallet by Wallet ID. - */ -getWalletById(params: { - portfolio_id: string; - wallet_id: string; -}): Promise +// Global Derivatives JSON-RPC gateway. Methods are POST /api/v2. +// https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/introduction ⋮---- -/** - * Get Wallet Deposit Instructions - * - * Retrieve a specific wallet's deposit instructions. - */ -getWalletDepositInstructions( - params: GetPrimeWalletDepositInstructionsRequest, -): Promise - -================ -File: src/types/websockets/client.ts -================ -import type { ClientRequestArgs } from 'http'; -import WebSocket from 'isomorphic-ws'; +// Static Advanced Trade sandbox (mocked accounts/orders). No matching engine / WebSocket sandbox. +// https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/sandbox ⋮---- -/** General configuration for the WebsocketClient */ -export interface WSClientConfigurableOptions { +export interface RestClientOptions { /** * Your API key name. * @@ -50388,52 +19408,79 @@ export interface WSClientConfigurableOptions { apiPassphrase?: string; /** - * For JWT auth (adv trade & app API), seconds until jwt expires. Defaults to 120 seconds. + * For the Advanced Trade or App APIs, instead of passing the key name and + * private key, you can also parse the exported "cdp_api_key.json" into an object and pass it here. + * + * It will automatically get parsed into the apiKey & apiSecret configuration parameters. */ - jwtExpiresSeconds?: number; - - /** How often to check if the connection is alive */ - pingInterval?: number; - - /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ - pongTimeout?: number; - - /** Delay in milliseconds before respawning the connection */ - reconnectTimeout?: number; - - wsUrl?: string; + cdpApiKey?: { + name: string; + privateKey: string; + }; - wsOptions?: { - protocols?: string[]; - agent?: any; - } & ( - | Omit, 'agent'> - | Omit, 'agent'> - ); + /** + * https://docs.cdp.coinbase.com/coinbase-app/docs/localization + * + * The Coinbase App API supports localization for error messages and other strings. + * Localization is defined in each request with Accept-Language header. + * + * Accepted values are currently as below. Note: this may not work for all coinbase product groups. + */ + localisation?: + | 'de' + | 'en' + | 'es' + | 'es-mx' + | 'fr' + | 'id' + | 'it' + | 'nl' + | 'pt' + | 'pt-br'; /** * Connect to the sandbox for supported products * + * - Coinbase Advanced Trade: static REST sandbox (mocked accounts/orders, no matching engine): + * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/sandbox * - Coinbase Exchange: https://docs.cdp.coinbase.com/exchange/docs/sandbox * - Coinbase International: https://docs.cdp.coinbase.com/intx/docs/sandbox * - * - Coinbase Advanced Trade: No WebSocket sandbox (REST static sandbox only via RestClientOptions.useSandbox). * - Coinbase App: No sandbox available. * - Coinbase Prime: No sandbox available. + * - Coinbase Commerce: No sandbox available. */ useSandbox?: boolean; /** - * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method - * - * Look in the examples folder for a demonstration on using node's createHmac instead. + * Enable keep alive for REST API requests (via axios). + * See: https://github.com/tiagosiebler/bybit-api/issues/368 */ - customSignMessageFn?: (message: string, secret: string) => Promise; + keepAlive?: boolean; /** - * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. + * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. + * Only relevant if keepAlive is set to true. + * Default: 1000 (defaults comes from https agent) */ - reauthWSAPIOnReconnect?: boolean; + keepAliveMsecs?: number; + + /** + * For JWT auth (adv trade & app API), seconds until jwt expires. Defaults to 120 seconds. + */ + jwtExpiresSeconds?: number; + + /** Default: false. If true, we'll throw errors if any params are undefined */ + strictParamValidation?: boolean; + + /** + * Optionally override API protocol + domain + * e.g baseUrl: 'https://api.differentUrl.com' + **/ + baseUrl?: string; + + /** Default: true. whether to try and post-process request exceptions (and throw them). */ + parseExceptions?: boolean; } ⋮---- /** @@ -50456,72 +19503,104 @@ export interface WSClientConfigurableOptions { */ ⋮---- /** - * For JWT auth (adv trade & app API), seconds until jwt expires. Defaults to 120 seconds. + * For the Advanced Trade or App APIs, instead of passing the key name and + * private key, you can also parse the exported "cdp_api_key.json" into an object and pass it here. + * + * It will automatically get parsed into the apiKey & apiSecret configuration parameters. */ ⋮---- -/** How often to check if the connection is alive */ -⋮---- -/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ -⋮---- -/** Delay in milliseconds before respawning the connection */ +/** + * https://docs.cdp.coinbase.com/coinbase-app/docs/localization + * + * The Coinbase App API supports localization for error messages and other strings. + * Localization is defined in each request with Accept-Language header. + * + * Accepted values are currently as below. Note: this may not work for all coinbase product groups. + */ ⋮---- /** * Connect to the sandbox for supported products * + * - Coinbase Advanced Trade: static REST sandbox (mocked accounts/orders, no matching engine): + * https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/sandbox * - Coinbase Exchange: https://docs.cdp.coinbase.com/exchange/docs/sandbox * - Coinbase International: https://docs.cdp.coinbase.com/intx/docs/sandbox * - * - Coinbase Advanced Trade: No WebSocket sandbox (REST static sandbox only via RestClientOptions.useSandbox). * - Coinbase App: No sandbox available. * - Coinbase Prime: No sandbox available. + * - Coinbase Commerce: No sandbox available. */ ⋮---- /** - * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method - * - * Look in the examples folder for a demonstration on using node's createHmac instead. + * Enable keep alive for REST API requests (via axios). + * See: https://github.com/tiagosiebler/bybit-api/issues/368 */ ⋮---- /** - * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. + * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. + * Only relevant if keepAlive is set to true. + * Default: 1000 (defaults comes from https agent) */ ⋮---- /** - * WS configuration that's always defined, regardless of user configuration - * (usually comes from defaults if there's no user-provided values) - */ -export interface WebsocketClientOptions extends WSClientConfigurableOptions { - pingInterval: number; - pongTimeout: number; - reconnectTimeout: number; - useSandbox: boolean; - recvWindow: number; - /** - * If true, require a "receipt" that the connection is ready for use (e.g. a specific event type) + * For JWT auth (adv trade & app API), seconds until jwt expires. Defaults to 120 seconds. */ - requireConnectionReadyConfirmation: boolean; - authPrivateConnectionsOnConnect: boolean; - authPrivateRequests: boolean; - reauthWSAPIOnReconnect: boolean; -} ⋮---- -/** - * If true, require a "receipt" that the connection is ready for use (e.g. a specific event type) - */ +/** Default: false. If true, we'll throw errors if any params are undefined */ +⋮---- +/** + * Optionally override API protocol + domain + * e.g baseUrl: 'https://api.differentUrl.com' + **/ +⋮---- +/** Default: true. whether to try and post-process request exceptions (and throw them). */ +⋮---- +export function serializeParams | undefined = {}>( + params: T, + strict_validation: boolean | undefined, + encodeValues: boolean, + prefixWith: string, + explodeArrayParameters: boolean, +): string +⋮---- +/** + * Coinbase expected array parameters to be sent individually in GET requests, e.g: + * ?order_side=SELL&order_status=OPEN&product_ids=BTC-USDC&product_ids=ETH-USDC + * + * This handles that repetition instead of sending arrays as-is + */ +⋮---- +// Only prefix if there's a value... +⋮---- +export function logInvalidOrderId( + orderIdProperty: CustomOrderIdProperty, + expectedOrderIdPrefix: string, + params: unknown, +) +⋮---- +export function getRestBaseUrl( + restClientOptions: RestClientOptions, + restClientType: RestClientType, +): string ⋮---- -export type WsMarket = 'advancedTrade' | 'exchange' | 'international' | 'prime'; +/** + * Extract and separate request parameters in query string from the rest of the endpoint, to prevent sign issues. + * + * @param url endpoint containing params in query string; "/v2/accounts/123123213?someParam=xyz" + * @returns + */ +export function getParamsFromURL(url: string): + +================ +File: src/index.ts +================ + ================ File: src/CBAdvancedTradeGlobalClient.ts ================ -import { AxiosRequestConfig } from 'axios'; -⋮---- import { BaseRestClient } from './lib/BaseRestClient.js'; -import { - REST_CLIENT_TYPE_ENUM, - RestClientOptions, - RestClientType, -} from './lib/requestUtils.js'; +import { REST_CLIENT_TYPE_ENUM, RestClientType } from './lib/requestUtils.js'; import { AdvTradeGlobalAuthRequest, AdvTradeGlobalCancelAllByCurrencyPairRequest, @@ -50669,23 +19748,12 @@ import { * Prices and sizes are JSON numbers. instrument_name replaces the old product id * (BTC-PERP-INTX becomes BTC_USDC-PERPETUAL). label replaces client_order_id and is * not unique. Order type, time in force, and status are lowercase. - * call() returns the JSON-RPC result and throws the JSON-RPC error. + * BaseRestClient handles JSON-RPC formatting, result extraction, errors and authentication. */ export class CBAdvancedTradeGlobalClient extends BaseRestClient ⋮---- -constructor( - restClientOptions: RestClientOptions = {}, - requestOptions: AxiosRequestConfig = {}, -) -⋮---- getClientType(): RestClientType ⋮---- -/** - * JSON-RPC POST to /api/v2. Public methods use post, private methods use postPrivate. - * Returns the result field. Throws the JSON-RPC error object on error. - */ -private call(method: string, params?: object): Promise -⋮---- /** * * Public @@ -52180,139 +21248,309 @@ getBlockRfqQuotes(params?: any): Promise * * JSON-RPC: private/get_block_rfq_makers */ -getBlockRfqMakers(params?: any): Promise +getBlockRfqMakers(params?: any): Promise +⋮---- +/** + * Get Block RFQ User Info + * + * Block RFQ identity and rating. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/get_block_rfq_user_info + */ +getBlockRfqUserInfo(params?: any): Promise +⋮---- +/** + * Execute Block Trade + * + * Execute a block trade. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/execute_block_trade + */ +executeBlockTrade(params?: any): Promise +⋮---- +/** + * Verify Block Trade + * + * Verify a block trade. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/verify_block_trade + */ +verifyBlockTrade(params?: any): Promise +⋮---- +/** + * Approve Block Trade + * + * Approve a pending block trade. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/approve_block_trade + */ +approveBlockTrade(params?: any): Promise +⋮---- +/** + * Reject Block Trade + * + * Reject a pending block trade. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/reject_block_trade + */ +rejectBlockTrade(params?: any): Promise +⋮---- +/** + * Simulate Block Trade + * + * Simulate a block trade. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/simulate_block_trade + */ +simulateBlockTrade(params?: any): Promise +⋮---- +/** + * Invalidate Block Trade Signature + * + * Invalidate a block-trade signature. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/invalidate_block_trade_signature + */ +invalidateBlockTradeSignature(params?: any): Promise +⋮---- +/** + * Get Block Trade + * + * One block trade. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/get_block_trade + */ +getBlockTrade(params?: any): Promise +⋮---- +/** + * Get Block Trades + * + * The user's block trades. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/get_block_trades + */ +getBlockTrades(params?: any): Promise +⋮---- +/** + * Get Block Trade Requests + * + * Pending block-trade requests. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/get_block_trade_requests + */ +getBlockTradeRequests(params?: any): Promise +⋮---- +/** + * Get Broker Trades + * + * Broker block trades. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/get_broker_trades + */ +getBrokerTrades(params?: any): Promise +⋮---- +/** + * Get Broker Trade Requests + * + * Broker block-trade requests. + * + * Request parameters are not in the published OpenAPI spec yet. + * + * JSON-RPC: private/get_broker_trade_requests + */ +getBrokerTradeRequests(params?: any): Promise + +================ +File: src/types/websockets/client.ts +================ +import type { ClientRequestArgs } from 'http'; +import WebSocket from 'isomorphic-ws'; +⋮---- +/** General configuration for the WebsocketClient */ +export interface WSClientConfigurableOptions { + /** + * Your API key name. + * + * - For the Advanced Trade or App APIs, this is your API Key Name. + */ + apiKey?: string; + + /** + * Your API key secret. + * + * - For the Advanced Trade or App APIs, this is your API private key (including the -----BEGIN EC PRIVATE KEY-----\n etc). + */ + apiSecret?: string; + + /** + * Your API passphrase (NOT your account password). Only used for the API groups that use an API passphrase: + * - Coinbase Exchange API + * - Coinbase International API + * - Coinbase Prime API + */ + apiPassphrase?: string; + + /** + * For JWT auth (adv trade & app API), seconds until jwt expires. Defaults to 120 seconds. + */ + jwtExpiresSeconds?: number; + + /** How often to check if the connection is alive */ + pingInterval?: number; + + /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ + pongTimeout?: number; + + /** Delay in milliseconds before respawning the connection */ + reconnectTimeout?: number; + + wsUrl?: string; + + wsOptions?: { + protocols?: string[]; + agent?: any; + } & ( + | Omit, 'agent'> + | Omit, 'agent'> + ); + + /** + * Connect to the sandbox for supported products + * + * - Coinbase Exchange: https://docs.cdp.coinbase.com/exchange/docs/sandbox + * - Coinbase International: https://docs.cdp.coinbase.com/intx/docs/sandbox + * + * - Coinbase Advanced Trade: No WebSocket sandbox (REST static sandbox only via RestClientOptions.useSandbox). + * - Coinbase App: No sandbox available. + * - Coinbase Prime: No sandbox available. + */ + useSandbox?: boolean; + + /** + * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method + * + * Look in the examples folder for a demonstration on using node's createHmac instead. + */ + customSignMessageFn?: (message: string, secret: string) => Promise; + + /** + * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. + */ + reauthWSAPIOnReconnect?: boolean; + + /** + * Time in milliseconds to wait for a Global WS API reply after sending. Default: 10000. + * Connection/authentication use their own lifecycle handling. + */ + wsAPITimeout?: number; +} ⋮---- /** - * Get Block RFQ User Info - * - * Block RFQ identity and rating. - * - * Request parameters are not in the published OpenAPI spec yet. + * Your API key name. * - * JSON-RPC: private/get_block_rfq_user_info + * - For the Advanced Trade or App APIs, this is your API Key Name. */ -getBlockRfqUserInfo(params?: any): Promise ⋮---- /** - * Execute Block Trade - * - * Execute a block trade. - * - * Request parameters are not in the published OpenAPI spec yet. + * Your API key secret. * - * JSON-RPC: private/execute_block_trade + * - For the Advanced Trade or App APIs, this is your API private key (including the -----BEGIN EC PRIVATE KEY-----\n etc). */ -executeBlockTrade(params?: any): Promise ⋮---- /** - * Verify Block Trade - * - * Verify a block trade. - * - * Request parameters are not in the published OpenAPI spec yet. - * - * JSON-RPC: private/verify_block_trade + * Your API passphrase (NOT your account password). Only used for the API groups that use an API passphrase: + * - Coinbase Exchange API + * - Coinbase International API + * - Coinbase Prime API */ -verifyBlockTrade(params?: any): Promise ⋮---- /** - * Approve Block Trade - * - * Approve a pending block trade. - * - * Request parameters are not in the published OpenAPI spec yet. - * - * JSON-RPC: private/approve_block_trade + * For JWT auth (adv trade & app API), seconds until jwt expires. Defaults to 120 seconds. */ -approveBlockTrade(params?: any): Promise ⋮---- -/** - * Reject Block Trade - * - * Reject a pending block trade. - * - * Request parameters are not in the published OpenAPI spec yet. - * - * JSON-RPC: private/reject_block_trade - */ -rejectBlockTrade(params?: any): Promise +/** How often to check if the connection is alive */ ⋮---- -/** - * Simulate Block Trade - * - * Simulate a block trade. - * - * Request parameters are not in the published OpenAPI spec yet. - * - * JSON-RPC: private/simulate_block_trade - */ -simulateBlockTrade(params?: any): Promise +/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +⋮---- +/** Delay in milliseconds before respawning the connection */ ⋮---- /** - * Invalidate Block Trade Signature - * - * Invalidate a block-trade signature. + * Connect to the sandbox for supported products * - * Request parameters are not in the published OpenAPI spec yet. + * - Coinbase Exchange: https://docs.cdp.coinbase.com/exchange/docs/sandbox + * - Coinbase International: https://docs.cdp.coinbase.com/intx/docs/sandbox * - * JSON-RPC: private/invalidate_block_trade_signature + * - Coinbase Advanced Trade: No WebSocket sandbox (REST static sandbox only via RestClientOptions.useSandbox). + * - Coinbase App: No sandbox available. + * - Coinbase Prime: No sandbox available. */ -invalidateBlockTradeSignature(params?: any): Promise ⋮---- /** - * Get Block Trade - * - * One block trade. - * - * Request parameters are not in the published OpenAPI spec yet. + * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method * - * JSON-RPC: private/get_block_trade + * Look in the examples folder for a demonstration on using node's createHmac instead. */ -getBlockTrade(params?: any): Promise ⋮---- /** - * Get Block Trades - * - * The user's block trades. - * - * Request parameters are not in the published OpenAPI spec yet. - * - * JSON-RPC: private/get_block_trades + * If you authenticated the WS API before, automatically try to re-authenticate the WS API if you're disconnected/reconnected for any reason. */ -getBlockTrades(params?: any): Promise ⋮---- /** - * Get Block Trade Requests - * - * Pending block-trade requests. - * - * Request parameters are not in the published OpenAPI spec yet. - * - * JSON-RPC: private/get_block_trade_requests + * Time in milliseconds to wait for a Global WS API reply after sending. Default: 10000. + * Connection/authentication use their own lifecycle handling. */ -getBlockTradeRequests(params?: any): Promise ⋮---- /** - * Get Broker Trades - * - * Broker block trades. - * - * Request parameters are not in the published OpenAPI spec yet. - * - * JSON-RPC: private/get_broker_trades + * WS configuration that's always defined, regardless of user configuration + * (usually comes from defaults if there's no user-provided values) + */ +export interface WebsocketClientOptions extends WSClientConfigurableOptions { + pingInterval: number; + pongTimeout: number; + reconnectTimeout: number; + useSandbox: boolean; + recvWindow: number; + /** + * If true, require a "receipt" that the connection is ready for use (e.g. a specific event type) */ -getBrokerTrades(params?: any): Promise + requireConnectionReadyConfirmation: boolean; + authPrivateConnectionsOnConnect: boolean; + authPrivateRequests: boolean; + reauthWSAPIOnReconnect: boolean; +} ⋮---- /** - * Get Broker Trade Requests - * - * Broker block-trade requests. - * - * Request parameters are not in the published OpenAPI spec yet. - * - * JSON-RPC: private/get_broker_trade_requests + * If true, require a "receipt" that the connection is ready for use (e.g. a specific event type) */ -getBrokerTradeRequests(params?: any): Promise +⋮---- +export type WsMarket = + | 'advancedTrade' + | 'advancedTradeGlobal' + | 'exchange' + | 'international' + | 'prime'; ================ File: docs/COINBASE_SDK_QUICKSTART_GUIDE.md @@ -52327,17 +21565,21 @@ siebly: - Spot - US Futures - International Perpetuals + - Global Derivatives - Public WebSockets - Private WebSockets + - WebSocket API - Sandboxes - summary: Build Coinbase integrations with Advanced Trade REST API calls, public and private WebSocket streams, safe order previews, reconnect recovery, sandbox guidance, and proxy support. + summary: Build Coinbase integrations with Advanced Trade REST API calls, Global Derivatives REST and WebSocket API calls, public and private streams, order previews, reconnect recovery, sandboxes, and proxies. codeFilename: first-coinbase-api-call.js codeStatus: public REST API startSectionId: start-building-first-calls software: - description: Node.js and JavaScript SDK for Coinbase Advanced Trade, Coinbase App, Exchange, International Exchange, Prime, and legacy Commerce REST APIs, plus public and private WebSocket streams. + description: Node.js and JavaScript SDK for Coinbase Advanced Trade, Global Derivatives, Coinbase App, Exchange, International Exchange, Prime, and legacy Commerce REST APIs, plus WebSocket streams and the Global WebSocket API. topics: - Coinbase Advanced Trade API + - Coinbase Advanced Trade Global Derivatives API + - Global WebSocket API - Coinbase App API - Coinbase Exchange API - Coinbase International Exchange API @@ -52352,6 +21594,7 @@ siebly: label: Coinbase API JavaScript Tutorial topics: - Advanced Trade products + - Global Derivatives REST and WebSocket API calls - REST API response shapes - public WebSocket streams - private WebSocket streams @@ -52362,17 +21605,18 @@ siebly: - reconnect recovery sdkPagePromo: descriptionBeforePackage: 'A practical JavaScript guide to using ' - descriptionAfterPackage: ' across Coinbase Advanced Trade REST API calls, public and private WebSocket streams, safe order previews, sandboxes, proxies, and reconnect recovery.' + descriptionAfterPackage: ' across Coinbase Advanced Trade and Global Derivatives REST API calls, public and private streams, the Global WebSocket API, order previews, sandboxes, proxies, and reconnect recovery.' highlights: - Advanced Trade public and private REST API calls + - Global Derivatives REST and WebSocket API calls - Public and private Advanced Trade WebSocket streams - Safe Spot order-preview workflow - REST API and WebSocket proxy examples exampleHref: /examples/Coinbase exampleLabel: Coinbase SDK examples - architectureClientSummary: CBAdvancedTradeClient, WebsocketClient, and specialized Coinbase REST API clients + architectureClientSummary: CBAdvancedTradeClient, CBAdvancedTradeGlobalClient, WebsocketClient, WebsocketAPIClient, and other Coinbase REST API clients architectureApiTitle: Coinbase APIs - architectureApiSummary: Advanced Trade, Coinbase App, Exchange, International Exchange, Prime, Commerce, and WebSocket streams + architectureApiSummary: Advanced Trade, Global Derivatives, Coinbase App, Exchange, International Exchange, Prime, Commerce, and WebSocket streams surfaceMap: heading: Choose the Coinbase client for the job summary: Start with Advanced Trade for retail trading, then use a specialized client only when the account belongs to another Coinbase API product. @@ -52382,15 +21626,20 @@ siebly: apiItems: - Advanced Trade REST API calls - Advanced Trade public and private streams + - Global Derivatives REST, streams, and WebSocket API calls - Coinbase App account and transfer calls - Exchange and International institutional APIs - Prime trading and custody APIs - Legacy Commerce APIs packageNodes: - label: CBAdvancedTradeClient - summary: Advanced Trade products, accounts, orders, portfolios, derivatives, conversions, fees, and payment methods + summary: Advanced Trade Spot and US futures, accounts, orders, portfolios, conversions, fees, and payment methods + - label: CBAdvancedTradeGlobalClient + summary: Global Derivatives instruments, orders, positions, and account state over REST - label: WebsocketClient - summary: Advanced Trade, Exchange, International, and Prime WebSocket subscriptions + summary: Advanced Trade, Global Derivatives, Exchange, International, and Prime WebSocket subscriptions + - label: WebsocketAPIClient + summary: Global Derivatives requests and order commands over WebSocket - label: CBAppClient summary: Coinbase App accounts, addresses, transactions, deposits, withdrawals, and public prices - label: CBExchangeClient @@ -52409,7 +21658,10 @@ siebly: rows: - eyebrow: Product ID code: "product_id: 'BTC-USD'" - summary: Select an Advanced Trade Spot, futures, or perpetual product. + summary: Select an Advanced Trade Spot or US futures product. + - eyebrow: Global instrument + code: "instrument_name: 'BTC_USDC-PERPETUAL'" + summary: Select a Global Derivatives instrument. - eyebrow: Product metadata code: "base_increment and price_increment" summary: Apply current size and price rules before an order request. @@ -52418,7 +21670,10 @@ siebly: summary: Scope balances, positions, and permissions to the intended portfolio. - eyebrow: Client order ID code: "client_order_id" - summary: Give an application-owned order a stable identifier. + summary: Identify an Advanced Trade Spot or US futures order. + - eyebrow: Global order label + code: "label" + summary: Label a Global order and track its returned order ID for reconciliation. - eyebrow: WebSocket connection code: "WS_KEY_MAP.advTradeMarketData" summary: Route a subscription to the correct public or private connection. @@ -52445,6 +21700,9 @@ siebly: private-rest: Private REST API public-websocket: Public WebSocket private-websocket: Private WebSocket + global-rest: Global Derivatives REST API + global-websocket: Global Derivatives WebSocket streams + global-ws-api: Global Derivatives WebSocket API spot-order-preview: Spot order preview reconnect-recovery: Reconnect recovery http-proxy: HTTP or HTTPS proxy @@ -52498,11 +21756,13 @@ siebly: items: - Keep API keys server-side and grant only the permissions each process needs. - Keep product ID, portfolio, API family, and wsKey explicit in code and logs. - - Set client_order_id on application-owned orders so retries and restarts can reconcile them. + - Set client_order_id on Advanced Trade Spot and US futures orders so retries and restarts can reconcile them. + - Track Global order IDs; labels are not guaranteed unique. - Read product increments, minimum sizes, status flags, and venue before validating an order. - Check both HTTP errors and operation-level success fields on order-management responses. - Treat an accepted write as pending until a private stream or REST API query confirms state. - - Subscribe to heartbeats and reload private state after stream gaps. + - Subscribe to heartbeats on the Advanced Trade Spot and US futures feeds; Global heartbeat replies are handled by the SDK. + - Reload private state after stream gaps. - Keep the system clock synchronized and respect current Coinbase rate limits. - Monitor proxy reachability, latency, and egress IP when a proxy is enabled. journeys: @@ -52516,6 +21776,9 @@ siebly: - heading: Stream live data summary: Subscribe to public ticker data and private Advanced Trade order updates. href: "#websocket-streams" + - heading: Use Global Derivatives + summary: Read positions, subscribe to market and account updates, and send WebSocket API requests. + href: "#advanced-trade-global" - heading: Understand order management summary: Preview an order safely, then learn how submission, lookup, cancellation, and confirmation fit together. href: "#order-management" @@ -52524,7 +21787,7 @@ siebly: href: "#api-hosts" article: heading: Build around Coinbase products and account state - summary: "This tutorial covers the Coinbase API pieces developers usually need first: Advanced Trade REST API calls, public and private streams, safe order previews, API environments, proxies, and reconnect recovery." + summary: "This tutorial covers Advanced Trade and Global Derivatives REST API calls, public and private streams, the Global WebSocket API, order previews, API environments, proxies, and reconnect recovery." related: cards: - heading: Coinbase SDK page @@ -52552,6 +21815,8 @@ siebly: This tutorial uses [`coinbase-api`](https://www.npmjs.com/package/coinbase-api), Siebly's Node.js and JavaScript SDK for Coinbase. This guide will primarily walk you through using the Coinbase Advanced Trade APIs & WebSockets for public market data, authenticated account access, WebSocket streams, and safe order previews. +Use `CBAdvancedTradeClient` for Spot and US futures. For international derivatives, see [Advanced Trade Global](#advanced-trade-global), which uses `CBAdvancedTradeGlobalClient` for REST and `WebsocketAPIClient` for API requests over WebSocket. + The SDK handles REST API authentication, short-lived JWT creation, product-specific WebSocket routing, private subscription signing, reconnects, and resubscriptions. It also provides focused clients for Coinbase App, Exchange, International Exchange, Prime, and legacy Commerce APIs. **Key links** @@ -52564,6 +21829,7 @@ The SDK handles REST API authentication, short-lived JWT creation, product-speci - Official documentation: [Coinbase Developer Documentation](https://docs.cdp.coinbase.com/) - Advanced Trade REST API: [Advanced Trade API endpoints](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/rest-api) - Advanced Trade WebSockets: [WebSocket overview](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/websocket/websocket-overview) +- Global Derivatives: [Technical migration guide](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/technical) - API authentication: [Coinbase App API key authentication](https://docs.cdp.coinbase.com/coinbase-app/authentication-authorization/api-key-authentication) - Trading-system terms: [Siebly glossary](https://siebly.io/reference/glossary) - More JavaScript SDKs: [Siebly.io](https://siebly.io) @@ -52574,15 +21840,17 @@ Private Advanced Trade REST API requests use short-lived JSON Web Tokens signed `coinbase-api` handles those mechanics and provides a focused client for each API family, so you can focus on your integration without excessive plumbing efforts: -| Client | Use it for | -| ----------------------- | -------------------------------------------------------------------------------------- | -| `CBAdvancedTradeClient` | Advanced Trade products, accounts, orders, portfolios, derivatives, fees, and converts | -| `WebsocketClient` | Advanced Trade, Exchange, International, and Prime WebSocket streams | -| `CBAppClient` | Coinbase App accounts, addresses, transactions, deposits, withdrawals, and prices | -| `CBExchangeClient` | Institutional Exchange market data, trading, profiles, reports, loans, and transfers | -| `CBInternationalClient` | International instruments, portfolios, orders, positions, loans, and transfers | -| `CBPrimeClient` | Prime portfolios, balances, orders, activities, allocations, wallets, and transactions | -| `CBCommerceClient` | Legacy Commerce charges, checkouts, and events | +| Client | Use it for | +| ----------------------------- | ---------------------------------------------------------------------------------------- | +| `CBAdvancedTradeClient` | Advanced Trade Spot and US futures, accounts, orders, portfolios, fees, and converts | +| `CBAdvancedTradeGlobalClient` | Global Derivatives instruments, orders, positions, and account state over REST | +| `WebsocketClient` | Advanced Trade, Global Derivatives, Exchange, International, and Prime WebSocket streams | +| `WebsocketAPIClient` | Global Derivatives API requests and order commands over WebSocket | +| `CBAppClient` | Coinbase App accounts, addresses, transactions, deposits, withdrawals, and prices | +| `CBExchangeClient` | Institutional Exchange market data, trading, profiles, reports, loans, and transfers | +| `CBInternationalClient` | International instruments, portfolios, orders, positions, loans, and transfers | +| `CBPrimeClient` | Prime portfolios, balances, orders, activities, allocations, wallets, and transactions | +| `CBCommerceClient` | Legacy Commerce charges, checkouts, and events | The Advanced Trade product group is the right starting point for most developers automating their own Coinbase trading account. The other REST API clients use different account products, credentials, permissions, and sometimes an API passphrase. These are typically catered more towards institutional users. @@ -52622,6 +21890,8 @@ Nothing executable in this tutorial needs transfer or withdrawal access. The ord Advanced Trade and Coinbase App keys do not use an API passphrase. Coinbase Exchange, International Exchange, and Prime credentials use a separate API key, secret, and passphrase. +Advanced Trade Global also uses a CDP key name and private key, with no passphrase. Use a key with access to the intended Global Derivatives account. + ## Coinbase products and request vocabulary Several values determine which market, account, and connection a request uses: @@ -52635,11 +21905,13 @@ Several values determine which market, account, and connection a request uses: | `base_min_size` | Product metadata | Minimum supported base-currency size | | `quote_min_size` | Product metadata | Minimum supported quote-currency size | | Product status flags | `status`, `trading_disabled`, `limit_only` | Current restrictions that affect valid order requests | -| Product type and venue | `product_type`, `product_venue` | Distinguish Spot, US futures, and International perpetual products | +| Product type and venue | `product_type`, `product_venue` | Advanced Trade product classification and trading venue | | Portfolio ID | `portfolio_uuid` | Portfolio that owns balances, permissions, orders, or derivative positions | | Client order ID | `client_order_id` | Application-owned [custom order ID](https://siebly.io/reference/glossary#custom-order-id) | | Order configuration | `market_market_ioc`, `limit_limit_gtc` | Order type, size, time in force, price, and post-only behavior | | WebSocket key | `WS_KEY_MAP.advTradeMarketData` | [WebSocket key](https://siebly.io/reference/glossary#ws-key) selecting the connection | +| Global instrument | `BTC_USDC-PERPETUAL` | Global Derivatives instrument selected with `instrument_name` | +| Global order label | `label` | Application-supplied order label; not guaranteed unique | Advanced Trade REST API methods return the endpoint body directly. There is no shared success envelope. Products are objects, accounts and orders are arrays nested inside response objects, and candles are objects inside a `candles` array. @@ -53132,11 +22404,13 @@ If a write times out without a clear result, query by the known Coinbase order I ### Know what WebSockets do -`coinbase-api` does not expose a `WebsocketAPIClient` for Coinbase because its supported Coinbase WebSocket interfaces are subscription feeds. Use: +For Advanced Trade Spot and US futures, use: - `WebsocketClient` for market and account updates. - `CBAdvancedTradeClient` for preview, submit, edit, query, and cancel commands. +Global Derivatives also supports API requests and order commands over WebSocket through `WebsocketAPIClient`. Its subscriptions use `WebsocketClient`. See [Advanced Trade Global](#advanced-trade-global) below. + A subscription response acknowledges a channel. It is not an order acknowledgement and does not confirm account state. ### Explore other Advanced Trade groups @@ -53152,13 +22426,123 @@ The Advanced Trade client covers more than Spot orders: | Payment methods | `getPaymentMethods()`, `getPaymentMethod()` | | US futures | `getFuturesBalanceSummary()`, `getFuturesPositions()`, `getFuturesSweeps()` | | Futures margin | `getIntradayMarginSetting()`, `getCurrentMarginWindow()` | -| International perpetuals | `getPerpetualsPortfolioSummary()`, `getPerpetualsPositions()`, `getPortfoliosBalances()` | -| International collateral | `allocatePortfolio()`, `updateMultiAssetCollateral()` | US futures and International perpetual products are available only to eligible accounts and jurisdictions. Read product metadata and account state rather than assuming that a product visible in public data is tradable by the authenticated portfolio. +International derivatives use `CBAdvancedTradeGlobalClient`. The older INTX methods on `CBAdvancedTradeClient` are not the Global gateway methods. See Coinbase's [migration guide](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/technical) for the endpoint and parameter changes. + For the full method-to-endpoint map, use the [Coinbase SDK endpoint reference](./endpointFunctionList.md). + + +## Advanced Trade Global + +Global Derivatives uses the Deribit-powered gateway. Use `CBAdvancedTradeGlobalClient` for REST calls, `WebsocketClient` for subscriptions, and `WebsocketAPIClient` for requests over WebSocket. + +The private examples below use `COINBASE_API_KEY_NAME` and `COINBASE_API_PRIVATE_KEY`. Public calls and public subscriptions do not require credentials. + +### Read positions over REST + +The SDK exchanges a signed CDP JWT for an access token, reuses that token for private requests, and refreshes it before expiry. Successful REST methods return the JSON-RPC `result` directly, so `getPositions()` returns an array. + + + +```javascript +import { CBAdvancedTradeGlobalClient } from 'coinbase-api'; + +async function main() { + const client = new CBAdvancedTradeGlobalClient({ + apiKey: process.env.COINBASE_API_KEY_NAME, + apiSecret: process.env.COINBASE_API_PRIVATE_KEY, + }); + + const positions = await client.getPositions({ currency: 'USDC' }); + const account = await client.getAccountSummary({ currency: 'USDC' }); + console.log('Positions:', positions); + console.log('Account:', account); +} + +main().catch((error) => console.error('Global REST request failed:', error)); +``` + +Global parameters differ from Advanced Trade Spot. Use `instrument_name`, such as `BTC_USDC-PERPETUAL`, and send prices and sizes as numbers. Order labels use `label`; a label is not an idempotency key. Global has no equivalent of `previewOrder()`. See the [migration guide](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/technical) for the full mapping. + +### Subscribe to Global streams + +Pass complete channel names and the matching `WS_KEY_MAP` value. This example always opens the public feed and adds private subscriptions when both credentials are set. + + + +```javascript +import { WebsocketClient, WS_KEY_MAP } from 'coinbase-api'; + +const apiKey = process.env.COINBASE_API_KEY_NAME; +const apiSecret = process.env.COINBASE_API_PRIVATE_KEY; +const client = new WebsocketClient({ apiKey, apiSecret }); + +client.on('update', ({ wsKey, params }) => { + console.log(wsKey, params.channel, params.data); +}); +client.on('response', (event) => console.log('Response:', event)); +client.on('exception', (event) => console.error('WebSocket error:', event)); + +client.subscribe( + ['quote.BTC_USDC-PERPETUAL', 'ticker.BTC_USDC-PERPETUAL.100ms'], + WS_KEY_MAP.advTradeGlobalMarketData, +); + +if (apiKey && apiSecret) { + client.subscribe( + ['user.orders.future.USDC.100ms', 'user.portfolio.USDC'], + WS_KEY_MAP.advTradeGlobalUserData, + ); +} + +// client.unsubscribe('user.portfolio.USDC', WS_KEY_MAP.advTradeGlobalUserData); +// client.closeAll(); +``` + +Private subscriptions wait for session authentication. The SDK renews authentication before expiry and authenticates again before restoring subscriptions after reconnecting. A WS auth response does not need to contain an access token: authentication applies to that socket session. + +Global notifications keep their JSON-RPC envelope. Read the channel from `params.channel` and its data from `params.data`. Subscription acknowledgements emit `response`; notifications emit `update`. + +### Make Global WebSocket API calls + +`WebsocketAPIClient` opens a separate connection from the subscription feeds. Its methods return the JSON-RPC envelope, with the method's data under `result`. + + + +```javascript +import { WebsocketAPIClient } from 'coinbase-api'; + +async function main() { + const client = new WebsocketAPIClient({ + apiKey: process.env.COINBASE_API_KEY_NAME, + apiSecret: process.env.COINBASE_API_PRIVATE_KEY, + }); + + try { + const time = await client.getTime(); + console.log('Server time:', time.result); + + const positions = await client.getPositions({ currency: 'USDC' }); + console.log('Positions:', positions.result); + } finally { + client.getWSClient().closeAll(); + } +} + +main().catch((error) => console.error('Global WS API request failed:', error)); +``` + +Private calls authenticate automatically and concurrent calls share authentication. `connectWSAPI()` is available if you want to connect and authenticate before the first request. The underlying connection uses `WS_KEY_MAP.advTradeGlobalWSAPI`. + +Order methods include `buy()`, `sell()`, `edit()` and `cancel()`. API errors, timeouts and disconnects reject the request promise. Requests are not replayed automatically. `wsAPITimeout` defaults to 10,000 milliseconds and starts after sending the request. It does not include connection or authentication time. + +Use `logout()` to end an authenticated session and wait for the server to close the connection. Use `getWSClient().closeAll()` to close local sockets during shutdown. Connection-scoped settings, such as heartbeat configuration and cancel-on-disconnect, must be set again after reconnecting. + +See the [public subscription example](../examples/AdvancedTradeGlobal/WebSockets/publicWs.ts), [private subscription example](../examples/AdvancedTradeGlobal/WebSockets/privateWs.ts), and [WS API example](../examples/AdvancedTradeGlobal/WebSockets/wsApi.ts). + ## Build with Coinbase WebSocket streams @@ -53167,17 +22551,22 @@ For the full method-to-endpoint map, use the [Coinbase SDK endpoint reference](. Each `wsKey` identifies one Coinbase WebSocket connection: -| WebSocket key | Authentication | Use | -| ------------------------------------- | -------------- | ----------------------------------------------------------- | -| `WS_KEY_MAP.advTradeMarketData` | Public | Advanced Trade ticker, level 2, trades, candles, and status | -| `WS_KEY_MAP.advTradeUserData` | Required | Advanced Trade user orders and futures balance summaries | -| `WS_KEY_MAP.exchangeMarketData` | Public | Coinbase Exchange market-data feed | -| `WS_KEY_MAP.exchangeDirectMarketData` | Required | Coinbase Exchange direct market-data feed | -| `WS_KEY_MAP.internationalMarketData` | Required | Coinbase International market-data feed | -| `WS_KEY_MAP.primeMarketData` | Required | Coinbase Prime market-data feed | +| WebSocket key | Authentication | Use | +| ------------------------------------- | -------------- | ---------------------------------------------------------------------- | +| `WS_KEY_MAP.advTradeMarketData` | Public | Advanced Trade ticker, level 2, trades, candles, and status | +| `WS_KEY_MAP.advTradeUserData` | Required | Advanced Trade user orders and futures balance summaries | +| `WS_KEY_MAP.advTradeGlobalMarketData` | Public | Global Derivatives market-data subscriptions | +| `WS_KEY_MAP.advTradeGlobalUserData` | Required | Global Derivatives order, trade, position, and portfolio subscriptions | +| `WS_KEY_MAP.advTradeGlobalWSAPI` | Private calls | Global Derivatives API requests through `WebsocketAPIClient` | +| `WS_KEY_MAP.exchangeMarketData` | Public | Coinbase Exchange market-data feed | +| `WS_KEY_MAP.exchangeDirectMarketData` | Required | Coinbase Exchange direct market-data feed | +| `WS_KEY_MAP.internationalMarketData` | Required | Coinbase International market-data feed | +| `WS_KEY_MAP.primeMarketData` | Required | Coinbase Prime market-data feed | Pass `WS_KEY_MAP` values explicitly. This keeps connection routing visible and prevents a topic from reaching the wrong API family. +Global connections open on demand and are excluded from `connectAll()`. Use `connect(WS_KEY_MAP.advTradeGlobalMarketData)` or `connect(WS_KEY_MAP.advTradeGlobalUserData)` to open a subscription feed ahead of time, or `connectWSAPI()` for the Global WS API. + ### Use the Advanced Trade channels | Channel | Authentication | Main use | @@ -53336,16 +22725,17 @@ See: The package covers several Coinbase products. Their credentials and account models are not interchangeable. -| Client | Representative coverage | -| ----------------------- | ------------------------------------------------------------------------------------------------- | -| `CBAdvancedTradeClient` | Retail trading, portfolios, Spot, US futures, International perpetuals, fees, and converts | -| `CBAppClient` | Coinbase App accounts, addresses, transactions, deposits, withdrawals, and public prices | -| `CBExchangeClient` | Institutional Exchange products, accounts, orders, fills, profiles, reports, loans, and transfers | -| `CBInternationalClient` | International instruments, portfolios, balances, positions, orders, fills, loans, and transfers | -| `CBPrimeClient` | Prime portfolios, balances, orders, allocations, activities, wallets, and transactions | -| `CBCommerceClient` | Legacy Commerce charges, checkouts, and events | +| Client | Representative coverage | +| ----------------------------- | ------------------------------------------------------------------------------------------------- | +| `CBAdvancedTradeClient` | Retail trading, portfolios, Spot, US futures, fees, and converts | +| `CBAdvancedTradeGlobalClient` | Global Derivatives instruments, orders, positions, and account state | +| `CBAppClient` | Coinbase App accounts, addresses, transactions, deposits, withdrawals, and public prices | +| `CBExchangeClient` | Institutional Exchange products, accounts, orders, fills, profiles, reports, loans, and transfers | +| `CBInternationalClient` | International instruments, portfolios, balances, positions, orders, fills, loans, and transfers | +| `CBPrimeClient` | Prime portfolios, balances, orders, allocations, activities, wallets, and transactions | +| `CBCommerceClient` | Legacy Commerce charges, checkouts, and events | -Use Advanced Trade for a normal Coinbase retail trading account. Coinbase Exchange, International Exchange, and Prime require the matching institutional account and credentials. +Use Advanced Trade for Spot and US futures and Advanced Trade Global for international derivatives. Coinbase Exchange, International Exchange, and Prime require the matching institutional account and credentials. `CBCommerceClient` maps the legacy `api.commerce.coinbase.com` charge and checkout endpoints. Coinbase now directs new payment integrations toward Coinbase Business Checkouts. Review the official [Commerce-to-Checkouts migration guide](https://docs.cdp.coinbase.com/coinbase-business/checkout-apis/migrate-from-commerce/api-schema-mapping) before starting a new payments integration. @@ -53355,21 +22745,25 @@ Use Advanced Trade for a normal Coinbase retail trading account. Coinbase Exchan Each Coinbase client has its own default REST API host. The WebSocket client selects a host from the requested `wsKey`. -| API or environment | REST API host | WebSocket host or guidance | -| ------------------------------ | --------------------------------------------------------- | ------------------------------------------------------------------------------- | -| Advanced Trade live | `https://api.coinbase.com` | `wss://advanced-trade-ws.coinbase.com` for market data | -| Advanced Trade private stream | `https://api.coinbase.com` | `wss://advanced-trade-ws-user.coinbase.com` | -| Advanced Trade static sandbox | `https://api-sandbox.coinbase.com` via `useSandbox: true` | No Advanced Trade sandbox WebSocket | -| Coinbase App live | `https://api.coinbase.com` | No Coinbase App stream in this SDK | -| Coinbase Exchange live | `https://api.exchange.coinbase.com` | `wss://ws-feed.exchange.coinbase.com` or the authenticated direct feed | -| Coinbase Exchange sandbox | `https://api-public.sandbox.exchange.coinbase.com` | `wss://ws-feed-public.sandbox.exchange.coinbase.com` or its direct sandbox feed | -| International Exchange live | `https://api.international.coinbase.com` | `wss://ws-md.international.coinbase.com` | -| International Exchange sandbox | `https://api-n5e1.coinbase.com` | `wss://ws-md.n5e2.coinbase.com` | -| Coinbase Prime live | `https://api.prime.coinbase.com` | `wss://ws-feed.prime.coinbase.com` | -| Legacy Commerce live | `https://api.commerce.coinbase.com` | No Commerce stream in this SDK | +| API or environment | REST API host | WebSocket host or guidance | +| ------------------------------------------------ | --------------------------------------------------------- | ------------------------------------------------------------------------------- | +| Advanced Trade live | `https://api.coinbase.com` | `wss://advanced-trade-ws.coinbase.com` for market data | +| Advanced Trade private stream | `https://api.coinbase.com` | `wss://advanced-trade-ws-user.coinbase.com` | +| Advanced Trade Global public streams | `https://drb.coinbase.com` | `wss://streams.drb.coinbase.com/ws/api/v2` | +| Advanced Trade Global private streams and WS API | `https://drb.coinbase.com` | `wss://drb.coinbase.com/ws/api/v2` | +| Advanced Trade static sandbox | `https://api-sandbox.coinbase.com` via `useSandbox: true` | No Advanced Trade sandbox WebSocket | +| Coinbase App live | `https://api.coinbase.com` | No Coinbase App stream in this SDK | +| Coinbase Exchange live | `https://api.exchange.coinbase.com` | `wss://ws-feed.exchange.coinbase.com` or the authenticated direct feed | +| Coinbase Exchange sandbox | `https://api-public.sandbox.exchange.coinbase.com` | `wss://ws-feed-public.sandbox.exchange.coinbase.com` or its direct sandbox feed | +| International Exchange live | `https://api.international.coinbase.com` | `wss://ws-md.international.coinbase.com` | +| International Exchange sandbox | `https://api-n5e1.coinbase.com` | `wss://ws-md.n5e2.coinbase.com` | +| Coinbase Prime live | `https://api.prime.coinbase.com` | `wss://ws-feed.prime.coinbase.com` | +| Legacy Commerce live | `https://api.commerce.coinbase.com` | No Commerce stream in this SDK | The [Advanced Trade static sandbox](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/sandbox) returns predefined mock responses for a limited set of account and order endpoints. It does not run a matching engine and is not a funded trading environment. Enable it on `CBAdvancedTradeClient` with `useSandbox: true` (REST only). There is no Advanced Trade WebSocket sandbox. +Global REST methods use JSON-RPC at `/api/v2`; the auth exchange uses `/api/v2/public/auth`. The SDK has no configured sandbox for Global REST or its WebSocket connections. + `useSandbox: true` is also supported by `CBExchangeClient` and `CBInternationalClient`, and by the matching Exchange or International WebSocket connections. On `WebsocketClient`, `useSandbox` is client-wide: it applies to every `wsKey` on that instance. Do not set `useSandbox: true` on an Advanced Trade WebSocket connection. Sandbox credentials are separate from production credentials where the product requires them. Advanced Trade's static sandbox also accepts unauthenticated requests for its mocked endpoints. ```javascript @@ -53668,7 +23062,7 @@ Do not assume that the rules for `BTC-USD` apply to another Spot, futures, or pe ### Use client order IDs -Generate and persist a unique `client_order_id` for each application-owned order. Store it with the Coinbase order ID, product, side, configuration, requested size, and creation time. +For Advanced Trade Spot and US futures, generate and persist a unique `client_order_id` for each application-owned order. Store it with the Coinbase order ID, product, side, configuration, requested size, and creation time. Global Derivatives uses `label`, which is not guaranteed unique. Track the returned order ID and reconcile state before retrying an uncertain request. ### Confirm final state @@ -53678,7 +23072,9 @@ After an uncertain timeout, reconcile known identifiers before retrying. ### Keep WebSocket streams healthy -Subscribe to `heartbeats` alongside other Advanced Trade channels. Monitor sequence numbers, heartbeat counters, exceptions, reconnects, and time since the last update. +Subscribe to `heartbeats` alongside channels on `WS_KEY_MAP.advTradeMarketData` or `WS_KEY_MAP.advTradeUserData`. Monitor sequence numbers, heartbeat counters, exceptions, reconnects, and time since the last update. + +Global uses different heartbeat messages. The SDK handles protocol ping/pong and answers server `test_request` messages with `public/test`; no `heartbeats` subscription is needed for Global. Reload the affected account state after a private stream gap. @@ -53700,7 +23096,7 @@ Yes. Every example in this tutorial is plain JavaScript. The package also publis ### Which REST API client should I use? -Use `CBAdvancedTradeClient` for a normal Coinbase retail trading account. Use the App, Exchange, International, Prime, or Commerce client only when the Coinbase account and workflow belong to that API family. +Use `CBAdvancedTradeClient` for Advanced Trade Spot and US futures, and `CBAdvancedTradeGlobalClient` for Global Derivatives. Use the App, Exchange, International, Prime, or Commerce client when the account and workflow belong to that API family. ### What are `COINBASE_API_KEY_NAME` and `COINBASE_API_PRIVATE_KEY`? @@ -53734,9 +23130,13 @@ Yes, a static REST sandbox. `useSandbox: true` on `CBAdvancedTradeClient` routes No. It validates and estimates the request but does not submit it to the matching engine. Check `errs` and `warning` before using its estimates. -### Why is there no Coinbase `WebsocketAPIClient`? +### What does `WebsocketAPIClient` support? + +`WebsocketAPIClient` supports Global Derivatives API requests and order commands over WebSocket. Use `WebsocketClient` for subscriptions. Advanced Trade Spot and US futures order commands use `CBAdvancedTradeClient`. -The Coinbase WebSocket interfaces supported by this SDK are subscription feeds. Use `WebsocketClient` for streams and the matching REST API client for order commands. +### Why do Global REST and WS API calls return different shapes? + +`CBAdvancedTradeGlobalClient` returns the JSON-RPC `result` directly. `WebsocketAPIClient` preserves the envelope, so read `response.result`. Global subscription updates use `event.params.data`. ### What does the first private `user` update contain? @@ -53771,6 +23171,7 @@ API key authentication is for server-side access to an account you control. Use - [SDK endpoint map](./endpointFunctionList.md) - [Advanced Trade REST API documentation](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/rest-api) - [Advanced Trade WebSocket documentation](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/websocket/websocket-overview) +- [Global Derivatives migration guide](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/technical) - [Coinbase authentication documentation](https://docs.cdp.coinbase.com/coinbase-app/authentication-authorization/api-key-authentication) - [Siebly glossary](https://siebly.io/reference/glossary) - [Exchange State](https://siebly.io/reference/exchange-state) @@ -53797,6 +23198,10 @@ import { SubmitCBExchOrderRequest } from '../types/request/coinbase-exchange.js' import { SubmitINTXOrderRequest } from '../types/request/coinbase-international.js'; import { SubmitPrimeOrderRequest } from '../types/request/coinbase-prime.js'; import { CustomOrderIdProperty } from '../types/shared.types.js'; +import { + ADVANCED_TRADE_GLOBAL_AUTH_ENDPOINT, + AdvancedTradeGlobalAuth, +} from './AdvancedTradeGlobalAuth.js'; import { signJWT } from './jwtNode.js'; import { neverGuard } from './misc-util.js'; import { @@ -53908,6 +23313,8 @@ putPrivate(endpoint: string, params?: ParamsInRequest) ⋮---- patchPrivate(endpoint: string, params?: ParamsInRequest) ⋮---- +private getAdvancedTradeGlobalAuth(): AdvancedTradeGlobalAuth +⋮---- /** * @private Make a HTTP request to a specific endpoint. Private endpoint API calls are automatically signed. */ @@ -53924,7 +23331,12 @@ private async _call( ⋮---- // Dispatch request ⋮---- -// Throw if API returns an error (e.g. insufficient balance) +/** Validate the response and extract the payload for this product group. */ +private parseResponse(response: AxiosResponse): any +⋮---- +// Throw if API returns an error (e.g. insufficient balance). +⋮---- +// JSON-RPC errors can arrive inside an HTTP 200 response. ⋮---- public generateNewOrderId(): string ⋮---- @@ -53952,7 +23364,14 @@ protected validateOrderId( /** * @private generic handler to parse request exceptions */ -parseException(e: any, requestParams: any): unknown +parseException( + e: any, + requestParams: any, + requestOptions?: AxiosRequestConfig, +): unknown +⋮---- +// Handle token rejection and credential redaction before applying the +// shared error format, including when parseExceptions is disabled. ⋮---- // Something happened in setting up the request that triggered an error ⋮---- @@ -54050,11 +23469,16 @@ private async buildRequest( method: Method, endpoint: string, url: string, - params?: any | undefined, + requestParams?: any | undefined, isPublicApi?: boolean, ): Promise ⋮---- -// JSON-RPC clients pass { body } on public POST. Flat params stay query strings. +// Keep JSON-RPC formatting here so endpoint methods use the usual post helpers. +⋮---- +// Method paths identify the RPC call; POSTs use the shared gateway URL. +// Auth keeps its documented POST URL, which is also bound into the CDP JWT. +⋮---- +// Global JSON-RPC calls send their envelope in the body. Flat params stay queries. ⋮---- // request parameter headers for this request ⋮---- @@ -54065,7 +23489,7 @@ private async buildRequest( ================ File: README.md ================ -# Node.js & JavaScript SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets +# Coinbase Advanced Trade - Node.js & JavaScript SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets

@@ -54082,16 +23506,11 @@ File: README.md [![Build & Test](https://github.com/sieblyio/coinbase-api/actions/workflows/e2etest.yml/badge.svg?branch=master)](https://github.com/sieblyio/coinbase-api/actions/workflows/e2etest.yml) [![last commit](https://img.shields.io/github/last-commit/sieblyio/coinbase-api)][1] [![Telegram](https://img.shields.io/badge/chat-on%20telegram-blue.svg)](https://t.me/nodetraders) -[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/sieblyio/coinbase-api) +[![Coinbase Tutorial](https://img.shields.io/badge/Coinbase%20Tutorial-siebly.io-blue)](https://siebly.io/sdk/coinbase/javascript/tutorial) [1]: https://www.npmjs.com/package/coinbase-api -> [!WARNING] -> On **October 1, 2026**, Advanced Trade is moving international derivatives from INTX onto a Deribit-powered gateway running on the Starbase platform. -> -> Spot and US futures stay on [`CBAdvancedTradeClient`](./src/CBAdvancedTradeClient.ts). International derivatives move to [`CBAdvancedTradeGlobalClient`](./src/CBAdvancedTradeGlobalClient.ts) (`https://drb.coinbase.com/api/v2`, JSON-RPC 2.0). Endpoint mapping is [below](#cbadvancedtradeglobalclient). Coinbase's guide: [Technical Migration Guide](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/technical). - -Updated & performant JavaScript & Node.js SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets: +Coinbase Advanced Trade SDK for Node.js and JavaScript. Updated & performant JavaScript & Node.js SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets: - Professional, robust & performant Coinbase SDK with extensive production use in live trading environments. - Complete integration with all Coinbase APIs - supports both retail and institutional REST clients and WebSockets: @@ -54233,6 +23652,9 @@ To use any of Coinbase's REST APIs in JavaScript/TypeScript/Node.js, import (or #### CBAdvancedTradeClient +> [!NOTE] +> Advanced Trade international derivatives moved from INTX to the Deribit-powered Starbase gateway on October 1, 2026. Use [`CBAdvancedTradeGlobalClient`](#cbadvancedtradeglobalclient) for these markets. `CBAdvancedTradeClient` continues to support spot and US futures. See Coinbase's [migration guide](https://docs.cdp.coinbase.com/coinbase-app/advanced-trade-apis/guides/derivatives/technical). + ```javascript const { CBAdvancedTradeClient } = require('coinbase-api'); /** @@ -54282,11 +23704,13 @@ doAPICall(); #### CBAdvancedTradeGlobalClient -International derivatives (perpetuals today, options and dated futures after cutover) use [`CBAdvancedTradeGlobalClient`](./src/CBAdvancedTradeGlobalClient.ts). It talks JSON-RPC 2.0 to `https://drb.coinbase.com/api/v2`. Spot and US futures stay on `CBAdvancedTradeClient`. +International derivatives REST API endpoints, sometimes referred to as "Advanced Trade Global", are available via the dedicated [`CBAdvancedTradeGlobalClient`](./src/CBAdvancedTradeGlobalClient.ts) class. + +Under the hood, it talks JSON-RPC 2.0 to `https://drb.coinbase.com/api/v2`. Spot and US futures stay on `CBAdvancedTradeClient`. The table below only says which method replaces which old endpoint. Parameters and responses are not the same shape. The breaks that matter: -- The client returns the JSON-RPC `result` and throws the JSON-RPC `error`. You do not read `result` or `id` off the return value. +- The client returns the JSON-RPC `result`. Errors use the SDK's standard exception handling, with JSON-RPC details in `body.error` by default (`response.data.error` when `parseExceptions: false`). You do not read `result` or `id` off a successful return value. - Prices and sizes are JSON numbers, not decimal strings. `amount: 0.001` is `0.001` of the base coin on these USDC perpetuals. - `instrument_name` replaces the old product id. `BTC-PERP-INTX` becomes `BTC_USDC-PERPETUAL`. - `label` replaces `client_order_id`. It is not guaranteed unique, so do not use it as an idempotency key. @@ -54435,7 +23859,7 @@ See all clients [here](./src/) for more information on all the functions or the ## WebSockets -All available WebSockets can be used via a shared `WebsocketClient`. The WebSocket client will automatically open/track/manage connections as needed. Each unique connection (one per server URL) is tracked using a WsKey (each WsKey is a string - see [WS_KEY_MAP](src/lib/websocket/websocket-util.ts) for a list of supported values - `WS_KEY_MAP` can also be used like an enum). +All available WebSockets can be used via a shared `WebsocketClient`. The WebSocket client will automatically open/track/manage connections as needed. Each connection is tracked using a WsKey (each WsKey is a string - see [WS_KEY_MAP](src/lib/websocket/websocket-util.ts) for a list of supported values - `WS_KEY_MAP` can also be used like an enum). Any subscribe/unsubscribe events will need to include a WsKey, so the WebSocket client understands which connection the event should be routed to. See examples below or in the [examples](./examples/) folder on GitHub. @@ -54466,6 +23890,85 @@ client.subscribe( ); ``` +#### Global Derivatives Public WebSocket + +Use `WS_KEY_MAP.advTradeGlobalMarketData` for the Global Derivatives public feed. Pass complete channel names, including their instrument and interval, through the same subscription interface: + +```javascript +import { WebsocketClient, WS_KEY_MAP } from 'coinbase-api'; + +const client = new WebsocketClient(); + +client.on('update', (event) => { + console.log(event.params.channel, event.params.data); +}); + +client.subscribe( + ['quote.BTC-PERPETUAL', 'ticker.BTC-PERPETUAL.100ms'], + WS_KEY_MAP.advTradeGlobalMarketData, +); + +// client.unsubscribe('quote.BTC-PERPETUAL', WS_KEY_MAP.advTradeGlobalMarketData); +``` + +No credentials are required. The client handles liveness checks and restores subscribed topics after reconnecting, if a connection for any reason needs to be automatically replaced. Updates preserve the JSON-RPC envelope, with data under `params.data`; acknowledgements use `response` and API errors use `exception`. Public intervals are `100ms` and `agg2`; `raw` requires authentication. See the [public example](./examples/AdvancedTradeGlobal/WebSockets/publicWs.ts) and [channel/event types](./src/types/websockets/advanced-trade-global.ts). + +Global connections open on demand and are excluded from `connectAll()`. To preconnect a Global subscription feed, call `connect(WS_KEY_MAP.advTradeGlobalMarketData)` or `connect(WS_KEY_MAP.advTradeGlobalUserData)`. Use `connectWSAPI()` to preconnect and authenticate the Global WS API. + +#### Global Derivatives Private WebSocket + +Use `WS_KEY_MAP.advTradeGlobalUserData` for account, order, trade, position and portfolio updates: + +```javascript +import { WebsocketClient, WS_KEY_MAP } from 'coinbase-api'; + +const client = new WebsocketClient({ apiKey, apiSecret }); + +client.on('authenticated', ({ wsKey }) => console.log('authenticated:', wsKey)); +client.on('update', (event) => + console.log(event.params.channel, event.params.data), +); +client.on('exception', (event) => console.error(event)); + +client.subscribe( + ['user.orders.future.USDC.100ms', 'user.portfolio.USDC'], + WS_KEY_MAP.advTradeGlobalUserData, +); +``` + +The client authenticates with a CDP JWT before subscribing, renews the session before expiry, and authenticates again before restoring subscriptions after reconnecting. Both ECDSA and Ed25519 CDP keys are supported. Private updates preserve the JSON-RPC envelope. Order notifications use arrays for `100ms`/`agg2` and individual objects for `raw`. See the [private example](./examples/AdvancedTradeGlobal/WebSockets/privateWs.ts) and [channel/event types](./src/types/websockets/advanced-trade-global.ts). + +#### Global Derivatives WebSocket API + +Use `WebsocketAPIClient` for promise-based Global API requests over WebSocket. Its named methods follow `CBAdvancedTradeGlobalClient`, reusing the REST parameter and result types. Responses preserve the JSON-RPC envelope, with the method's data under `result`: + +```typescript +import { WebsocketAPIClient, WS_KEY_MAP } from 'coinbase-api'; + +const client = new WebsocketAPIClient({ apiKey, apiSecret }); + +const time = await client.getTime(); // Public methods need no credentials. +const positions = await client.getPositions({ currency: 'USDC' }); +console.log(time.result, positions.result); + +// Alternatively, use the underlying WebsocketClient's typed request interface: +const response = await client + .getWSClient() + .sendWSAPIRequest(WS_KEY_MAP.advTradeGlobalWSAPI, 'private/get_positions', { + currency: 'USDC', + }); +console.log(response.result); + +// When finished: +await client.logout({ invalidate_token: false }); +``` + +The dedicated `WS_KEY_MAP.advTradeGlobalWSAPI` connection uses `wss://drb.coinbase.com/ws/api/v2`. Private calls authenticate automatically, concurrent calls share authentication, and sessions renew before expiry. `connectWSAPI()` optionally warms up an authenticated connection. Reauthentication after reconnect is enabled by default; subscriptions use their existing separate connections. + +API errors, timeouts and disconnects reject the affected promises. Requests are never replayed automatically. `wsAPITimeout` defaults to 10,000 milliseconds waiting for the RPC reply after sending; individual `sendWSAPIRequest()` calls can override it with `{ requestTimeout: 15000 }` as the fourth argument. Connection and authentication use their own lifecycle handling; `public/auth` uses the authentication timeout. Responses and API errors also emit `response` and `exception` events on `getWSClient()`. + +Session methods include heartbeat configuration, cancel-on-disconnect and logout. Connection-scoped settings must be reapplied after reconnecting. Logout waits for the server's normal close because it sends no JSON-RPC response, and prevents automatic reconnect. See the [WS API example](./examples/AdvancedTradeGlobal/WebSockets/wsApi.ts), [named methods](./src/WebsocketAPIClient.ts) and [request/response maps](./src/types/websockets/wsAPI.ts). Block/RFQ methods remain outside this interface for now. + #### Private Websocket ```javascript @@ -54730,8 +24233,8 @@ File: package.json ================ { "name": "coinbase-api", - "version": "1.2.6", - "description": "Node.js SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets, with TypeScript & strong end to end tests.", + "version": "1.3.1", + "description": "Coinbase Advanced Trade SDK for Node.js and JavaScript. Complete Node.js & JavaScript SDK for Coinbase's Advanced Trade, App, Exchange, International, Prime & Commerce REST APIs and WebSockets, with TypeScript & strong end to end tests.", "scripts": { "clean": "rm -rf dist", "build": "npm run clean && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && bash ./postBuild.sh", @@ -54764,7 +24267,7 @@ File: package.json ], "dependencies": { "@types/ws": "8.18.1", - "axios": "1.18.1", + "axios": "1.20.0", "isomorphic-ws": "4.0.1", "jose": "6.1.3", "nanoid": "3.3.18", @@ -54773,8 +24276,8 @@ File: package.json "devDependencies": { "@types/jest": "^29.5.12", "@types/node": "^22.10.2", - "@typescript-eslint/eslint-plugin": "^8.18.0", - "@typescript-eslint/parser": "^8.18.0", + "@typescript-eslint/eslint-plugin": "8.70.0", + "@typescript-eslint/parser": "8.70.0", "eslint": "^8.29.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", @@ -54789,15 +24292,19 @@ File: package.json "webpack-cli": "^4.0.0" }, "overrides": { - "brace-expansion@<2": "1.1.18", - "brace-expansion@>=2 <3": "2.1.4", - "brace-expansion@>=5 <6": "5.0.9", - "fast-uri@>=3 <4": "3.1.5", - "js-yaml@>=3 <4": "3.15.1", - "js-yaml@>=4 <5": "4.3.1" + "brace-expansion@<2": "1.1.21", + "brace-expansion@>=2 <3": "2.1.7", + "brace-expansion@>=5 <6": "5.0.12", + "fast-uri@>=3 <4": "3.1.8", + "js-yaml@>=3 <4": "3.15.2", + "js-yaml@>=4 <5": "4.3.2" }, "keywords": [ "coinbase", + "coinbase advanced trade", + "advanced trade", + "coinbase advanced trade api", + "coinbase advanced trade sdk", "coinbase api", "coinbase node", "coinbase node api",