Overview

This is a documentation for the market makers to create an API that can be easily integrated with Paraswap.

Complete flow for Paraswap Market Making

  1. ParaSwap server calls /prices every RefreshInterval seconds to fetch all the order book like prices
  2. When a user does a pricing call to the ParaSwap API, the ParaSwap server does an in-memory computation of prices for the market maker using the order book and quickly returns the aggregated prices.
  3. When the user requests ParaSwap API to build the transaction, ParaSwap calls /quotes to get the 0x v4 order. This is then encoded and sent to the user.

Description of the endpoint

A market maker should implement 2 endpoints to start market making at ParaSwap.

1. Get indicative prices

This endpoint is used to get indicative prices for all the token pairs

Request URL: GET <RequestURL>/prices

Header:

API-KEY: APIKey

Sample Return Payload:

{
   "success": true,
   "price_list":[
      {
         "from":{
            "address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "decimals":18
         },
         "to":{
            "address":"0x6b175474e89094c44da98b954eedeac495271d0f",
            "decimals":18
         },
         "side":"SELL",
         "rates":[
            [
               "3000000000000000000",
               "1823130000000000000000"
            ],
            [
               "6200000000000000000",
               "1823090000000000000000"
            ],
            [
               "1030000000000000000",
               "1823000000000000000000"
            ]
         ]
      },
			{
         "from":{
            "address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "decimals":18
         },
         "to":{
            "address":"0x6b175474e89094c44da98b954eedeac495271d0f",
            "decimals":18
         },
         "side":"BUY",
         "rates":[
            [
							 "182000000000000000000",
               "561668041999848"
            ],
            [
							 "6823090000000000000000",
               "581668041999848"
            ],
            [
               "10823090000000000000000",
               "591668041999848"
            ]
         ]
      }
   ]
}

<aside> 💡 The rates in the above payload are basically a list of pairs of (volume, unitPrice) like an order book. Hence for a pair (v, p) the market maker should be able to fill any order below v at price p.

</aside>

2. Get firm rate

This endpoint is used to get a signed 0x v4 order such that paraswap can use it to build a transaction