API Reference

Was this section helpful?

What made this section unhelpful for you?

Base URL

Production:

http://api.polkadex.trade/graphql

Language Box

Query

The Query type in GraphQL represents the entry point for retrieving data from the API. It defines the available read-only operations (queries) that clients can execute to fetch data.

Was this section helpful?

What made this section unhelpful for you?

findBalanceByMainAccount

Body Parameters

main_accountstring Required

Funding account/Main account address

assetstring Required

Asset Id of any asset

Responses

200
Object

Response Attributes

findBalanceByMainAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 query findBalanceByMainAccount($main_account: String!, $asset: String!) { findBalanceByMainAccount(main_account: $main_account, asset: $asset) { a f r } }

Response

{
  "findBalanceByMainAccount": {
    "a": "PDEX",
    "f": 10,
    "r": 4.5
  }
}

findOrderById

Body Parameters

order_idstring Required

Order ID of any order

Responses

200
Object

Response Attributes

findOrderByIdobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 query findOrderById($order_id: String!) { findOrderById(order_id: $order_id) { u cid id t m s ot st p q qoq afp fq fee stid isReverted } }

Response

{
  "findOrderById": {
    "u": "esq2wFkRsic8WM4nstAtkjqWdCDnTrGHMpFjaGN2rEHnQXUNm",
    "cid": "0x7765626170702d000026fd8baf4e200cb273233cfecb2e7a1ec3eca8e1287a4e",
    "id": "0xb11ba11996516327bef353005cfbc165930d5a36a5a091aaff2cacacafd8cb48",
    "t": "1718330833070",
    "m": "95930534000017180603917534864279132680-3496813586714279103986568049643838918",
    "s": "Ask",
    "ot": "MARKET",
    "st": "CLOSED",
    "p": "0",
    "q": "0.2",
    "qoq": "0",
    "afp": "6.382",
    "fq": "0.2",
    "fee": "0.0012764",
    "stid": "46220302",
    "isReverted": false
  }
}

findUserByMainAccount

Body Parameters

main_accountstring Required

Funding account address

Responses

200
Object

Response Attributes

findUserByMainAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query findUserByMainAccount($main_account: String!) { findUserByMainAccount(main_account: $main_account) { items { } nextToken } }

Response

{
  "findUserByMainAccount": {
    "items": [
      {
        "main": "esq2wFkRsic8WM4nstAtkjqWdCDnTrGHMpFjaGN2rEHnQXUNm",
        "proxy": "esofajbxqmo8X6viLFkxGDAsrnaVC923JqsqvEXHxQJuFDmTW",
        "stid": "36266116"
      }
    ],
    "nextToken": null
  }
}

findUserByTradeAccount

Body Parameters

trade_accountstring Required

Trading account address

Responses

200
Object

Response Attributes

findUserByTradeAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query findUserByTradeAccount($trade_account: String!) { findUserByTradeAccount(trade_account: $trade_account) { items { } nextToken } }

Response

{
  "findUserByTradeAccount": {
    "items": {
      "main": "esq2wFkRsic8WM4nstAtkjqWdCDnTrGHMpFjaGN2rEHnQXUNm",
      "proxy": "esofajbxqmo8X6viLFkxGDAsrnaVC923JqsqvEXHxQJuFDmTW",
      "stid": "36266116"
    },
    "nextToken": null
  }
}

getAllAssets

Body Parameters

limitint

Limit for result

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

getAllAssetsobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query getAllAssets($limit: Int, $nextToken: String) { getAllAssets(limit: $limit, nextToken: $nextToken) { items { } nextToken } }

Response

{
  "getAllAssets": {
    "items": [
      {
        "symbol": "PDEX",
        "name": "POLKADEX",
        "asset_id": "PDEX"
      }
    ],
    "nextToken": null
  }
}

getAllBalancesByMainAccount

Body Parameters

main_accountstring Required

Funding account address

Responses

200
Object

Response Attributes

getAllBalancesByMainAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query getAllBalancesByMainAccount($main_account: String!) { getAllBalancesByMainAccount(main_account: $main_account) { items { } nextToken } }

Response

{
  "getAllBalancesByMainAccount": {
    "items": [
      {
        "a": "PDEX",
        "f": 10,
        "r": 5.4
      }
    ],
    "nextToken": null
  }
}

getAllMarkets

Responses

200
Object

Response Attributes

getAllMarketsobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 query getAllMarkets { getAllMarkets { items { } } }

Response

{
  "getAllMarkets": {
    "items": [
      {
        "market": "119367686984583275840673742485354142551-3496813586714279103986568049643838918",
        "max_volume": "100000",
        "min_volume": "1",
        "price_tick_size": "1.0E-8",
        "qty_step_size": "100",
        "base_asset_precision": "0",
        "quote_asset_precision": "8"
      }
    ]
  }
}

getKlinesByMarketInterval

Body Parameters

marketstring Required

Market ID

intervalstring Required

Interval for getting data i.e. 1m,30m, 1d etc.

fromobject Required

ISO time string

toobject Required

ISO time string

Responses

200
Object

Response Attributes

getKlinesByMarketIntervalobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 query getKlinesByMarketInterval($market: String!, $interval: String!, $from: AWSDateTime!, $to: AWSDateTime!) { getKlinesByMarketInterval(market: $market, interval: $interval, from: $from, to: $to) { items { } } }

Response

{
  "getKlinesByMarketInterval": {
    "items": [
      {
        "o": " 0.4467",
        "c": " 0.4471",
        "h": " 0.4477",
        "l": " 0.4463",
        "vb": " 773.6",
        "vq": " 345.74508",
        "t": "2024-06-20 03:00:00.000000000"
      }
    ]
  }
}

getMarketTickers

Body Parameters

marketstring Required

Market ID

fromobject Required

ISO time string

Empty value:
True
toobject Required

ISO time string

Responses

200
Object

Response Attributes

getMarketTickersobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 9 10 11 12 13 query getMarketTickers($market: String!, $from: AWSDateTime!, $to: AWSDateTime!) { getMarketTickers(market: $market, from: $from, to: $to) { items { o c h l vb vq } nextToken } }

Response

{
  "getMarketTickers": {
    "items": [
      {
        "o": " 0.06886",
        "c": " 0.06917",
        "h": "0.07088",
        "l": " 0.06772",
        "vb": " 339459.490915423",
        "vq": " 23427.001511999853"
      }
    ],
    "nextToken": null
  }
}

getOrderbook

Body Parameters

marketstring Required

Market ID

limitint

Limit for results i.e. 10 items for result

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

getOrderbookobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 9 10 11 query getOrderbook($market: String!, $limit: Int, $nextToken: String) { getOrderbook(market: $market, limit: $limit, nextToken: $nextToken) { items { p q s stid } nextToken } }

Response

{
  "getOrderbook": {
    "items": [
      {
        "p": "0.4478",
        "q": "12.2",
        "s": "Ask",
        "stid": "47757860"
      }
    ],
    "nextToken": null
  }
}

listOpenOrdersByMainAccount

Body Parameters

main_accountstring Required

Funding account address

limitint

Limit for result items

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

listOpenOrdersByMainAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query listOpenOrdersByMainAccount($main_account: String!, $limit: Int, $nextToken: String) { listOpenOrdersByMainAccount(main_account: $main_account, limit: $limit, nextToken: $nextToken) { items { } nextToken } }

Response

{
  "listOpenOrdersByMainAccount": {
    "items": [
      {
        "u": "esq2wFkRsic8WM4nstAtkjqWdCDnTrGHMpFjaGN2rEHnQXUNm",
        "cid": "0x7765626170702d00008ffa7bc33e3cab169144e91ed97bae32cd3722879c7941",
        "id": "0x9d379170b377fa5e9d27978e8b302c7834d6ffd2d06c642fe2a98fdc0345c239",
        "t": "1718076637872",
        "m": "130314105136721928300689838359167097187-3496813586714279103986568049643838918",
        "s": "Ask",
        "ot": "LIMIT",
        "st": "OPEN",
        "p": "100000",
        "q": "0.1",
        "qoq": "0",
        "afp": "0",
        "fq": "0",
        "fee": "0",
        "stid": "45404791",
        "isReverted": false
      }
    ],
    "nextToken": null
  }
}

listOpenOrdersByTradeAccount

Body Parameters

trade_accountstring Required

Trading account address

limitint

Limit for result items

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

listOpenOrdersByTradeAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query listOpenOrdersByTradeAccount($trade_account: String!, $limit: Int, $nextToken: String) { listOpenOrdersByTradeAccount(trade_account: $trade_account, limit: $limit, nextToken: $nextToken) { items { } nextToken } }

Response

{
  "listOpenOrdersByTradeAccount": {
    "items": [
      {
        "u": "esq2wFkRsic8WM4nstAtkjqWdCDnTrGHMpFjaGN2rEHnQXUNm",
        "cid": "0x7765626170702d00008ffa7bc33e3cab169144e91ed97bae32cd3722879c7941",
        "id": "0x9d379170b377fa5e9d27978e8b302c7834d6ffd2d06c642fe2a98fdc0345c239",
        "t": "1718076637872",
        "m": "130314105136721928300689838359167097187-3496813586714279103986568049643838918",
        "s": "Ask",
        "ot": "LIMIT",
        "st": "OPEN",
        "p": "100000",
        "q": "0.1",
        "qoq": "0",
        "afp": "0",
        "fq": "0",
        "fee": "0",
        "stid": "45404791",
        "isReverted": false
      }
    ],
    "nextToken": null
  }
}

listOrderHistoryByMainAccount

Body Parameters

main_accountstring Required

Funding account address

fromobject Required

ISO time string

toobject

ISO time string

limitint

Limit for result items

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

listOrderHistoryByMainAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query listOrderHistoryByMainAccount($main_account: String!, $from: AWSDateTime!, $to: AWSDateTime, $limit: Int, $nextToken: String) { listOrderHistoryByMainAccount(main_account: $main_account, from: $from, to: $to, limit: $limit, nextToken: $nextToken) { items { } nextToken } }

Response

{
  "listOrderHistoryByMainAccount": {
    "items": [
      {
        "u": "esq2wFkRsic8WM4nstAtkjqWdCDnTrGHMpFjaGN2rEHnQXUNm",
        "cid": "0x7765626170702d00008ffa7bc33e3cab169144e91ed97bae32cd3722879c7941",
        "id": "0x9d379170b377fa5e9d27978e8b302c7834d6ffd2d06c642fe2a98fdc0345c239",
        "t": "1718076637872",
        "m": "130314105136721928300689838359167097187-3496813586714279103986568049643838918",
        "s": "Ask",
        "ot": "LIMIT",
        "st": "OPEN",
        "p": "100000",
        "q": "0.1",
        "qoq": "0",
        "afp": "0",
        "fq": "0",
        "fee": "0",
        "stid": "45404791",
        "isReverted": false
      }
    ],
    "nextToken": null
  }
}

listOrderHistoryByTradeAccount

Body Parameters

trade_accountstring Required

Trading account address

fromobject Required

ISO time string

toobject

ISO time string

limitint

Limit for result items

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

listOrderHistoryByTradeAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query listOrderHistoryByTradeAccount($trade_account: String!, $from: AWSDateTime!, $to: AWSDateTime, $limit: Int, $nextToken: String) { listOrderHistoryByTradeAccount(trade_account: $trade_account, from: $from, to: $to, limit: $limit, nextToken: $nextToken) { items { } nextToken } }

Response

{
  "listOrderHistoryByTradeAccount": {
    "items": [
      {
        "u": "esq2wFkRsic8WM4nstAtkjqWdCDnTrGHMpFjaGN2rEHnQXUNm",
        "cid": "0x7765626170702d00008ffa7bc33e3cab169144e91ed97bae32cd3722879c7941",
        "id": "0x9d379170b377fa5e9d27978e8b302c7834d6ffd2d06c642fe2a98fdc0345c239",
        "t": "1718076637872",
        "m": "130314105136721928300689838359167097187-3496813586714279103986568049643838918",
        "s": "Ask",
        "ot": "LIMIT",
        "st": "OPEN",
        "p": "100000",
        "q": "0.1",
        "qoq": "0",
        "afp": "0",
        "fq": "0",
        "fee": "0",
        "stid": "45404791",
        "isReverted": false
      }
    ],
    "nextToken": null
  }
}

listRecentTrades

Body Parameters

mstring Required

Market ID

limitint

Limit for result items i.e 30 or 50 etc.

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

listRecentTradesobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query listRecentTrades($m: String!, $limit: Int, $nextToken: String) { listRecentTrades(m: $m, limit: $limit, nextToken: $nextToken) { items { } nextToken } }

Response

{
  "listRecentTrades": {
    "items": [
      {
        "m": "PDEX-3496813586714279103986568049643838918",
        "p": "0.4466",
        "q": "30.8",
        "t": "1718854132954",
        "stid": "47760500",
        "taker_id": "0xcdd8dc6ca2589748b408b491b43de6a515e361c33a8a58b824ff9312e397ea9d",
        "maker_id": "0xb5480012450d2631b766a2feaa317587d8ed86e39f8e94ecc29d29ecb7fe6b6e",
        "trade_id": "0xe1ca765cc6344cf9ee07c25db2c7f9d8e745991f9b2958f0a4a75c82b38fd3cb"
      }
    ],
    "nextToken": null
  }
}

listTradesByMainAccount

Body Parameters

main_accountstring Required

Funding account address

fromobject Required

ISO time string

toobject

ISO time string

limitint

Limit for result items

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

listTradesByMainAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query listTradesByMainAccount($main_account: String!, $from: AWSDateTime!, $to: AWSDateTime, $limit: Int, $nextToken: String) { listTradesByMainAccount(main_account: $main_account, from: $from, to: $to, limit: $limit, nextToken: $nextToken) { items { } nextToken } }

Response

{
  "listTradesByMainAccount": {
    "items": [
      {
        "m": "95930534000017180603917534864279132680-3496813586714279103986568049643838918",
        "p": "6.386",
        "q": "0.156592546",
        "s": "Bid",
        "t": "1718341115180",
        "stid": "46249069",
        "trade_id": "0x25b68869cda8233add51ebc84ebf013e40b08d1adc6728bf1d6c634bccb1f8e2",
        "isReverted": false
      }
    ],
    "nextToken": null
  }
}

listTradesByMarket

Body Parameters

mstring Required

Market ID

fromobject Required

ISO time string

toobject

ISO time string

limitint

Limit for result items

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

listTradesByMarketobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query listTradesByMarket($m: String!, $from: AWSDateTime!, $to: AWSDateTime, $limit: Int, $nextToken: String) { listTradesByMarket(m: $m, from: $from, to: $to, limit: $limit, nextToken: $nextToken) { items { } nextToken } }

Response

{
  "listTradesByMarket": {
    "items": [
      {
        "m": "95930534000017180603917534864279132680-3496813586714279103986568049643838918",
        "p": "6.386",
        "q": "0.156592546",
        "s": "Bid",
        "t": "1718341115180",
        "stid": "46249069",
        "trade_id": "0x25b68869cda8233add51ebc84ebf013e40b08d1adc6728bf1d6c634bccb1f8e2",
        "isReverted": false
      }
    ],
    "nextToken": null
  }
}

listTradesByTradeAccount

Body Parameters

trade_accountstring Required

Trading account address

fromobject Required

ISO time string

toobject

ISO time string

limitint

Limit for result items

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

listTradesByTradeAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query listTradesByTradeAccount($trade_account: String!, $from: AWSDateTime!, $to: AWSDateTime, $limit: Int, $nextToken: String) { listTradesByTradeAccount(trade_account: $trade_account, from: $from, to: $to, limit: $limit, nextToken: $nextToken) { items { } nextToken } }

Response

{
  "listTradesByTradeAccount": {
    "items": [
      {
        "m": "95930534000017180603917534864279132680-3496813586714279103986568049643838918",
        "p": "6.386",
        "q": "0.156592546",
        "s": "Bid",
        "t": "1718341115180",
        "stid": "46249069",
        "trade_id": "0x25b68869cda8233add51ebc84ebf013e40b08d1adc6728bf1d6c634bccb1f8e2",
        "isReverted": false
      }
    ],
    "nextToken": null
  }
}

listTransactionsByMainAccount

Body Parameters

main_accountstring Required

Funding account address

fromobject Required

ISO time string

toobject

ISO time string

transaction_typestring Required

Transaction type i.e. DEPOSIT or WITHDRAW

limitint

Limit for result items

nextTokenstring

Pagination token

Responses

200
Object

Response Attributes

listTransactionsByMainAccountobject

Show child attributes

Was this section helpful?

What made this section unhelpful for you?

POST

/

Select
1 2 3 4 5 6 7 8 query listTransactionsByMainAccount($main_account: String!, $from: AWSDateTime!, $to: AWSDateTime, $transaction_type: string!, $limit: Int, $nextToken: String) { listTransactionsByMainAccount(main_account: $main_account, from: $from, to: $to, transaction_type: $transaction_type, limit: $limit, nextToken: $nextToken) { items { } nextToken } }

Response

{
  "listTransactionsByMainAccount": {
    "items": [
      {
        "tt": "DEPOSIT",
        "a": "313524628741076911470961827389955394913",
        "q": "9.99358E-5",
        "fee": "0",
        "st": "CONFIRMED",
        "t": "1718599215117",
        "stid": "46909737",
        "snapshot_id": null,
        "isReverted": false
      }
    ],
    "nextToken": null
  }
}

Mutation

The Mutation type in GraphQL is used for modifying or creating data. It defines the operations (mutations) that allow clients to make changes to the data stored on the server, such as creating, updating, or deleting resources

Subscription

The Subscription type in GraphQL enables real-time communication between clients and the server. It defines a set of events or data streams that clients can subscribe to and receive updates whenever the subscribed events occur.

Objects

Objects in GraphQL represent complex data structures. They define the fields and their types that can be queried in a GraphQL API. Objects can have nested fields and relationships with other objects.

Scalars

Scalars: Scalars in GraphQL represent primitive data types, such as String, Int, Boolean, Float, etc. They are used to define the types of individual fields in the GraphQL schema.

Directives

Directives in GraphQL provide a way to control the execution behavior of queries and mutations. They allow you to modify the result, change the execution order, skip or include fields conditionally, and apply custom logic to the resolution process.

Was this section helpful?

What made this section unhelpful for you?

Enums

Enums in GraphQL define a set of possible values for a field. They represent a discrete set of options or states that a field can have. Enums help ensure type safety and provide a clear list of valid values for a field.

Unions

Unions in GraphQL allow you to combine multiple object types into a single type. They represent a result that can be one of several object types. Unions are useful when a field can return different types of objects, and you want to specify all the possible types in the schema.

Was this section helpful?

What made this section unhelpful for you?