- Clients
- Enums
- REST Requests
- RestRequestCancelOrders
- RestRequestFindBalances
- RestRequestFindCandles
- RestRequestFindDeposit
- RestRequestFindDeposits
- RestRequestFindFill
- RestRequestFindFills
- RestRequestFindMarkets
- RestRequestFindOrder
- RestRequestFindOrders
- RestRequestFindTrades
- RestRequestFindWithdrawal
- RestRequestFindWithdrawals
- RestRequestOrder
- RestRequestWithdrawal
- RestRequestAssociateWallet
- REST Responses
- RestResponseAsset
- RestResponseBalance
- RestResponseCandle
- RestResponseDeposit
- RestResponseExchangeInfo
- RestResponseFill
- RestResponseMarket
- RestResponseOrder
- RestResponseCanceledOrder
- RestResponseOrderBookLevel1
- RestResponseOrderBookLevel2
- RestResponseOrderBookPriceLevel
- RestResponseOrderFill
- RestResponsePing
- RestResponseTicker
- RestResponseTime
- RestResponseTrade
- RestResponseUser
- RestResponseWallet
- RestResponseWebSocketToken
- RestResponseWithdrawal
- RestResponseAssociateWallet
- WebSocket Subscriptions
- AuthTokenWebSocketRequestOrdersSubscription
- AuthTokenWebSocketRequestBalancesSubscription
- WebSocketRequestTickersSubscription
- WebSocketRequestCandlesSubscription
- WebSocketRequestTradesSubscription
- WebSocketRequestL1OrderBookSubscription
- WebSocketRequestL2OrderBookSubscription
- WebSocketRequestBalancesSubscription
- WebSocketRequestOrdersSubscription
- WebSocket Responses
- WebSocketResponseError
- WebSocketResponseSubscriptions
- WebSocketResponseTickerShort
- WebSocketResponseTickerLong
- WebSocketResponseCandleShort
- WebSocketResponseCandleLong
- WebSocketResponseTradeShort
- WebSocketResponseTradeLong
- WebSocketResponseL1OrderBookShort
- WebSocketResponseL1OrderBookLong
- WebSocketResponseL2OrderBookShort
- WebSocketResponseL2OrderBookLong
- WebSocketResponseBalanceShort
- WebSocketResponseBalanceLong
- WebSocketResponseOrderShort
- WebSocketResponseOrderLong
- WebSocketResponseOrderFillShort
- Type Guards
- ECDSA Signatures
- Misc Types & Utilities
- L1Equal
- L2toL1OrderBook
- BestAvailablePriceLevels
- RestRequestFindLiquidityPools
- L1OrderBook
- L2LimitOrderBookToHybridOrderBooks
- updateL2Levels
- RestRequestAddLiquidity
- L2OrderBook
- calculateGrossBaseQuantity
- WebSocketRequestTokenPriceSubscription
- createPrivateKeyMessageSigner
- updateL2Side
- OrderBookFeesAndMinimums
- RestRequestRemoveLiquidity
- privateKeySigner
- OrderBookLevelType
- OrderBookLevelL1
- calculateGrossBaseValueOfBuyQuantities
- RestRequestFindLiquidityAddition
- OrderBookLevelL2
- calculateGrossQuoteQuantity
- PoolReserveQuantities
- RestRequestFindLiquidityRemoval
- PriceLevelQuantities
- RestRequestFindLiquidityChanges
- calculateGrossQuoteValueOfSellQuantities
- MarketType
- calculateBaseQuantityOut
- LiquidityChangeOrigination
- WebSocketRequestAuthenticatedSubscription
- WebSocketRequestUnauthenticatedSubscription
- LiquidityChangeType
- AuthTokenWebSocketRequestAuthenticatedSubscription
- calculateQuoteQuantityOut
- AuthTokenWebSocketRequestSubscription
- MultiverseChain
- WebSocketRequestSubscription
- WebSocketResponseLiquidityPoolShort
- numerator
- RestResponseLiquidityPool
- WebSocketResponseLiquidityPoolLong
- WebSocketRequestSubscriptionsByName
- calculateSyntheticPriceLevels
- RestResponseLiquidityAddition
- RestResponseLiquidityPoolReserves
- WebSocketResponseL2OrderBookChange
- RestResponseLiquidityRemoval
- WebSocketRequestUnsubscribe
- recalculateHybridLevelAmounts
- WebSocketRequestSubscriptions
- WebSocketRequest
- WebSocketRequest
- TradeType
- sortAndMergeLevelsUnadjusted
- quantitiesAvailableFromPoolAtAskPrice
- WebSocketResponseTokenPriceShort
- WebSocketResponseTokenPriceLong
- WebSocketResponseSubscriptionMessageShort
- WebSocketResponseSubscriptionMessageLong
- quantitiesAvailableFromPoolAtBidPrice
- aggregateL2OrderBookAtTickSize
- L1orL2BestAvailablePrices
- L1L2OrderBooksWithMinimumTaker
- validateSyntheticPriceLevelInputs
- adjustPriceToTickSize
import { RestPublicClient } from '@idexio/idex-sdk';
Public REST API client
options
RestPublicClientOptions
import { v1 as uuidv1 } from 'uuid';
import { RestPublicClient } from '@idexio/idex-sdk';
const publicClient = new RestPublicClient({
sandbox: true,
// Optionally provide an API key to increase rate limits
apiKey: '1f7c4f52-4af7-4e1b-aa94-94fac8d931aa',
});
console.log(await publicClient.getTickers('IDEX-ETH'));
Test connectivity to the REST API
Returns {}
Returns the current server time
Returns Promise<number> Current server time as milliseconds since UNIX epoch
Returns basic information about the exchange.
Returns Promise<RestResponseExchangeInfo>
Returns information about assets supported by the exchange
Returns Promise<Array<RestResponseAsset>>
Returns information about the currently listed markets
findMarkets
RestRequestFindMarkets
Returns Promise<Array<RestResponseMarket>>
Returns information about liquidity pools supported by the exchange
findLiquidityPools
RestRequestFindLiquidityPools
Returns Promise<Array<RestResponseLiquidityPool>>
Returns market statistics for the trailing 24-hour period
market
string? Base-quote pair e.g. 'IDEX-ETH', if provided limits ticker data to a single market
Returns Promise<Array<RestResponseTicker>>
Returns candle (OHLCV) data for a market
findCandles
RestRequestFindCandles
Returns Promise<Array<RestResponseCandle>>
Returns public trade data for a market
findTrades
RestRequestFindTrades
Returns Promise<Array<RestResponseTrade>>
Get current top bid/ask price levels of order book for a market
market
string Base-quote pair e.g. 'IDEX-ETH'limitOrderOnly
(optional, defaultfalse
)
Returns Promise<RestResponseOrderBookLevel1>
Get current order book price levels for a market
market
string Base-quote pair e.g. 'IDEX-ETH'limit
number Number of bids and asks to return. Default is 50, 0 returns the entire book (optional, default50
)limitOrderOnly
(optional, defaultfalse
)
Returns Promise<RestResponseOrderBookLevel2>
Public REST API client options
Type: Object
sandbox
boolean?baseURL
string? Override the API urlapiKey
string? Increases rate limits if providedmultiverseChain
MultiverseChain?
import { RestAuthenticatedClient } from '@idexio/idex-sdk';
Authenticated API client
options
RestAuthenticatedClientOptions
import { v1 as uuidv1 } from 'uuid';
import { RestAuthenticatedClient } from '@idexio/idex-sdk';
const authenticatedClient = new RestAuthenticatedClient({
// Edit the values before for your environment
apiKey: '1f7c4f52-4af7-4e1b-aa94-94fac8d931aa',
apiSecret: 'axuh3ywgg854aq7m73oy6gnnpj5ar9a67szuw5lclbz77zqu0j',
// Optionally prove a wallet private key to automatically sign requests that need an ECDSA signature
walletPrivateKey: '0x3141592653589793238462643383279502884197169399375105820974944592'
sandbox: true,
});
Add liquidity to a hybrid liquidity pool from assets held by a wallet on the exchange
addLiquidityRequest
RestRequestAddLiquiditysigner
MessageSigner? Required if a private key was not provided in the constructor (optional, defaultthis.signer
)dependentTransactions
Array<string>?
Returns Promise<RestResponseLiquidityAddition>
Remove liquidity from a hybrid liquidity pool represented by LP tokens held by a wallet on the exchange
removeLiquidityRequest
RestRequestRemoveLiquiditysigner
MessageSigner? Required if a private key was not provided in the constructor (optional, defaultthis.signer
)dependentTransaction
string?
Returns Promise<RestResponseLiquidityRemoval>
Returns information about a single Liquidity Addition from a wallet
findLiquidityAddition
RestRequestFindLiquidityAddition
Returns Promise<RestResponseLiquidityAddition>
Returns information about multiple Liquidity Additions from a wallet
findLiquidityAdditions
RestRequestFindLiquidityChanges
Returns Promise<Array<RestResponseLiquidityAddition>>
Returns information about a single Liquidity Removal from a wallet
findLiquidityRemoval
RestRequestFindLiquidityRemoval
Returns Promise<RestResponseLiquidityRemoval>
Returns information about multiple Liquidity Removals from a wallet
findLiquidityRemovals
RestRequestFindLiquidityChanges
Returns Promise<Array<RestResponseLiquidityRemoval>>
Get account details for the API key’s user
nonce
string UUIDv1
Returns Promise<RestResponseUser>
Get account details for the API key’s user
nonce
string UUIDv1
Returns Promise<Array<RestResponseWallet>>
Get asset quantity data (positions) held by a wallet on the exchange
findBalances
RestRequestFindBalances
Returns Promise<Array<RestResponseBalance>>
- See: Associate Wallet
Associate a wallet with the authenticated account
associate
RestRequestAssociateWalletsigner
MessageSigner? Required if a private key was not provided in the constructor (optional, defaultthis.signer
)
const wallet = await authenticatedClient.associateWallet(
{
nonce: uuidv1(),
wallet: '0xA71C4aeeAabBBB8D2910F41C2ca3964b81F7310d',
},
idex.signatures.createPrivateKeyMessageSigner(config.walletPrivateKey),
);
Returns Promise<RestResponseAssociateWallet>
Create and submit an order to the matching engine.
order
RestRequestOrdersigner
MessageSigner? Required if a private key was not provided in the constructor (optional, defaultthis.signer
)
const order = await authenticatedClient.createOrder(
{
nonce: uuidv1(),
wallet: '0xA71C4aeeAabBBB8D2910F41C2ca3964b81F7310d',
market: 'IDEX-ETH',
type: 'limit',
side: 'sell',
price: '0.10000000',
quantity: '1.50000000',
},
idex.signatures.createPrivateKeyMessageSigner(config.walletPrivateKey),
);
Returns Promise<RestResponseOrder>
Tests order creation and validation without submitting an order to the matching engine
order
RestRequestOrdersigner
MessageSigner? Required if a private key was not provided in the constructor (optional, defaultthis.signer
)
const order = await authenticatedClient.createTestOrder(
{
nonce: uuidv1(),
wallet: '0xA71C4aeeAabBBB8D2910F41C2ca3964b81F7310d',
market: 'IDEX-ETH',
type: 'limit',
side: 'sell',
price: '0.10000000',
quantity: '1.50000000',
},
idex.signatures.createPrivateKeyMessageSigner(config.walletPrivateKey),
);
Returns Promise<RestResponseOrder>
Cancel a single order
cancelOrder
RestRequestCancelOrdersigner
MessageSigner? Required if a private key was not provided in the constructor (optional, defaultthis.signer
)
const responseByOrderId = await authenticatedClient.cancelOrder(
{
nonce: uuidv1(),
wallet: '0xA71C4aeeAabBBB8D2910F41C2ca3964b81F7310d',
orderId: 'f077a010-ce18-11ea-9557-a9d3f954788d',
},
idex.signatures.createPrivateKeyMessageSigner(config.walletPrivateKey),
);
const clientOrderId = '0001_23234_18863_IDEX_ETH';
const responseByClientId = await authenticatedClient.cancelOrder(
{
nonce: uuidv1(),
wallet: '0xA71C4aeeAabBBB8D2910F41C2ca3964b81F7310d',
orderId: `client:${clientOrderId}`,
},
idex.signatures.createPrivateKeyMessageSigner(config.walletPrivateKey),
);
Returns Promise<RestResponseCanceledOrder>
Cancel multiple orders
cancelOrders
RestResponseCanceledOrdersigner
MessageSigner? Required if a private key was not provided in the constructor (optional, defaultthis.signer
)
const allOrders = authenticatedClient.cancelOrders(
{
nonce: uuidv1(),
wallet: '0xA71C4aeeAabBBB8D2910F41C2ca3964b81F7310d',
},
idex.signatures.createPrivateKeyMessageSigner(config.walletPrivateKey),
);
const ordersForMarket = authenticatedClient.cancelOrders(
{
nonce: uuidv1(),
wallet: '0xA71C4aeeAabBBB8D2910F41C2ca3964b81F7310d',
market: 'IDEX-ETH'
},
idex.signatures.createPrivateKeyMessageSigner(config.walletPrivateKey),
);
Returns Promise<RestResponseCanceledOrder>
Get an order
findOrder
RestRequestFindOrder
Returns Promise<RestResponseOrder>
Get multiple orders
findOrders
RestRequestFindOrders
Returns Promise<Array<RestResponseOrder>>
Get a fill
findFill
RestRequestFindFill
Returns Promise<RestResponseFill>
Get multiple fills
findFills
RestRequestFindFills
Returns Promise<Array<RestResponseFill>>
Get a deposit
findDeposit
RestRequestFindDeposit
Returns Promise<RestResponseDeposit>
Get multiple deposits
findDeposits
RestRequestFindDeposits
Returns Promise<Array<RestResponseDeposit>>
Create a new withdrawal
withdrawal
RestRequestWithdrawalsigner
MessageSigner? Required if a private key was not provided in the constructor (optional, defaultthis.signer
)
const withdrawal = await authenticatedClient.withdraw(
{
nonce: uuidv1(),
wallet: '0xA71C4aeeAabBBB8D2910F41C2ca3964b81F7310d',
asset: 'MATIC',
quantity: '0.04000000',
},
idex.signatures.createPrivateKeyMessageSigner(config.walletPrivateKey),
);
Returns Promise<RestResponseWithdrawal>
Get a withdrawal
findWithdrawal
RestRequestFindWithdrawal
Returns Promise<RestResponseWithdrawal>
Get multiple withdrawals
findWithdrawals
RestRequestFindWithdrawals
Returns Promise<Array<RestResponseWithdrawal>>
Obtain a WebSocket API token
Authenticated API client configuration options.
Type: Object
apiKey
string Used to authenticate userapiSecret
string Used to compute HMAC signaturewalletPrivateKey
string? If provided, used to create ECDSA signaturessandbox
boolean? If true, client will point to API sandboxmultiverseChain
MultiverseChain? Which multiverse chain the client will point to
import { WebSocketClient } from '@idexio/idex-sdk';
WebSocket API client
When apiKey and apiSecret are provided, the client will automatically handle WebSocket authentication token generation and refresh. Omit when using only public WebSocket subscriptions.
options
WebSocketClientOptions
import * as idex from '@idexio/idex-sdk';
const webSocketClient = new idex.WebSocketClient({
// Edit the values before for your environment
apiKey: '1f7c4f52-4af7-4e1b-aa94-94fac8d931aa',
apiSecret: 'axuh3ywgg854aq7m73oy6gnnpj5ar9a67szuw5lclbz77zqu0j',
shouldReconnectAutomatically: true,
sandbox: true,
});
await webSocketClient.connect();
Subscribe to a given set of subscriptions, optionally providing a list of top level markets or a cid property.
subscriptions
Array<AuthTokenWebSocketRequestAuthenticatedSubscription>markets
Array<string>? Optionally provide top level marketscid
string? A custom identifier to identify the matching response
Returns this
Strictly typed subscribe which only can be used on authenticated subscriptions.
For this methods you need to pass websocketAuthTokenFetch
to the websocket constructor.
Library will automatically refresh user's wallet auth tokens for you.
subscriptions
Array<AuthTokenWebSocketRequestAuthenticatedSubscription>markets
Array<string>? Optionally provide top level marketscid
string? A custom identifier to identify the matching response
Returns this
Subscribe which only can be used on non-authenticated subscriptions
subscriptions
Array<WebSocketRequestUnauthenticatedSubscription>markets
Array<string>? Optionally provide top level marketscid
string? A custom identifier to identify the matching response
Returns this
WebSocket API client options
Type: Object
apiKey
string? Used to authenticate user when automatically refreshing WS tokenapiSecret
string? Used to compute HMAC signature when automatically refreshing WS token receiving push updates. Eg. {market}@{subscription}_{option}shouldReconnectAutomatically
boolean? If true, automatically reconnects when connection is closed by the server or network errorsconnectTimeout
number? Timeout (in milliseconds) before failing when trying to connect to the WebSocket. Defaults to 5000.sandbox
boolean? If true, client will point to API sandboxmultiverseChain
MultiverseChain? Which multiverse chain the client will point to
import { OrderBookRealTimeClient } from '@idexio/idex-sdk';
Extends EventEmitter
Orderbook API client
options
OrderBookRealTimeClientOptionsfeesAndMinimumsOverride
OrderBookFeesAndMinimums?
import { OrderBookRealTimeClient } from '@idexio/idex-sdk';
const client = new OrderBookRealTimeClient({
multiverseChain: 'matic',
sandbox: false,
});
const markets = ['IDEX-USD'];
client.start(markets);
function handleOrderBook(l2: L2OrderBook) {
const l2 = await client.getOrderBookLevel2('IDEX-USD', 10);
}
client.on('ready', handleOrderBook);
client.on('l2Changed', handleOrderBook);
Loads initial state from REST API and begin listening to orderbook updates.
Returns Promise<void>
Stop the order book client, and reset internal state. Call this when you are no longer using the client, to release memory and network resources.
Returns void
Set custom fee rates for synthetic price level calculations. Use this if your wallet has custom fees set.
feesAndMinimumsOverride
Partial<OrderBookFeesAndMinimums>rates
Partial<OrderBookFeeRates>
Returns void
Load the current state of the level 1 orderbook for this market.
market
stringtickSize
number minimum price movement expressed in pips (10^-8) (optional, default1
)
Returns RestResponseOrderBookLevel1
Load the current state of the level 2 orderbook for this market.
market
stringlimit
number Total number of price levels (bids + asks) to return, between 2 and 1000 (optional, default100
)tickSize
number minimum price movement expressed in pips (10^-8) (optional, default1
)
Returns Promise<RestResponseOrderBookLevel2>
Orderbook Client Options
Type: Object
apiKey
string? Increases rate limits if providedconnectTimeout
number? Connection timeout for websocket (default 5000)sandbox
boolean? If true, client will point to API sandboxmultiverseChain
MultiverseChain? Which multiverse chain the client will point to
Sets of named constants used as field types for several requests and responses
Type: string
Type: string
Type: string
Type: string
Type: string
Type: string
Type: string
Type: string
Type: string
Either not yet submitted or not yet mined
Type: string
Mined, no need for any block confirmation delay
Type: string
Transaction reverted
Type: string
Type: string
Maker provides liquidity
Type: string
Taker removes liquidity
Type: string
Type: string
No orders or cancels accepted
Type: string
Cancels accepted but not trades
Type: string
Cancels and limitMaker orders only
Type: string
Trades and cancels accepted
Type: string
Hybrid trades and cancels accepted
Type: string
Type: string
Decrement And Cancel (DC) - When two orders from the same user cross, the smaller order will be canceled and the larger order size will be decremented by the smaller order size. If the two orders are the same size, both will be canceled.
Type: string
Cancel Oldest (CO) - Cancel the older (maker) order in full
Type: string
Cancel Newest (CN) - Cancel the newer, taker order and leave the older, resting order on the order book. This is the only valid option when time-in-force is set to fill or kill
Type: string
Cancel Both (CB) - Cancel both orders
Type: string
Type: string
Type: string
Type: string
Type: string
An order without a stop has been accepted into the trading engine. Will not be sent as a discrete change event if the order matches on execution.
Type: string
A stop order has accepted into the trading engine, once triggered, will go through other normal events starting with new
Type: string
An order has generated a fill, both on maker and taker sides. Will be the first change event sent if an order matches on execution.
Type: string
An order is canceled by the user.
Type: string
LIMIT FOK orders with no fill, LIMIT IOC or MARKET orders that partially fill, GTT orders past time.
Type: string
Type: string
Stop order exists on the order book
Type: string
Limit order exists on the order book
Type: string
Limit order has completed fills but has remaining open quantity
Type: string
Limit order is completely filled and is no longer on the book; market order was filled
Type: string
Limit order was canceled prior to execution completion but may be partially filled
Type: string
Order was rejected by the trading engine
Type: string
GTT limit order expired prior to execution completion but may be partially filled
Type: string
Order submitted to the test endpoint and accepted by the trading engine, not executed
Type: string
Order submitted to the test endpoint and rejected by validation or the trading engine, not executed
Type: string
Type: string
Good until canceled (default)
Type: string
Good until time
Type: string
Immediate or cancel
Type: string
Fill or kill
Type: string
Type: string
Type: string
Type: string
Type: string
Type: string
Type: string
Type: string
Type: string
Type: Object
nonce
string UUIDv1wallet
stringorderId
string? Single orderId or clientOrderId to cancel; prefix client-provided ids with client:market
string? Base-quote pair e.g. 'IDEX-ETH'
Type: Object
Type: Object
market
string Base-quote pair e.g. 'IDEX-ETH'interval
CandleInterval Time interval for datastart
number? Starting timestamp (inclusive)end
number? Ending timestamp (inclusive)limit
number? Max results to return from 1-1000
Type: Object
Type: Object
nonce
string UUIDv1wallet
stringasset
string? Asset by symbolstart
number? Starting timestamp (inclusive)end
number? Ending timestamp (inclusive)limit
number? Max results to return from 1-1000fromId
string? Deposits created at the same timestamp or after fromId
Type: Object
Type: Object
nonce
string UUIDv1wallet
string Ethereum wallet addressmarket
string Base-quote pair e.g. 'IDEX-ETH'start
number? Starting timestamp (inclusive)end
number? Ending timestamp (inclusive)limit
number? Max results to return from 1-1000fromId
string? Fills created at the same timestamp or after fillId
Type: Object
market
string Target market, all markets are returned if omitted
Type: Object
nonce
string UUIDv1wallet
stringorderId
string Single orderId or clientOrderId to cancel; prefix client-provided ids with client:
Type: Object
nonce
string UUIDv1wallet
stringmarket
string? Base-quote pair e.g. 'IDEX-ETH'closed
boolean? false only returns active orders on the order book; true only returns orders that are no longer on the order book and resulted in at least one fill; only applies if orderId is absentstart
number? Starting timestamp (inclusive)end
number? Ending timestamp (inclusive)limit
number? Max results to return from 1-1000fromId
string? orderId of the earliest (oldest) order, only applies if orderId is absent
Type: Object
market
string Base-quote pair e.g. 'IDEX-ETH'start
number? Starting timestamp (inclusive)end
number? Ending timestamp (inclusive)limit
number? Max results to return from 1-1000fromId
string? Trades created at the same timestamp or after fromId
Type: Object
Type: Object
nonce
string UUIDv1wallet
stringasset
string? Asset by symbolassetContractAddress
string? Asset by contract addressstart
number? Starting timestamp (inclusive)end
number? Ending timestamp (inclusive)limit
number? Max results to return from 1-1000fromId
string? Withdrawals created after the fromId
Type: Object
nonce
string UUIDv1wallet
stringmarket
string Base-quote pair e.g. 'IDEX-ETH'type
OrderTypeside
OrderSidequantity
string? Order quantity in base terms, exclusive with quoteOrderQuantityquoteOrderQuantity
string? Order quantity in quote terms, exclusive with quantityprice
string? Price in quote terms, optional for market ordersstopPrice
string? Stop loss or take profit price, only if stop or take orderclientOrderId
string? Client-supplied order idtimeInForce
OrderTimeInForce? Defaults to good until canceledselfTradePrevention
OrderSelfTradePrevention? Defaults to decrease and cancel
Type: Object
nonce
string UUIDv1wallet
stringasset
string? Asset by symbolassetContractAddress
string? Asset by contract addressquantity
string Withdrawal amount in asset terms, fees are taken from this value
Type: Object
The wallet to associate with the authenticated account.
Type: string
Asset
Type: Object
name
stringsymbol
stringcontractAddress
stringassetDecimals
numberexchangeDecimals
numbermaticPrice
string
Balance
Type: Object
asset
string Asset symbolquantity
string Total quantity of the asset held by the wallet on the exchangeavailableForTrade
string Quantity of the asset available for trading; quantity - lockedlocked
string Quantity of the asset held in trades on the order bookusdValue
(string | null) Total value of the asset held by the wallet on the exchange in USD
Candle (OHLCV) data points aggregated by time interval
Type: Object
start
number Time of the start of the intervalopen
string Price of the first fill of the interval in quote termshigh
string Price of the highest fill of the interval in quote termslow
string Price of the lowest fill of the interval in quote termsclose
string Price of the last fill of the interval in quote termsvolume
string Total volume of the period in base termssequence
number Fill sequence number of the last trade in the interval
Asset deposits into smart contract
Type: Object
depositId
string IDEX-issued deposit identifierasset
string Asset by symbolquantity
string Deposit amount in asset termstxId
string Ethereum transaction hashtxTime
number Timestamp of the Ethereum deposit transactionconfirmationTime
number Timestamp of credit on IDEX including block confirmations
Basic exchange info
Type: Object
timeZone
string Server time zone, always UTCserverTime
number Current server timematicDepositContractAddress
string Polygon address of the exchange smart contract for depositsmaticCustodyContractAddress
string Polygon address of the custody smart contract for certain add and remove liquidity callsmaticUsdPrice
string Current price of MATIC in USDgasPrice
number Current gas price used by the exchange for trade settlement and withdrawal transactions in Gweivolume24hUsd
string Total exchange trading volume for the trailing 24 hours in USDtotalVolumeUsd
string Total exchange trading volume for IDEX v3 on Polygon in USDtotalTrades
number Total number of trade executions for IDEX v3 on PolygontotalValueLockedUsd
string Total value locked in IDEX v3 on Polygon in USDidexTokenAddress
string Token contract address for the IDEX token on PolygonidexUsdPrice
string Current price of the IDEX token in USDidexMarketCapUsd
string Market capitalization of the IDEX token in USDmakerFeeRate
string Maker trade fee ratetakerFeeRate
string Total taker trade fee ratetakerIdexFeeRate
string Taker trade fee rate collected by IDEX; used in computing synthetic price levels for real-time order bookstakerLiquidityProviderFeeRate
string Taker trade fee rate collected by liquidity providers; used in computing synthetic price levels for real-time order booksmakerTradeMinimum
string Minimum size of an order that can rest on the order book in MATIC, applies to both MATIC and tokenstakerTradeMinimum
string Minimum order size that is accepted by the matching engine for execution in MATIC, applies to both MATIC and tokenswithdrawMinimum
string Minimum withdrawal amount in MATIC, applies to both MATIC and tokensliquidityAdditionMinimum
string Minimum liquidity addition amount in MATIC, applies to both MATIC and tokensliquidityRemovalMinimum
string Minimum withdrawal amount in MATIC, applies to both MATIC and tokensblockConfirmationDelay
number Minimum number of block confirmations before on-chain transactions are processed
Fill
Type: Object
fillId
string Internal ID of fillprice
string Executed price of fill in quote termsquantity
string Executed quantity of fill in base termsquoteQuantity
string Executed quantity of fill in quote termsorderBookQuantity
string? Quantity of the fill in base terms supplied by order book liquidity, omitted for pool fillsorderBookQuoteQuantity
string? Quantity of the fill in quote terms supplied by order book liquidity, omitted for pool fillspoolQuantity
string? Quantity of the fill in base terms supplied by pool liquidity, omitted for orderBook fillspoolQuoteQuantity
string? Quantity of the fill in quote terms supplied by pool liquidity, omitted for orderBook fillstime
string Fill timestampmakerSide
OrderSide Which side of the order the liquidity maker was onsequence
number Last trade sequence number for the marketmarket
string Base-quote pair e.g. 'IDEX-ETH'orderId
string Internal ID of orderclientOrderId
string? Client-provided ID of orderside
OrderSide Orders side, buy or sellfee
string Fee amount on fillfeeAsset
string Which token the fee was taken ingas
string Amount collected to cover trade settlement gas costs, only present for takerliquidity
Liquidity Whether the fill is the maker or taker in the trade from the perspective of the requesting API account, maker or takertype
TradeType Fill typetxId
(string | null) Ethereum transaction ID, if availabletxStatus
string Ethereum transaction status
Market
Type: Object
market
string Market symboltype
MarketType Market typestatus
MarketStatus Market trading statusbaseAsset
string Base asset symbolbaseAssetPrecision
number Exchange decimal precision of the base asset, always 8 due to precision normalizationquoteAsset
string Quote asset symbolquoteAssetPrecision
number Exchange decimal precision of the base asset, always 8 due to precision normalizationmakerFeeRate
string Maker trade fee ratetakerFeeRate
string Total taker trade fee ratetakerIdexFeeRate
string Taker trade fee rate collected by IDEX; used in computing synthetic price levels for real-time order bookstakerLiquidityProviderFeeRate
string Taker trade fee rate collected by liquidity providers; used in computing synthetic price levels for real-time order bookstickSize
string Market tick size (minimum change in order price)
Order
Type: Object
market
string Market symbol as base-quote pair e.g. 'IDEX-ETH'orderId
string Exchange-assigned order identifierclientOrderId
string? Client-specified order identifierwallet
string Ethereum address of placing wallettime
string Time of initial order processing by the matching enginestatus
OrderStatus Current order statuserrorCode
string? Error short code explaining order error or failed batch cancelerrorMessage
string? Error description explaining order error or failed batch canceltype
OrderType Order typeside
OrderSide Order sideoriginalQuantity
string? Original quantity specified by the order in base terms, omitted for market orders specified in quote termsoriginalQuoteQuantity
string? Original quantity specified by the order in quote terms, only present for market orders specified in quote termsexecutedQuantity
string Quantity that has been executed in base termscumulativeQuoteQuantity
string? Cumulative quantity that has been spent (buy orders) or received (sell orders) in quote terms, omitted if unavailable for historical ordersavgExecutionPrice
string? Weighted average price of fills associated with the order; only present with fillsprice
string? Original price specified by the order in quote terms, omitted for all market ordersstopPrice
string? Stop loss or take profit price, only present for stopLoss, stopLossLimit, takeProfit, and takeProfitLimit orderstimeInForce
OrderTimeInForce? Time in force policy, see values, only present for limit ordersselfTradePrevention
OrderSelfTradePrevention Self-trade prevention policy, see valuesfills
Array<RestResponseOrderFill>? Array of order fill objects
Response to "cancel order" requests (single or multiple orders). Includes
one { orderId: string }
object for each successfully canceled order.
OrderBookLevel1
Type: Object
sequence
numberbids
([RestResponseOrderBookPriceLevel] | [])asks
([RestResponseOrderBookPriceLevel] | [])pool
(RestResponseLiquidityPoolReserves | null)
OrderBookLevel2
Type: Object
sequence
numberbids
Array<RestResponseOrderBookPriceLevel>asks
Array<RestResponseOrderBookPriceLevel>pool
(RestResponseLiquidityPoolReserves | null)
OrderBookPriceLevel
price and size as decimal strings numorders = # of limit orders at this price level (0 for synthetic levels)
Type: [Price, Size, NumOrders]
OrderFill
Type: Object
fillId
string Internal ID of fillprice
string Executed price of fill in quote termsquantity
string Executed quantity of fill in base termsquoteQuantity
string Executed quantity of trade in quote termsorderBookQuantity
string? Quantity of the fill in base terms supplied by order book liquidity, omitted for pool fillsorderBookQuoteQuantity
string? Quantity of the fill in quote terms supplied by order book liquidity, omitted for pool fillspoolQuantity
string? Quantity of the fill in base terms supplied by pool liquidity, omitted for orderBook fillspoolQuoteQuantity
string? Quantity of the fill in quote terms supplied by pool liquidity, omitted for orderBook fillstime
string Fill timestampmakerSide
OrderSide Which side of the order the liquidity maker was onsequence
number Last trade sequence number for the marketfee
string Fee amount on fillfeeAsset
string Which token the fee was taken ingas
string?liquidity
Liquiditytype
TradeType orderBook, pool, or hybridtxId
(string | null) Ethereum transaction ID, if availabletxStatus
string Ethereum transaction status
Ping
Type: Object
Ticker
Type: Object
market
string Base-quote pair e.g. 'IDEX-ETH'time
number Time when data was calculated, open and change is assumed to be trailing 24hopen
(string | null) Price of the first trade for the period in quote termshigh
(string | null) Highest traded price in the period in quote termslow
(string | null) Lowest traded price in the period in quote termsclose
(string | null) Same as lastcloseQuantity
(string | null) Quantity of the last period in base termsbaseVolume
string 24h volume in base termsquoteVolume
string 24h volume in quote termspercentChange
string % change from open to closenumTrades
number Number of fills for the market in the periodask
(string | null) Best ask price on the order bookbid
(string | null) Best bid price on the order booksequence
(number | null) Last trade sequence number for the market
Time
Type: Object
time
number Current server time
Trade
Type: Object
fillId
string Internal ID of fillprice
string Executed price of trade in quote termsquantity
string Executed quantity of trade in base termsquoteQuantity
string Executed quantity of trade in quote termstime
number Fill timestampmakerSide
OrderSide Which side of the order the liquidity maker was ontype
TradeType orderBook, pool, or hybridsequence
number Last trade sequence number for the market
User
Type: Object
depositEnabled
boolean Deposits are enabled for the user accountorderEnabled
boolean Placing orders is enabled for the user accountcancelEnabled
boolean Cancelling orders is enabled for the user accountwithdrawEnabled
boolean Withdrawals are enabled for the user accounttotalPortfolioValueUsd
string Total value of all holdings deposited on the exchange, for all wallets associated with the user account, in USDmakerFeeRate
string User-specific maker trade fee ratetakerFeeRate
string User-specific taker trade fee ratetakerIdexFeeRate
string User-specific liquidity pool taker IDEX fee ratetakerLiquidityProviderFeeRate
string User-specific liquidity pool taker LP provider fee rate
Type: Object
address
string Ethereum address of the wallettotalPortfolioValueUsd
string Total value of all holdings deposited on the exchange for the wallet in USDtime
number Timestamp of association of the wallet with the user account
Type: Object
token
string WebSocket subscription authentication token
Type: Object
withdrawalId
string Exchange-assigned withdrawal identifierasset
string? Symbol of the withdrawn asset, exclusive with assetContractAddressassetContractAddress
string? Token contract address of withdrawn asset, exclusive with assetquantity
string Quantity of the withdrawaltime
number Timestamp of withdrawal API requestfee
string Amount deducted from withdrawal to cover IDEX-paid gastxId
(string | null) Ethereum transaction ID, if availabletxStatus
string Ethereum transaction status
Type: Object
address
string Ethereum address of the wallettotalPortfolioValueUsd
string Total value of all holdings deposited on the exchange for the wallet in USDtime
number Timestamp of association of the wallet with the user account
Type: Object
name
"orders"
The name of the subscriptionwallet
string Orders subscription withwallet
attribute, which is fed to thewebsocketAuthTokenFetch
function when needed to get an updatedwsToken
.
Note: This property is not sent over the WebSocket and is exclusive to the idex-sdk.
Type: Object
name
"balances"
The name of the subscriptionwallet
string Balances subscription withwallet
attribute, which is fed to thewebsocketAuthTokenFetch
function when needed to get an updatedwsToken
.
Note: This property is not sent over the WebSocket and is exclusive to the idex-sdk.
TickersSubscription
Type: Object
CandlesSubscription
Type: Object
TradesSubscription
Type: Object
L1OrderBookSubscription
Type: Object
L2OrderBookSubscription
Type: Object
BalancesSubscription
Type: Object
OrdersSubscription
Type: Object
Error Response
Type: Object
Subscriptions Response
Type: Object
cid
string?method
string subscriptionssubscriptions
Array<WebSocketRequestSubscription>
TickerShort
Type: Object
m
string (market) Market symbolt
number (time) Timestamp when the statistics were computed, the opening time of the period is 24 hours prioro
(string | null) (open) Price of the first trade in the period in quote termsh
(string | null) (high) Highest traded price in the period in quote termsl
(string | null) (low) Lowest traded price in the period in quote termsc
(string | null) (close) Price of the last trade in the period in quote termsQ
(string | null) (closeQuantity) Quantity of the last trade in th period in base termsv
string (baseVolume) Trailing 24-hour trading volume in base termsq
string (quoteVolume) Trailing 24-hour trading volume in quote termsP
string (percentChange) Percentage change from open price to close pricen
number (numTrades) Number of trades in the perioda
(string | null) (ask) Best ask price on the order book in quote termsb
(string | null) (bid) Best bid price on the order book in quote termsu
(number | null) (sequence) Fill sequence number of the last trade in the period
TickerLong
Type: Object
market
string Market symboltime
number Timestamp when the statistics were computed, the opening time of the period is 24 hours prioropen
(string | null) Price of the first trade in the period in quote termshigh
(string | null) Highest traded price in the period in quote termslow
(string | null) Lowest traded price in the period in quote termsclose
(string | null) Price of the last trade in the period in quote termscloseQuantity
(string | null) Quantity of the last trade in th period in base termsbaseVolume
string Trailing 24-hour trading volume in base termsquoteVolume
string Trailing 24-hour trading volume in quote termspercentChange
string Percentage change from open price to close pricenumTrades
number Number of trades in the periodask
(string | null) Best ask price on the order book in quote termsbid
(string | null) Best bid price on the order book in quote termssequence
(number | null) Fill sequence number of the last trade in the period
CandleShort
Type: Object
m
string (market) Market symbolt
number (time) Timestamp when the statistics were computed, time is always between the start and end timestamps of the intervali
string (interval) Interval duration, see Interval Valuess
number (start) Timestamp of the start of the intervale
number (end) Timestamp of the end of the intervalo
string (open) Price of the first trade in the interval in quote termsh
string (high) Highest traded price in the interval in quote termsl
string (low) Lowest traded price in the interval in quote termsc
string (close) Price of the last trade in the interval in quote termsv
string (volume) Trading volume in the interval in base termsn
number (numTrades) Number of trades in the candleu
number (sequence) Fill sequence number of the last trade in the interval
CandleLong
Type: Object
market
string Market symboltime
number Timestamp when the statistics were computed, time is always between the start and end timestamps of the intervalinterval
string Interval duration, see Interval Valuesstart
number Timestamp of the start of the intervalend
number Timestamp of the end of the intervalopen
string Price of the first trade in the interval in quote termshigh
string Highest traded price in the interval in quote termslow
string Lowest traded price in the interval in quote termsclose
string Price of the last trade in the interval in quote termsvolume
string Trading volume in the interval in base termsnumTrades
number Number of trades in the candlesequence
number Fill sequence number of the last trade in the interval
TradeShort
Type: Object
y
string (type) orderBook, pool, or hybridm
string (market) Market symboli
string (fillId) Trade identifierp
string (price) Price of the trade in quote termsq
string (quantity) Quantity of the trade in base termsQ
string (quoteQuantity) Quantity of the trade in quote termst
number (time) Timestamp of the trades
string (makerSide) Maker side of the trade, buy or sellu
number (sequence) Fill sequence number of the trade
TradeLong
Type: Object
market
string Market symbolfillId
string Trade identifierprice
string Price of the trade in quote termsquantity
string Quantity of the trade in base termsquoteQuantity
string Quantity of the trade in quote termstime
number Timestamp of the trademakerSide
string Maker side of the trade, buy or sellsequence
number Fill sequence number of the trade
L1OrderBookShort
Type: Object
m
string (market) Market symbolt
number (time) Timestamp of the order book updateb
string (bidPrice) Best bid priceB
string (bidQuantity) Quantity available at the best bid pricea
string (askPrice) Best ask priceA
string (askQuantity) Quantity available at the best ask pricep
(WebSocketResponseLiquidityPoolShort | null) Liquidity pool reserves for this market
L1OrderBookLong
Type: Object
market
string Market symboltime
number Timestamp of the order book updatebidPrice
string Best bid pricebidQuantity
string Quantity available at the best bid priceaskPrice
string Best ask priceaskQuantity
string Quantity available at the best ask pricepool
(WebSocketResponseLiquidityPoolLong | null) Liquidity pool reserves for this market
L2OrderBookShort
Type: Object
m
string (market) Market symbolt
number (time) Timestamp of the order book updateu
number (sequence) Order book update sequence number of the updateb
Array<WebSocketResponseL2OrderBookChange> (bids) Array of bid price level updatesa
Array<WebSocketResponseL2OrderBookChange> (asks) Array of ask price level updatesp
(WebSocketResponseLiquidityPoolShort | null) Liquidity pool reserves for this market
L2OrderBookLong
Type: Object
market
string Market symboltime
number Timestamp of the order book updatesequence
number Order book update sequence number of the updatebids
Array<WebSocketResponseL2OrderBookChange> Array of bid price level updatesasks
Array<WebSocketResponseL2OrderBookChange> Array of ask price level updatesp
(WebSocketResponseLiquidityPoolLong | null) Liquidity pool reserves for this market
BalanceShort
Type: Object
w
string (wallet) Target wallet addressa
string (asset) Asset symbolq
string (quantity) Total quantity of the asset held by the wallet on the exchangef
string (availableForTrade) Quantity of the asset available for trading; quantity - lockedl
string (locked) Quantity of the asset held in trades on the order bookd
string (usdValue) Total value of the asset held by the wallet on the exchange in USD
BalanceLong
Type: Object
wallet
string Target wallet addressasset
string Asset symbolquantity
string Total quantity of the asset held by the wallet on the exchangeavailableForTrade
string Quantity of the asset available for trading; quantity - lockedlocked
string Quantity of the asset held in trades on the order bookusdValue
string Total value of the asset held by the wallet on the exchange in USD
OrderShort
Type: Object
m
string (market) Market symboli
string (orderId) Exchange-assigned order identifierc
string? (clientOrderId) Client-specified order identifierw
string (wallet) Ethereum address of placing wallett
string (executionTime) Timestamp of the most recent updateT
number (time) Timestamp of initial order processing by the matching enginex
OrderStateChange (update) Type of order update, see valuesX
OrderStatus (status) Order status, see valuesu
number? (sequence) order book update sequence number, only included if update type triggers an order book updateo
OrderType (type) Order type, see valuesS
OrderSide (side) Order side, buy or sellq
string? (originalQuantity) Original quantity specified by the order in base terms, omitted for market orders specified in quote termsQ
string? (originalQuoteQuantity) Original quantity specified by the order in quote terms, only present for market orders specified in quote termsz
string (executedQuantity) Quantity that has been executed in base termsZ
string? (cumulativeQuoteQuantity) Cumulative quantity that has been spent (buy orders) or received (sell orders) in quote terms, omitted if unavailable for historical ordersv
string? (avgExecutionPrice) Weighted average price of fills associated with the order; only present with fillsp
string? (price) Original price specified by the order in quote terms, omitted for all market ordersP
string? (stopPrice) Stop loss or take profit price, only present for stopLoss, stopLossLimit, takeProfit, and takeProfitLimit ordersf
OrderTimeInForce? (timeInForce) Time in force policy, see values, only present for limit ordersV
OrderSelfTradePrevention (selfTradePrevention) Self-trade prevention policy, see valuesF
Array<WebSocketResponseOrderFillShort>? (fills) Array of order fill objects
OrderLong
Type: Object
market
string Market symbolorderId
string Exchange-assigned order identifierclientOrderId
string? Client-specified order identifierwallet
string Ethereum address of placing walletexecutionTime
string Timestamp of the most recent updatetime
number Timestamp of initial order processing by the matching engineupdate
string Type of order update, see valuesstatus
OrderStatus Order status, see valuessequence
number? order book update sequence number, only included if update type triggers an order book updatetype
OrderType Order type, see valuesside
OrderSide Order side, buy or selloriginalQuantity
string? Original quantity specified by the order in base terms, omitted for market orders specified in quote termsoriginalQuoteQuantity
string? Original quantity specified by the order in quote terms, only present for market orders specified in quote termsexecutedQuantity
string Quantity that has been executed in base termscumulativeQuoteQuantity
string? Cumulative quantity that has been spent (buy orders) or received (sell orders) in quote terms, omitted if unavailable for historical ordersavgExecutionPrice
string? Weighted average price of fills associated with the order; only present with fillsprice
string? Original price specified by the order in quote terms, omitted for all market ordersstopPrice
string? Stop loss or take profit price, only present for stopLoss, stopLossLimit, takeProfit, and takeProfitLimit orderstimeInForce
OrderTimeInForce? Time in force policy, see values, only present for limit ordersselfTradePrevention
OrderSelfTradePrevention Self-trade prevention policy, see valuesfills
Array<RestResponseOrderFill>? Array of order fill objects
OrderFillShort
Type: Object
type
TradeType orderBook, pool, or hybridi
string (fillId) Fill identifierp
string (price) Price of the fill in quote termsq
string (quantity) Quantity of the fill in base termsQ
string (quoteQuantity) Quantity of the fill in quote termsoq
string? Quantity of the fill in base terms supplied by order book liquidity, omitted for pool fillsoQ
string? Quantity of the fill in quote terms supplied by order book liquidity, omitted for pool fillspq
string? Quantity of the fill in base terms supplied by pool liquidity, omitted for orderBook fillspQ
string? Quantity of the fill in quote terms supplied by pool liquidity, omitted for orderBook fillst
number (time) Timestamp of the fills
string (makerSide) Maker side of the fill, buy or sellu
string (sequence) Fill sequence numberf
string (fee) Fee amount collected on the filla
string (feeAsset) Symbol of asset in which fees collectedg
string? (gas) Amount collected to cover trade settlement gas costs, only present for takerl
string (liquidity) Whether the fill is the maker or taker in the trade from the perspective of the requesting user account, maker or takerT
string (txId) Ethereum ID of the trade settlement transactionS
string (txStatus) Status of the trade settlement transaction, see values
Type Guards are mostly useful for TypeScript users and can be used to refine general types when needing to parse or build the required values.
A type guard that checks if a given value is a subscription object which represents
an authenticated subscription. These subscriptions require the wallet
property
(local to idex-sdk only) and require that the WebSocketClient
was created
with the websocketAuthTokenFetch
function provided.
subscription
any
subscription
any The subscription to check
Returns any
A type guard that checks if a given value is a subscription object which represents an unauthenticated subscription.
subscription
any
subscription
any The subscription to check
Returns any
A type guard that checks if a given value is a subscription object which represents
a candles
subscription. This is useful as the candles subscription has the interval
property in addition to markets
and name
.
subscription
any
subscription
any The subscription to check
Returns any
A type guard which allows using a subscription object in a "loose" manner. This is less "safe" but can often be useful when parsing values where you do not need strict typing. When true, the provided value will be a "partial" shape of that conforms to any/all subscription objects.
This should be used lightly.
subscription
any
subscription
any The subscription to check
Returns any
A type guard which checks if a string is a valid candle interval.
value
any
value
string The subscription to check
Returns any
A function that accepts a string and returns a Promise resolving on its ECDSA signature
Type: Function
The possible error short codes when interacting with the IDEX API's.
Type: ("TOKEN_NOT_FOUND"
| "ORDER_NOT_FOUND"
| "MARKET_NOT_FOUND"
| "DEPOSIT_NOT_FOUND"
| "WITHDRAWAL_NOT_FOUND"
| "FILL_NOT_FOUND"
| "USER_NOT_FOUND"
| "ENDPOINT_NOT_FOUND"
| "EXCEEDED_RATE_LIMIT"
| "INSUFFICIENT_FUNDS"
| "USER_MIGRATION_REQUIRED"
| "WALLET_NOT_ASSOCIATED"
| "EMAIL_VERIFICATION_REQUIRED"
| "INVALID_WALLET_SIGNATURE"
| "INVALID_API_KEY"
| "REQUIRED_API_KEY"
| "INVALID_HMAC_SIGNATURE"
| "REQUIRED_HMAC_SIGNATURE"
| "REQUIRED_API_KEY_READ_SCOPE"
| "REQUIRED_API_KEY_TRADE_SCOPE"
| "REQUIRED_API_KEY_WITHDRAW_SCOPE"
| "TRADING_RESTRICTED_FOR_LOCATION"
| "EXCEEDED_WITHDRAWAL_LIMIT"
| "CANCELS_DISABLED"
| "TRADING_DISABLED"
| "WITHDRAWALS_DISABLED"
| "INTERNAL_SERVER_ERROR"
| "BAD_REQUEST"
| "SERVICE_UNAVAILABLE"
| "INVALID_API_VERSION"
| "REQUIRED_PARAMETER"
| "INVALID_PARAMETER"
| "INVALID_WITHDRAWAL_QUANTITY"
| "INVALID_ORDER_QUANTITY"
| "INVALID_ORDER_PRICE_CROSSES_SPREAD"
)
Determine whether two level 1 order books are equal, including pool reserves
beforeL1
L1OrderBookafterL1
L1OrderBook
Returns boolean
Derive the level 1 orderbook from a level 2 orderbook
l2
L2OrderBook
Returns L1OrderBook
Type: Object
baseReceived
bigint actual quantity received, in base units at the best available buy pricebestAvailableBuyPrice
bigint best available price for buy orders of the minimum sizebestAvailableSellPrice
bigint best available price for sell orders of the minimum sizequoteReceived
bigint actual quantity received, in quote units at the best available sell price
Type: Object
market
string? Target markettokenA
string? Address of one reserve tokentokenB
string? Address of one reserve token
Type: Object
sequence
numberasks
OrderBookLevelL1bids
OrderBookLevelL1pool
(PoolReserveQuantities | null)
Convert a limit-order orderbook and a liquidity pool to a hybrid order book representation
orderBook
L2OrderBook L2 book, e.g. from GET /v1/orderbook?level=2&limitOrderOnly=truevisibleLevels
number number of price levels to calculate, default = 10 asks, 10 bids (optional, default10
)visibleSlippage
number price slippage per level, in increments of 0.001%, default = 100 (0.1%) (optional, default100
)idexFeeRate
bigint trade fee rate charged by IDEX, expressed in pipspoolFeeRate
bigint pool fee rate chared by liquidity pool, expressed in pipsincludeMinimumTakerLevels
boolean if true, calculate a synthetic price level at twice the minimum trade sizeminimumTakerInQuote
(bigint | null) minimum trade size expressed in pips, or null if none availabletickSize
number minimum price movement expressed in pips (10^-8)
Returns {l1: L1OrderBook, l2: L2OrderBook}
Updates a level 2 orderbook using a partial "diff" received over websockets
book
L2OrderBookupdatedLevels
L2OrderBook level 2 orderbook containing only limit order price levels that have changed
Returns void orderbook is updated in-place
Type: Object
nonce
string UUIDv1wallet
string Ethereum wallet addresstokenA
string Asset by addresstokenB
string Asset by addressamountADesired
string Maximum amount of tokenA to add to the liquidity poolamountBDesired
string Maximum amount of tokenB to add to the liquidity poolamountAMin
string Minimum amount of tokenA to add to the liquidity poolamountBMin
string Minimum amount of tokenB to add to the liquidity poolto
string Wallet to credit LP tokens, or the custodian contract address to leave on exchange
Type: Object
sequence
numberasks
Array<OrderBookLevelL2>bids
Array<OrderBookLevelL2>pool
(PoolReserveQuantities | null)
Helper function to calculate gross base available at a bid price see: {quantitiesAvailableFromPoolAtBidPrice}
baseAssetQuantity
bigintquoteAssetQuantity
biginttargetPrice
bigintidexFeeRate
bigintpoolFeeRate
bigint
Returns bigint
TokenPriceSubscription
Type: Object
Returns an ethers Wallet signer which takes a message and signs it with the originally provided private key.
walletPrivateKey
string The private key to use when signing any given messages
const signMessage = createPrivateKeyMessageSigner(myPrivateKey)
const signed = await signMessage(myMessageToSign)
Returns MessageSigner
Applies a changeset to a single side of the orderbook
isAscending
boolean true for asks, false for bids (ordering of price levels)side
Array<OrderBookLevelL2>updates
Array<OrderBookLevelL2>
Returns Array<OrderBookLevelL2>
Type: Object
takerIdexFeeRate
string Taker trade fee rate collected by IDEX; used in computing synthetic price levels for real-time order bookstakerLiquidityProviderFeeRate
string Taker trade fee rate collected by liquidity providers; used in computing synthetic price levels for real-time order bookstakerTradeMinimum
string Minimum order size that is accepted by the matching engine for execution in MATIC, applies to both MATIC and tokensSee RestResponseExchangeInfo
Type: Object
nonce
string UUIDv1wallet
string Ethereum wallet addresstokenA
string Asset by addresstokenB
string Asset by addressliquidity
string LP tokens to burnamountAMin
string Minimum amount of tokenA to add to the liquidity poolamountBMin
string Minimum amount of tokenB to add to the liquidity poolto
string Wallet to credit LP tokens, or the custodian contract address to leave on exchange
- See: {createPrivateKeyMessageSigner}
Meta
- deprecated: use createPrivateKeyMessageSigner directly
Type: Object
Type: Object
price
bigintsize
bigintnumOrders
number
Helper function to convert from quote to base quantities see: {quantitiesAvailableFromPoolAtAskPrice}
baseAssetQuantity
bigintquoteAssetQuantity
bigintgrossQuoteQuantity
bigint
Returns bigint
Type: Object
nonce
string UUIDv1wallet
string Ethereum wallet addressliquidityAdditionId
string? Single liquidityAdditionId to return; exclusive with initiatingTxIdinitiatingTxId
string? Transaction id of the Exchange contract addLiquidity or addLiquidityETH call transaction, only applies to chain-initiated liquidity additions; exclusive with liquidityAdditionIdstart
number? Starting timestamp (inclusive)end
number? Ending timestamp (inclusive)limit
number? Max results to return from 1-1000fromId
string? Liquidity additions created at the same timestamp or after fromId
Type: Object
price
bigintsize
bigintnumOrders
numbertype
OrderBookLevelType
Helper function to calculate gross quote available at an ask price see: {quantitiesAvailableFromPoolAtAskPrice}
baseAssetQuantity
bigintquoteAssetQuantity
biginttargetPrice
bigintidexFeeRate
bigintpoolFeeRate
bigint
Returns bigint
Type: Object
baseReserveQuantity
bigintquoteReserveQuantity
bigint
Type: Object
nonce
string UUIDv1wallet
string Ethereum wallet addressliquidityRemovalId
string? Single liquidityRemovalId to return; exclusive with initiatingTxIdinitiatingTxId
string? Transaction id of the Exchange contract removeLiquidity or removeLiquidityETH call transaction, only applies to chain-initiated liquidity removals; exclusive with liquidityRemovalIdstart
number? Starting timestamp (inclusive)end
number? Ending timestamp (inclusive)limit
number? Max results to return from 1-1000fromId
string? Liquidity additions created at the same timestamp or after fromId
Type: Object
grossBase
bigintgrossQuote
bigint
Type: Object
nonce
string UUIDv1wallet
string Ethereum wallet addressstart
number? Starting timestamp (inclusive)end
number? Ending timestamp (inclusive)limit
number? Max results to return from 1-1000fromId
string? Deposits created at the same timestamp or after fromId
Helper function to convert from base to quote quantities see: {quantitiesAvailableFromPoolAtBidPrice}
baseAssetQuantity
bigintquoteAssetQuantity
bigintgrossBaseQuantity
bigint
Returns bigint
Type: string
Orderbook trades accepted
Type: string
Orderbook, pool, and hybrid trades accepted
Type: string
Given a taker order size expressed in quote, how much base is received from the pool
see: {L1orL2BestAvailablePrices}
baseAssetQuantity
bigintquoteAssetQuantity
bigintgrossQuoteQuantityIn
bigintidexFeeRate
bigintpoolFeeRate
bigint
Returns bigint
Type: string
Initiation on-chain via contract call
Type: string
Initiated off-chain via API
Type: string
Type: (WebSocketRequestBalancesSubscription | WebSocketRequestOrdersSubscription)
Type: (WebSocketRequestCandlesSubscription | WebSocketRequestL1OrderBookSubscription | WebSocketRequestL2OrderBookSubscription | WebSocketRequestTickersSubscription | WebSocketRequestTradesSubscription)
Type: string
Adding reserve assets to pool and minting LP tokens
Type: string
Removing reserve assets from pool and burning LP tokens
Type: string
Type: (AuthTokenWebSocketRequestBalancesSubscription | AuthTokenWebSocketRequestOrdersSubscription)
Given a taker order size expressed in base, how much quote is received from the pool
see: {L1orL2BestAvailablePrices}
baseAssetQuantity
bigintquoteAssetQuantity
bigintgrossBaseQuantityIn
bigintidexFeeRate
bigintpoolFeeRate
bigint
Returns bigint
Type: (AuthTokenWebSocketRequestAuthenticatedSubscription | WebSocketRequestUnauthenticatedSubscription)
The available multiverse chains to define when creating a client.
Type: "matic"
Type: (AuthTokenWebSocketRequestAuthenticatedSubscription | WebSocketRequestUnauthenticatedSubscription)
LiquidityPoolShort
Type: Object
q
string (baseReserveQuantity) quantity of base asset held in the liquidity poolQ
string (quoteReserveQuantity) quantity of quote asset held in the liquidity pool
The result needs to be rounded down to prevent the pool's constant product from decreasing, ie. the second part of the subtraction (the division) needs to be rounded up.
Liquidity Pool
Type: Object
tokenA
string Address of one reserve tokentokenB
string Address of one reserve tokenreserveA
string Quantity of token A held as reserve in token precision, not pipsreserveB
string Quantity of token B held as reserve in token precision, not pipsliquidityToken
string Address of the liquidity provider (LP) tokentotalLiquidity
string Total quantity of liquidity provider (LP) tokens minted in token precision, not pipsreserveUsd
string Total value of reserves in USDmarket
string Market symbol of pool’s associated hybrid market
LiquidityPoolLong
Type: Object
baseReserveQuantity
string quantity of base asset held in the liquidity poolquoteReserveQuantity
string quantity of quote asset held in the liquidity pool
Type: Object
balances
WebSocketRequestSubscriptionsByNameorders
WebSocketRequestOrdersSubscriptioncandles
WebSocketRequestCandlesSubscriptionl1orderbook
WebSocketRequestL1OrderBookSubscriptionl2orderbook
WebSocketRequestL2OrderBookSubscriptiontickers
WebSocketRequestTickersSubscriptiontrades
WebSocketRequestTradesSubscription
Generates a synthetic orderbook consisting of price levels for pool liquidity only
baseAssetQuantity
bigint pool reserve in base asset, must be at least 1.0 expressed in pips (10^-8)quoteAssetQuantity
bigint pool reserve in quote asset, must be at least 1.0 expressed in pips (10^-8)visibleLevels
number how many ask and bid price levels to generate (of each)visibleSlippage
number how much slippage per price level, in 1/1000th of a percent (100 = 0.1%)idexFeeRate
bigint? the idex fee rate to use for calculations (query /v1/exchange for current global setting) (optional, defaultBigInt(0)
)poolFeeRate
bigint? the liquidity pool fee rate to use for calculations (query /v1/exchange for current global setting) (optional, defaultBigInt(0)
)tickSize
number minimum price movement expressed in pips (10^-8) (optional, default1
)
Returns SyntheticL2OrderBook a level 2 order book with synthetic price levels only
LiquidityAddition
Type: Object
liquidityAdditionId
string Internal ID of liquidity additiontokenA
string Asset symboltokenB
string Asset symbolamountA
(string | null) Amount of tokenA added to the liquidity poolamountB
(string | null) Amount of tokenB added to the liquidity poolliquidity
(string | null) Amount of liquidity provided (LP) tokens mintedtime
number Liquidity addition timestampinitiatingTxId
(string | null) On chain initiated transaction ID, if availableerrorCode
string Error short code present on liquidity addition errorerrorMessage
string Human-readable error message present on liquidity addition errorfeeTokenA
(string | null) Amount of tokenA collected as feesfeeTokenB
(string | null) Amount of tokenB collected as feestxId
(string | null) Ethereum transaction ID, if availabletxStatus
(EthTransactionStatus | null) Ethereum transaction status
LiquidityPoolReserves
Type: Object
baseReserveQuantity
string reserve quantity of base asset in poolquoteReserveQuantity
string reserve quantity of quote asset in pool
L2OrderBookChange
Type: [string, string, number]
LiquidityRemoval
Type: Object
liquidityRemovalId
string Internal ID of liquidity removaltokenA
string Asset symboltokenB
string Asset symbolamountA
(string | null) Amount of tokenA added to the liquidity poolamountB
(string | null) Amount of tokenB added to the liquidity poolliquidity
(string | null) Amount of liquidity provided (LP) tokens mintedtime
number Liquidity addition timestampinitiatingTxId
(string | null) On chain initiated transaction ID, if availableerrorCode
string Error short code present on liquidity addition errorerrorMessage
string Human-readable error message present on liquidity addition errorfeeTokenA
(string | null) Amount of tokenA collected as feesfeeTokenB
(string | null) Amount of tokenB collected as feestxId
(string | null) Ethereum transaction ID, if availabletxStatus
(EthTransactionStatus | null) Ethereum transaction status
UnsubscribeRequest
Type: Object
method
string 'unsubscribe'cid
string? client-supplied request idmarkets
Array<string>? array of market symbolssubscriptions
Array<(WebSocketRequestUnsubscribeSubscription | WebSocketRequestUnsubscribeShortNames)>? array of subscription objects
Recalculate price level quantities for a book previously sorted with {sortAndMergeLevelsUnadjusted}
orderbook
L2OrderBook an unadjusted level 2 order book as returned by {sortAndMergeLevelsUnadjusted}idexFeeRate
bigint idex fee rate to use in pool quantity calculationspoolFeeRate
bigint pool fee rate to use in pool quantity calculations
Returns L2OrderBook the recalculated level 2 order book
SubscriptionsRequest
Type: Object
Type: (WebSocketRequestSubscribeStrict | WebSocketRequestSubscriptions | WebSocketRequestUnsubscribe)
Type: (WebSocketRequestSubscribe | WebSocketRequestSubscriptions | WebSocketRequestUnsubscribe)
Type: string
Type: string
Type: string
Type: string
Combines limit orders and synthetic price levels into an intermediate sorted state IMPORTANT: this function does not update price level quantities after merging
limitOrderLevels
Array<OrderBookLevelL2> a level 2 orderbook with only limit orderssyntheticLevels
Array<OrderBookLevelL2> a level 2 orderbook with only synthetic ordersisBefore
function (a: OrderBookLevelL2, b: OrderBookLevelL2): boolean
Returns Array<OrderBookLevelL2> a level 2 order book with synthetic price levels only
Helper function to calculate the asset quantities available at a given price level (pool liquidity only)
baseAssetQuantity
bigint pool reserve in base asset, must be at least 1.0 expressed in pips (10^-8)quoteAssetQuantity
bigint pool reserve in quote asset, must be at least 1.0 expressed in pips (10^-8)askPrice
bigint the ask price level to calculate quantities foridexFeeRate
bigint? the idex fee rate to use for calculations (query /v1/exchange for current global setting)poolFeeRate
bigint? the liquidity pool fee rate to use for calculations (query /v1/exchange for current global setting)
Returns PriceLevelQuantities a level 2 order book with synthetic price levels only
TokenPriceShort
Type: Object
TokenPriceLong
Type: Object
Short-hand response payloads
Type: ({type: "tickers"
, data: WebSocketResponseTickerShort} | {type: "trades"
, data: WebSocketResponseTradeShort} | {type: "candles"
, data: WebSocketResponseCandleShort} | {type: "l1orderbook"
, data: WebSocketResponseL1OrderBookShort} | {type: "l2orderbook"
, data: WebSocketResponseL2OrderBookShort} | {type: "balances"
, data: WebSocketResponseBalanceShort} | {type: "orders"
, data: WebSocketResponseOrderShort} | {type: "tokenprice"
, data: WebSocketResponseTokenPriceShort})
Transformer (long-form) response payloads
Type: ({type: "tickers"
, data: WebSocketResponseTickerLong} | {type: "trades"
, data: WebSocketResponseTradeLong} | {type: "candles"
, data: WebSocketResponseCandleLong} | {type: "l1orderbook"
, data: WebSocketResponseL1OrderBookLong} | {type: "l2orderbook"
, data: WebSocketResponseL2OrderBookLong} | {type: "balances"
, data: WebSocketResponseBalanceLong} | {type: "orders"
, data: WebSocketResponseOrderLong} | {type: "tokenprice"
, data: WebSocketResponseTokenPriceLong})
Helper function to calculate the asset quantities available at a given price level (pool liquidity only)
baseAssetQuantity
bigint pool reserve in base asset, must be at least 1.0 expressed in pips (10^-8)quoteAssetQuantity
bigint pool reserve in quote asset, must be at least 1.0 expressed in pips (10^-8)bidPrice
bigint the bid price level to calculate quantities foridexFeeRate
bigint? the idex fee rate to use for calculations (query /v1/exchange for current global setting)poolFeeRate
bigint? the liquidity pool fee rate to use for calculations (query /v1/exchange for current global setting)
Returns PriceLevelQuantities a level 2 order book with synthetic price levels only
Helper function to re-aggregate L2 orderbook price levels at a larger (more zeroes) tick size
inputBook
L2OrderBooktickSize
bigint
Returns L2OrderBook
Given a minimum taker order size, calculate the best achievable price level using pool liquidity only
pool
PoolReserveQuantities pool reserve quantities for the orderbook in questionidexFeeRate
bigint the idex fee rate to use for pool calculationspoolFeeRate
bigint the pool fee rate to use for pool calculationstakerMinimumInBase
bigint the minimum taker order size, expressed in base asset unitstakerMinimumInQuote
bigint the minimum taker order size, expressed in quote asset unitstickSize
bigint
Returns PriceLevelQuantities a level 2 order book with synthetic price levels only
Modifies an existing level 2 order book to include better price levels at the desired taker order size, if available from pool reserves
l2
L2OrderBookidexFeeRate
bigint the idex fee rate to use for pool calculationspoolFeeRate
bigint the pool fee rate to use for pool calculationstakerMinimumInQuote
bigint the minimum taker order size, expressed in quote asset unitstickSize
bigintpool
PoolReserveQuantities pool reserve quantities for the orderbook in question
Returns {l1: L1OrderBook, l2: L2OrderBook}
Validates assumptions for reserve quantities and pricing required for quantity calculations
baseAssetQuantity
bigint pool reserve in base asset, must be at least 1.0 expressed in pips (10^-8)quoteAssetQuantity
bigint pool reserve in quote asset, must be at least 1.0 expressed in pips (10^-8)targetPrice
bigint price expressed in pips, must be 0 < price < 2^64-1 and on the correct side of the spreadisBuy
boolean if true, the price is targeting buy orders (bids), otherwise sell orders (asks)
Returns void validation always succeeds or throws
Adjusts prices in pips to account for tick size by discarding insignificant digits using specified rounding mode. Ex price 123456789 at tick size 1 is 123456789, at tick size 10 123456780, at 100 123456700, etc
price
biginttickSize
bigintroundingMode
BigNumber.RoundingMode (optional, defaultBigNumber.ROUND_HALF_UP
)
Returns bigint