0

We've noticed that in one edge case the 0x API returns a weird result. We're trying to get a swap transaction for the exact same token, it works with sellAmount 0.1 BNB but fails with sellAmount of 0.00001 BNB, and returns the error INSUFFICIENT_ASSET_LIQUIDITY which doesn't seem to be the case.

Here a preview of the queries:

Query that works (Buying 0.1 BNB worth of asset)

https://bsc.api.0x.org/swap/v1/quote?buyToken=0x83A86adf1a7c56e77d36d585B808052e0a2aAD0e&sellToken=BNB&slippagePercentage=0.12&includedSources=PancakeSwap_V2&sellAmount=100000000000000000

Query that fails (Buying 0.00001 BNB worth of asset)

https://bsc.api.0x.org/swap/v1/quote?buyToken=0x83A86adf1a7c56e77d36d585B808052e0a2aAD0e&sellToken=BNB&slippagePercentage=0.12&includedSources=PancakeSwap_V2&sellAmount=10000000000000

1 Answer 1

0

The sellAmount of the failed query may be too small to query due to how 0x breaks order sizes into chunks and then queries those chunks. This amount is probably too small to return any liquidity when chunked due to decimal differences.

If you remove the includedSources=PancakeSwap_V2 parameter the API will return a valid response that goes through MultiHop. MultiHop works a bit differently and doesn’t sample smaller amounts, just the user-provided amount.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.