0

I'm trying to query the USDC/WETH orderbook for the best bid and ask. However, I don't think the response data makes much sense. There is a makerAmount and takerAmount. Does this mean that to interact with this limit order, I need to put up the price determined by the ratio of the 2 assets? This price/ratio seems to be very out of line with the prices I'm seeing on coinbase and other popular exchanges.

Am I missing anything? Or maybe I'm using the wrong API for my usecase?

1 Answer 1

0

The price on a order is the ratio between the assets in units. Be in mind that USDC is a token with 6 decimals, and WETH a token with 18 decimals, so you need first to convert these values to their unit values. So for instance if you have an order with makerToken: USDC and takerToken: WETH, makerAmount: 2000 000000 and takerAmount 1 0000 0000 0000 0000 00.

Converting this order to units:

MakerAmount: 2000 USDC

TakerAmount: 1 WETH

You are making a 2000 USDC to take for 1 WETH, which translates to 2000 WETH/USDC price.

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.