Retrieve Delta price with fallback to Market

This endpoint is also available in Paraswap SDK. You can find example usage here.

Get Delta Price with fallback to Market

GET https://api.paraswap.io/quote

This endpoint gets the Delta price and with ability to fallback to market prices.

Query Parameters

Name
Type
Description

srcToken*

string

Source Token Address.

srcDecimals*

integer

Source Token Decimals.

destToken*

string

Destination Token Address.

destDecimals*

integer

Destination Token Decimals.

amount*

string

srcToken amount (in case of SELL) or destToken amount (in case of BUY). The amount should be in WEI/Raw units (eg. 1WBTC -> 100000000)

side

SELL | BUY

Default: SELL.

chainId*

string

Chain ID. (Mainnet - 1, Optimism - 10, BSC - 56, Polygon - 137, Fantom - 250, zkEVM - 1101, Base - 8453, Arbitrum - 42161, Avalanche - 43114, Gnosis - 100).

userAddress

string

User's Wallet Address.

partner

string

Partner string.

mode

ALL | DELTA | MARKET

Preferred mode for the trade. In case of "all", Delta pricing is returned, with Market as a fallback. Default: ALL.

Query Modes Explained

The endpoint behaves differently based on the mode passed:

  • DELTA - will return the Delta pricing data in the delta field, which can then be used to build, sign and submit a Delta Order.

  • MARKET - will return the Market pricing data in the market field , which is an equivalent to the successful response from /prices?version=6.2 of the Paraswap API, which can then be used to build a swap transaction.

  • ALL - default mode. Will return the Delta pricing data in the delta field. In case the Delta prices are unavailable, fallback to MARKET mode and returns the Market pricing data. Also specifies the fallback reason in fallbackReason field. Refer here for example of usage of this mode.

Examples for Successful Responses for each mode.

{
    "delta": {
        "srcToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "destToken": "0x6b175474e89094c44da98b954eedeac495271d0f",
        "srcAmount": "1000000000000000000",
        "destAmount": "3086837366586070760141",
        "destAmountBeforeFee": "3107438280392627995443",
        "gasCostUSD": "20.600749",
        "gasCost": "435040",
        "srcUSD": "3105.5700000000",
        "destUSD": "3086.8126718864",
        "destUSDBeforeFee": "3107.4134208864",
        "gasCostBeforeFee": "154200",
        "gasCostUSDBeforeFee": "7.301939",
        "partner": "paraswap.io",
        "partnerFee": 0,
        "hmac": "43ca1b6aaed09f892daf87c332a840caac7c6f23"
    }
}

Most common fallback reasons and error types

The following is a list of the most common error messages and fallback reasons of the /delta/quote endpoint. Most are self-explanatory and can be self-solved, but feel free to contact ParaSwap Support using the chat in the bottom right corner of this page.

  • ValidationError - validation for params failed

  • UnsupportedChain - the chain ID is not supported by Delta.

  • UnsupportedToken - the token is not supported by Delta.

  • SourceEth - Native chain token cannot be used as source token in Delta.

  • UnsupportedSide - BUY is not supported by Delta yet.

  • PricingError - internal oracle failed to provide a price.

  • GasCostExceedsTradeAmount - estimated value paid for gas is bigger than trade amount.

Last updated