Skip to content

Class: CBPrimeClient ​

REST client for Coinbase Prime API: https://docs.cdp.coinbase.com/prime/docs/welcome

Extends ​

  • BaseRestClient

Constructors ​

Constructor ​

ts
new CBPrimeClient(restClientOptions?: RestClientOptions, requestOptions?: AxiosRequestConfig): CBPrimeClient;

Parameters ​

ParameterType
restClientOptions?RestClientOptions
requestOptions?AxiosRequestConfig

Returns ​

CBPrimeClient

Overrides ​

BaseRestClient.constructor

Methods ​

cancelOrder() ​

ts
cancelOrder(params: object): Promise<any>;

Cancel Order

Cancel an order. (Filled orders cannot be canceled.)

Parameters ​

ParameterType
params{ order_id: string; portfolio_id: string; }
params.order_idstring
params.portfolio_idstring

Returns ​

Promise<any>


createAddressBookEntry() ​

ts
createAddressBookEntry(params: CreatePrimeAddressBookEntryRequest): Promise<any>;

Create Address Book Entry

Creates an entry for a portfolio's trusted addresses.

Parameters ​

ParameterType
paramsCreatePrimeAddressBookEntryRequest

Returns ​

Promise<any>


createConversion() ​

ts
createConversion(params: CreatePrimeConversionRequest): Promise<any>;

Create Conversion

Perform a conversion between 2 assets.

Parameters ​

ParameterType
paramsCreatePrimeConversionRequest

Returns ​

Promise<any>


createPortfolioAllocations() ​

ts
createPortfolioAllocations(params: CreatePrimePortfolioAllocationsRequest): Promise<any>;

Create Portfolio Allocations

Create allocation for a given portfolio.

Parameters ​

ParameterType
paramsCreatePrimePortfolioAllocationsRequest

Returns ​

Promise<any>


createPortfolioNetAllocations() ​

ts
createPortfolioNetAllocations(params: CreatePrimePortfolioNetAllocationsRequest): Promise<any>;

Create Portfolio Net Allocations

Create net allocation for a given portfolio.

Parameters ​

ParameterType
paramsCreatePrimePortfolioNetAllocationsRequest

Returns ​

Promise<any>


createTransfer() ​

ts
createTransfer(params: CreatePrimeTransferRequest): Promise<any>;

Create Transfer

Create a wallet transfer.

Parameters ​

ParameterType
paramsCreatePrimeTransferRequest

Returns ​

Promise<any>


createWallet() ​

ts
createWallet(params: CreatePrimeWalletRequest): Promise<any>;

Create Wallet

Create a wallet.

Parameters ​

ParameterType
paramsCreatePrimeWalletRequest

Returns ​

Promise<any>


createWithdrawal() ​

ts
createWithdrawal(params: CreatePrimeWithdrawalRequest): Promise<any>;

Create Withdrawal

Create a withdrawal.

Parameters ​

ParameterType
paramsCreatePrimeWithdrawalRequest

Returns ​

Promise<any>


deletePrivate() ​

ts
deletePrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;

Parameters ​

ParameterType
endpointstring
params?ParamsInRequest

Returns ​

Promise<any>

Inherited from ​

BaseRestClient.deletePrivate


editOrder() ​

ts
editOrder(params: EditPrimeOrderRequest): Promise<any>;

Edit Order (Beta)

Edit an open order. Supports LIMIT, STOP-LIMIT, TWAP, VWAP, and PEG orders.

Parameters ​

ParameterType
paramsEditPrimeOrderRequest

Returns ​

Promise<any>


generateNewOrderId() ​

ts
generateNewOrderId(): string;

Returns ​

string

Inherited from ​

BaseRestClient.generateNewOrderId


get() ​

ts
get(endpoint: string, params?: object): Promise<any>;

Parameters ​

ParameterType
endpointstring
params?object

Returns ​

Promise<any>

Inherited from ​

BaseRestClient.get


getActivities() ​

ts
getActivities(params: GetPrimeActivitiesRequest): Promise<any>;

List activities associated with the specified portfolio. Use getEntityActivities() for entity-wide activity.

Parameters ​

ParameterType
paramsGetPrimeActivitiesRequest

Returns ​

Promise<any>


getActivityById() ​

ts
getActivityById(params: object): Promise<any>;

Get Activity by Activity ID

Retrieve an activity by its activity ID - this endpoint can retrieve both portfolio and entity activities when passed the appropriate API key.

Parameters ​

ParameterType
params{ activity_id: string; }
params.activity_idstring

Returns ​

Promise<any>


getAddressBook() ​

ts
getAddressBook(params: GetPrimeAddressBookRequest): Promise<any>;

Get Address Book

Gets a list of address book addresses.

Parameters ​

ParameterType
paramsGetPrimeAddressBookRequest

Returns ​

Promise<any>


getAllocationById() ​

ts
getAllocationById(params: object): Promise<any>;

Get Allocation By ID

Retrieve an allocation by allocation ID.

Parameters ​

ParameterType
params{ allocation_id: string; portfolio_id: string; }
params.allocation_idstring
params.portfolio_idstring

Returns ​

Promise<any>


getAssets() ​

ts
getAssets(params: object): Promise<any>;

List Assets

List all assets available for a given entity.

Parameters ​

ParameterType
params{ entity_id: string; }
params.entity_idstring

Returns ​

Promise<any>


getClientType() ​

ts
getClientType(): RestClientType;

Defines the client type (affecting how requests & signatures behave)

Returns ​

RestClientType

Overrides ​

BaseRestClient.getClientType


getConversionFees() ​

ts
getConversionFees(): Promise<any>;

Get your organization’s stablecoin conversion fee tiers and month-to-date net conversion volume per currency. Requires an organization-scoped API key. Sends an authenticated request to GET /v1/conversion/fees.

Returns ​

Promise<any>


getEntityAccruals() ​

ts
getEntityAccruals(params: GetPrimeEntityAccrualsRequest): Promise<any>;

List Interest Accruals

List an entity's interest accruals within the specified date range.

Parameters ​

ParameterType
paramsGetPrimeEntityAccrualsRequest

Returns ​

Promise<any>


getEntityActivities() ​

ts
getEntityActivities(params: GetPrimeEntityActivitiesRequest): Promise<any>;

List Entity Activities

List all activities associated with a given entity.

Parameters ​

ParameterType
paramsGetPrimeEntityActivitiesRequest

Returns ​

Promise<any>


getEntityAggregatePositions() ​

ts
getEntityAggregatePositions(params: object): Promise<any>;

List Aggregate Entity Positions

List paginated aggregate positions for a specific entity.

Parameters ​

ParameterType
params{ cursor?: string; entity_id: string; limit?: number; }
params.cursor?string
params.entity_idstring
params.limit?number

Returns ​

Promise<any>


getEntityLocateAvailabilities() ​

ts
getEntityLocateAvailabilities(params: GetPrimeEntityLocateAvailabilitiesRequest): Promise<any>;

Get Entity Locate Availabilities

Get currencies available to be located with their corresponding amount and rate.

Parameters ​

ParameterType
paramsGetPrimeEntityLocateAvailabilitiesRequest

Returns ​

Promise<any>


getEntityMargin() ​

ts
getEntityMargin(params: object): Promise<any>;

Get Margin Information

Gets real-time evaluation of the margin model based on current positions and spot rates.

Parameters ​

ParameterType
params{ entity_id: string; }
params.entity_idstring

Returns ​

Promise<any>


getEntityMarginSummaries() ​

ts
getEntityMarginSummaries(params: GetPrimeEntityMarginSummariesRequest): Promise<any>;

List Margin Call Summaries

Lists the margin call history for a given entity ID.

Parameters ​

ParameterType
paramsGetPrimeEntityMarginSummariesRequest

Returns ​

Promise<any>


getEntityPaymentMethod() ​

ts
getEntityPaymentMethod(params: object): Promise<any>;

Get Entity Payment Method

Get payment method details by id for a given entity.

Parameters ​

ParameterType
params{ entity_id: string; payment_method_id: string; }
params.entity_idstring
params.payment_method_idstring

Returns ​

Promise<any>


getEntityPaymentMethods() ​

ts
getEntityPaymentMethods(params: object): Promise<any>;

List Entity Payment Methods

Retrieve all payment methods for a given entity.

Parameters ​

ParameterType
params{ entity_id: string; }
params.entity_idstring

Returns ​

Promise<any>


getEntityPositions() ​

ts
getEntityPositions(params: object): Promise<any>;

List Entity Positions

List paginated positions for a specific entity.

Parameters ​

ParameterType
params{ cursor?: string; entity_id: string; limit?: number; }
params.cursor?string
params.entity_idstring
params.limit?number

Returns ​

Promise<any>


getEntityTFTieredFees() ​

ts
getEntityTFTieredFees(params: GetPrimeEntityTFTieredFeesRequest): Promise<any>;

Get Trade Finance Tiered Pricing Fees

Get trade finance tiered pricing fees for a given entity at a specific time, default to current time.

Parameters ​

ParameterType
paramsGetPrimeEntityTFTieredFeesRequest

Returns ​

Promise<any>


getInvoices() ​

ts
getInvoices(params: GetPrimeInvoicesRequest): Promise<any>;

List Invoices

Retrieve a list of invoices belonging to an entity.

Parameters ​

ParameterType
paramsGetPrimeInvoicesRequest

Returns ​

Promise<any>


getNetAllocationsByNettingId() ​

ts
getNetAllocationsByNettingId(params: object): Promise<any>;

Get Net Allocations By Netting ID

Retrieve an allocation by netting ID.

Parameters ​

ParameterType
params{ netting_id: string; portfolio_id: string; }
params.netting_idstring
params.portfolio_idstring

Returns ​

Promise<any>


getOpenOrders() ​

ts
getOpenOrders(params: GetPrimeOpenOrdersRequest): Promise<any>;

List Open Orders

List all open orders for a given portfolio.

Parameters ​

ParameterType
paramsGetPrimeOpenOrdersRequest

Returns ​

Promise<any>


getOrderById() ​

ts
getOrderById(params: object): Promise<any>;

Get Order by Order ID

Retrieve an order by order ID.

Parameters ​

ParameterType
params{ order_id: string; portfolio_id: string; }
params.order_idstring
params.portfolio_idstring

Returns ​

Promise<any>


getOrderFills() ​

ts
getOrderFills(params: GetPrimeOrderFillsRequest): Promise<any>;

List Order Fills

Retrieve fills on a given order.

Parameters ​

ParameterType
paramsGetPrimeOrderFillsRequest

Returns ​

Promise<any>


getOrderPreview() ​

ts
getOrderPreview(params: GetPrimeOrderPreviewRequest): Promise<any>;

Get Order Preview

Retrieve an order preview for a given portfolio.

Parameters ​

ParameterType
paramsGetPrimeOrderPreviewRequest

Returns ​

Promise<any>


getPortfolioAccruals() ​

ts
getPortfolioAccruals(params: GetPrimePortfolioAccrualsRequest): Promise<any>;

List Interest Accruals For Portfolio

List a portfolio's interest accruals within the specified date range.

Parameters ​

ParameterType
paramsGetPrimePortfolioAccrualsRequest

Returns ​

Promise<any>


getPortfolioActivityById() ​

ts
getPortfolioActivityById(params: object): Promise<any>;

Get Portfolio Activity by Activity ID

Retrieve an activity by its activity ID for a specific portfolio.

Parameters ​

ParameterType
params{ activity_id: string; portfolio_id: string; }
params.activity_idstring
params.portfolio_idstring

Returns ​

Promise<any>


getPortfolioAllocations() ​

ts
getPortfolioAllocations(params: GetPrimePortfolioAllocationsRequest): Promise<any>;

List Portfolio Allocations

Retrieve historical allocations for a given portfolio.

Parameters ​

ParameterType
paramsGetPrimePortfolioAllocationsRequest

Returns ​

Promise<any>


getPortfolioBalances() ​

ts
getPortfolioBalances(params: object): Promise<any>;

List Portfolio Balances

List all balances for a specific portfolio.

Parameters ​

ParameterType
params{ balance_type?: "TRADING_BALANCES" | "VAULT_BALANCES" | "TOTAL_BALANCES"; portfolio_id: string; symbols?: string[]; }
params.balance_type?"TRADING_BALANCES" | "VAULT_BALANCES" | "TOTAL_BALANCES"
params.portfolio_idstring
params.symbols?string[]

Returns ​

Promise<any>


getPortfolioBuyingPower() ​

ts
getPortfolioBuyingPower(params: GetPrimePortfolioBuyingPowerRequest): Promise<any>;

Get Portfolio Buying Power

Returns the size of a buy trade that can be performed based on existing holdings and available credit.

Parameters ​

ParameterType
paramsGetPrimePortfolioBuyingPowerRequest

Returns ​

Promise<any>


getPortfolioById() ​

ts
getPortfolioById(params: object): Promise<any>;

Get Portfolio by Portfolio ID

Retrieve a given portfolio by its portfolio ID.

Parameters ​

ParameterType
params{ portfolio_id: string; }
params.portfolio_idstring

Returns ​

Promise<any>


getPortfolioCommission() ​

ts
getPortfolioCommission(params: object): Promise<any>;

Get Portfolio Commission

Retrieve commission associated with a given portfolio.

Parameters ​

ParameterType
params{ portfolio_id: string; }
params.portfolio_idstring

Returns ​

Promise<any>


getPortfolioCreditInformation() ​

ts
getPortfolioCreditInformation(params: object): Promise<any>;

Get Portfolio Credit Information

Retrieve a portfolio's post-trade credit information.

Parameters ​

ParameterType
params{ portfolio_id: string; }
params.portfolio_idstring

Returns ​

Promise<any>


getPortfolioDerivativePositions() ​

ts
getPortfolioDerivativePositions(params: GetPrimePortfolioDerivativePositionsRequest): Promise<any>;

Retrieve active derivative positions for a portfolio from GET /v1/portfolios/{portfolio_id}/derivatives/positions, optionally filtered by product_id. The official response schema covers derivative product types including futures, prediction markets and options; product and venue availability depend on the account. This SDK release returns Promise<any>.

Parameters ​

ParameterType
paramsGetPrimePortfolioDerivativePositionsRequest

Returns ​

Promise<any>


getPortfolioDerivativesCurrencySummary() ​

ts
getPortfolioDerivativesCurrencySummary(params: GetPrimePortfolioDerivativesCurrencySummaryRequest): Promise<any>;

Retrieve per-currency international derivatives balances for a given portfolio. Sends an authenticated request to GET /v1/portfolios/{portfolio_id}/derivatives/currency_summary.

Parameters ​

ParameterType
paramsGetPrimePortfolioDerivativesCurrencySummaryRequest

Returns ​

Promise<any>


getPortfolioFills() ​

ts
getPortfolioFills(params: GetPrimePortfolioFillsRequest): Promise<any>;

List Portfolio Fills

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.

Parameters ​

ParameterType
paramsGetPrimePortfolioFillsRequest

Returns ​

Promise<any>


getPortfolioLocates() ​

ts
getPortfolioLocates(params: GetPrimePortfolioLocatesRequest): Promise<any>;

List Existing Locates

List locates for the portfolio.

Parameters ​

ParameterType
paramsGetPrimePortfolioLocatesRequest

Returns ​

Promise<any>


getPortfolioMarginConversions() ​

ts
getPortfolioMarginConversions(params: GetPrimePortfolioMarginConversionsRequest): Promise<any>;

List Margin Conversions

Lists conversions and short collateral requirement between specified date range. This endpoint is deprecated and will be removed in the future. Use /v1/entities/{entity_id}/margin_summaries instead.

Parameters ​

ParameterType
paramsGetPrimePortfolioMarginConversionsRequest

Returns ​

Promise<any>


getPortfolioOrders() ​

ts
getPortfolioOrders(params: GetPrimePortfolioOrdersRequest): Promise<any>;

List Portfolio Orders

List historical orders for a given portfolio.

Parameters ​

ParameterType
paramsGetPrimePortfolioOrdersRequest

Returns ​

Promise<any>


getPortfolioProducts() ​

ts
getPortfolioProducts(params: GetPrimePortfolioProductsRequest): Promise<any>;

List Portfolio Products

List tradable products for a given portfolio.

Parameters ​

ParameterType
paramsGetPrimePortfolioProductsRequest

Returns ​

Promise<any>


getPortfolios() ​

ts
getPortfolios(): Promise<any>;

List Portfolios

List all portfolios for which the current API key has read access.

Returns ​

Promise<any>


getPortfolioTransactions() ​

ts
getPortfolioTransactions(params: GetPrimePortfolioTransactionsRequest): Promise<any>;

List Portfolio Transactions

List transactions for a given portfolio (only transactions that affect balances are accessible).

Parameters ​

ParameterType
paramsGetPrimePortfolioTransactionsRequest

Returns ​

Promise<any>


getPortfolioUsers() ​

ts
getPortfolioUsers(params: GetPrimePortfolioUsersRequest): Promise<any>;

List Portfolio Users

List all users associated with a given portfolio.

Parameters ​

ParameterType
paramsGetPrimePortfolioUsersRequest

Returns ​

Promise<any>


getPortfolioWallets() ​

ts
getPortfolioWallets(params: GetPrimePortfolioWalletsRequest): Promise<any>;

List Portfolio Wallets

List all wallets associated with a given portfolio.

Parameters ​

ParameterType
paramsGetPrimePortfolioWalletsRequest

Returns ​

Promise<any>


getPortfolioWithdrawalPower() ​

ts
getPortfolioWithdrawalPower(params: GetPrimePortfolioWithdrawalPowerRequest): Promise<any>;

Get Portfolio Withdrawal Power

Returns the nominal quantity of a given asset that can be withdrawn based on holdings and current portfolio equity.

Parameters ​

ParameterType
paramsGetPrimePortfolioWithdrawalPowerRequest

Returns ​

Promise<any>


getPrivate() ​

ts
getPrivate(endpoint: string, params?: object): Promise<any>;

Parameters ​

ParameterType
endpointstring
params?object

Returns ​

Promise<any>

Inherited from ​

BaseRestClient.getPrivate


getSignTimestampMs() ​

ts
getSignTimestampMs(): number;

Timestamp used to sign the request. Override this method to implement your own timestamp/sync mechanism

Returns ​

number

Inherited from ​

BaseRestClient.getSignTimestampMs


getTransactionById() ​

ts
getTransactionById(params: object): Promise<any>;

Get Transaction by Transaction ID

Retrieve a specific transaction by its transaction ID (only transactions that affect balances are accessible).

Parameters ​

ParameterType
params{ portfolio_id: string; transaction_id: string; }
params.portfolio_idstring
params.transaction_idstring

Returns ​

Promise<any>


getTransactionTravelRuleData() ​

ts
getTransactionTravelRuleData(params: GetPrimeTransactionTravelRuleDataRequest): Promise<any>;

Get Transaction Travel Rule Data

(Beta) Get fulfilled travel rule data for a transaction.

Parameters ​

ParameterType
paramsGetPrimeTransactionTravelRuleDataRequest

Returns ​

Promise<any>


getUsers() ​

ts
getUsers(params: GetPrimeUsersRequest): Promise<any>;

List Users

List all users associated with a given entity.

Parameters ​

ParameterType
paramsGetPrimeUsersRequest

Returns ​

Promise<any>


getWalletBalance() ​

ts
getWalletBalance(params: object): Promise<any>;

Get Wallet Balance

Query balance for a specific wallet.

Parameters ​

ParameterType
params{ portfolio_id: string; wallet_id: string; }
params.portfolio_idstring
params.wallet_idstring

Returns ​

Promise<any>


getWalletById() ​

ts
getWalletById(params: object): Promise<any>;

Get Wallet by Wallet ID

Retrieve a specific wallet by Wallet ID.

Parameters ​

ParameterType
params{ portfolio_id: string; wallet_id: string; }
params.portfolio_idstring
params.wallet_idstring

Returns ​

Promise<any>


getWalletDepositInstructions() ​

ts
getWalletDepositInstructions(params: GetPrimeWalletDepositInstructionsRequest): Promise<any>;

Get Wallet Deposit Instructions

Retrieve a specific wallet's deposit instructions.

Parameters ​

ParameterType
paramsGetPrimeWalletDepositInstructionsRequest

Returns ​

Promise<any>


getWalletTransactions() ​

ts
getWalletTransactions(params: GetPrimeWalletTransactionsRequest): Promise<any>;

List Wallet Transactions

Retrieve transactions for a given wallet (only transactions that affect balances are accessible).

Parameters ​

ParameterType
paramsGetPrimeWalletTransactionsRequest

Returns ​

Promise<any>


getWeb3WalletBalances() ​

ts
getWeb3WalletBalances(params: GetPrimeWeb3WalletBalancesRequest): Promise<any>;

List Web3 Wallet Balances

Query balances for a specific web3 wallet.

Parameters ​

ParameterType
paramsGetPrimeWeb3WalletBalancesRequest

Returns ​

Promise<any>


patchPrivate() ​

ts
patchPrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;

Parameters ​

ParameterType
endpointstring
params?ParamsInRequest

Returns ​

Promise<any>

Inherited from ​

BaseRestClient.patchPrivate


post() ​

ts
post(endpoint: string, params?: ParamsInRequest): Promise<any>;

Parameters ​

ParameterType
endpointstring
params?ParamsInRequest

Returns ​

Promise<any>

Inherited from ​

BaseRestClient.post


postPrivate() ​

ts
postPrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;

Parameters ​

ParameterType
endpointstring
params?ParamsInRequest

Returns ​

Promise<any>

Inherited from ​

BaseRestClient.postPrivate


putPrivate() ​

ts
putPrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;

Parameters ​

ParameterType
endpointstring
params?ParamsInRequest

Returns ​

Promise<any>

Inherited from ​

BaseRestClient.putPrivate


rotateApiKey() ​

ts
rotateApiKey(params?: RotatePrimeApiKeyRequest): Promise<any>;

Request a replacement API key with the same configuration. Sends the supplied parameters, or an empty object when omitted, to POST /v1/api-keys/rotate. The invoking key needs the Rotate API Key permission. An authorized approver must approve the rotation in Prime before the new key activates. See API key rotation.

Parameters ​

ParameterType
params?RotatePrimeApiKeyRequest

Returns ​

Promise<any>


submitOrder() ​

ts
submitOrder(params: SubmitPrimeOrderRequest): Promise<any>;

Create Order

Create an order for a given portfolio.

Parameters ​

ParameterType
paramsSubmitPrimeOrderRequest

Returns ​

Promise<any>

Built by Siebly. Open source SDKs for exchange APIs.