dydx
dydx cryptocurrency exchange — CCXT unified API: methods, parameters and endpoints.
dydx
Kind: global class
Extends: Exchange
- fetchTime
- fetchMarkets
- fetchTrades
- fetchOHLCV
- fetchFundingRateHistory
- fetchOrder
- fetchOrders
- fetchOpenOrders
- fetchClosedOrders
- fetchPosition
- fetchPositions
- createOrder
- cancelOrder
- cancelOrders
- fetchOrderBook
- fetchLedger
- transfer
- fetchTransfers
- withdraw
- fetchWithdrawals
- fetchDeposits
- fetchDepositsWithdrawals
- fetchAccounts
- fetchBalance
- watchTrades
- unWatchTrades
- watchOrderBook
- unWatchOrderBook
- watchOHLCV
- unWatchOHLCV
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
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to fetch trades for |
| since | int | No | timestamp in ms of the earliest trade to fetch |
| limit | int | No | the maximum amount of trades to fetch |
| params | object | No | extra 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
| 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 |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | the 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for |
| since | int | No | timestamp in ms of the earliest funding rate to fetch |
| limit | int | No | the maximum amount of funding rate structures to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.until | int | No | timestamp 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
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | the order id |
| symbol | string | Yes | unified symbol of the market the order was made in |
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market orders were made in |
| since | int | No | the earliest time in ms to fetch orders for |
| limit | int | No | the maximum number of order structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.address | string | No | wallet address that made trades |
| params.subAccountNumber | string | No | sub 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market orders were made in |
| since | int | No | the earliest time in ms to fetch orders for |
| limit | int | No | the maximum number of order structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.address | string | No | wallet address that made trades |
| params.subAccountNumber | string | No | sub 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market orders were made in |
| since | int | No | the earliest time in ms to fetch orders for |
| limit | int | No | the maximum number of order structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.address | string | No | wallet address that made trades |
| params.subAccountNumber | string | No | sub 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified market symbol of the market the position is held in |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.address | string | No | wallet address that made trades |
| params.subAccountNumber | string | No | sub 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
| 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.address | string | No | wallet address that made trades |
| params.subAccountNumber | string | No | sub 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
| 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 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.timeInForce | string | No | "GTT", "IOC", or "PO" |
| params.triggerPrice | float | No | The price a trigger order is triggered at |
| params.stopLossPrice | float | No | price for a stoploss order |
| params.takeProfitPrice | float | No | price for a takeprofit order |
| params.clientOrderId | string | No | a unique id for the order |
| params.postOnly | bool | No | true or false whether the order is post-only |
| params.reduceOnly | bool | No | true or false whether the order is reduce-only |
| params.goodTillBlock | float | No | expired block number for the order, required for market order and non limit GTT order, default value is latestBlockHeight + 20 |
| params.goodTillBlockTimeInSeconds | float | No | expired 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
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | it should be the clientOrderId in this case |
| symbol | string | Yes | unified symbol of the market the order was made in |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.clientOrderId | string | No | client order id used when creating the order |
| params.trigger | boolean | No | whether the order is a trigger/algo order |
| params.orderFlags | float | No | default 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.goodTillBlock | float | No | expired block number for the order, required for market order and non limit GTT order (orderFlags = 0), default value is latestBlockHeight + 20 |
| params.goodTillBlockTimeInSeconds | float | No | expired time elapsed for the order, required for limit GTT order and conditional (orderFlagss > 0), default value is 30 days |
| params.subAccountId | int | No | sub 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
| Param | Type | Required | Description |
|---|---|---|---|
| ids | Array<string> | Yes | order ids |
| symbol | string | No | unified market symbol |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.clientOrderIds | Array<string> | No | max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma |
| params.subAccountId | int | No | sub 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
| 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 |
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
| 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.address | string | No | wallet address that made trades |
| params.subAccountNumber | string | No | sub 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
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | unified currency code |
| amount | float | Yes | amount to transfer |
| fromAccount | string | Yes | account to transfer from main, subaccount |
| toAccount | string | Yes | account to transfer to subaccount, address |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.vaultAddress | string | No | the 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
| Param | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | unified currency code of the currency transferred |
| since | int | No | the earliest time in ms to fetch transfers for |
| limit | int | No | the maximum number of transfers structures to retrieve |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.address | string | No | wallet address that made trades |
| params.subAccountNumber | string | No | sub account number |
dydx.fetchTransfers (code, since?, limit?, params?)withdraw
make a withdrawal
Kind: instance method of dydx
Returns: object - a transaction structure
| 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 | Yes | |
| params | object | No | extra 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
| 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.address | string | No | wallet address that made trades |
| params.subAccountNumber | string | No | sub 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
| 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.address | string | No | wallet address that made trades |
| params.subAccountNumber | string | No | sub 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
| 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 is undefined |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.address | string | No | wallet address that made trades |
| params.subAccountNumber | string | No | sub 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
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.address | string | No | wallet 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
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to fetch trades for |
| since | int | No | timestamp in ms of the earliest trade to fetch |
| limit | int | No | the maximum amount of trades to fetch |
| params | object | No | extra 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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified symbol of the market to fetch trades for |
| params | object | No | extra 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
| 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 |
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
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | unified array of symbols |
| params | object | No | extra 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
| 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 |
| params | object | No | extra 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
| 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 |
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.timezone | object | No | if provided, kline intervals are interpreted in that timezone instead of UTC, example '+08:00' |
dydx.unWatchOHLCV (symbol, timeframe, params?)