Back to Ccxt

Coinbase

wiki/exchanges/coinbase.md

4.5.7347.4 KB
Original Source

<a name="coinbase" id="coinbase"></a>

coinbase{docsify-ignore}

Kind: global class
Extends: <code>Exchange</code>

<a name="coinbase" id="coinbase"></a>

coinbase{docsify-ignore}

This is the retail Coinbase.com exchange class, covering the Advanced Trade API - the successor of the former Coinbase Pro after the Pro/retail unification. Use this class for regular Coinbase.com accounts and API keys created at coinbase.com. For the institutional Coinbase Exchange API (exchange.coinbase.com, application-gated credentials) see the separate coinbaseexchange class, and for Coinbase International derivatives see coinbaseinternational. Historical Coinbase Pro trading data lives in the retail account and is accessible through this class.

Instantiation with CDP (Cloud Developer Platform) keys, the current key format, see https://github.com/ccxt/ccxt/issues/23771:

const exchange = new ccxt.coinbase ({
    'apiKey': 'organizations/{org_id}/apiKeys/{key_id}', // the full "name" field from the CDP key file
    'secret': '-----BEGIN EC PRIVATE KEY-----\n...\n-----END EC PRIVATE KEY-----\n', // the "privateKey" field, keep the newlines
});

No password/passphrase is used - that field belonged to the old Coinbase Pro keys. If the secret travels through an env var or json config, literal backslash-n sequences instead of real newlines will break the signature - pass the PEM exactly as issued.

javascript
coinbase.coinbase ()

<a name="fetchTime" id="fetchtime"></a>

fetchTime{docsify-ignore}

fetches the current integer timestamp in milliseconds from the exchange server

Kind: instance method of <code>coinbase</code>
Returns: <code>int</code> - the current integer timestamp in milliseconds from the exchange server

See

ParamTypeRequiredDescription
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.method<code>string</code>No'v2PublicGetTime' or 'v3PublicGetBrokerageTime' default is 'v2PublicGetTime'
javascript
coinbase.fetchTime (params?)

<a name="fetchAccounts" id="fetchaccounts"></a>

fetchAccounts{docsify-ignore}

fetch all the accounts associated with a profile

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a dictionary of account structures indexed by the account type

See

ParamTypeRequiredDescription
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.paginate<code>boolean</code>Nodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
javascript
coinbase.fetchAccounts (params?)

<a name="fetchPortfolios" id="fetchportfolios"></a>

fetchPortfolios{docsify-ignore}

fetch all the portfolios

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a dictionary of account structures indexed by the account type

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/portfolios/list-portfolios

ParamTypeRequiredDescription
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.fetchPortfolios (params?)

<a name="createDepositAddress" id="createdepositaddress"></a>

createDepositAddress{docsify-ignore}

create a currency deposit address

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - an address structure

See: https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/onchain-addresses

ParamTypeRequiredDescription
code<code>string</code>Yesunified currency code of the currency for the deposit address
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.createDepositAddress (code, params?)

<a name="fetchWithdrawals" id="fetchwithdrawals"></a>

fetchWithdrawals{docsify-ignore}

Fetch all withdrawals made from an account. Won't return crypto withdrawals. Use fetchLedger for those.

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<object></code> - a list of transaction structures

See

ParamTypeRequiredDescription
code<code>string</code>Yesunified currency code
since<code>int</code>Nothe earliest time in ms to fetch withdrawals for
limit<code>int</code>Nothe maximum number of withdrawals structures to retrieve
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.currencyType<code>string</code>No"fiat" or "crypto"
javascript
coinbase.fetchWithdrawals (code, since?, limit?, params?)

<a name="fetchDeposits" id="fetchdeposits"></a>

fetchDeposits{docsify-ignore}

Fetch all fiat deposits made to an account. Won't return crypto deposits or staking rewards. Use fetchLedger for those.

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<object></code> - a list of transaction structures

See

ParamTypeRequiredDescription
code<code>string</code>Yesunified currency code
since<code>int</code>Nothe earliest time in ms to fetch deposits for
limit<code>int</code>Nothe maximum number of deposits structures to retrieve
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.currencyType<code>string</code>No"fiat" or "crypto"
javascript
coinbase.fetchDeposits (code, since?, limit?, params?)

<a name="fetchDepositsWithdrawals" id="fetchdepositswithdrawals"></a>

fetchDepositsWithdrawals{docsify-ignore}

fetch history of deposits and withdrawals

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a list of transaction structure

See: https://docs.cdp.coinbase.com/coinbase-app/track-apis/transactions

ParamTypeRequiredDescription
code<code>string</code>Nounified currency code for the currency of the deposit/withdrawals, default is undefined
since<code>int</code>Notimestamp in ms of the earliest deposit/withdrawal, default is undefined
limit<code>int</code>Nomax number of deposit/withdrawals to return, default = 50, Min: 1, Max: 100
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.fetchDepositsWithdrawals (code?, since?, limit?, params?)

<a name="fetchMarkets" id="fetchmarkets"></a>

fetchMarkets{docsify-ignore}

retrieves data on all markets for coinbase

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<object></code> - an array of objects representing market data

See

ParamTypeRequiredDescription
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.usePrivate<code>boolean</code>Nouse private endpoint for fetching markets
javascript
coinbase.fetchMarkets (params?)

<a name="fetchCurrencies" id="fetchcurrencies"></a>

fetchCurrencies{docsify-ignore}

fetches all available currencies on an exchange

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - an associative dictionary of currencies

See

ParamTypeRequiredDescription
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.fetchCurrencies (params?)

<a name="fetchTickers" id="fetchtickers"></a>

fetchTickers{docsify-ignore}

fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a dictionary of ticker structures

See

ParamTypeRequiredDescription
symbols<code>Array<string></code>, <code>undefined</code>Yesunified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.usePrivate<code>boolean</code>Nouse private endpoint for fetching tickers
javascript
coinbase.fetchTickers (symbols, params?)

<a name="fetchTicker" id="fetchticker"></a>

fetchTicker{docsify-ignore}

fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a ticker structure

See

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified symbol of the market to fetch the ticker for
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.usePrivate<code>boolean</code>Nowhether to use the private endpoint for fetching the ticker
javascript
coinbase.fetchTicker (symbol, params?)

<a name="fetchBalance" id="fetchbalance"></a>

fetchBalance{docsify-ignore}

query for balance and get the amount of funds available for trading or funds locked in orders

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a balance structure

See

ParamTypeRequiredDescription
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.v3<code>boolean</code>Nodefault false, set true to use v3 api endpoint
params.type<code>string</code>No"spot" (default) or "swap" or "future"
params.limit<code>int</code>Nodefault 250, maximum number of accounts to return
javascript
coinbase.fetchBalance (params?)

<a name="fetchLedger" id="fetchledger"></a>

fetchLedger{docsify-ignore}

Fetch the history of changes, i.e. actions done by the user or operations that altered the balance. Will return staking rewards, and crypto deposits or withdrawals.

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a ledger structure

See: https://docs.cdp.coinbase.com/coinbase-app/track-apis/transactions

ParamTypeRequiredDescription
code<code>string</code>Nounified currency code, default is undefined
since<code>int</code>Notimestamp in ms of the earliest ledger entry, default is undefined
limit<code>int</code>Nomax number of ledger entries to return, default is undefined
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.paginate<code>boolean</code>Nodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
javascript
coinbase.fetchLedger (code?, since?, limit?, params?)

<a name="createMarketBuyOrderWithCost" id="createmarketbuyorderwithcost"></a>

createMarketBuyOrderWithCost{docsify-ignore}

create a market buy order by providing the symbol and cost

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - an order structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/create-order

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified symbol of the market to create an order in
cost<code>float</code>Yeshow much you want to trade in units of the quote currency
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.createMarketBuyOrderWithCost (symbol, cost, params?)

<a name="createOrder" id="createorder"></a>

createOrder{docsify-ignore}

create a trade order

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - an order structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/create-order

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified symbol of the market to create an order in
type<code>string</code>Yes'market' or 'limit'
side<code>string</code>Yes'buy' or 'sell'
amount<code>float</code>Yeshow much you want to trade in units of the base currency, quote currency for 'market' 'buy' orders
price<code>float</code>Nothe price to fulfill the order, in units of the quote currency, ignored in market orders
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.stopPrice<code>float</code>Noprice to trigger stop orders
params.triggerPrice<code>float</code>Noprice to trigger stop orders
params.stopLossPrice<code>float</code>Noprice to trigger stop-loss orders
params.takeProfitPrice<code>float</code>Noprice to trigger take-profit orders
params.postOnly<code>bool</code>Notrue or false
params.timeInForce<code>string</code>No'GTC', 'IOC', 'GTD' or 'PO', 'FOK'
params.stop_direction<code>string</code>No'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
params.end_time<code>string</code>No'2023-05-25T17:01:05.092Z' for 'GTD' orders
params.cost<code>float</code>Nospot market buy only the quote quantity that can be used as an alternative for the amount
params.preview<code>boolean</code>Nodefault to false, wether to use the test/preview endpoint or not
params.leverage<code>float</code>Nodefault to 1, the leverage to use for the order
params.marginMode<code>string</code>No'cross' or 'isolated'
params.retail_portfolio_id<code>string</code>Noportfolio uid
params.is_max<code>boolean</code>NoUsed in conjunction with tradable_balance to indicate the user wants to use their entire tradable balance
params.tradable_balance<code>string</code>Noamount of tradable balance
params.reduceOnly<code>float</code>Noset to true for closing a position or use closePosition
javascript
coinbase.createOrder (symbol, type, side, amount, price?, params?)

<a name="cancelOrder" id="cancelorder"></a>

cancelOrder{docsify-ignore}

cancels an open order

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - An order structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/cancel-orders

ParamTypeRequiredDescription
id<code>string</code>Yesorder id
symbol<code>string</code>Yesnot used by cancelOrder()
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.cancelOrder (id, symbol, params?)

<a name="cancelOrders" id="cancelorders"></a>

cancelOrders{docsify-ignore}

cancel multiple orders

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a list of order structures

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/cancel-orders

ParamTypeRequiredDescription
ids<code>Array<string></code>Yesorder ids
symbol<code>string</code>Yesnot used by cancelOrders()
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.cancelOrders (ids, symbol, params?)

<a name="editOrder" id="editorder"></a>

editOrder{docsify-ignore}

edit a trade order

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - an order structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/edit-order

ParamTypeRequiredDescription
id<code>string</code>Yescancel order id
symbol<code>string</code>Yesunified symbol of the market to create an order in
type<code>string</code>Yes'market' or 'limit'
side<code>string</code>Yes'buy' or 'sell'
amount<code>float</code>Yeshow much of currency you want to trade in units of base currency
price<code>float</code>Nothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.preview<code>boolean</code>Nodefault to false, wether to use the test/preview endpoint or not
javascript
coinbase.editOrder (id, symbol, type, side, amount, price?, params?)

<a name="fetchOrder" id="fetchorder"></a>

fetchOrder{docsify-ignore}

fetches information on an order made by the user

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - An order structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/get-order

ParamTypeRequiredDescription
id<code>string</code>Yesthe order id
symbol<code>string</code>Yesunified market symbol that the order was made in
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.fetchOrder (id, symbol, params?)

<a name="fetchOrders" id="fetchorders"></a>

fetchOrders{docsify-ignore}

fetches information on multiple orders made by the user

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<Order></code> - a list of order structures

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/list-orders

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified market symbol that the orders were made in
since<code>int</code>Nothe earliest time in ms to fetch orders
limit<code>int</code>Nothe maximum number of order structures to retrieve
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.until<code>int</code>Nothe latest time in ms to fetch trades for
params.paginate<code>boolean</code>Nodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
javascript
coinbase.fetchOrders (symbol, since?, limit?, params?)

<a name="fetchOpenOrders" id="fetchopenorders"></a>

fetchOpenOrders{docsify-ignore}

fetches information on all currently open orders

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<Order></code> - a list of order structures

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/list-orders

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified market symbol of the orders
since<code>int</code>Notimestamp in ms of the earliest order, default is undefined
limit<code>int</code>Nothe maximum number of open order structures to retrieve
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.paginate<code>boolean</code>Nodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
params.until<code>int</code>Nothe latest time in ms to fetch trades for
javascript
coinbase.fetchOpenOrders (symbol, since?, limit?, params?)

<a name="fetchClosedOrders" id="fetchclosedorders"></a>

fetchClosedOrders{docsify-ignore}

fetches information on multiple closed orders made by the user

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<Order></code> - a list of order structures

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/list-orders

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified market symbol of the orders
since<code>int</code>Notimestamp in ms of the earliest order, default is undefined
limit<code>int</code>Nothe maximum number of closed order structures to retrieve
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.paginate<code>boolean</code>Nodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
params.until<code>int</code>Nothe latest time in ms to fetch trades for
javascript
coinbase.fetchClosedOrders (symbol, since?, limit?, params?)

<a name="fetchCanceledOrders" id="fetchcanceledorders"></a>

fetchCanceledOrders{docsify-ignore}

fetches information on multiple canceled orders made by the user

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a list of order structures

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/list-orders

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified market symbol of the orders
since<code>int</code>Notimestamp in ms of the earliest order, default is undefined
limit<code>int</code>Nothe maximum number of canceled order structures to retrieve
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.fetchCanceledOrders (symbol, since?, limit?, params?)

<a name="fetchOHLCV" id="fetchohlcv"></a>

fetchOHLCV{docsify-ignore}

fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<Array<int>></code> - A list of candles ordered as timestamp, open, high, low, close, volume

See

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified symbol of the market to fetch OHLCV data for
timeframe<code>string</code>Yesthe length of time each candle represents
since<code>int</code>Notimestamp in ms of the earliest candle to fetch
limit<code>int</code>Nothe maximum amount of candles to fetch, not used by coinbase
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.until<code>int</code>Nothe latest time in ms to fetch trades for
params.paginate<code>boolean</code>Nodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
params.usePrivate<code>boolean</code>Nodefault false, when true will use the private endpoint to fetch the candles
javascript
coinbase.fetchOHLCV (symbol, timeframe, since?, limit?, params?)

<a name="fetchTrades" id="fetchtrades"></a>

fetchTrades{docsify-ignore}

get the list of most recent trades for a particular symbol

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<Trade></code> - a list of trade structures

See

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified market symbol of the trades
since<code>int</code>Nonot used by coinbase fetchTrades
limit<code>int</code>Nothe maximum number of trade structures to fetch
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.usePrivate<code>boolean</code>Nodefault false, when true will use the private endpoint to fetch the trades
javascript
coinbase.fetchTrades (symbol, since?, limit?, params?)

<a name="fetchMyTrades" id="fetchmytrades"></a>

fetchMyTrades{docsify-ignore}

fetch all trades made by the user

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<Trade></code> - a list of trade structures

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/list-fills

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified market symbol of the trades
since<code>int</code>Notimestamp in ms of the earliest order, default is undefined
limit<code>int</code>Nothe maximum number of trade structures to fetch
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.until<code>int</code>Nothe latest time in ms to fetch trades for
params.paginate<code>boolean</code>Nodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
javascript
coinbase.fetchMyTrades (symbol, since?, limit?, params?)

<a name="fetchOrderBook" id="fetchorderbook"></a>

fetchOrderBook{docsify-ignore}

fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - an order book structure

See

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified symbol of the market to fetch the order book for
limit<code>int</code>Nothe maximum amount of order book entries to return
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.usePrivate<code>boolean</code>Nodefault false, when true will use the private endpoint to fetch the order book
javascript
coinbase.fetchOrderBook (symbol, limit?, params?)

<a name="fetchBidsAsks" id="fetchbidsasks"></a>

fetchBidsAsks{docsify-ignore}

fetches the bid and ask price and volume for multiple markets

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a dictionary of ticker structures

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/products/get-best-bid-ask

ParamTypeRequiredDescription
symbols<code>Array<string></code>Nounified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.fetchBidsAsks (symbols?, params?)

<a name="withdraw" id="withdraw"></a>

withdraw{docsify-ignore}

make a withdrawal

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a transaction structure

See: https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/send-crypto

ParamTypeRequiredDescription
code<code>string</code>Yesunified currency code
amount<code>float</code>Yesthe amount to withdraw
address<code>string</code>Yesthe address to withdraw to
tag<code>string</code>Noan optional tag for the withdrawal
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.network<code>string</code>Nothe cryptocurrency network to use for the withdrawal using the lowercase name like bitcoin, ethereum, solana, etc.
params.travel_rule_data<code>object</code>Nosome regions require travel rule information for crypto withdrawals, see the exchange docs for details https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/travel-rule
javascript
coinbase.withdraw (code, amount, address, tag?, params?)

<a name="fetchDepositAddress" id="fetchdepositaddress"></a>

fetchDepositAddress{docsify-ignore}

fetch the deposit address for a currency associated with this account

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - an address structure

See: https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/onchain-addresses

ParamTypeRequiredDescription
code<code>string</code>Yesunified currency code
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.fetchDepositAddress (code, params?)

<a name="deposit" id="deposit"></a>

deposit{docsify-ignore}

make a deposit

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a transaction structure

See: https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/deposit-fiat

ParamTypeRequiredDescription
code<code>string</code>Yesunified currency code
amount<code>float</code>Yesthe amount to deposit
id<code>string</code>Yesthe payment method id to be used for the deposit, can be retrieved from v2PrivateGetPaymentMethods
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.accountId<code>string</code>Nothe id of the account to deposit into
javascript
coinbase.deposit (code, amount, id, params?)

<a name="fetchDeposit" id="fetchdeposit"></a>

fetchDeposit{docsify-ignore}

fetch information on a deposit, fiat only, for crypto transactions use fetchLedger

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a transaction structure

See: https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/deposit-fiat

ParamTypeRequiredDescription
id<code>string</code>Yesdeposit id
code<code>string</code>Nounified currency code
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.accountId<code>string</code>Nothe id of the account that the funds were deposited into
javascript
coinbase.fetchDeposit (id, code?, params?)

<a name="fetchDepositMethodIds" id="fetchdepositmethodids"></a>

fetchDepositMethodIds{docsify-ignore}

fetch the deposit id for a fiat currency associated with this account

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - an array of deposit id structures

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/payment-methods/list-payment-methods

ParamTypeRequiredDescription
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.fetchDepositMethodIds (params?)

<a name="fetchDepositMethodId" id="fetchdepositmethodid"></a>

fetchDepositMethodId{docsify-ignore}

fetch the deposit id for a fiat currency associated with this account

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a deposit id structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/payment-methods/get-payment-method

ParamTypeRequiredDescription
id<code>string</code>Yesthe deposit payment method id
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.fetchDepositMethodId (id, params?)

<a name="fetchConvertQuote" id="fetchconvertquote"></a>

fetchConvertQuote{docsify-ignore}

fetch a quote for converting from one currency to another

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a conversion structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/convert/create-convert-quote

ParamTypeRequiredDescription
fromCode<code>string</code>Yesthe currency that you want to sell and convert from
toCode<code>string</code>Yesthe currency that you want to buy and convert into
amount<code>float</code>Nohow much you want to trade in units of the from currency
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.trade_incentive_metadata<code>object</code>Noan object to fill in user incentive data
params.trade_incentive_metadata.user_incentive_id<code>string</code>Nothe id of the incentive
params.trade_incentive_metadata.code_val<code>string</code>Nothe code value of the incentive
javascript
coinbase.fetchConvertQuote (fromCode, toCode, amount?, params?)

<a name="createConvertTrade" id="createconverttrade"></a>

createConvertTrade{docsify-ignore}

convert from one currency to another

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a conversion structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/convert/commit-convert-trade

ParamTypeRequiredDescription
id<code>string</code>Yesthe id of the trade that you want to make
fromCode<code>string</code>Yesthe currency that you want to sell and convert from
toCode<code>string</code>Yesthe currency that you want to buy and convert into
amount<code>float</code>Nohow much you want to trade in units of the from currency
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.createConvertTrade (id, fromCode, toCode, amount?, params?)

<a name="fetchConvertTrade" id="fetchconverttrade"></a>

fetchConvertTrade{docsify-ignore}

fetch the data for a conversion trade

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a conversion structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/convert/get-convert-trade

ParamTypeRequiredDescription
id<code>string</code>Yesthe id of the trade that you want to commit
code<code>string</code>Yesthe unified currency code that was converted from
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.toCode<code>strng</code>Yesthe unified currency code that was converted into
javascript
coinbase.fetchConvertTrade (id, code, params?)

<a name="transfer" id="transfer"></a>

transfer{docsify-ignore}

transfer currency internally between portfolios of the same account

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a transfer structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/portfolios/move-portfolios-funds

ParamTypeRequiredDescription
code<code>string</code>Yesunified currency code
amount<code>float</code>Yesamount to transfer
fromAccount<code>string</code>Yesthe portfolio uuid to transfer funds from
toAccount<code>string</code>Yesthe portfolio uuid to transfer funds to
params<code>object</code>Noextra parameters specific to the exchange API endpoint
javascript
coinbase.transfer (code, amount, fromAccount, toAccount, params?)

<a name="closePosition" id="closeposition"></a>

closePosition{docsify-ignore}

futures only closes open positions for a market

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - an order structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/close-position

ParamTypeRequiredDescription
symbol<code>string</code>YesUnified CCXT market symbol
side<code>string</code>Nonot used by coinbase
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.clientOrderId<code>string</code>Yesmandatory the client order id of the position to close
params.size<code>float</code>Nothe size of the position to close, optional
javascript
coinbase.closePosition (symbol, side?, params?)

<a name="fetchPositions" id="fetchpositions"></a>

fetchPositions{docsify-ignore}

fetch all open positions

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<object></code> - a list of position structure

See

ParamTypeRequiredDescription
symbols<code>Array<string></code>Nolist of unified market symbols
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.portfolio<code>string</code>Nothe portfolio UUID to fetch positions for
javascript
coinbase.fetchPositions (symbols?, params?)

<a name="fetchPosition" id="fetchposition"></a>

fetchPosition{docsify-ignore}

fetch data on a single open contract trade position

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a position structure

See

ParamTypeRequiredDescription
symbol<code>string</code>Yesunified market symbol of the market the position is held in, default is undefined
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.product_id<code>string</code>Nofutures only the product id of the position to fetch, required for futures markets only
params.portfolio<code>string</code>Noperpetual/swaps only the portfolio UUID to fetch the position for, required for perpetual/swaps markets only
javascript
coinbase.fetchPosition (symbol, params?)

<a name="fetchTradingFees" id="fetchtradingfees"></a>

fetchTradingFees{docsify-ignore}

fetch the trading fees for multiple markets

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a dictionary of fee structures indexed by market symbols

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/fees/get-transaction-summary

ParamTypeRequiredDescription
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.type<code>string</code>No'spot' or 'swap'
javascript
coinbase.fetchTradingFees (params?)

<a name="fetchPortfolioDetails" id="fetchportfoliodetails"></a>

fetchPortfolioDetails{docsify-ignore}

Fetch details for a specific portfolio by UUID

Kind: instance method of <code>coinbase</code>
Returns: <code>Array<any></code> - An account structure https://docs.ccxt.com/?id=account-structure

See: https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/portfolios/get-portfolio-breakdown

ParamTypeRequiredDescription
portfolioUuid<code>string</code>YesThe unique identifier of the portfolio to fetch
params<code>Dict</code>NoExtra parameters specific to the exchange API endpoint
javascript
coinbase.fetchPortfolioDetails (portfolioUuid, params?)

<a name="fetchDepositAddresses" id="fetchdepositaddresses"></a>

fetchDepositAddresses{docsify-ignore}

fetch deposit addresses for multiple currencies (when available)

Kind: instance method of <code>coinbase</code>
Returns: <code>object</code> - a dictionary of address structures indexed by currency code

See: https://docs.cdp.coinbase.com/coinbase-app/transfer-apis/onchain-addresses

ParamTypeRequiredDescription
codes<code>Array<string></code>Nolist of unified currency codes, default is undefined (all currencies)
params<code>object</code>Noextra parameters specific to the exchange API endpoint
params.accountId<code>string</code>Noaccount ID to fetch deposit addresses for
javascript
coinbase.fetchDepositAddresses (codes?, params?)