Class: CBPrimeClient
REST client for Coinbase Prime API: https://docs.cdp.coinbase.com/prime/docs/welcome
Extends
BaseRestClient
Constructors
Constructor
new CBPrimeClient(restClientOptions?: RestClientOptions, requestOptions?: AxiosRequestConfig): CBPrimeClient;Parameters
| Parameter | Type |
|---|---|
restClientOptions? | RestClientOptions |
requestOptions? | AxiosRequestConfig |
Returns
CBPrimeClient
Overrides
BaseRestClient.constructor
Methods
cancelOrder()
cancelOrder(params: object): Promise<any>;Cancel Order
Cancel an order. (Filled orders cannot be canceled.)
Parameters
| Parameter | Type |
|---|---|
params | { order_id: string; portfolio_id: string; } |
params.order_id | string |
params.portfolio_id | string |
Returns
Promise<any>
createAddressBookEntry()
createAddressBookEntry(params: CreatePrimeAddressBookEntryRequest): Promise<any>;Create Address Book Entry
Creates an entry for a portfolio's trusted addresses.
Parameters
| Parameter | Type |
|---|---|
params | CreatePrimeAddressBookEntryRequest |
Returns
Promise<any>
createConversion()
createConversion(params: CreatePrimeConversionRequest): Promise<any>;Create Conversion
Perform a conversion between 2 assets.
Parameters
| Parameter | Type |
|---|---|
params | CreatePrimeConversionRequest |
Returns
Promise<any>
createPortfolioAllocations()
createPortfolioAllocations(params: CreatePrimePortfolioAllocationsRequest): Promise<any>;Create Portfolio Allocations
Create allocation for a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | CreatePrimePortfolioAllocationsRequest |
Returns
Promise<any>
createPortfolioNetAllocations()
createPortfolioNetAllocations(params: CreatePrimePortfolioNetAllocationsRequest): Promise<any>;Create Portfolio Net Allocations
Create net allocation for a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | CreatePrimePortfolioNetAllocationsRequest |
Returns
Promise<any>
createTransfer()
createTransfer(params: CreatePrimeTransferRequest): Promise<any>;Create Transfer
Create a wallet transfer.
Parameters
| Parameter | Type |
|---|---|
params | CreatePrimeTransferRequest |
Returns
Promise<any>
createWallet()
createWallet(params: CreatePrimeWalletRequest): Promise<any>;Create Wallet
Create a wallet.
Parameters
| Parameter | Type |
|---|---|
params | CreatePrimeWalletRequest |
Returns
Promise<any>
createWithdrawal()
createWithdrawal(params: CreatePrimeWithdrawalRequest): Promise<any>;Create Withdrawal
Create a withdrawal.
Parameters
| Parameter | Type |
|---|---|
params | CreatePrimeWithdrawalRequest |
Returns
Promise<any>
deletePrivate()
deletePrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | ParamsInRequest |
Returns
Promise<any>
Inherited from
BaseRestClient.deletePrivate
editOrder()
editOrder(params: EditPrimeOrderRequest): Promise<any>;Edit Order (Beta)
Edit an open order. Supports LIMIT, STOP-LIMIT, TWAP, VWAP, and PEG orders.
Parameters
| Parameter | Type |
|---|---|
params | EditPrimeOrderRequest |
Returns
Promise<any>
generateNewOrderId()
generateNewOrderId(): string;Returns
string
Inherited from
BaseRestClient.generateNewOrderId
get()
get(endpoint: string, params?: object): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | object |
Returns
Promise<any>
Inherited from
BaseRestClient.get
getActivities()
getActivities(params: GetPrimeActivitiesRequest): Promise<any>;List activities associated with the specified portfolio. Use getEntityActivities() for entity-wide activity.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeActivitiesRequest |
Returns
Promise<any>
getActivityById()
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
| Parameter | Type |
|---|---|
params | { activity_id: string; } |
params.activity_id | string |
Returns
Promise<any>
getAddressBook()
getAddressBook(params: GetPrimeAddressBookRequest): Promise<any>;Get Address Book
Gets a list of address book addresses.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeAddressBookRequest |
Returns
Promise<any>
getAllocationById()
getAllocationById(params: object): Promise<any>;Get Allocation By ID
Retrieve an allocation by allocation ID.
Parameters
| Parameter | Type |
|---|---|
params | { allocation_id: string; portfolio_id: string; } |
params.allocation_id | string |
params.portfolio_id | string |
Returns
Promise<any>
getAssets()
getAssets(params: object): Promise<any>;List Assets
List all assets available for a given entity.
Parameters
| Parameter | Type |
|---|---|
params | { entity_id: string; } |
params.entity_id | string |
Returns
Promise<any>
getClientType()
getClientType(): RestClientType;Defines the client type (affecting how requests & signatures behave)
Returns
RestClientType
Overrides
BaseRestClient.getClientType
getConversionFees()
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()
getEntityAccruals(params: GetPrimeEntityAccrualsRequest): Promise<any>;List Interest Accruals
List an entity's interest accruals within the specified date range.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeEntityAccrualsRequest |
Returns
Promise<any>
getEntityActivities()
getEntityActivities(params: GetPrimeEntityActivitiesRequest): Promise<any>;List Entity Activities
List all activities associated with a given entity.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeEntityActivitiesRequest |
Returns
Promise<any>
getEntityAggregatePositions()
getEntityAggregatePositions(params: object): Promise<any>;List Aggregate Entity Positions
List paginated aggregate positions for a specific entity.
Parameters
| Parameter | Type |
|---|---|
params | { cursor?: string; entity_id: string; limit?: number; } |
params.cursor? | string |
params.entity_id | string |
params.limit? | number |
Returns
Promise<any>
getEntityLocateAvailabilities()
getEntityLocateAvailabilities(params: GetPrimeEntityLocateAvailabilitiesRequest): Promise<any>;Get Entity Locate Availabilities
Get currencies available to be located with their corresponding amount and rate.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeEntityLocateAvailabilitiesRequest |
Returns
Promise<any>
getEntityMargin()
getEntityMargin(params: object): Promise<any>;Get Margin Information
Gets real-time evaluation of the margin model based on current positions and spot rates.
Parameters
| Parameter | Type |
|---|---|
params | { entity_id: string; } |
params.entity_id | string |
Returns
Promise<any>
getEntityMarginSummaries()
getEntityMarginSummaries(params: GetPrimeEntityMarginSummariesRequest): Promise<any>;List Margin Call Summaries
Lists the margin call history for a given entity ID.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeEntityMarginSummariesRequest |
Returns
Promise<any>
getEntityPaymentMethod()
getEntityPaymentMethod(params: object): Promise<any>;Get Entity Payment Method
Get payment method details by id for a given entity.
Parameters
| Parameter | Type |
|---|---|
params | { entity_id: string; payment_method_id: string; } |
params.entity_id | string |
params.payment_method_id | string |
Returns
Promise<any>
getEntityPaymentMethods()
getEntityPaymentMethods(params: object): Promise<any>;List Entity Payment Methods
Retrieve all payment methods for a given entity.
Parameters
| Parameter | Type |
|---|---|
params | { entity_id: string; } |
params.entity_id | string |
Returns
Promise<any>
getEntityPositions()
getEntityPositions(params: object): Promise<any>;List Entity Positions
List paginated positions for a specific entity.
Parameters
| Parameter | Type |
|---|---|
params | { cursor?: string; entity_id: string; limit?: number; } |
params.cursor? | string |
params.entity_id | string |
params.limit? | number |
Returns
Promise<any>
getEntityTFTieredFees()
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
| Parameter | Type |
|---|---|
params | GetPrimeEntityTFTieredFeesRequest |
Returns
Promise<any>
getInvoices()
getInvoices(params: GetPrimeInvoicesRequest): Promise<any>;List Invoices
Retrieve a list of invoices belonging to an entity.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeInvoicesRequest |
Returns
Promise<any>
getNetAllocationsByNettingId()
getNetAllocationsByNettingId(params: object): Promise<any>;Get Net Allocations By Netting ID
Retrieve an allocation by netting ID.
Parameters
| Parameter | Type |
|---|---|
params | { netting_id: string; portfolio_id: string; } |
params.netting_id | string |
params.portfolio_id | string |
Returns
Promise<any>
getOpenOrders()
getOpenOrders(params: GetPrimeOpenOrdersRequest): Promise<any>;List Open Orders
List all open orders for a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeOpenOrdersRequest |
Returns
Promise<any>
getOrderById()
getOrderById(params: object): Promise<any>;Get Order by Order ID
Retrieve an order by order ID.
Parameters
| Parameter | Type |
|---|---|
params | { order_id: string; portfolio_id: string; } |
params.order_id | string |
params.portfolio_id | string |
Returns
Promise<any>
getOrderFills()
getOrderFills(params: GetPrimeOrderFillsRequest): Promise<any>;List Order Fills
Retrieve fills on a given order.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeOrderFillsRequest |
Returns
Promise<any>
getOrderPreview()
getOrderPreview(params: GetPrimeOrderPreviewRequest): Promise<any>;Get Order Preview
Retrieve an order preview for a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeOrderPreviewRequest |
Returns
Promise<any>
getPortfolioAccruals()
getPortfolioAccruals(params: GetPrimePortfolioAccrualsRequest): Promise<any>;List Interest Accruals For Portfolio
List a portfolio's interest accruals within the specified date range.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimePortfolioAccrualsRequest |
Returns
Promise<any>
getPortfolioActivityById()
getPortfolioActivityById(params: object): Promise<any>;Get Portfolio Activity by Activity ID
Retrieve an activity by its activity ID for a specific portfolio.
Parameters
| Parameter | Type |
|---|---|
params | { activity_id: string; portfolio_id: string; } |
params.activity_id | string |
params.portfolio_id | string |
Returns
Promise<any>
getPortfolioAllocations()
getPortfolioAllocations(params: GetPrimePortfolioAllocationsRequest): Promise<any>;List Portfolio Allocations
Retrieve historical allocations for a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimePortfolioAllocationsRequest |
Returns
Promise<any>
getPortfolioBalances()
getPortfolioBalances(params: object): Promise<any>;List Portfolio Balances
List all balances for a specific portfolio.
Parameters
| Parameter | Type |
|---|---|
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_id | string |
params.symbols? | string[] |
Returns
Promise<any>
getPortfolioBuyingPower()
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
| Parameter | Type |
|---|---|
params | GetPrimePortfolioBuyingPowerRequest |
Returns
Promise<any>
getPortfolioById()
getPortfolioById(params: object): Promise<any>;Get Portfolio by Portfolio ID
Retrieve a given portfolio by its portfolio ID.
Parameters
| Parameter | Type |
|---|---|
params | { portfolio_id: string; } |
params.portfolio_id | string |
Returns
Promise<any>
getPortfolioCommission()
getPortfolioCommission(params: object): Promise<any>;Get Portfolio Commission
Retrieve commission associated with a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | { portfolio_id: string; } |
params.portfolio_id | string |
Returns
Promise<any>
getPortfolioCreditInformation()
getPortfolioCreditInformation(params: object): Promise<any>;Get Portfolio Credit Information
Retrieve a portfolio's post-trade credit information.
Parameters
| Parameter | Type |
|---|---|
params | { portfolio_id: string; } |
params.portfolio_id | string |
Returns
Promise<any>
getPortfolioDerivativePositions()
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
| Parameter | Type |
|---|---|
params | GetPrimePortfolioDerivativePositionsRequest |
Returns
Promise<any>
getPortfolioDerivativesCurrencySummary()
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
| Parameter | Type |
|---|---|
params | GetPrimePortfolioDerivativesCurrencySummaryRequest |
Returns
Promise<any>
getPortfolioFills()
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
| Parameter | Type |
|---|---|
params | GetPrimePortfolioFillsRequest |
Returns
Promise<any>
getPortfolioLocates()
getPortfolioLocates(params: GetPrimePortfolioLocatesRequest): Promise<any>;List Existing Locates
List locates for the portfolio.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimePortfolioLocatesRequest |
Returns
Promise<any>
getPortfolioMarginConversions()
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
| Parameter | Type |
|---|---|
params | GetPrimePortfolioMarginConversionsRequest |
Returns
Promise<any>
getPortfolioOrders()
getPortfolioOrders(params: GetPrimePortfolioOrdersRequest): Promise<any>;List Portfolio Orders
List historical orders for a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimePortfolioOrdersRequest |
Returns
Promise<any>
getPortfolioProducts()
getPortfolioProducts(params: GetPrimePortfolioProductsRequest): Promise<any>;List Portfolio Products
List tradable products for a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimePortfolioProductsRequest |
Returns
Promise<any>
getPortfolios()
getPortfolios(): Promise<any>;List Portfolios
List all portfolios for which the current API key has read access.
Returns
Promise<any>
getPortfolioTransactions()
getPortfolioTransactions(params: GetPrimePortfolioTransactionsRequest): Promise<any>;List Portfolio Transactions
List transactions for a given portfolio (only transactions that affect balances are accessible).
Parameters
| Parameter | Type |
|---|---|
params | GetPrimePortfolioTransactionsRequest |
Returns
Promise<any>
getPortfolioUsers()
getPortfolioUsers(params: GetPrimePortfolioUsersRequest): Promise<any>;List Portfolio Users
List all users associated with a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimePortfolioUsersRequest |
Returns
Promise<any>
getPortfolioWallets()
getPortfolioWallets(params: GetPrimePortfolioWalletsRequest): Promise<any>;List Portfolio Wallets
List all wallets associated with a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimePortfolioWalletsRequest |
Returns
Promise<any>
getPortfolioWithdrawalPower()
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
| Parameter | Type |
|---|---|
params | GetPrimePortfolioWithdrawalPowerRequest |
Returns
Promise<any>
getPrivate()
getPrivate(endpoint: string, params?: object): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | object |
Returns
Promise<any>
Inherited from
BaseRestClient.getPrivate
getSignTimestampMs()
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()
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
| Parameter | Type |
|---|---|
params | { portfolio_id: string; transaction_id: string; } |
params.portfolio_id | string |
params.transaction_id | string |
Returns
Promise<any>
getTransactionTravelRuleData()
getTransactionTravelRuleData(params: GetPrimeTransactionTravelRuleDataRequest): Promise<any>;Get Transaction Travel Rule Data
(Beta) Get fulfilled travel rule data for a transaction.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeTransactionTravelRuleDataRequest |
Returns
Promise<any>
getUsers()
getUsers(params: GetPrimeUsersRequest): Promise<any>;List Users
List all users associated with a given entity.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeUsersRequest |
Returns
Promise<any>
getWalletBalance()
getWalletBalance(params: object): Promise<any>;Get Wallet Balance
Query balance for a specific wallet.
Parameters
| Parameter | Type |
|---|---|
params | { portfolio_id: string; wallet_id: string; } |
params.portfolio_id | string |
params.wallet_id | string |
Returns
Promise<any>
getWalletById()
getWalletById(params: object): Promise<any>;Get Wallet by Wallet ID
Retrieve a specific wallet by Wallet ID.
Parameters
| Parameter | Type |
|---|---|
params | { portfolio_id: string; wallet_id: string; } |
params.portfolio_id | string |
params.wallet_id | string |
Returns
Promise<any>
getWalletDepositInstructions()
getWalletDepositInstructions(params: GetPrimeWalletDepositInstructionsRequest): Promise<any>;Get Wallet Deposit Instructions
Retrieve a specific wallet's deposit instructions.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeWalletDepositInstructionsRequest |
Returns
Promise<any>
getWalletTransactions()
getWalletTransactions(params: GetPrimeWalletTransactionsRequest): Promise<any>;List Wallet Transactions
Retrieve transactions for a given wallet (only transactions that affect balances are accessible).
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeWalletTransactionsRequest |
Returns
Promise<any>
getWeb3WalletBalances()
getWeb3WalletBalances(params: GetPrimeWeb3WalletBalancesRequest): Promise<any>;List Web3 Wallet Balances
Query balances for a specific web3 wallet.
Parameters
| Parameter | Type |
|---|---|
params | GetPrimeWeb3WalletBalancesRequest |
Returns
Promise<any>
patchPrivate()
patchPrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | ParamsInRequest |
Returns
Promise<any>
Inherited from
BaseRestClient.patchPrivate
post()
post(endpoint: string, params?: ParamsInRequest): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | ParamsInRequest |
Returns
Promise<any>
Inherited from
BaseRestClient.post
postPrivate()
postPrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | ParamsInRequest |
Returns
Promise<any>
Inherited from
BaseRestClient.postPrivate
putPrivate()
putPrivate(endpoint: string, params?: ParamsInRequest): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | ParamsInRequest |
Returns
Promise<any>
Inherited from
BaseRestClient.putPrivate
rotateApiKey()
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
| Parameter | Type |
|---|---|
params? | RotatePrimeApiKeyRequest |
Returns
Promise<any>
submitOrder()
submitOrder(params: SubmitPrimeOrderRequest): Promise<any>;Create Order
Create an order for a given portfolio.
Parameters
| Parameter | Type |
|---|---|
params | SubmitPrimeOrderRequest |
Returns
Promise<any>