we are trying to integrate 0x protocol in our derivatives protocol and I have a couple of questions regarding the quote endpoint (GET /swap/v1/quote API, https://0x.org/docs/api#get-swapv1quote)

  1. Based on my understanding, executing a quote transaction is equivalent to executing a market fill order. Is that correct?
  2. Is there a way to see what exactly happens under the hood when I execute say https://ropsten.api.0x.org/swap/v1/quote?buyToken=WETH&sellToken=DAI&buyAmount=10000000000000000? Is it sorting the orders from best to worst price and then executing batchFillOrder? Is the code available on github somewhere?
  3. The quote API doesn't seem to work if I replace buyToken/sellToken in the url with my own ERC20 derivative tokens. It response says INSUFFICIENT_LIQUIDITY. This suggests that posting orders to the quote endpoint is limited to a pre-defined set of exchanges/sources? If yes, what's the process to get our derivatives exchange onboarded?

I have created a github repository that shows a few examples how to interact with the 0x protocol (inluding executing a quote transaction). Beginners may find useful. Contributions and improvement proposals from the broader 0x community are welcome. https://github.com/Walodja1987/0x-fill-order-example

1 Answer 1


Attempting to give a first answer here

  1. correct, across AMMs, RFQs, Open Orderbook
  2. everything should be available in the 0x-api repo. It's pretty convoluted and typically our integrators trust to be taking a neutral position, always benefitting the user. For example, all positive slippage is returned to the user
  3. is there any liquidity available for your custom token? Have you posted an order in the orderbook API? Can you find it by /orderbook/v1/order/:orderHash: I don't think it's available on ropsten
  • Thanks for your reply! 3. I have created a bunch of sell limit orders for my custom token. See here: polygon.api.0x.org/orderbook/v1/… However, when I query for it using the quote endpoint it says INSUFFICIENT_ASSET_LIQUIDITY: polygon.api.0x.org/swap/v1/… Commented Nov 17, 2021 at 13:53
  • Thanks for clarifying, I think it has to do with polygon implementation. We have not connected the open orderbook liquidity onto /swap routing. Let us look into that. Commented Nov 17, 2021 at 16:35
  • Ok, keep me posted. It will save me a lot of work if I don't have to come up with my own logic to market fill orders using batchFillLimitOrders :-) Commented Nov 17, 2021 at 21:48

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.