CCXT

dydx

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

dydx

Kind: global class
Extends: Exchange

fetchTime

fetches the current integer timestamp in milliseconds from the exchange server

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

See: https://docs.dydx.xyz/indexer-client/http#get-time

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

fetchMarkets

retrieves data on all markets for hyperliquid

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

See: https://docs.dydx.xyz/indexer-client/http#get-perpetual-markets

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

fetchTrades

get the list of most recent trades for a particular symbol

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

See: https://developer.woox.io/api-reference/endpoint/public_data/marketTrades

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
dydx.fetchTrades (symbol, since?, limit?, params?)

fetchOHLCV

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

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

See: https://docs.dydx.xyz/indexer-client/http#get-candles

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
params.untilintNothe latest time in ms to fetch entries for
dydx.fetchOHLCV (symbol, timeframe, since?, limit?, params?)

fetchFundingRateHistory

fetches historical funding rate prices

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

See: https://docs.dydx.xyz/indexer-client/http#get-historical-funding

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
dydx.fetchFundingRateHistory (symbol, since?, limit?, params?)

fetchOrder

fetches information on an order made by the user

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

See: https://docs.dydx.xyz/indexer-client/http#get-order

ParamTypeRequiredDescription
idstringYesthe order id
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
dydx.fetchOrder (id, symbol, params?)

fetchOrders

fetches information on multiple orders made by the user

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

See: https://docs.dydx.xyz/indexer-client/http#list-orders

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.addressstringNowallet address that made trades
params.subAccountNumberstringNosub account number
dydx.fetchOrders (symbol, since?, limit?, params?)

fetchOpenOrders

fetch all unfilled currently open orders

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

See: https://docs.dydx.xyz/indexer-client/http#list-orders

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.addressstringNowallet address that made trades
params.subAccountNumberstringNosub account number
dydx.fetchOpenOrders (symbol, since?, limit?, params?)

fetchClosedOrders

fetches information on multiple closed orders made by the user

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

See: https://docs.dydx.xyz/indexer-client/http#list-orders

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.addressstringNowallet address that made trades
params.subAccountNumberstringNosub account number
dydx.fetchClosedOrders (symbol, since?, limit?, params?)

fetchPosition

fetch data on an open position

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

See: https://docs.dydx.xyz/indexer-client/http#list-positions

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market the position is held in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.addressstringNowallet address that made trades
params.subAccountNumberstringNosub account number
dydx.fetchPosition (symbol, params?)

fetchPositions

fetch all open positions

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

See: https://docs.dydx.xyz/indexer-client/http#list-positions

ParamTypeRequiredDescription
symbolsArray<string>Nolist of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
params.addressstringNowallet address that made trades
params.subAccountNumberstringNosub account number
dydx.fetchPositions (symbols?, params?)

createOrder

create a trade order

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

See: https://docs.dydx.xyz/interaction/trading#place-an-order

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of currency you want to trade in units of 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.timeInForcestringNo"GTT", "IOC", or "PO"
params.triggerPricefloatNoThe price a trigger order is triggered at
params.stopLossPricefloatNoprice for a stoploss order
params.takeProfitPricefloatNoprice for a takeprofit order
params.clientOrderIdstringNoa unique id for the order
params.postOnlyboolNotrue or false whether the order is post-only
params.reduceOnlyboolNotrue or false whether the order is reduce-only
params.goodTillBlockfloatNoexpired block number for the order, required for market order and non limit GTT order, default value is latestBlockHeight + 20
params.goodTillBlockTimeInSecondsfloatNoexpired time elapsed for the order, required for limit GTT order and conditional, default value is 30 days
dydx.createOrder (symbol, type, side, amount, price?, params?)

cancelOrder

cancels an open order

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

See: https://docs.dydx.xyz/interaction/trading/#cancel-an-order

ParamTypeRequiredDescription
idstringYesit should be the clientOrderId in this case
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdstringNoclient order id used when creating the order
params.triggerbooleanNowhether the order is a trigger/algo order
params.orderFlagsfloatNodefault is 64, orderFlags for the order, market order and non limit GTT order is 0, limit GTT order is 64 and conditional order is 32
params.goodTillBlockfloatNoexpired block number for the order, required for market order and non limit GTT order (orderFlags = 0), default value is latestBlockHeight + 20
params.goodTillBlockTimeInSecondsfloatNoexpired time elapsed for the order, required for limit GTT order and conditional (orderFlagss > 0), default value is 30 days
params.subAccountIdintNosub account id, default is 0
dydx.cancelOrder (id, symbol, params?)

cancelOrders

cancel multiple orders

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

ParamTypeRequiredDescription
idsArray<string>Yesorder ids
symbolstringNounified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdsArray<string>Nomax length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma
params.subAccountIdintNosub account id, default is 0
dydx.cancelOrders (ids, symbol?, params?)

fetchOrderBook

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

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

See: https://docs.dydx.xyz/indexer-client/http#get-perpetual-market-orderbook

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
dydx.fetchOrderBook (symbol, limit?, params?)

fetchLedger

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

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

See: https://docs.dydx.xyz/indexer-client/http#get-transfers

ParamTypeRequiredDescription
codestringNounified currency code, default is undefined
sinceintNotimestamp in ms of the earliest ledger entry, default is undefined
limitintNomax number of ledger entries to return, default is undefined
paramsobjectNoextra parameters specific to the exchange API endpoint
params.addressstringNowallet address that made trades
params.subAccountNumberstringNosub account number
dydx.fetchLedger (code?, since?, limit?, params?)

transfer

transfer currency internally between wallets on the same account

Kind: instance method of dydx
Returns: object - a transfer structure

ParamTypeRequiredDescription
codestringYesunified currency code
amountfloatYesamount to transfer
fromAccountstringYesaccount to transfer from main, subaccount
toAccountstringYesaccount to transfer to subaccount, address
paramsobjectNoextra parameters specific to the exchange API endpoint
params.vaultAddressstringNothe vault address for order
dydx.transfer (code, amount, fromAccount, toAccount, params?)

fetchTransfers

fetch a history of internal transfers made on an account

Kind: instance method of dydx
Returns: Array<object> - a list of transfer structures

See: https://docs.dydx.xyz/indexer-client/http#get-transfers

ParamTypeRequiredDescription
codestringYesunified currency code of the currency transferred
sinceintNothe earliest time in ms to fetch transfers for
limitintNothe maximum number of transfers structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.addressstringNowallet address that made trades
params.subAccountNumberstringNosub account number
dydx.fetchTransfers (code, since?, limit?, params?)

withdraw

make a withdrawal

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

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

fetchWithdrawals

fetch all withdrawals made from an account

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

See: https://docs.dydx.xyz/indexer-client/http#get-transfers

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.addressstringNowallet address that made trades
params.subAccountNumberstringNosub account number
dydx.fetchWithdrawals (code, since?, limit?, params?)

fetchDeposits

fetch all deposits made to an account

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

See: https://docs.dydx.xyz/indexer-client/http#get-transfers

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.addressstringNowallet address that made trades
params.subAccountNumberstringNosub account number
dydx.fetchDeposits (code, since?, limit?, params?)

fetchDepositsWithdrawals

fetch history of deposits and withdrawals

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

See: https://docs.dydx.xyz/indexer-client/http#get-transfers

ParamTypeRequiredDescription
codestringNounified currency code for the currency of the deposit/withdrawals, default is undefined
sinceintNotimestamp in ms of the earliest deposit/withdrawal, default is undefined
limitintNomax number of deposit/withdrawals to return, default is undefined
paramsobjectNoextra parameters specific to the exchange API endpoint
params.addressstringNowallet address that made trades
params.subAccountNumberstringNosub account number
dydx.fetchDepositsWithdrawals (code?, since?, limit?, params?)

fetchAccounts

fetch all the accounts associated with a profile

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

See: https://docs.dydx.xyz/indexer-client/http#get-subaccounts

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.addressstringNowallet address that made trades
dydx.fetchAccounts (params?)

fetchBalance

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

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

See: https://docs.dydx.xyz/indexer-client/http#get-subaccount

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
dydx.fetchBalance (params?)

watchTrades

get the list of most recent trades for a particular symbol

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

See: https://docs.dydx.xyz/indexer-client/websockets#trades

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
dydx.watchTrades (symbol, since?, limit?, params?)

unWatchTrades

unsubscribes from the trades channel

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

See: https://docs.dydx.xyz/indexer-client/websockets#trades

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

watchOrderBook

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

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

See: https://docs.dydx.xyz/indexer-client/websockets#orders

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
dydx.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 dydx
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://docs.dydx.xyz/indexer-client/websockets#orders

ParamTypeRequiredDescription
symbolstringYesunified array of symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
dydx.unWatchOrderBook (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 dydx
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume

See: https://docs.dydx.xyz/indexer-client/websockets#candles

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
dydx.watchOHLCV (symbol, timeframe, since?, limit?, params?)

unWatchOHLCV

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

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

See: https://docs.dydx.xyz/indexer-client/websockets#candles

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch OHLCV data for
timeframestringYesthe length of time each candle represents
paramsobjectNoextra parameters specific to the exchange API endpoint
params.timezoneobjectNoif provided, kline intervals are interpreted in that timezone instead of UTC, example '+08:00'
dydx.unWatchOHLCV (symbol, timeframe, params?)

On this page