aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-api/src/api.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-08 07:24:31 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-08 07:24:31 +0800
commit3771df728c2dfcdeeb3fc49cd27ef864f2e94316 (patch)
tree6016ad964c09d8fe86f22fe48e0a9d2f63b61eff /packages/sra-api/src/api.ts
parentf6dbc239958e37a585d3f89b98eb6cd473895335 (diff)
downloaddexon-sol-tools-3771df728c2dfcdeeb3fc49cd27ef864f2e94316.tar
dexon-sol-tools-3771df728c2dfcdeeb3fc49cd27ef864f2e94316.tar.gz
dexon-sol-tools-3771df728c2dfcdeeb3fc49cd27ef864f2e94316.tar.bz2
dexon-sol-tools-3771df728c2dfcdeeb3fc49cd27ef864f2e94316.tar.lz
dexon-sol-tools-3771df728c2dfcdeeb3fc49cd27ef864f2e94316.tar.xz
dexon-sol-tools-3771df728c2dfcdeeb3fc49cd27ef864f2e94316.tar.zst
dexon-sol-tools-3771df728c2dfcdeeb3fc49cd27ef864f2e94316.zip
Add GET OrderBook endpoint
Diffstat (limited to 'packages/sra-api/src/api.ts')
-rw-r--r--packages/sra-api/src/api.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/packages/sra-api/src/api.ts b/packages/sra-api/src/api.ts
index 2cc15b297..5289a31f3 100644
--- a/packages/sra-api/src/api.ts
+++ b/packages/sra-api/src/api.ts
@@ -205,6 +205,42 @@ export const api: OpenApiSpec = {
),
},
},
+ '/v2/orderbook': {
+ get: {
+ description: `Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **per_page** query params apply to both \`bids\` and \`asks\` collections, and if \`page\` * \`per_page\` > \`total\` for a certain collection, the \`records\` for that collection should just be empty. `,
+ operationId: 'getOrderBook',
+ parameters: generateParameters(
+ [
+ {
+ name: 'baseAssetData',
+ in: 'query',
+ description: `assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.`,
+ required: true,
+ example: '0xf47261b04c32345ced77393b3530b1eed0f346429d',
+ schema: {
+ $ref: '#/components/schemas/hexSchema',
+ },
+ },
+ {
+ name: 'quoteAssetData',
+ in: 'query',
+ description: `assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).`,
+ required: true,
+ example: '0xf47261b04c32345ced77393b3530b1eed0f346429d',
+ schema: {
+ $ref: '#/components/schemas/hexSchema',
+ },
+ },
+ ],
+ true,
+ ),
+ responses: generateResponses(
+ 'relayerApiOrderBookResponseSchema',
+ examples.relayerApiOrderBookResponse,
+ `The sorted order book for the specified asset pair.`,
+ ),
+ },
+ },
},
components: {
schemas: openApiSchemas,