Computes the optimal capacity allocation in order to get the best price on cover purchases.
git clone [email protected]:NexusMutual/cover-router.git
cd cover-router && npm ci
cp .env.sample .env
- To run the server
npm run start
Note: if running the server in nodemon(dev), change the destination of persisted data so the server wouldn't restart constantly
- URL:
/v2/quote
- Method:
GET
- OpenAPI: v2/api/docs/#/Quote/get_v2_quote
- Description: The quote route uses a product id, a period and the cover amount for a given cover asset to return premium and the best available combination of pools for the premium.
- Quote Engine: Calculation is based on batching the current capacities and mapping them with the price per pool, then the cheapest capacity is selected, and remapped if the whole cover amount is not covered by the cheapest capacity.
- URL:
/v2/capacity
- Method:
GET
- OpenAPI: v2/api/docs/#/Capacity/get_v2_capacity_
- Description: Returns the current capacity for all products for a period of 30 days if no period query param is specified.
- URL:
/v2/capacity/{productId}
- Method:
GET
- OpenAPI: v2/api/docs/#/Capacity/get_v2_capacity__productId_
- Description: Returns the current capacity for a specific product for a period of 30 days if no period query param is specified. Additionally, if the query parameter
withPools=true
is provided, the response will include thecapacityPerPool
field with detailed capacity information per pool.
-
URL:
/v2/capacity/pools/{poolId}
-
Method:
GET
-
OpenAPI: [v2/api/docs/#/Capacity/get_v2_capacity_pools__poolId_](https://api.nexusmutual.io/v2/api/docs/#/Capacity/ get_v2_capacity_pools__poolId_)
-
Description: Returns the current capacity for all products in a specific pool for a period of 30 days if no period query param is specified.
-
Parameters:
poolId
: Required path parameter specifying the pool ID.period
: Optional query parameter specifying the period in days (default is 30, range is 28-365).
-
URL:
/v2/capacity/pools/{poolId}/products/{productId}
-
Method:
GET
-
OpenAPI: v2/api/docs/#/Capacity/get_v2_capacity_pools__poolId__products__productId_
-
Description: Returns the current capacity for a specific product in a specific pool for a period of 30 days if no period query param is specified.
-
Parameters:
poolId
: Required path parameter specifying the pool ID.productId
: Required path parameter specifying the product ID.period
: Optional query parameter specifying the period in days (default is 30, range is 28-365).