Does the 0x API correctly determine a sellAmount
when given a buyAmount
and a specific slippage
?
In the documentation is says the following about the slippage parameter
(Optional) The maximum acceptable slippage of the buyToken amount if sellAmount is provided; The maximum acceptable slippage of the sellAmount amount if buyAmount is provided. E.g 0.03 for 3% slippage allowed.
But both of these /swap/v1/quote
requests produce the same takerAmount
even with very different slippage.
slippage set to 0.1
{
"buyToken": "0xfa5047c9c78b8877af97bdcb85db743fd7313d4a",
"sellToken": "0x7ff4169a6b5122b664c51c95727d87750ec07c84",
"slippagePercentage": 0.1,
"skipValidation": "true",
"intentOnFilling": "true",
"buyAmount": 1000000000000000000000
}
slippage set to 0.5
{
"buyToken": "0xfa5047c9c78b8877af97bdcb85db743fd7313d4a",
"sellToken": "0x7ff4169a6b5122b664c51c95727d87750ec07c84",
"slippagePercentage": 0.5,
"skipValidation": "true",
"intentOnFilling": "true",
"buyAmount": 1000000000000000000000
}
API response
{
"makerToken": "0xfa5047c9c78b8877af97bdcb85db743fd7313d4a",
"takerToken": "0x7ff4169a6b5122b664c51c95727d87750ec07c84",
"makerAmount": "1000000000000000000000",
"takerAmount": "41002212925764457213198",
"fillData": {
"tokenAddressPath": [
"0x7ff4169a6b5122b664c51c95727d87750ec07c84",
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"0xfa5047c9c78b8877af97bdcb85db743fd7313d4a"
],
"router": "0xf164fc0ec4e93095b804a4795bbe1e041497b92a"
},
"source": "Uniswap_V2",
"sourcePathId": "0x1cf4a7984db8f5cc1ec4dccfeae82934796000f1cc836d50a0bdbd86ec264f5e",
"type": 0
}