CCXT

gate

gate cryptocurrency exchange — CCXT unified API: methods, parameters and endpoints.

gate

Kind: global class
Extends: Exchange

loadUnifiedStatus

returns unifiedAccount so the user can check if the unified account is enabled

Kind: instance method of gate
Returns: boolean - true or false if the enabled unified account is enabled or not and sets the unifiedAccount option if it is undefined

See: https://www.gate.com/docs/developers/apiv4/#retrieve-user-account-information

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.loadUnifiedStatus (params?)

fetchTime

fetches the current integer timestamp in milliseconds from the exchange server

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

See: https://www.gate.com/docs/developers/apiv4/#get-server-current-time

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchTime (params?)

fetchMarkets

retrieves data on all markets for gate

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

See

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchMarkets (params?)

fetchCurrencies

fetches all available currencies on an exchange

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

See: https://www.gate.com/docs/developers/apiv4/en/#query-all-currency-information

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchCurrencies (params?)

fetchFundingRate

fetch the current funding rate

Kind: instance method of gate
Returns: object - a funding rate structure

See: https://www.gate.com/docs/developers/apiv4/en/#query-single-contract-information

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchFundingRate (symbol, params?)

fetchFundingRates

fetch the funding rate for multiple markets

Kind: instance method of gate
Returns: Array<object> - a list of funding rate structures, indexed by market symbols

See: https://www.gate.com/docs/developers/apiv4/en/#query-all-futures-contracts

ParamTypeRequiredDescription
symbolsArray<string>, undefinedYeslist of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchFundingRates (symbols, params?)

fetchDepositAddressesByNetwork

fetch a dictionary of addresses for a currency, indexed by network

Kind: instance method of gate
Returns: object - a dictionary of address structures indexed by the network

See: https://www.gate.com/docs/developers/apiv4/en/#generate-currency-deposit-address

ParamTypeRequiredDescription
codestringYesunified currency code of the currency for the deposit address
paramsobjectNoextra parameters specific to the api endpoint
gate.fetchDepositAddressesByNetwork (code, params?)

fetchDepositAddress

fetch the deposit address for a currency associated with this account

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

See: https://www.gate.com/docs/developers/apiv4/en/#generate-currency-deposit-address

ParamTypeRequiredDescription
codestringYesunified currency code
paramsobjectNoextra parameters specific to the exchange API endpoint
params.networkstringNounified network code (not used directly by gate.com but used by ccxt to filter the response)
gate.fetchDepositAddress (code, params?)

fetchTradingFee

fetch the trading fees for a market

Kind: instance method of gate
Returns: object - a fee structure

See: https://www.gate.com/docs/developers/apiv4/en/#query-personal-trading-fees

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchTradingFee (symbol, params?)

fetchTradingFees

fetch the trading fees for multiple markets

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

See: https://www.gate.com/docs/developers/apiv4/en/#query-personal-trading-fees

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchTradingFees (params?)

fetchTransactionFees

DEPRECATED

please use fetchDepositWithdrawFees instead

Kind: instance method of gate
Returns: object - a list of fee structures

See: https://www.gate.com/docs/developers/apiv4/en/#query-withdrawal-status

ParamTypeRequiredDescription
codesArray<string>, undefinedYeslist of unified currency codes
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchTransactionFees (codes, params?)

fetchDepositWithdrawFees

fetch deposit and withdraw fees

Kind: instance method of gate
Returns: object - a list of fee structures

See: https://www.gate.com/docs/developers/apiv4/en/#query-withdrawal-status

ParamTypeRequiredDescription
codesArray<string>, undefinedYeslist of unified currency codes
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchDepositWithdrawFees (codes, params?)

fetchFundingHistory

fetch the history of funding payments paid and received on this account

Kind: instance method of gate
Returns: object - a funding history structure

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch funding history for
limitintNothe maximum number of funding history structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchFundingHistory (symbol, since?, limit?, params?)

fetchOrderBook

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

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

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the order book for
limitintNothe maximum amount of order book entries to return
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchOrderBook (symbol, limit?, params?)

fetchTicker

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

Kind: instance method of gate
Returns: object - a ticker structure

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchTicker (symbol, params?)

fetchTickers

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

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

See

ParamTypeRequiredDescription
symbolsArray<string>, undefinedYesunified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchTickers (symbols, params?)

fetchBalance

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

See

ParamTypeRequiredDescription
paramsobjectNoexchange specific parameters
params.typestringNospot, margin, swap or future, if not provided this.options['defaultType'] is used
params.settlestringNo'btc' or 'usdt' - settle currency for perpetual swap and future - default="usdt" for swap and "btc" for future
params.marginModestringNo'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
params.symbolstringNomargin only - unified ccxt symbol
params.unifiedAccountbooleanNodefault false, set to true for fetching the unified account balance
gate.fetchBalance (params?)

fetchFundingRateHistory

fetches historical funding rate prices

Kind: instance method of gate
Returns: Array<object> - a list of funding rate structures

See: https://www.gate.com/docs/developers/apiv4/en/#get-all-futures-trading-statistics

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the funding rate history for
sinceintNotimestamp in ms of the earliest funding rate to fetch
limitintNothe maximum amount of funding rate structures to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNotimestamp in ms of the latest funding rate to fetch
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
gate.fetchFundingRateHistory (symbol, since?, limit?, params?)

fetchTrades

get the list of most recent trades for a particular symbol

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

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch trades for
sinceintNotimestamp in ms of the earliest trade to fetch
limitintNothe maximum amount of trades to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNotimestamp in ms of the latest trade to fetch
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
gate.fetchTrades (symbol, since?, limit?, params?)

fetchOrderTrades

fetch all the trades made from a single order

Kind: instance method of gate
Returns: Array<object> - a list of trade structures

See

ParamTypeRequiredDescription
idstringYesorder id
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch trades for
limitintNothe maximum number of trades to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchOrderTrades (id, symbol, since?, limit?, params?)

fetchMyTrades

Fetch personal trading history

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

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch trades for
limitintNothe maximum number of trades structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.marginModestringNo'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
params.typestringNo'spot', 'swap', or 'future', if not provided this.options['defaultMarginMode'] is used
params.untilintNoThe latest timestamp, in ms, that fetched trades were made
params.pageintNospot only Page number
params.order_idstringNospot only Filter trades with specified order ID. symbol is also required if this field is present
params.orderstringNocontract only Futures order ID, return related data only if specified
params.offsetintNocontract only list offset, starting from 0
params.last_idstringNocontract only specify list staring point using the id of last record in previous list-query results
params.count_totalintNocontract only whether to return total number matched, default to 0(no return)
params.unifiedAccountboolNoset to true for fetching trades in a unified account
params.paginateboolNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
gate.fetchMyTrades (symbol, since?, limit?, params?)

fetchDeposits

fetch all deposits made to an account

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

See: https://www.gate.com/docs/developers/apiv4/en/#get-deposit-records

ParamTypeRequiredDescription
codestringYesunified currency code
sinceintNothe earliest time in ms to fetch deposits for
limitintNothe maximum number of deposits structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNoend time in ms
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
gate.fetchDeposits (code, since?, limit?, params?)

fetchWithdrawals

fetch all withdrawals made from an account

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

See: https://www.gate.com/docs/developers/apiv4/en/#get-withdrawal-records

ParamTypeRequiredDescription
codestringYesunified currency code
sinceintNothe earliest time in ms to fetch withdrawals for
limitintNothe maximum number of withdrawals structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNoend time in ms
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
gate.fetchWithdrawals (code, since?, limit?, params?)

withdraw

make a withdrawal

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

See: https://www.gate.com/docs/developers/apiv4/en/#withdraw

ParamTypeRequiredDescription
codestringYesunified currency code
amountfloatYesthe amount to withdraw
addressstringYesthe address to withdraw to
tagstringYes
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.withdraw (code, amount, address, tag, params?)

createOrder

Create an order on the exchange

Kind: instance method of gate
Returns: object | undefined - An order structure

See

ParamTypeRequiredDescription
symbolstringYesUnified CCXT market symbol
typestringYes'limit' or 'market' "market" is contract only
sidestringYes'buy' or 'sell'
amountfloatYesthe amount of currency to trade
pricefloatNothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerPricefloatNoThe price at which a trigger order is triggered at
params.timeInForcestringNo"GTC", "IOC", or "PO"
params.stopLossPricefloatNoThe price at which a stop loss order is triggered at
params.takeProfitPricefloatNoThe price at which a take profit order is triggered at
params.marginModestringNo'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
params.icebergintNoAmount to display for the iceberg order, Null or 0 for normal orders, Set to -1 to hide the order completely
params.textstringNoUser defined information
params.accountstringNospot and margin only "spot", "margin" or "cross_margin"
params.auto_borrowboolNomargin only Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough
params.settlestringNocontract only Unified Currency Code for settle currency
params.reduceOnlyboolNocontract only Indicates if this order is to reduce the size of a position
params.closeboolNocontract only Set as true to close the position, with size set to 0
params.auto_sizeboolNocontract only Set side to close dual-mode position, close_long closes the long side, while close_short the short one, size also needs to be set to 0
params.price_typeintNocontract only 0 latest deal price, 1 mark price, 2 index price
params.costfloatNospot market buy only the quote quantity that can be used as an alternative for the amount
params.unifiedAccountboolNoset to true for creating an order in the unified account
params.clientOrderIdstringNothe clientOrderId of the order
gate.createOrder (symbol, type, side, amount, price?, params?)

createOrders

create a list of trade orders

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

See

ParamTypeRequiredDescription
ordersArrayYeslist of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.createOrders (orders, params?)

createMarketBuyOrderWithCost

create a market buy order by providing the symbol and cost

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

See: https://www.gate.com/docs/developers/apiv4/en/#create-an-order

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to create an order in
costfloatYeshow much you want to trade in units of the quote currency
paramsobjectNoextra parameters specific to the exchange API endpoint
params.unifiedAccountboolNoset to true for creating a unified account order
gate.createMarketBuyOrderWithCost (symbol, cost, params?)

editOrder

edit a trade order, gate currently only supports the modification of the price or amount fields

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

See

ParamTypeRequiredDescription
idstringYesorder id
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of the currency you want to trade in units of the base currency
pricefloatNothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.unifiedAccountboolNoset to true for editing an order in a unified account
gate.editOrder (id, symbol, type, side, amount, price?, params?)

fetchOrder

Retrieves information on an order

Kind: instance method of gate
Returns: An order structure

See

ParamTypeRequiredDescription
idstringYesOrder id
symbolstringYesUnified market symbol, required for spot and margin
paramsobjectNoParameters specified by the exchange api
params.triggerboolNoTrue if the order being fetched is a trigger order
params.marginModestringNo'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
params.typestringNo'spot', 'swap', or 'future', if not provided this.options['defaultMarginMode'] is used
params.settlestringNo'btc' or 'usdt' - settle currency for perpetual swap and future - market settle currency is used if symbol !== undefined, default="usdt" for swap and "btc" for future
params.unifiedAccountboolNoset to true for fetching a unified account order
gate.fetchOrder (id, symbol, params?)

fetchOpenOrders

fetch all unfilled currently open orders

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

See: https://www.gate.com/docs/developers/apiv4/en/#list-all-open-orders

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch open orders for
limitintNothe maximum number of open orders structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerboolNotrue for fetching trigger orders
params.typestringNospot, margin, swap or future, if not provided this.options['defaultType'] is used
params.marginModestringNo'cross' or 'isolated' - marginMode for type='margin', if not provided this.options['defaultMarginMode'] is used
params.unifiedAccountboolNoset to true for fetching unified account orders
gate.fetchOpenOrders (symbol, since?, limit?, params?)

fetchClosedOrders

fetches information on multiple closed orders made by the user

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

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerboolNotrue for fetching trigger orders
params.typestringNospot, swap or future, if not provided this.options['defaultType'] is used
params.marginModestringNo'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
params.historicalbooleanNoswap only true for using historical endpoint
params.unifiedAccountboolNoset to true for fetching unified account orders
gate.fetchClosedOrders (symbol, since?, limit?, params?)

cancelOrder

Cancels an open order

Kind: instance method of gate
Returns: An order structure

See

ParamTypeRequiredDescription
idstringYesOrder id
symbolstringYesUnified market symbol
paramsobjectNoParameters specified by the exchange api
params.triggerboolNoTrue if the order to be cancelled is a trigger order
params.unifiedAccountboolNoset to true for canceling unified account orders
gate.cancelOrder (id, symbol, params?)

cancelOrders

cancel multiple orders

Kind: instance method of gate
Returns: object - an list of order structures

See

ParamTypeRequiredDescription
idsArray<string>Yesorder ids
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.unifiedAccountboolNoset to true for canceling unified account orders
gate.cancelOrders (ids, symbol, params?)

cancelOrdersForSymbols

cancel multiple orders for multiple symbols

Kind: instance method of gate
Returns: object - an list of order structures

See: https://www.gate.com/en-eu/docs/developers/apiv4/#cancel-a-batch-of-orders-with-an-id-list

ParamTypeRequiredDescription
ordersArray<CancellationRequest>Yeslist of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdsArray<string>Noclient order ids
params.unifiedAccountboolNoset to true for canceling unified account orders
gate.cancelOrdersForSymbols (orders, params?)

cancelAllOrders

cancel all open orders

Kind: instance method of gate
Returns: Array<object> - a list of order structures

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
paramsobjectNoextra parameters specific to the exchange API endpoint
params.unifiedAccountboolNoset to true for canceling unified account orders
gate.cancelAllOrders (symbol, params?)

transfer

transfer currency internally between wallets on the same account

Kind: instance method of gate
Returns: A transfer structure

See: https://www.gate.com/docs/developers/apiv4/en/#transfer-between-trading-accounts

ParamTypeRequiredDescription
codestringYesunified currency code for currency being transferred
amountfloatYesthe amount of currency to transfer
fromAccountstringYesthe account to transfer currency from
toAccountstringYesthe account to transfer currency to
paramsobjectNoextra parameters specific to the exchange API endpoint
params.symbolstringNoUnified market symbol required for type == margin
gate.transfer (code, amount, fromAccount, toAccount, params?)

setLeverage

set the level of leverage for a market

Kind: instance method of gate
Returns: object - response from the exchange

See

ParamTypeRequiredDescription
leveragefloatYesthe rate of leverage
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.setLeverage (leverage, symbol, params?)

fetchPosition

fetch data on an open contract position

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

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market the position is held in
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchPosition (symbol, params?)

fetchPositions

fetch all open positions

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

See

ParamTypeRequiredDescription
symbolsArray<string>, undefinedYesNot used by gate, but parsed internally by CCXT
paramsobjectNoextra parameters specific to the exchange API endpoint
params.settlestringNo'btc' or 'usdt' - settle currency for perpetual swap and future - default="usdt" for swap and "btc" for future
params.typestringNoswap, future or option, if not provided this.options['defaultType'] is used
gate.fetchPositions (symbols, params?)

fetchLeverageTiers

retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes

Kind: instance method of gate
Returns: object - a dictionary of leverage tiers structures, indexed by market symbols

See

ParamTypeRequiredDescription
symbolsArray<string>Nolist of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchLeverageTiers (symbols?, params?)

fetchMarketLeverageTiers

retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market

Kind: instance method of gate
Returns: object - a leverage tiers structure

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchMarketLeverageTiers (symbol, params?)

repayIsolatedMargin

repay borrowed margin and interest

Kind: instance method of gate
Returns: object - a margin loan structure

See: https://www.gate.com/docs/developers/apiv4/en/#borrow-or-repay-2

ParamTypeRequiredDescription
symbolstringYesunified market symbol
codestringYesunified currency code of the currency to repay
amountfloatYesthe amount to repay
paramsobjectNoextra parameters specific to the exchange API endpoint
params.modestringNo'all' or 'partial' payment mode, extra parameter required for isolated margin
params.idstringNo'34267567' loan id, extra parameter required for isolated margin
gate.repayIsolatedMargin (symbol, code, amount, params?)

repayCrossMargin

repay cross margin borrowed margin and interest

Kind: instance method of gate
Returns: object - a margin loan structure

See: https://www.gate.com/docs/developers/apiv4/en/#borrow-or-repay

ParamTypeRequiredDescription
codestringYesunified currency code of the currency to repay
amountfloatYesthe amount to repay
paramsobjectNoextra parameters specific to the exchange API endpoint
params.modestringNo'all' or 'partial' payment mode, extra parameter required for isolated margin
params.idstringNo'34267567' loan id, extra parameter required for isolated margin
params.unifiedAccountbooleanNoset to true for repaying in the unified account
gate.repayCrossMargin (code, amount, params?)

borrowIsolatedMargin

create a loan to borrow margin

Kind: instance method of gate
Returns: object - a margin loan structure

See: https://www.gate.com/docs/developers/apiv4/en/#borrow-or-repay-2

ParamTypeRequiredDescription
symbolstringYesunified market symbol, required for isolated margin
codestringYesunified currency code of the currency to borrow
amountfloatYesthe amount to borrow
paramsobjectNoextra parameters specific to the exchange API endpoint
params.ratestringNo'0.0002' or '0.002' extra parameter required for isolated margin
gate.borrowIsolatedMargin (symbol, code, amount, params?)

borrowCrossMargin

create a loan to borrow margin

Kind: instance method of gate
Returns: object - a margin loan structure

See: https://www.gate.com/docs/developers/apiv4/en/#borrow-or-repay

ParamTypeRequiredDescription
codestringYesunified currency code of the currency to borrow
amountfloatYesthe amount to borrow
paramsobjectNoextra parameters specific to the exchange API endpoint
params.ratestringNo'0.0002' or '0.002' extra parameter required for isolated margin
params.unifiedAccountbooleanNodefault true (set to false to use deprecated privateMarginPostCrossLoans method)
gate.borrowCrossMargin (code, amount, params?)

fetchBorrowInterest

fetch the interest owed by the user for borrowing currency for margin trading

Kind: instance method of gate
Returns: Array<object> - a list of borrow interest structures

See

ParamTypeRequiredDescription
codestringNounified currency code
symbolstringNounified market symbol when fetching interest in isolated markets
sinceintNothe earliest time in ms to fetch borrow interest for
limitintNothe maximum number of structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.unifiedAccountbooleanNoset to true for fetching borrow interest in the unified account
gate.fetchBorrowInterest (code?, symbol?, since?, limit?, params?)

reduceMargin

remove margin from a position

Kind: instance method of gate
Returns: object - a margin structure

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol
amountfloatYesthe amount of margin to remove
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.reduceMargin (symbol, amount, params?)

addMargin

add margin

Kind: instance method of gate
Returns: object - a margin structure

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol
amountfloatYesamount of margin to add
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.addMargin (symbol, amount, params?)

fetchOpenInterest

Retrieves the open interest of a currency

Kind: instance method of gate
Returns: object - an open interest structure/docs/manual#open-interest-structure

See: https://www.gate.com/docs/developers/apiv4/en/#futures-statistics

ParamTypeRequiredDescription
symbolstringYesUnified CCXT market symbol
timeframestringYes"5m", "15m", "30m", "1h", "4h", "1d"
sinceintNothe time(ms) of the earliest record to retrieve as a unix timestamp
limitintNodefault 30
paramsobjectNoexchange specific parameters
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
gate.fetchOpenInterest (symbol, timeframe, since?, limit?, params?)

fetchSettlementHistory

fetches historical settlement records

Kind: instance method of gate
Returns: Array<object> - a list of settlement history objects

See: https://www.gate.com/docs/developers/apiv4/en/#list-settlement-history

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the settlement history, required on gate
sinceintNotimestamp in ms
limitintNonumber of records
paramsobjectNoexchange specific params
gate.fetchSettlementHistory (symbol, since?, limit?, params?)

fetchMySettlementHistory

fetches historical settlement records of the user

Kind: instance method of gate
Returns: Array<object> - a list of [settlement history objects]

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the settlement history
sinceintNotimestamp in ms
limitintNonumber of records
paramsobjectNoexchange specific params
gate.fetchMySettlementHistory (symbol, since?, limit?, params?)

fetchLedger

fetch the history of changes, actions done by the user or operations that altered the balance of the user

Kind: instance method of gate
Returns: object - a ledger structure

See

ParamTypeRequiredDescription
codestringNounified currency code
sinceintNotimestamp in ms of the earliest ledger entry
limitintNomax number of ledger entries to return
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNoend time in ms
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
gate.fetchLedger (code?, since?, limit?, params?)

setPositionMode

set dual/hedged mode to true or false for a swap market, make sure all positions are closed and no orders are open before setting dual mode

Kind: instance method of gate
Returns: object - response from the exchange

See: https://www.gate.com/docs/developers/apiv4/en/#set-position-mode

ParamTypeDescription
hedgedboolset to true to enable dual mode
symbolstring, undefinedif passed, dual mode is set for all markets with the same settle currency
paramsobjectextra parameters specific to the exchange API endpoint
params.settlestringsettle currency
gate.setPositionMode (hedged, symbol, params)

fetchUnderlyingAssets

fetches the market ids of underlying assets for a specific contract market type

Kind: instance method of gate
Returns: Array<object> - a list of underlying assets

See: https://www.gate.com/docs/developers/apiv4/en/#list-all-underlying-assets

ParamTypeRequiredDescription
paramsobjectNoexchange specific params
params.typestringNothe contract market type, 'option', 'swap' or 'future', the default is 'option'
gate.fetchUnderlyingAssets (params?)

fetchLiquidations

retrieves the public liquidations of a trading pair

Kind: instance method of gate
Returns: object - an array of liquidation structures

See: https://www.gate.com/docs/developers/apiv4/en/#query-liquidation-order-history

ParamTypeRequiredDescription
symbolstringYesunified CCXT market symbol
sinceintNothe earliest time in ms to fetch liquidations for
limitintNothe maximum number of liquidation structures to retrieve
paramsobjectNoexchange specific parameters for the exchange API endpoint
params.untilintNotimestamp in ms of the latest liquidation
gate.fetchLiquidations (symbol, since?, limit?, params?)

fetchMyLiquidations

retrieves the users liquidated positions

Kind: instance method of gate
Returns: object - an array of liquidation structures

See

ParamTypeRequiredDescription
symbolstringYesunified CCXT market symbol
sinceintNothe earliest time in ms to fetch liquidations for
limitintNothe maximum number of liquidation structures to retrieve
paramsobjectNoexchange specific parameters for the exchange API endpoint
gate.fetchMyLiquidations (symbol, since?, limit?, params?)

fetchGreeks

fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract

Kind: instance method of gate
Returns: object - a greeks structure

See: https://www.gate.com/docs/developers/apiv4/en/#query-options-market-ticker-information

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch greeks for
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchGreeks (symbol, params?)

closePosition

closes open positions for a market

Kind: instance method of gate
Returns: Array<object> - A list of position structures

See

ParamTypeRequiredDescription
symbolstringYesUnified CCXT market symbol
sidestringYes'buy' or 'sell'
paramsobjectNoextra parameters specific to the okx api endpoint
gate.closePosition (symbol, side, params?)

fetchLeverage

fetch the set leverage for a market

Kind: instance method of gate
Returns: object - a leverage structure

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
params.unifiedbooleanNodefault false, set to true for fetching the unified accounts leverage
gate.fetchLeverage (symbol, params?)

fetchLeverages

fetch the set leverage for all leverage markets, only spot margin is supported on gate

Kind: instance method of gate
Returns: object - a list of leverage structures

See: https://www.gate.com/docs/developers/apiv4/en/#list-lending-markets

ParamTypeRequiredDescription
symbolsArray<string>Yesa list of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
params.unifiedbooleanNodefault false, set to true for fetching unified account leverages
gate.fetchLeverages (symbols, params?)

fetchOption

fetches option data that is commonly found in an option chain

Kind: instance method of gate
Returns: object - an option chain structure

See: https://www.gate.com/docs/developers/apiv4/en/#query-specified-contract-details

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchOption (symbol, params?)

fetchOptionChain

fetches data for an underlying asset that is commonly found in an option chain

Kind: instance method of gate
Returns: object - a list of option chain structures

See: https://www.gate.com/docs/developers/apiv4/en/#list-all-contracts-for-specified-underlying-and-expiration-date

ParamTypeRequiredDescription
codestringYesbase currency to fetch an option chain for
paramsobjectNoextra parameters specific to the exchange API endpoint
params.underlyingstringNothe underlying asset, can be obtained from fetchUnderlyingAssets ()
params.expirationintNounix timestamp of the expiration time
gate.fetchOptionChain (code, params?)

fetchPositionsHistory

fetches historical positions

Kind: instance method of gate
Returns: Array<object> - a list of position structures

See

ParamTypeRequiredDescription
symbolsArray<string>Yesunified conract symbols, must all have the same settle currency and the same market type
sinceintNothe earliest time in ms to fetch positions for
limitintNothe maximum amount of records to fetch, default=1000
paramsobjectYesextra parameters specific to the exchange api endpoint
params.untilintNothe latest time in ms to fetch positions for EXCHANGE SPECIFIC PARAMETERS
params.offsetintNolist offset, starting from 0
params.sidestringNolong or short
params.pnlstringNoquery profit or loss
gate.fetchPositionsHistory (symbols, since?, limit?, params)

createOrderWs

Create an order on the exchange

Kind: instance method of gate
Returns: object | undefined - An order structure

See

ParamTypeRequiredDescription
symbolstringYesUnified CCXT market symbol
typestringYes'limit' or 'market' "market" is contract only
sidestringYes'buy' or 'sell'
amountfloatYesthe amount of currency to trade
pricefloatNoignored in "market" orders the price at which the order is to be fulfilled at in units of the quote currency
paramsobjectNoextra parameters specific to the exchange API endpoint
params.stopPricefloatNoThe price at which a trigger order is triggered at
params.timeInForcestringNo"GTC", "IOC", or "PO"
params.stopLossPricefloatNoThe price at which a stop loss order is triggered at
params.takeProfitPricefloatNoThe price at which a take profit order is triggered at
params.marginModestringNo'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
params.icebergintNoAmount to display for the iceberg order, Null or 0 for normal orders, Set to -1 to hide the order completely
params.textstringNoUser defined information
params.accountstringNospot and margin only "spot", "margin" or "cross_margin"
params.auto_borrowboolNomargin only Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough
params.settlestringNocontract only Unified Currency Code for settle currency
params.reduceOnlyboolNocontract only Indicates if this order is to reduce the size of a position
params.closeboolNocontract only Set as true to close the position, with size set to 0
params.auto_sizeboolNocontract only Set side to close dual-mode position, close_long closes the long side, while close_short the short one, size also needs to be set to 0
params.price_typeintNocontract only 0 latest deal price, 1 mark price, 2 index price
params.costfloatNospot market buy only the quote quantity that can be used as an alternative for the amount
gate.createOrderWs (symbol, type, side, amount, price?, params?)

createOrdersWs

create a list of trade orders

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

See: https://www.gate.io/docs/developers/futures/ws/en/#order-batch-place

ParamTypeRequiredDescription
ordersArrayYeslist of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.createOrdersWs (orders, params?)

cancelAllOrdersWs

cancel all open orders

Kind: instance method of gate
Returns: Array<object> - a list of order structures

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
paramsobjectNoextra parameters specific to the exchange API endpoint
params.channelstringNothe channel to use, defaults to spot.order_cancel_cp or futures.order_cancel_cp
gate.cancelAllOrdersWs (symbol, params?)

cancelOrderWs

Cancels an open order

Kind: instance method of gate
Returns: An order structure

See

ParamTypeRequiredDescription
idstringYesOrder id
symbolstringYesUnified market symbol
paramsobjectNoParameters specified by the exchange api
params.triggerboolNoTrue if the order to be cancelled is a trigger order
gate.cancelOrderWs (id, symbol, params?)

editOrderWs

edit a trade order, gate currently only supports the modification of the price or amount fields

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

See

ParamTypeRequiredDescription
idstringYesorder id
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of the currency you want to trade in units of the base currency
pricefloatNothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.editOrderWs (id, symbol, type, side, amount, price?, params?)

fetchOrderWs

Retrieves information on an order

Kind: instance method of gate
Returns: An order structure

See

ParamTypeRequiredDescription
idstringYesOrder id
symbolstringYesUnified market symbol, required for spot and margin
paramsobjectNoParameters specified by the exchange api
params.triggerboolNoTrue if the order being fetched is a trigger order
params.marginModestringNo'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
params.typestringNo'spot', 'swap', or 'future', if not provided this.options['defaultMarginMode'] is used
params.settlestringNo'btc' or 'usdt' - settle currency for perpetual swap and future - market settle currency is used if symbol !== undefined, default="usdt" for swap and "btc" for future
gate.fetchOrderWs (id, symbol, params?)

fetchOpenOrdersWs

fetch all unfilled currently open orders

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

See: https://www.gate.io/docs/developers/futures/ws/en/#order-list

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch open orders for
limitintNothe maximum number of open orders structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchOpenOrdersWs (symbol, since?, limit?, params?)

fetchClosedOrdersWs

fetches information on multiple closed orders made by the user

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

See: https://www.gate.io/docs/developers/futures/ws/en/#order-list

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.fetchClosedOrdersWs (symbol, since?, limit?, params?)

fetchOrdersWs

fetches information on multiple orders made by the user by status

Kind: instance method of gate
Returns: Array<object> - a list of order structures

See: https://www.gate.io/docs/developers/futures/ws/en/#order-list

ParamTypeRequiredDescription
statusstringYesrequested order status
symbolstringYesunified market symbol of the market orders were made in
sinceint, undefinedNothe earliest time in ms to fetch orders for
limitint, undefinedNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.orderIdintNoorder id to begin at
params.limitintNothe maximum number of order structures to retrieve
gate.fetchOrdersWs (status, symbol, since?, limit?, params?)

watchOrderBook

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

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

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the order book for
limitintNothe maximum amount of order book entries to return
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.watchOrderBook (symbol, limit?, params?)

unWatchOrderBook

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

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

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the order book for
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.unWatchOrderBook (symbol, params?)

watchTicker

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

Kind: instance method of gate
Returns: object - a ticker structure

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.watchTicker (symbol, params?)

watchTickers

watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list

Kind: instance method of gate
Returns: object - a ticker structure

See

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.watchTickers (symbols, params?)

watchBidsAsks

watches best bid & ask for symbols

Kind: instance method of gate
Returns: object - a ticker structure

See

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.watchBidsAsks (symbols, params?)

watchTrades

get the list of most recent trades for a particular symbol

Kind: instance method of gate
Returns: Array<object> - a list of trade structures

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch trades for
sinceintNotimestamp in ms of the earliest trade to fetch
limitintNothe maximum amount of trades to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.watchTrades (symbol, since?, limit?, params?)

watchTradesForSymbols

get the list of most recent trades for a particular symbol

Kind: instance method of gate
Returns: Array<object> - a list of trade structures

See

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to fetch trades for
sinceintNotimestamp in ms of the earliest trade to fetch
limitintNothe maximum amount of trades to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.watchTradesForSymbols (symbols, since?, limit?, params?)

unWatchTradesForSymbols

get the list of most recent trades for a particular symbol

Kind: instance method of gate
Returns: Array<object> - a list of trade structures

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to fetch trades for
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.unWatchTradesForSymbols (symbols, params?)

unWatchTrades

get the list of most recent trades for a particular symbol

Kind: instance method of gate
Returns: Array<object> - a list of trade structures

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch trades for
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.unWatchTrades (symbol, params?)

watchOHLCV

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

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

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch OHLCV data for
timeframestringYesthe length of time each candle represents
sinceintNotimestamp in ms of the earliest candle to fetch
limitintNothe maximum amount of candles to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.watchOHLCV (symbol, timeframe, since?, limit?, params?)

watchMyTrades

watches information on multiple trades made by the user

Kind: instance method of gate
Returns: Array<object> - a list of trade structures

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market trades were made in
sinceintNothe earliest time in ms to fetch trades for
limitintNothe maximum number of trade structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.watchMyTrades (symbol, since?, limit?, params?)

watchBalance

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

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

See

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
gate.watchBalance (params?)

watchPositions

watch all open positions

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

See

ParamTypeRequiredDescription
symbolsArray<string>Nolist of unified market symbols to watch positions for
sinceintNothe earliest time in ms to fetch positions for
limitintNothe maximum number of positions to retrieve
paramsobjectYesextra parameters specific to the exchange API endpoint
gate.watchPositions (symbols?, since?, limit?, params)

watchOrders

watches information on multiple orders made by the user

Kind: instance method of gate
Returns: Array<object> - a list of order structures

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.typestringNospot, margin, swap, future, or option. Required if listening to all symbols.
params.isInversebooleanNoif future, listen to inverse or linear contracts
gate.watchOrders (symbol, since?, limit?, params?)

watchMyLiquidations

watch the public liquidations of a trading pair

Kind: instance method of gate
Returns: object - an array of liquidation structures

See

ParamTypeRequiredDescription
symbolstringYesunified CCXT market symbol
sinceintNothe earliest time in ms to fetch liquidations for
limitintNothe maximum number of liquidation structures to retrieve
paramsobjectNoexchange specific parameters for the bitmex api endpoint
gate.watchMyLiquidations (symbol, since?, limit?, params?)

watchMyLiquidationsForSymbols

watch the private liquidations of a trading pair

Kind: instance method of gate
Returns: object - an array of liquidation structures

See

ParamTypeRequiredDescription
symbolsArray<string>Yesunified CCXT market symbols
sinceintNothe earliest time in ms to fetch liquidations for
limitintNothe maximum number of liquidation structures to retrieve
paramsobjectNoexchange specific parameters for the gate api endpoint
gate.watchMyLiquidationsForSymbols (symbols, since?, limit?, params?)

On this page