### Install and Build Project Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/README.md Install project dependencies and build the TypeScript project. ```bash npm install npm run build ``` -------------------------------- ### Install the Advanced Trade SDK Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/README.md Install the SDK using npm. This is the first step before using any of the SDK's functionalities. ```bash npm install @coinbase-sample/advanced-trade-sdk-ts ``` -------------------------------- ### Install the TypeScript SDK Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/README.md Use npm to install the Coinbase Advanced Trade SDK for TypeScript. ```bash npm install @coinbase-sample/advanced-trade-sdk-ts ``` -------------------------------- ### Build and Run TypeScript Project Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/configuration.md Commands to install dependencies, build the TypeScript project, and run the compiled JavaScript output. Ensure Node.js and npm are installed. ```bash # Install dependencies npm install # Build TypeScript npm run build # Run compiled JavaScript node dist/your-file.js ``` -------------------------------- ### Rate Limit Headers Example Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/README.md Illustrates the typical headers returned by the API to indicate rate limit status. ```text X-RateLimit-Limit: 10 X-RateLimit-Remaining: 9 X-RateLimit-Reset: 1704067268 ``` -------------------------------- ### Get Product Information Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/README.md Fetch details for a specific product, such as BTC-USD, using the ProductsService. The productId must be specified. ```typescript productService = new ProductsService(client); productService .getProduct({productId: "BTC-USD"}) .then((result) => { console.log(result); }) .catch((error) => { console.error(error.message); }); ``` -------------------------------- ### Create a Market Buy Order Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/README.md Place a market order to buy a specified amount of a product. This example shows a $10 market buy on BTC-USD. ```typescript const orderService = new OrdersService(client); orderService .createOrder({ clientOrderId: "00000001", productId: "BTC-USD", side: OrderSide.BUY, orderConfiguration:{ marketMarketIoc: { quoteSize: "10" } } }) .then((result) => { console.log(result); }) .catch((error) => { console.error(error.message); }); ``` -------------------------------- ### PKCS8 Private Key Format Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/configuration.md Example of a private key in PKCS8 format, another supported format for authentication. ```text -----BEGIN PRIVATE KEY----- MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg... -----END PRIVATE KEY----- ``` -------------------------------- ### Handle CoinbaseAdvTradeClientException Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/types.md Example of how to catch and log client-side exceptions. This pattern is useful for distinguishing between SDK-level errors and other potential issues in your application. ```typescript try { await service.method({}); } catch (error) { if (error instanceof CoinbaseAdvTradeClientException) { console.error(`Client error: ${error.message}`); } } ``` -------------------------------- ### Get Best Bid/Ask Prices Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/products-service.md Retrieves the best bid and ask prices for specified products. If no product IDs are provided, it returns data for all products. Use this to get real-time market quotes. ```typescript const bbo = await productsService.getBestBidAsk({ productIds: ['BTC-USD', 'ETH-USD'] }); bbo.pricebooks.forEach(book => { const bestBid = book.bids[0]; const bestAsk = book.asks[0]; console.log(`${book.productId}: Bid $${bestBid[0]} / Ask $${bestAsk[0]}`); }); ``` -------------------------------- ### Example Usage of CoinbaseCallOptions Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/types.md Demonstrates how to apply CoinbaseCallOptions, specifically setting a timeout for an API service method. This is useful for controlling request duration. ```typescript const response = await service.method(request, { timeout: 5000 // 5 second timeout }); ``` -------------------------------- ### Rate Limiting Headers Example Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md These headers provide information about your current rate limit status. Implement exponential backoff when you receive a 429 status code. ```text X-RateLimit-Limit: 10 // Requests per window X-RateLimit-Remaining: 9 // Remaining in window X-RateLimit-Reset: 1704067268 // Unix timestamp of window reset ``` -------------------------------- ### List Portfolios Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/portfolios-service.md Retrieves all portfolios for the authenticated user. This method is useful for getting an overview of all available trading accounts. ```APIDOC ## GET /portfolios ### Description Retrieves all portfolios for the authenticated user. ### Method GET ### Endpoint /portfolios ### Parameters #### Query Parameters - **request** (ListPortfoliosRequest) - Required - Empty request object (filter params). #### Request Body None ### Response #### Success Response (200) - **portfolios** (Array) - List of portfolio objects. #### Response Example { "portfolios": [ { "uuid": "portfolio-uuid-1", "name": "Portfolio 1" }, { "uuid": "portfolio-uuid-2", "name": "Portfolio 2" } ] } ``` -------------------------------- ### Production Client Configuration with Error Handling Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/configuration.md Configure the client for production with error tracking and minimal logging. This setup helps in monitoring and alerting for API issues. ```typescript // With error handling and minimal logging const client = new CoinbaseAdvTradeClient(credentials); // Error tracking/alerting client.addTransformResponse((response) => { if (response.status >= 400) { // Send to error tracking service logError(response); } return response; }); ``` -------------------------------- ### Get Product Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/products-service.md Retrieves detailed information for a specific product, including its price, 24h change, volume, and trading increments. Optionally includes tradability status. ```APIDOC ## GET /products/{productId} ### Description Retrieves detailed information for a specific product, including its price, 24h change, volume, and trading increments. Optionally includes tradability status. ### Method GET ### Endpoint /products/{productId} ### Parameters #### Path Parameters - **productId** (string) - Yes - Product ID (e.g., 'BTC-USD'). #### Query Parameters - **getTradabilityStatus** (boolean) - No - Include tradability status in response. ### Response #### Success Response (200) - **productId** (string) - The unique identifier for the product. - **price** (string) - The current price of the product. - **pricePercentageChange24h** (string) - The percentage change in price over the last 24 hours. - **volume24h** (string) - The trading volume over the last 24 hours. - **baseIncrement** (string) - The minimum increment for the base currency. - **quoteIncrement** (string) - The minimum increment for the quote currency. - **quoteMinSize** (string) - The minimum order size in quote currency. - **quoteMaxSize** (string) - The maximum order size in quote currency. - **baseMinSize** (string) - The minimum order size in base currency. - **baseMaxSize** (string) - The maximum order size in base currency. - **baseName** (string) - The name of the base currency. - **quoteName** (string) - The name of the quote currency. - **displayName** (string) - The display name of the product. - **status** (string) - The trading status of the product ('OPEN', 'HALTED', 'PAUSED'). - **cancelOnly** (boolean) - Optional - Indicates if only cancellations are allowed. - **limitOnly** (boolean) - Optional - Indicates if only limit orders are allowed. - **postOnly** (boolean) - Optional - Indicates if only post-only orders are allowed. - **tradingDisabled** (boolean) - Optional - Indicates if trading is disabled for the product. #### Response Example ```json { "productId": "BTC-USD", "price": "50000.00", "pricePercentageChange24h": "5.2", "volume24h": "1000000.00", "baseIncrement": "0.00001", "quoteIncrement": "0.01", "quoteMinSize": "10", "quoteMaxSize": "100000", "baseMinSize": "0.00001", "baseMaxSize": "10", "baseName": "BTC", "quoteName": "USD", "displayName": "Bitcoin / US Dollar", "status": "OPEN" } ``` ``` -------------------------------- ### Handle CoinbaseAdvTradeException Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/types.md Example of how to catch and log server-side API exceptions. This allows you to inspect the status code and response body for detailed error information from the API. ```typescript try { await service.method(request); } catch (error) { if (error instanceof CoinbaseAdvTradeException) { console.error(`API Error ${error.statusCode}: ${error.message}`); console.error(`Response:`, error.response); } } ``` -------------------------------- ### Get Best Bid/Ask Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves the best bid and ask prices for specified products. Accepts an array of product IDs or a comma-separated string. ```typescript { pricebooks: Array<{ productId: string; bids: Array<[price, size]>; asks: Array<[price, size]>; time: string; }>; } ``` -------------------------------- ### Portfolios Service Interface Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/portfolios-service.md Defines the available methods for interacting with portfolios, such as getting, listing, creating, deleting, editing, and moving funds. ```typescript export interface IPortfoliosService { getPortfolio(request: GetPortfolioRequest, options?: CoinbaseCallOptions): Promise<...>; listPortfolios(request: ListPortfoliosRequest, options?: CoinbaseCallOptions): Promise<...>; createPortfolio(request: CreatePortfolioRequest, options?: CoinbaseCallOptions): Promise<...>; deletePortfolio(request: DeletePortfolioRequest, options?: CoinbaseCallOptions): Promise<...>; editPortfolio(request: EditPortfolioRequest, options?: CoinbaseCallOptions): Promise<...>; movePortfolioFunds(request: MovePortfolioFundsRequest, options?: CoinbaseCallOptions): Promise<...>; } ``` -------------------------------- ### Get Specific Product Details Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/products-service.md Fetch detailed information for a single product using its ID. Useful for checking price, volume, and trading increments. ```typescript const product = await productsService.getProduct({ productId: 'BTC-USD' }); console.log(`${product.displayName}: $${product.price}`); console.log(`24h Change: ${product.pricePercentageChange24h}%`); console.log(`24h Volume: ${product.volume24h}`); ``` -------------------------------- ### Get Product Details Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/public-service.md Retrieve detailed information for a specific product using its ID. Provides data like display name, price, and 24-hour volume. ```typescript const product = await publicService.getProduct({ productId: 'BTC-USD' }); console.log(`${product.displayName}: $${product.price}`); console.log(`24h Volume: ${product.volume24h}`); ``` -------------------------------- ### Get Product Candles Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves historical candle data for a specific product. Requires product ID, start and end timestamps, and a granularity. The limit parameter can be adjusted, with a maximum of 350. ```typescript { candles: Array<[timestamp, open, high, low, close, volume]> } ``` -------------------------------- ### Get Product Market Trades Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves market trades for a specific product. Requires product ID and a limit (max 100). Optional start and end timestamps can filter the trade data. ```typescript { trades: Array<{ tradeId: string; productId: string; orderId: string; userId: string; side: 'BUY' | 'SELL'; price: string; size: string; time: string; commission: string; }>; } ``` -------------------------------- ### Initialize ProductsService Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/products-service.md Instantiate the ProductsService by passing an authenticated CoinbaseAdvTradeClient instance. ```typescript import { CoinbaseAdvTradeClient, ProductsService } from '@coinbase-sample/advanced-trade-sdk-ts'; const client = new CoinbaseAdvTradeClient(); const productsService = new ProductsService(client); ``` -------------------------------- ### Using API Configuration Constants Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/configuration.md Demonstrates how to import and utilize configuration constants like API base path and version within your application. ```typescript import { API_BASE_PATH, VERSION } from '@coinbase-sample/advanced-trade-sdk-ts'; console.log(`SDK Version: ${VERSION}`); console.log(`API Endpoint: ${API_BASE_PATH}`); ``` -------------------------------- ### Get Product Order Book Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/products-service.md Retrieves the current order book snapshot (bids and asks) for a product. Useful for understanding market depth and current trading interest. ```typescript const book = await productsService.getProductBook({ productId: 'BTC-USD', limit: 10 }); console.log('Top Bids:'); book.bids.slice(0, 3).forEach(([price, size]) => { console.log(` $${price}: ${size} BTC`); }); console.log('Top Asks:'); book.asks.slice(0, 3).forEach(([price, size]) => { console.log(` $${price}: ${size} BTC`); }); ``` -------------------------------- ### Initialize and Use the Coinbase Advanced Trade Client Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/README.md This snippet shows how to initialize the client with credentials and use services like OrdersService and ProductsService. Ensure your API key and private key are set as environment variables. ```typescript import { CoinbaseAdvTradeClient, CoinbaseAdvTradeCredentials, OrdersService, ProductsService, } from '@coinbase-sample/advanced-trade-sdk-ts'; // Initialize credentials const credentials = new CoinbaseAdvTradeCredentials( process.env.CDP_API_KEY, process.env.CDP_PRIVATE_KEY ); // Create client const client = new CoinbaseAdvTradeClient(credentials); // Create service instances const ordersService = new OrdersService(client); const productsService = new ProductsService(client); // Get product information const product = await productsService.getProduct({ productId: 'BTC-USD' }); console.log(`BTC Price: $${product.price}`); // List orders const orders = await ordersService.listOrders({ productIds: ['BTC-USD'], limit: 10 }); console.log(`Open orders: ${orders.orders.length}`); ``` -------------------------------- ### Get Perpetual Portfolio Summary Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/perpetuals-service.md Retrieves a summary of a perpetual portfolio, including balances and all associated positions. Use this to get a high-level view of portfolio status. ```typescript const summary = await perpetualsService.getPortfolioSummary({ portfolioUuid: 'portfolio-uuid-123' }); console.log(`Portfolio: ${summary.name}`); console.log(`Positions: ${summary.positions.length}`); ``` -------------------------------- ### Initialize the Client with Credentials Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/README.md Instantiate the client by passing your CDP API key and secret, stored securely, into the credentials object. ```typescript const credentials = new CoinbaseAdvTradeCredentials( process.env.KEY_NAME, process.env.PRIVATE_KEY ); const client = new CoinbaseAdvTradeClient(credentials); ``` -------------------------------- ### Get Order Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/orders-service.md Retrieves details for a specific order by its ID. ```APIDOC ## getOrder ### Description Retrieves the details of a specific order using its unique identifier. ### Method GET ### Endpoint /api/v3/brokerage/orders/{order_id} ### Parameters #### Path Parameters - **order_id** (string) - Required - The unique identifier of the order. ### Response #### Success Response (200) - **GetOrderResponse** (object) - The details of the requested order. ``` -------------------------------- ### Get Server Time Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves the current server time. This endpoint does not require authentication. ```typescript { iso: string; // ISO 8601 timestamp epochSeconds: string; // Unix seconds epochMillis: string; // Unix milliseconds } ``` -------------------------------- ### Initialize AccountsService Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/accounts-service.md Instantiate the AccountsService with an authenticated CoinbaseAdvTradeClient. Ensure you have your API keys and private key set up. ```typescript import { CoinbaseAdvTradeClient, CoinbaseAdvTradeCredentials, AccountsService } from '@coinbase-sample/advanced-trade-sdk-ts'; const credentials = new CoinbaseAdvTradeCredentials(process.env.CDP_API_KEY, process.env.CDP_PRIVATE_KEY); const client = new CoinbaseAdvTradeClient(credentials); const accountsService = new AccountsService(client); ``` -------------------------------- ### Initialize PublicService Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/public-service.md Instantiate the PublicService with a CoinbaseAdvTradeClient. No API credentials are required for public endpoints. ```typescript import { CoinbaseAdvTradeClient, PublicService } from '@coinbase-sample/advanced-trade-sdk-ts'; // No credentials needed for public endpoints const client = new CoinbaseAdvTradeClient(); const publicService = new PublicService(client); ``` -------------------------------- ### Get Futures Balance Summary Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves a summary of the futures account balance. Requires authentication. ```APIDOC ## GET /cfm/balance_summary ### Description Retrieves a summary of the futures account balance. ### Method GET ### Endpoint /cfm/balance_summary ### Authentication Required ### Response #### Success Response - **Response** (`GetFuturesBalanceSummaryResponse` object) - Summary of the futures balance. ``` -------------------------------- ### Get Futures Intraday Margin Settings Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves the intraday margin settings for futures. Requires authentication. ```APIDOC ## GET /cfm/intraday_margin_setting ### Description Retrieves the intraday margin settings for futures. ### Method GET ### Endpoint /cfm/intraday_margin_setting ### Authentication Required ### Response #### Success Response - **Response** (`GetFuturesIntradayMarginSettingsResponse` object) - The intraday margin settings. ``` -------------------------------- ### Get Futures Position Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves details for a specific futures position using its product ID. Requires authentication. ```APIDOC ## GET /cfm/positions/{productId} ### Description Retrieves details for a specific futures position. ### Method GET ### Endpoint /cfm/positions/{productId} ### Parameters #### Path Parameters - **productId** (string) - Required - Product ID ### Authentication Required ### Response #### Success Response - **Response** (`GetFuturesPositionsResponse` object) - Details of the specific futures position. ``` -------------------------------- ### Service Initialization Pattern Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/configuration.md Illustrates the common pattern for initializing the Coinbase Advanced Trade client and its associated services using API credentials. ```typescript import { CoinbaseAdvTradeClient, CoinbaseAdvTradeCredentials, AccountsService, OrdersService, ProductsService, PublicService, PortfoliosService, PerpetualsService, } from '@coinbase-sample/advanced-trade-sdk-ts'; const credentials = new CoinbaseAdvTradeCredentials( process.env.CDP_API_KEY, process.env.CDP_PRIVATE_KEY ); const client = new CoinbaseAdvTradeClient(credentials); // Initialize services const accountsService = new AccountsService(client); const ordersService = new OrdersService(client); const productsService = new ProductsService(client); const publicService = new PublicService(client); const portfoliosService = new PortfoliosService(client); const perpetualsService = new PerpetualsService(client); ``` -------------------------------- ### Build the Project Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/README.md Run this command to build the TypeScript project. A JavaScript counterpart will be generated for each TypeScript file. ```bash npm run build ``` -------------------------------- ### Get Order Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/orders-service.md Retrieves a specific order by its unique identifier. This method provides detailed information about a single order. ```APIDOC ## getOrder ### Description Retrieves a specific order by ID. ### Method GET ### Endpoint /orders/historical/{orderId} ### Parameters #### Path Parameters - **orderId** (string) - Yes - The UUID of the order to retrieve. #### Query Parameters - **options** (CoinbaseCallOptions) - Optional - Additional call options. ### Request Example ```typescript const order = await ordersService.getOrder({ orderId: 'order-uuid-123' }); console.log(`Status: ${order.status}, Filled: ${order.filledSize}`); ``` ### Response #### Success Response (200) - **order** (GetOrderResponse) - Order object with full details. ``` -------------------------------- ### Initialize Authenticated Client Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/configuration.md Use this snippet to create an authenticated client by loading credentials from environment variables. ```typescript import { CoinbaseAdvTradeClient, CoinbaseAdvTradeCredentials } from '@coinbase-sample/advanced-trade-sdk-ts'; // Load credentials from environment const credentials = new CoinbaseAdvTradeCredentials( process.env.CDP_API_KEY, process.env.CDP_PRIVATE_KEY ); // Create authenticated client const client = new CoinbaseAdvTradeClient(credentials); ``` -------------------------------- ### Get Specific Account by UUID Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/accounts-service.md Fetch detailed information for a single account using its unique identifier (UUID). ```typescript const account = await accountsService.getAccount({ accountUuid: '12345678-1234-1234-1234-123456789012' }); console.log(`Account: ${account.name}, Currency: ${account.currency}`); console.log(`Available Balance: ${account.availableBalance?.value}`); ``` -------------------------------- ### Initialize OrdersService Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/orders-service.md Instantiate the OrdersService with an authenticated CoinbaseAdvTradeClient. Ensure you have your API credentials set up. ```typescript import { CoinbaseAdvTradeClient, CoinbaseAdvTradeCredentials, OrdersService, OrderSide } from '@coinbase-sample/advanced-trade-sdk-ts'; const credentials = new CoinbaseAdvTradeCredentials(process.env.CDP_API_KEY, process.env.CDP_PRIVATE_KEY); const client = new CoinbaseAdvTradeClient(credentials); const ordersService = new OrdersService(client); ``` -------------------------------- ### Ed25519 Private Key Format (PEM) Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/configuration.md Example of an Ed25519 private key in PEM format, suitable for authentication. ```text -----BEGIN PRIVATE KEY----- MC4CAQAwBQYDK2VwBCIEIK7VJFQUOrES2xc... -----END PRIVATE KEY----- ``` -------------------------------- ### Development Client Configuration with Verbose Logging Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/configuration.md Use this configuration for development to see detailed API responses. Ensure you have your credentials set up. ```typescript // With verbose logging const client = new CoinbaseAdvTradeClient(credentials); client.addTransformResponse((response) => { console.log('API Response:', JSON.stringify(response, null, 2)); return response; }); ``` -------------------------------- ### Create Order Preview Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/orders-service.md Simulates an order to preview execution details and fees without placing the order. Useful for estimating costs and impact. ```typescript const preview = await ordersService.createOrderPreview({ productId: 'BTC-USD', side: 'BUY', orderConfiguration: { marketMarketIoc: { quoteSize: '100' } } }); console.log(`Estimated amount: ${preview.baseSize}, Fees: ${preview.commissionAmount}`); ``` -------------------------------- ### Get Specific Futures Position Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/additional-services.md Retrieves a specific futures position by its product ID. Requires the product ID as a parameter. ```typescript getPosition( request: GetFuturesPositionRequest, options?: CoinbaseCallOptions ): Promise ``` -------------------------------- ### Authenticate with API Key and Private Key Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/README.md Instantiate credentials using API key and private key, which can be loaded from environment variables or a .env file. ```typescript // From environment variables const credentials = new CoinbaseAdvTradeCredentials( process.env.CDP_API_KEY, process.env.CDP_PRIVATE_KEY ); // From .env file import dotenv from 'dotenv'; dotenv.config(); const credentials = new CoinbaseAdvTradeCredentials( process.env.CDP_API_KEY, process.env.CDP_PRIVATE_KEY ); ``` -------------------------------- ### List Futures Positions Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/additional-services.md Retrieves all open futures positions. Use this method to get an overview of your current futures positions. ```typescript listPositions( request: ListFuturesPositionsRequest, options?: CoinbaseCallOptions ): Promise ``` -------------------------------- ### ECDSA P-256 Private Key Format Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/configuration.md Example of an ECDSA P-256 private key in PEM format, which can be used for authentication. ```text -----BEGIN EC PRIVATE KEY----- MHcCAQEEIIGlh975aqLDMJ4Z//////////byeSb/xF/rn0z8Her... -----END EC PRIVATE KEY----- ``` -------------------------------- ### CoinbaseAdvTradeClient Constructor Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/client.md Initializes a new instance of the CoinbaseAdvTradeClient. It can be configured with CDP API credentials for authentication and an optional custom API base path. Without credentials, only public endpoints are accessible. ```APIDOC ## Constructor CoinbaseAdvTradeClient ### Description Initializes a new instance of the `CoinbaseAdvTradeClient`. It can be configured with CDP API credentials for authentication and an optional custom API base path. Without credentials, only public endpoints are accessible. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters Table | Parameter | Type | Required | Default | Description | |---|---|---|---|---| | credentials | `CoinbaseAdvTradeCredentials` | No | undefined | CDP API credentials for authentication. If omitted, only public endpoints are accessible. | | apiBasePath | `string` | No | `https://api.coinbase.com/api/v3/brokerage/` | Base URL for the API. | ### Request Example ```typescript import { CoinbaseAdvTradeClient, CoinbaseAdvTradeCredentials } from '@coinbase-sample/advanced-trade-sdk-ts'; const credentials = new CoinbaseAdvTradeCredentials( process.env.CDP_API_KEY, process.env.CDP_PRIVATE_KEY ); const client = new CoinbaseAdvTradeClient(credentials); ``` ### Response #### Success Response An instance of `CoinbaseAdvTradeClient` configured with the provided credentials and base path. #### Response Example ```typescript // Instance of CoinbaseAdvTradeClient const client = new CoinbaseAdvTradeClient(credentials); ``` ### Notes - The client automatically adds a response transformer that converts snake_case API responses to camelCase - Without credentials, the client can only access public endpoints - The user agent header is automatically set to `coinbase-advanced-ts/{version}` ``` -------------------------------- ### Get Public Product Candles Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves candle data for a specific product. This endpoint does not require authentication. The response is an array of candles. ```typescript Candles array ``` -------------------------------- ### Set Environment Variables for Credentials Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/configuration.md Export your API key and private key as environment variables before running your application. ```bash export CDP_API_KEY="your-api-key" export CDP_PRIVATE_KEY="your-private-key-pem-or-base64" ``` -------------------------------- ### Get Portfolio Details Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/portfolios-service.md Retrieves detailed information for a specific portfolio, including a breakdown by asset. Requires the portfolio's UUID. ```typescript const portfolio = await portfoliosService.getPortfolio({ portfolioUuid: 'portfolio-uuid-123' }); console.log(`Portfolio: ${portfolio.name}`); portfolio.balances.forEach(balance => { console.log(` ${balance.asset}: ${balance.amount}`); }); ``` -------------------------------- ### Run a Built File Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/README.md Execute a compiled JavaScript file from the dist directory using Node.js. ```bash node dist/{INSERT-FILENAME}.js ``` ```bash node dist/main.js ``` -------------------------------- ### CreateOrder Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Creates a new order. Requires specifying product, side, and order configuration. ```APIDOC ## POST /orders ### Description Creates a new order. Requires specifying product, side, and order configuration. ### Method POST ### Endpoint /orders ### Request Body - **clientOrderId** (string) - Required - **productId** (string) - Required - **side** (string) - Required - BUY or SELL - **orderConfiguration** (OrderConfiguration) - Required - **retailPortfolioId** (string) - Optional ### Request Example { "clientOrderId": "string", "productId": "string", "side": "BUY", "orderConfiguration": { ... }, "retailPortfolioId": "string" } ### Response #### Success Response (200) - **order** (NewOrderResponse) - New order object ``` -------------------------------- ### TypeScript Request and Response Types Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/README.md Defines example TypeScript types for API requests and responses, including required and optional fields. ```typescript // Request types with required/optional fields type GetAccountRequest = { accountUuid: string; }; // Response types with full schema type Account = { uuid?: string; name?: string; currency?: string; availableBalance?: Amount; // ... }; ``` -------------------------------- ### ConvertsService Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for the ConvertsService, handling currency conversion operations within the SDK. ```APIDOC ## ConvertsService ### Description Handles currency conversion operations. ### Methods - **currency conversions** ``` -------------------------------- ### Handling CoinbaseAdvTradeClientException Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/errors.md Example of how to catch and handle CoinbaseAdvTradeClientException in a try-catch block. This is useful for managing client-side errors before API requests are made. ```typescript try { const response = await accountsService.getAccount({ accountUuid: 'invalid-uuid-format' }); } catch (error) { if (error instanceof CoinbaseAdvTradeClientException) { console.error(`Client Error: ${error.message}`); // Handle client-side error } } ``` -------------------------------- ### Get Public Product Market Trades Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves market trades for a specific product. This endpoint does not require authentication. The response is an array of trades. ```typescript Trades array ``` -------------------------------- ### Create Allocate Portfolio Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/perpetuals-service.md Allocates collateral to a perpetual portfolio. Use this to add funds to your portfolio. ```typescript const result = await perpetualsService.createAllocatePortfolio({ portfolioUuid: 'portfolio-uuid-123', currency: 'USD', amount: '1000.00' }); console.log('Collateral allocated successfully'); ``` -------------------------------- ### Get Current Margin Window Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/additional-services.md Retrieves current margin window information. Optionally accepts a margin profile type to filter results. ```typescript getCurrentMarginWindow( request: GetFuturesCurrentMarginWindowRequest, options?: CoinbaseCallOptions ): Promise ``` -------------------------------- ### PortfoliosService Methods Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/INDEX.md Offers methods for managing user portfolios, including listing, creating, editing, deleting portfolios, and moving funds between them. ```APIDOC ## PortfoliosService ### Description Methods for managing user portfolios. #### Methods ##### listPortfolios - **Description**: Retrieves a list of user portfolios. - **Method**: GET - **Endpoint**: `/portfolios` ##### getPortfolio - **Description**: Retrieves details for a specific portfolio by its ID. - **Method**: GET - **Endpoint**: `/portfolios/{portfolioId}` - **Path Parameters**: - **portfolioId** (string) - Required - The unique identifier of the portfolio. ##### createPortfolio - **Description**: Creates a new portfolio. - **Method**: POST - **Endpoint**: `/portfolios` - **Request Body**: - **name** (string) - Required - The name of the new portfolio. ##### editPortfolio - **Description**: Edits an existing portfolio. - **Method**: PUT - **Endpoint**: `/portfolios/{portfolioId}` - **Path Parameters**: - **portfolioId** (string) - Required - The unique identifier of the portfolio to edit. - **Request Body**: - **name** (string) - Required - The new name for the portfolio. ##### deletePortfolio - **Description**: Deletes a portfolio. - **Method**: DELETE - **Endpoint**: `/portfolios/{portfolioId}` - **Path Parameters**: - **portfolioId** (string) - Required - The unique identifier of the portfolio to delete. ##### movePortfolioFunds - **Description**: Moves funds between portfolios. - **Method**: POST - **Endpoint**: `/portfolios/move` - **Request Body**: - **from_portfolio_id** (string) - Required - The ID of the source portfolio. - **to_portfolio_id** (string) - Required - The ID of the destination portfolio. - **amount** (string) - Required - The amount of funds to move. - **currency** (string) - Required - The currency of the funds being moved. ``` -------------------------------- ### Get Intraday Margin Setting Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/additional-services.md Retrieves the current intraday margin settings for your futures account. Use this to check your active margin configurations. ```typescript getIntradayMarginSetting( request: GetFuturesIntradayMarginSettingsRequest, options?: CoinbaseCallOptions ): Promise ``` -------------------------------- ### Initialize CoinbaseAdvTradeCredentials with PEM Key Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/credentials.md Instantiate credentials using a PEM-formatted private key and an API key. This is suitable for ECDSA P-256 keys. ```typescript import { CoinbaseAdvTradeCredentials } from '@coinbase-sample/advanced-trade-sdk-ts'; // Using PEM-formatted private key const credentials = new CoinbaseAdvTradeCredentials( 'your-api-key', `-----BEGIN EC PRIVATE KEY----- MHcCAQEEIIGlh975aqLDMJ4Z//////////byeSb/xF/rn0z8Her... -----END EC PRIVATE KEY-----` ); ``` -------------------------------- ### Get API Key Permissions Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/additional-services.md Retrieves the permissions granted to the current API key. Use this to check allowed operations for your API key. ```typescript const perms = await dataService.getAPIKeyPermissions({}); console.log('Allowed resources:', perms.resources); perms.resources.forEach(resource => { console.log(` ${resource.primary_id}: ${resource.permissions}`); }); ``` -------------------------------- ### Project File Structure Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/README.md This snippet displays the directory structure of the Coinbase Advanced SDK for TypeScript project. It helps in understanding the organization of different modules and documentation files. ```tree output/ ├── README.md (this file) ├── types.md ├── errors.md ├── configuration.md ├── endpoints.md └── api-reference/ ├── client.md ├── credentials.md ├── accounts-service.md ├── orders-service.md ├── products-service.md ├── portfolios-service.md ├── perpetuals-service.md ├── public-service.md └── additional-services.md ``` -------------------------------- ### Initialize CoinbaseAdvTradeCredentials with Ed25519 Base64 Key Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/credentials.md Instantiate credentials using a raw base64-encoded Ed25519 private key and an API key. Ensure the key is 64 bytes. ```typescript import { CoinbaseAdvTradeCredentials } from '@coinbase-sample/advanced-trade-sdk-ts'; // Using Ed25519 base64 key const credentials2 = new CoinbaseAdvTradeCredentials( 'your-api-key', 'Lr/xf5vNPDz1Qq...' // 64-byte base64 encoded Ed25519 key ); ``` -------------------------------- ### Get Portfolio Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/portfolios-service.md Retrieves detailed information for a specific portfolio, including a breakdown by asset. Use this to inspect the holdings of a particular trading account. ```APIDOC ## GET /portfolios/{portfolioUuid} ### Description Retrieves detailed information for a specific portfolio including breakdown by asset. ### Method GET ### Endpoint /portfolios/{portfolioUuid} ### Parameters #### Path Parameters - **portfolioUuid** (string) - Required - UUID of the portfolio to retrieve. #### Query Parameters - **request** (GetPortfolioRequest) - Required - Request object. #### Request Body None ### Response #### Success Response (200) - **uuid** (string) - The unique identifier of the portfolio. - **name** (string) - The name of the portfolio. - **balances** (Array<{ asset: string; amount: string; }>) - An array of objects, each representing an asset and its balance within the portfolio. #### Response Example { "uuid": "portfolio-uuid-123", "name": "My Portfolio", "balances": [ { "asset": "BTC", "amount": "0.5" }, { "asset": "ETH", "amount": "2.0" } ] } ``` -------------------------------- ### CreateOrderPreview Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Creates a preview of an order to estimate execution details before placing the actual order. ```APIDOC ## POST /orders/preview ### Description Creates a preview of an order to estimate execution details before placing the actual order. ### Method POST ### Endpoint /orders/preview ### Request Body - **clientOrderId** (string) - Required - **productId** (string) - Required - **side** (string) - Required - BUY or SELL - **orderConfiguration** (OrderConfiguration) - Required - **retailPortfolioId** (string) - Optional ### Request Example { "clientOrderId": "string", "productId": "string", "side": "BUY", "orderConfiguration": { ... }, "retailPortfolioId": "string" } ### Response #### Success Response (200) - **preview** (OrderPreviewResponse) - Order preview details ``` -------------------------------- ### List Perpetual Positions Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/perpetuals-service.md Retrieves all open positions for a specific perpetual portfolio. Use this to get an overview of active trades within a portfolio. ```typescript const positions = await perpetualsService.listPositions({ portfolioUuid: 'portfolio-uuid-123' }); positions.positions.forEach(pos => { console.log(`${pos.symbol}: ${pos.numberOfContracts} contracts`); }); ``` -------------------------------- ### ListPaymentMethods Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Lists all available payment methods for the authenticated user. ```APIDOC ## GET /payment_methods ### Description Lists all available payment methods. ### Method GET ### Endpoint /payment_methods ### Authentication Required ``` -------------------------------- ### Get Public Product Order Book Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves the order book for a specific product. This endpoint does not require authentication. The response is an order book object. ```typescript Order book object ``` -------------------------------- ### Create Portfolio Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/portfolios-service.md Creates a new portfolio with a specified name. This is useful for setting up new, organized trading accounts. ```APIDOC ## POST /portfolios ### Description Creates a new portfolio with the specified name. ### Method POST ### Endpoint /portfolios ### Parameters #### Query Parameters - **request** (CreatePortfolioRequest) - Required - Request object. - **request.name** (string) - Required - Name for the new portfolio. #### Request Body None ### Response #### Success Response (200) - **uuid** (string) - UUID of the newly created portfolio. - **name** (string) - Name of the newly created portfolio. #### Response Example { "uuid": "new-portfolio-uuid", "name": "My New Trading Portfolio" } ``` -------------------------------- ### Get Futures Current Margin Window Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/endpoints.md Retrieves the current margin window details, optionally filtered by margin profile type. Requires authentication. ```APIDOC ## GET /cfm/current_margin_window ### Description Retrieves the current margin window details. ### Method GET ### Endpoint /cfm/current_margin_window ### Parameters #### Query Parameters - **marginProfileType** (string) - Optional - Margin profile type ### Authentication Required ### Response #### Success Response - **Response** (`GetFuturesCurrentMarginWindowResponse` object) - Details of the current margin window. ``` -------------------------------- ### Get Product Market Trades Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/products-service.md Retrieves a list of recent market trades for a given product. Use this to see the latest executed trades and their details. ```typescript const trades = await productsService.getProductMarketTrades({ productId: 'ETH-USD', limit: 20 }); trades.trades.forEach(trade => { console.log(`${trade.side} ${trade.size} ETH @ $${trade.price}`); }); ``` -------------------------------- ### CoinbaseAdvTradeCredentials Constructor Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/credentials.md Initializes the CoinbaseAdvTradeCredentials class. It can be used with or without an API key and secret. If not provided, only public endpoints are accessible. ```APIDOC ## Constructor CoinbaseAdvTradeCredentials ### Description Initializes the `CoinbaseAdvTradeCredentials` class for managing CDP API authentication. ### Parameters #### Path Parameters - **key** (string) - Optional - The CDP API key (access key) used in the `kid` JWT header. - **secret** (string) - Optional - The private key for signing JWTs. Supports PEM format or raw base64-encoded Ed25519 keys (64 bytes). ### Behavior - If `key` or `secret` is not provided, the credentials object is created but no authentication headers are generated, allowing only public endpoint access. - A console message is logged: "Could not authenticate. Only public endpoints accessible." ### Example ```typescript import { CoinbaseAdvTradeCredentials } from '@coinbase-sample/advanced-trade-sdk-ts'; // Using PEM-formatted private key const credentials = new CoinbaseAdvTradeCredentials( 'your-api-key', `-----BEGIN EC PRIVATE KEY----- MHcCAQEEIIGlh975aqLDMJ4Z//////////byeSb/xF/rn0z8Her... -----END EC PRIVATE KEY-----` ); // Using Ed25519 base64 key const credentials2 = new CoinbaseAdvTradeCredentials( 'your-api-key', 'Lr/xf5vNPDz1Qq...' // 64-byte base64 encoded Ed25519 key ); ``` ``` -------------------------------- ### getIntradayMarginSetting Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/additional-services.md Retrieves the current intraday margin settings for the futures account. This helps in understanding margin requirements. ```APIDOC ## GET /cfm/intraday_margin_setting ### Description Retrieves intraday margin settings. ### Method GET ### Endpoint /cfm/intraday_margin_setting ### Parameters #### Query Parameters None explicitly documented. ### Request Example ```json { "example": "No request body or specific query parameters documented for this call." } ``` ### Response #### Success Response (200) - **body** (GetFuturesIntradayMarginSettingsResponse) - The intraday margin settings. #### Response Example ```json { "example": "Response structure not explicitly defined in source, but will be of type GetFuturesIntradayMarginSettingsResponse." } ``` ``` -------------------------------- ### Get Server Time Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/public-service.md Retrieve the current server time. This endpoint is public and does not require authentication. The response includes ISO, epochSeconds, and epochMillis formats. ```typescript const serverTime = await publicService.getServerTime({}); console.log(`Server time: ${serverTime.iso}`); console.log(`Unix timestamp: ${serverTime.epochSeconds}`); ``` -------------------------------- ### Get Perpetual Portfolio Balance Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/perpetuals-service.md Retrieves the balance information for a perpetual portfolio. This includes total balance and available margin, essential for risk management. ```typescript const balance = await perpetualsService.getPortfolioBalance({ portfolioUuid: 'portfolio-uuid-123' }); console.log(`Total Balance: ${balance.totalBalance}`); console.log(`Available Margin: ${balance.availableMargin}`); ``` -------------------------------- ### createOrderPreview Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/orders-service.md Simulates an order without placing it to preview execution details and fees. This is useful for estimating costs and understanding potential trade outcomes before committing to an order. ```APIDOC ## POST /orders/preview ### Description Simulates an order without placing it to preview execution details and fees. ### Method POST ### Endpoint /orders/preview ### Parameters #### Request Body - **request** (CreateOrderPreviewRequest) - Required - Same schema as CreateOrderRequest. - **clientOrderId** (string) - Required - Unique identifier provided by client. - **productId** (string) - Required - Trading pair (e.g., "BTC-USD"). - **side** ('BUY' | 'SELL') - Required - Order side. - **orderConfiguration** (object) - Required - Order type configuration. - **marketMarketIoc** (object) - Optional - Market order configuration. - **quoteSize** (string) - Optional - The amount of quote currency to buy or sell. - **baseSize** (string) - Optional - The amount of base currency to buy or sell. - **limitLimitGtc** (object) - Optional - Limit GTC order configuration. - **baseSize** (string) - Required - The amount of base currency to buy or sell. - **limitPrice** (string) - Required - The limit price for the order. - **postOnly** (boolean) - Optional - If true, the order will only be posted to the order book and not matched immediately. - **limitLimitFok** (object) - Optional - Limit FOK order configuration. - **baseSize** (string) - Required - The amount of base currency to buy or sell. - **limitPrice** (string) - Required - The limit price for the order. - **stopLimitStopLimitGtc** (object) - Optional - Stop limit GTC order configuration. - **baseSize** (string) - Required - The amount of base currency to buy or sell. - **limitPrice** (string) - Required - The limit price for the order. - **stopPrice** (string) - Required - The price at which the stop limit order becomes active. - **stopDirection** (string) - Optional - The direction of the stop order (e.g., 'STOP_LIMIT_UP', 'STOP_LIMIT_DOWN'). - **retailPortfolioId** (string) - Optional - Portfolio UUID for order. ### Request Example ```json { "productId": "BTC-USD", "side": "BUY", "orderConfiguration": { "marketMarketIoc": { "quoteSize": "100" } } } ``` ### Response #### Success Response (200) - **strategyResponse** (object) - Contains details about the simulated order execution. - **commissionAmount** (string) - The estimated commission fee for the order. - **commissionCurrency** (string) - The currency of the commission fee. - **totalFees** (string) - The total estimated fees for the order. - **price** (string) - The estimated execution price. - **baseSize** (string) - The estimated amount of base currency to be traded. - **quoteSize** (string) - The estimated amount of quote currency to be traded. - **pnl** (string) - The estimated profit or loss. - **commissionRate** (string) - The estimated commission rate. - **ச்சி** (string) - The estimated slippage. #### Response Example ```json { "commissionAmount": "0.50", "commissionCurrency": "USD", "totalFees": "0.50", "price": "40000.00", "baseSize": "0.0025", "quoteSize": "100.00", "pnl": "0.00", "commissionRate": "0.005", "slippage": "0.00" } ``` ``` -------------------------------- ### PerpetualsService Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/DELIVERY_SUMMARY.txt Documentation for the PerpetualsService, focused on INTX perpetuals trading. It provides methods for advanced perpetuals trading functionalities. ```APIDOC ## PerpetualsService ### Description Facilitates INTX perpetuals trading. Provides methods for advanced perpetuals trading functionalities. ### Methods - **INTX perpetuals trading** ``` -------------------------------- ### Get Futures Balance Summary Source: https://github.com/coinbase-samples/advanced-sdk-ts/blob/main/_autodocs/api-reference/additional-services.md Retrieves the futures account balance summary. Provides an overview of your account's financial status within the futures market. ```typescript getBalanceSummary( request: GetFuturesBalanceSummaryRequest, options?: CoinbaseCallOptions ): Promise ```