Files
ritmex-bot/docs/ccxt/wiki/exchanges/coinbase.md
T
2025-10-03 15:28:16 +08:00

43 KiB

coinbase{docsify-ignore}

Kind: global class
Extends: Exchange

fetchTime{docsify-ignore}

fetches the current integer timestamp in milliseconds from the exchange server

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

See: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-time#http-request

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
params.method string No 'v2PublicGetTime' or 'v3PublicGetBrokerageTime' default is 'v2PublicGetTime'
coinbase.fetchTime ([params])

fetchAccounts{docsify-ignore}

fetch all the accounts associated with a profile

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

See

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
coinbase.fetchAccounts ([params])

fetchPortfolios{docsify-ignore}

fetch all the portfolios

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

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getportfolios

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
coinbase.fetchPortfolios ([params])

createDepositAddress{docsify-ignore}

create a currency deposit address

Kind: instance method of coinbase
Returns: object - an address structure

See: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-addresses#create-address

Param Type Required Description
code string Yes unified currency code of the currency for the deposit address
params object No extra parameters specific to the exchange API endpoint
coinbase.createDepositAddress (code[, params])

fetchWithdrawals{docsify-ignore}

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

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

See: https://docs.cdp.coinbase.com/coinbase-app/docs/api-withdrawals#list-withdrawals

Param Type Required Description
code string Yes unified currency code
since int No the earliest time in ms to fetch withdrawals for
limit int No the maximum number of withdrawals structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.currencyType string No "fiat" or "crypto"
coinbase.fetchWithdrawals (code[, since, limit, params])

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 coinbase
Returns: Array<object> - a list of transaction structures

See: https://docs.cdp.coinbase.com/coinbase-app/docs/api-deposits#list-deposits

Param Type Required Description
code string Yes unified currency code
since int No the earliest time in ms to fetch deposits for
limit int No the maximum number of deposits structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.currencyType string No "fiat" or "crypto"
coinbase.fetchDeposits (code[, since, limit, params])

fetchDepositsWithdrawals{docsify-ignore}

fetch history of deposits and withdrawals

Kind: instance method of coinbase
Returns: object - a list of transaction structure

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

Param Type Required Description
code string No unified currency code for the currency of the deposit/withdrawals, default is undefined
since int No timestamp in ms of the earliest deposit/withdrawal, default is undefined
limit int No max number of deposit/withdrawals to return, default = 50, Min: 1, Max: 100
params object No extra parameters specific to the exchange API endpoint
coinbase.fetchDepositsWithdrawals ([code, since, limit, params])

fetchMarkets{docsify-ignore}

retrieves data on all markets for coinbase

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

See

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
params.usePrivate boolean No use private endpoint for fetching markets
coinbase.fetchMarkets ([params])

fetchCurrencies{docsify-ignore}

fetches all available currencies on an exchange

Kind: instance method of coinbase
Returns: object - an associative dictionary of currencies

See

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
coinbase.fetchCurrencies ([params])

fetchTickers{docsify-ignore}

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

Kind: instance method of coinbase
Returns: object - a dictionary of ticker structures

See

Param Type Required Description
symbols Array<string>, undefined Yes unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
params object No extra parameters specific to the exchange API endpoint
params.usePrivate boolean No use private endpoint for fetching tickers
coinbase.fetchTickers (symbols[, params])

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 coinbase
Returns: object - a ticker structure

See

Param Type Required Description
symbol string Yes unified symbol of the market to fetch the ticker for
params object No extra parameters specific to the exchange API endpoint
params.usePrivate boolean No whether to use the private endpoint for fetching the ticker
coinbase.fetchTicker (symbol[, params])

fetchBalance{docsify-ignore}

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

Kind: instance method of coinbase
Returns: object - a balance structure

See

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
params.v3 boolean No default false, set true to use v3 api endpoint
params.type string No "spot" (default) or "swap" or "future"
params.limit int No default 250, maximum number of accounts to return
coinbase.fetchBalance ([params])

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 coinbase
Returns: object - a ledger structure

See: https://docs.cdp.coinbase.com/coinbase-app/docs/api-transactions#list-transactions

Param Type Required Description
code string No unified currency code, default is undefined
since int No timestamp in ms of the earliest ledger entry, default is undefined
limit int No max number of ledger entries to return, default is undefined
params object No extra parameters specific to the exchange API endpoint
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
coinbase.fetchLedger ([code, since, limit, params])

createMarketBuyOrderWithCost{docsify-ignore}

create a market buy order by providing the symbol and cost

Kind: instance method of coinbase
Returns: object - an order structure

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_postorder

Param Type Required Description
symbol string Yes unified symbol of the market to create an order in
cost float Yes how much you want to trade in units of the quote currency
params object No extra parameters specific to the exchange API endpoint
coinbase.createMarketBuyOrderWithCost (symbol, cost[, params])

createOrder{docsify-ignore}

create a trade order

Kind: instance method of coinbase
Returns: object - an order structure

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_postorder

Param Type Required Description
symbol string Yes unified symbol of the market to create an order in
type string Yes 'market' or 'limit'
side string Yes 'buy' or 'sell'
amount float Yes how much you want to trade in units of the base currency, quote currency for 'market' 'buy' orders
price float No the price to fulfill the order, in units of the quote currency, ignored in market orders
params object No extra parameters specific to the exchange API endpoint
params.stopPrice float No price to trigger stop orders
params.triggerPrice float No price to trigger stop orders
params.stopLossPrice float No price to trigger stop-loss orders
params.takeProfitPrice float No price to trigger take-profit orders
params.postOnly bool No true or false
params.timeInForce string No 'GTC', 'IOC', 'GTD' or 'PO', 'FOK'
params.stop_direction string No 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
params.end_time string No '2023-05-25T17:01:05.092Z' for 'GTD' orders
params.cost float No spot market buy only the quote quantity that can be used as an alternative for the amount
params.preview boolean No default to false, wether to use the test/preview endpoint or not
params.leverage float No default to 1, the leverage to use for the order
params.marginMode string No 'cross' or 'isolated'
params.retail_portfolio_id string No portfolio uid
params.is_max boolean No Used in conjunction with tradable_balance to indicate the user wants to use their entire tradable balance
params.tradable_balance string No amount of tradable balance
coinbase.createOrder (symbol, type, side, amount[, price, params])

cancelOrder{docsify-ignore}

cancels an open order

Kind: instance method of coinbase
Returns: object - An order structure

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_cancelorders

Param Type Required Description
id string Yes order id
symbol string Yes not used by coinbase cancelOrder()
params object No extra parameters specific to the exchange API endpoint
coinbase.cancelOrder (id, symbol[, params])

cancelOrders{docsify-ignore}

cancel multiple orders

Kind: instance method of coinbase
Returns: object - a list of order structures

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_cancelorders

Param Type Required Description
ids Array<string> Yes order ids
symbol string Yes not used by coinbase cancelOrders()
params object No extra parameters specific to the exchange API endpoint
coinbase.cancelOrders (ids, symbol[, params])

editOrder{docsify-ignore}

edit a trade order

Kind: instance method of coinbase
Returns: object - an order structure

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_editorder

Param Type Required Description
id string Yes cancel order id
symbol string Yes unified symbol of the market to create an order in
type string Yes 'market' or 'limit'
side string Yes 'buy' or 'sell'
amount float Yes how much of currency you want to trade in units of base currency
price float No the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
params object No extra parameters specific to the exchange API endpoint
params.preview boolean No default to false, wether to use the test/preview endpoint or not
coinbase.editOrder (id, symbol, type, side, amount[, price, params])

fetchOrder{docsify-ignore}

fetches information on an order made by the user

Kind: instance method of coinbase
Returns: object - An order structure

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_gethistoricalorder

Param Type Required Description
id string Yes the order id
symbol string Yes unified market symbol that the order was made in
params object No extra parameters specific to the exchange API endpoint
coinbase.fetchOrder (id, symbol[, params])

fetchOrders{docsify-ignore}

fetches information on multiple orders made by the user

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

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_gethistoricalorders

Param Type Required Description
symbol string Yes unified market symbol that the orders were made in
since int No the earliest time in ms to fetch orders
limit int No the maximum number of order structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.until int No the latest time in ms to fetch trades for
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
coinbase.fetchOrders (symbol[, since, limit, params])

fetchOpenOrders{docsify-ignore}

fetches information on all currently open orders

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

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_gethistoricalorders

Param Type Required Description
symbol string Yes unified market symbol of the orders
since int No timestamp in ms of the earliest order, default is undefined
limit int No the maximum number of open order structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
params.until int No the latest time in ms to fetch trades for
coinbase.fetchOpenOrders (symbol[, since, limit, params])

fetchClosedOrders{docsify-ignore}

fetches information on multiple closed orders made by the user

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

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_gethistoricalorders

Param Type Required Description
symbol string Yes unified market symbol of the orders
since int No timestamp in ms of the earliest order, default is undefined
limit int No the maximum number of closed order structures to retrieve
params object No extra parameters specific to the exchange API endpoint
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
params.until int No the latest time in ms to fetch trades for
coinbase.fetchClosedOrders (symbol[, since, limit, params])

fetchCanceledOrders{docsify-ignore}

fetches information on multiple canceled orders made by the user

Kind: instance method of coinbase
Returns: object - a list of order structures

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_gethistoricalorders

Param Type Required Description
symbol string Yes unified market symbol of the orders
since int No timestamp in ms of the earliest order, default is undefined
limit int No the maximum number of canceled order structures to retrieve
params object No extra parameters specific to the exchange API endpoint
coinbase.fetchCanceledOrders (symbol[, since, limit, params])

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 coinbase
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpubliccandles

Param Type Required Description
symbol string Yes unified symbol of the market to fetch OHLCV data for
timeframe string Yes the length of time each candle represents
since int No timestamp in ms of the earliest candle to fetch
limit int No the maximum amount of candles to fetch, not used by coinbase
params object No extra parameters specific to the exchange API endpoint
params.until int No the latest time in ms to fetch trades for
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
params.usePrivate boolean No default false, when true will use the private endpoint to fetch the candles
coinbase.fetchOHLCV (symbol, timeframe[, since, limit, params])

fetchTrades{docsify-ignore}

get the list of most recent trades for a particular symbol

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

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpublicmarkettrades

Param Type Required Description
symbol string Yes unified market symbol of the trades
since int No not used by coinbase fetchTrades
limit int No the maximum number of trade structures to fetch
params object No extra parameters specific to the exchange API endpoint
params.usePrivate boolean No default false, when true will use the private endpoint to fetch the trades
coinbase.fetchTrades (symbol[, since, limit, params])

fetchMyTrades{docsify-ignore}

fetch all trades made by the user

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

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getfills

Param Type Required Description
symbol string Yes unified market symbol of the trades
since int No timestamp in ms of the earliest order, default is undefined
limit int No the maximum number of trade structures to fetch
params object No extra parameters specific to the exchange API endpoint
params.until int No the latest time in ms to fetch trades for
params.paginate boolean No default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
coinbase.fetchMyTrades (symbol[, since, limit, params])

fetchOrderBook{docsify-ignore}

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

Kind: instance method of coinbase
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpublicproductbook

Param Type Required Description
symbol string Yes unified symbol of the market to fetch the order book for
limit int No the maximum amount of order book entries to return
params object No extra parameters specific to the exchange API endpoint
params.usePrivate boolean No default false, when true will use the private endpoint to fetch the order book
coinbase.fetchOrderBook (symbol[, limit, params])

fetchBidsAsks{docsify-ignore}

fetches the bid and ask price and volume for multiple markets

Kind: instance method of coinbase
Returns: object - a dictionary of ticker structures

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getbestbidask

Param Type Required Description
symbols Array<string> No unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
params object No extra parameters specific to the exchange API endpoint
coinbase.fetchBidsAsks ([symbols, params])

withdraw{docsify-ignore}

make a withdrawal

Kind: instance method of coinbase
Returns: object - a transaction structure

See: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#send-money

Param Type Required Description
code string Yes unified currency code
amount float Yes the amount to withdraw
address string Yes the address to withdraw to
tag string No an optional tag for the withdrawal
params object No extra parameters specific to the exchange API endpoint
coinbase.withdraw (code, amount, address[, tag, params])

fetchDepositAddress{docsify-ignore}

fetch the deposit address for a currency associated with this account

Kind: instance method of coinbase
Returns: object - an address structure

See: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses

Param Type Required Description
code string Yes unified currency code
params object No extra parameters specific to the exchange API endpoint
coinbase.fetchDepositAddress (code[, params])

deposit{docsify-ignore}

make a deposit

Kind: instance method of coinbase
Returns: object - a transaction structure

See: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#deposit-funds

Param Type Required Description
code string Yes unified currency code
amount float Yes the amount to deposit
id string Yes the payment method id to be used for the deposit, can be retrieved from v2PrivateGetPaymentMethods
params object No extra parameters specific to the exchange API endpoint
params.accountId string No the id of the account to deposit into
coinbase.deposit (code, amount, id[, params])

fetchDeposit{docsify-ignore}

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

Kind: instance method of coinbase
Returns: object - a transaction structure

See: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#show-deposit

Param Type Required Description
id string Yes deposit id
code string No unified currency code
params object No extra parameters specific to the exchange API endpoint
params.accountId string No the id of the account that the funds were deposited into
coinbase.fetchDeposit (id[, code, params])

fetchDepositMethodIds{docsify-ignore}

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

Kind: instance method of coinbase
Returns: object - an array of deposit id structures

See: https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpaymentmethods

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
coinbase.fetchDepositMethodIds ([params])

fetchDepositMethodId{docsify-ignore}

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

Kind: instance method of coinbase
Returns: object - a deposit id structure

See: https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpaymentmethod

Param Type Required Description
id string Yes the deposit payment method id
params object No extra parameters specific to the exchange API endpoint
coinbase.fetchDepositMethodId (id[, params])

fetchConvertQuote{docsify-ignore}

fetch a quote for converting from one currency to another

Kind: instance method of coinbase
Returns: object - a conversion structure

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_createconvertquote

Param Type Required Description
fromCode string Yes the currency that you want to sell and convert from
toCode string Yes the currency that you want to buy and convert into
amount float No how much you want to trade in units of the from currency
params object No extra parameters specific to the exchange API endpoint
params.trade_incentive_metadata object No an object to fill in user incentive data
params.trade_incentive_metadata.user_incentive_id string No the id of the incentive
params.trade_incentive_metadata.code_val string No the code value of the incentive
coinbase.fetchConvertQuote (fromCode, toCode[, amount, params])

createConvertTrade{docsify-ignore}

convert from one currency to another

Kind: instance method of coinbase
Returns: object - a conversion structure

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_commitconverttrade

Param Type Required Description
id string Yes the id of the trade that you want to make
fromCode string Yes the currency that you want to sell and convert from
toCode string Yes the currency that you want to buy and convert into
amount float No how much you want to trade in units of the from currency
params object No extra parameters specific to the exchange API endpoint
coinbase.createConvertTrade (id, fromCode, toCode[, amount, params])

fetchConvertTrade{docsify-ignore}

fetch the data for a conversion trade

Kind: instance method of coinbase
Returns: object - a conversion structure

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getconverttrade

Param Type Required Description
id string Yes the id of the trade that you want to commit
code string Yes the unified currency code that was converted from
params object No extra parameters specific to the exchange API endpoint
params.toCode strng Yes the unified currency code that was converted into
coinbase.fetchConvertTrade (id, code[, params])

closePosition{docsify-ignore}

futures only closes open positions for a market

Kind: instance method of coinbase
Returns: object - an order structure

See: https://docs.cdp.coinbase.com/coinbase-app/trade/reference/retailbrokerageapi_closeposition

Param Type Required Description
symbol string Yes Unified CCXT market symbol
side string No not used by coinbase
params object No extra parameters specific to the coinbase api endpoint
params.clientOrderId string Yes mandatory the client order id of the position to close
params.size float No the size of the position to close, optional
coinbase.closePosition (symbol[, side, params])

fetchPositions{docsify-ignore}

fetch all open positions

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

See

Param Type Required Description
symbols Array<string> No list of unified market symbols
params object No extra parameters specific to the exchange API endpoint
params.portfolio string No the portfolio UUID to fetch positions for
coinbase.fetchPositions ([symbols, params])

fetchPosition{docsify-ignore}

fetch data on a single open contract trade position

Kind: instance method of coinbase
Returns: object - a position structure

See

Param Type Required Description
symbol string Yes unified market symbol of the market the position is held in, default is undefined
params object No extra parameters specific to the exchange API endpoint
params.product_id string No futures only the product id of the position to fetch, required for futures markets only
params.portfolio string No perpetual/swaps only the portfolio UUID to fetch the position for, required for perpetual/swaps markets only
coinbase.fetchPosition (symbol[, params])

fetchTradingFees{docsify-ignore}

fetch the trading fees for multiple markets

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

See: https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_gettransactionsummary/

Param Type Required Description
params object No extra parameters specific to the exchange API endpoint
params.type string No 'spot' or 'swap'
coinbase.fetchTradingFees ([params])

fetchPortfolioDetails{docsify-ignore}

Fetch details for a specific portfolio by UUID

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

See: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getportfolios

Param Type Required Description
portfolioUuid string Yes The unique identifier of the portfolio to fetch
params Dict No Extra parameters specific to the exchange API endpoint
coinbase.fetchPortfolioDetails (portfolioUuid[, params])