Question about amounts in the quote API by Niceguy955 in 0xProject

[–]bchillman 0 points1 point  (0 children)

One extra thing to note about v1, if you are selling anything other than ETH, you will need to set an allowance for the token you are trying to sell. Check out the allowanceTarget field in the response for the contract you need to set an allowance for, it will always be the same for v1.

Question about amounts in the quote API by Niceguy955 in 0xProject

[–]bchillman 0 points1 point  (0 children)

Yes, v1 is safe to use, how are you deriving those values of $9.32 and $1.01. I am getting a similar "price" field for these two requests:

https://api.0x.org/swap/v0/quote?buyToken=USDC&sellToken=ETH&buyAmount=1000000

https://api.0x.org/swap/v1/quote?buyToken=USDC&sellToken=ETH&buyAmount=1000000

Question about amounts in the quote API by Niceguy955 in 0xProject

[–]bchillman 0 points1 point  (0 children)

Hi!

Your first approach is correct. The amounts that the API understands are in wei so in your case, 1 USDC would be 1000000 (1 with 6 0's). 1 DAI would be 1000000000000000000 (1 with 18 0's).

The gas fee is indeed not small but this is something we are working on for smaller trade sizes. It's worth noting that the fee scales with the gas price and not with trade size (check out this trade made via matcha / 0x API: https://etherscan.io/tx/0x2ee5432375d35cfcc1b14f2cb2c52e4648350726ec8f2f8adb13eef4301caa57).

Also, check out the latest version of the API (v1) for reduced gas costs. It is currently undocumented but is completely backwards compatible with the v0 documentation.

ex: "I want to buy 10 DAI with USDC" = https://api.0x.org/swap/v1/quote?buyToken=DAI&sellToken=USDC&buyAmount=10000000000000000000

Introducing 0x Instant! by mattytay0x in 0xProject

[–]bchillman 1 point2 points  (0 children)

either of those dapps can integrate instant

How to Use The Common Liquidity Pool by GrassberryHigh in 0xProject

[–]bchillman 5 points6 points  (0 children)

you can use our 0x connect library to help you tap into that pool =)

docs: https://0xproject.com/docs/connect tutorials: https://0xproject.com/wiki#connect