Documentation can be found here

REST client consists of the next clients:

public - public methods client;

orders - orders methods client;

trade - trade methods client;

user - user methods client.

Public Client

Order Rules

This endpoint provides all the values for the rules that an order needs to fulfill in order for it to be placed successfully

  await api.public.getSymbolOrderRules('SPOT_NEAR_USDC')
Parameter nameTypeIs required?Description
symbolstringYesSymbol for which to get order rules

Available Pairs

Get available symbols that Orderly Network supports, and also send order rules for each symbol

  await api.public.getAvailableSymbols()

Parameters: None

Fee Structure

Get the latest Orderly Network fee structure

  await api.public.getFeeInformation()

Parameters: None

Market Trades

Get the latest market trades

  await api.public.getMarketTrades('SPOT_NEAR_USDC', 10)
Parameter nameTypeIs required?Description
symbolstringYesFor which symbol to get latest market trades
limitnumberNoHow may records to return

Orders client

Create Order

  const order = {
    symbol: 'SPOT_NEAR_USDC',
    order_type: 'LIMIT',
    side: 'BUY',
    order_price: 1.11,
    order_quantity: 2.00000000
  }

  await api.orders.create(order)
Parameter nameTypeIs required?Description
symbolstringYesToken symbol
client_order_idstringNoCustomized order_id, a unique id among open orders
order_typeenumYesOrder type. Possible values are: LIMIT/MARKET/IOC/FOK/POST_ONLY/ASK/BID.
order_pricenumberNoIf order_type is MARKET, then is not required, otherwise this parameter is required
order_quantitynumberNoFor MARKET/ASK/BID order, if order_amount is given, it is not required.
order_amountnumberNoFor MARKET/ASK/BID order, the order size in terms of quote currency
visible_quantitynumberNoThe order quantity shown on orderbook. (default: equal to order_quantity)
sideenumYesOrder side. Possible values are: SELL/BUY.

Batch Create Order

Places multiple orders at once

  const order1 = {
    symbol: 'SPOT_NEAR_USDC',
    order_type: 'LIMIT',
    side: 'BUY',
    order_price: 1.11,
    order_quantity: 2.00000000
  }

  const order2 = {
    symbol: 'SPOT_WOO_USDC',
    order_type: 'LIMIT',
    side: 'BUY',
    order_price: 0.12,
    order_quantity: 10.00000000
  }

  await api.orders.createBatch([order1, order2])
Parameter nameTypeIs required?Description
ordersarrayYesArray of objects used for create order request

Cancel

Cancels placed request

  const cancleOrderRequest = {
    symbol: 'SPOT_NEAR_USDC',
    order_id: 12345
  }

  await api.orders.cancle(cancleOrderRequest)
Parameter nameTypeIs required?Description
symbolstringYesToken symbol
order_idnumberRequired if client_order_id is not providedID of the order
client_order_idnumberRequired if order_id is not providedclient_order_id of the order

Cancel Order in Bulk

Cancels multiple placed orders for a symbol

  await api.orders.cancelBatch({symbol: 'SPOT_NEAR_USDC'})
Parameter nameTypeIs required?Description
symbolstringYesToken symbol

Get an order

Gets an order by client_order_id or order_id

  await api.orders.getOrder({order_id: 12345})
Parameter nameTypeIs required?Description
order_idnumberRequired if client_order_id is not providedID of the order
client_order_idnumberRequired if order_id is not providedclient_order_id of the order

Get Orders

Gets multiple orders by provided params

  await api.orders.getOrders({})
Parameter nameTypeIs required?Description
symbolstringNoWhich token to query orders for
sideenumNoWhich order side orders to get. Possible values are: BUY/SELL.
order_typeenumNoWhich order type orders to get. Possible values are LIMIT/MARKET
order_tagstringNoAn optional tag for the order.
statusenumNoWhich order status orders to get. Possible values are: NEW/CANCELLED/PARTIAL_FILLED/FILLED/REJECTED/INCOMPLETE/COMPLETED
start_tnumberNoStart time range that wish to query, noted the time stamp is 13-digits timestamp.
end_tnumberNoEnd time range that wish to query, noted the time stamp is 13-digits timestamp.
pagenumberNoThe page wish to query (default: 1).
sizenumberNoThe page size wish to query (default: 25, max: 500)

Orderbook snapshot

Get a snapshot of the current orderbook

  await api.orders.getOrderbook('SPOT_NEAR_USDC', 10)
Parameter nameTypeIs required?Description
symbolstringYesToken symbol for which to get the snapshot
max_levelnumberNoThe levels wish to show on both side (default: 100).

Trade client

Get Kline

Get the latest klines of the trading pairs

  const getKlineData = {
    symbol: 'SPOT_NEAR_USDC',
    type: '1h',
    limit: 100
  }

  await api.trade.getKline(getKlineData)
Parameter nameTypeIs required?Description
symbolstringYesToken symbol for which to get klines
typeenumYesWhich kline type to get 1m/5m/15m/30m/1h/4h/12h/1d/1w/1mon/1y
limitnumberNoNumber of klines to get (default: 100, maximum: 1000).

Order Trades

Get specific order trades by order_id

  await api.trade.getOrderTrades(12345)
Parameter nameTypeIs required?Description
order_idnumberYesID of the order

Get Trades

Get the client’s trades history in a range of time

  await api.trade.getTrades({symbol: 'SPOT_NEAR_USDC'})
Parameter nameTypeIs required?Description
symbolstringNoToken symbol for which to get trades
tagstringNoAn optional tag for the order.
start_tnumberNoStart time range that wish to query, noted the time stamp is 13-digits timestamp.
end_tnumberNoEnd time range that wish to query, noted the time stamp is 13-digits timestamp.
pagenumberNoThe page wish to query (default: 1).
sizenumberNoThe page size wish to query (default: 25)

Transaction Detail

Get specific transaction detail by trade id

  await api.trade.getTrade(54321)
Parameter nameTypeIs required?Description
tradeIdnumberYesID of the trade

User client

Check holdings

Get a holding summary of the user

  await api.account.getCurrentHolding(true)
Parameter nameTypeIs required?Description
allbooleanNoIf true then will return all token even if balance is empty.

Account Information

Get account information

  await api.account.getInformation()

Parameters: None

Asset History

Get asset history, including token deposit/withdraw and collateral deposit/withdraw.

  await api.account.getAssetHistory({side: 'DEPOSIT'})
Parameter nameTypeIs required?Description
tokenstringNoToken name you want to search
sideenumNoWhich history record type to query. Possible values are: DEPOSIT/WITHDRAW
statusenumNoWhich status to search. Possible values are: NEW/CONFIRM/PROCESSING/COMPLETED/FAILED
start_tnumberNoStart time range that wish to query, noted the time stamp is 13-digits timestamp.
end_tnumberNoEnd time range that wish to query, noted the time stamp is 13-digits timestamp.
pagenumberNoThe page wish to query (default: 1).