diff --git a/pages/api_integration-guides/how_to_interpret_block_data_for_trades.md b/pages/api_integration-guides/how_to_interpret_block_data_for_trades.md index 79ef6fd7..6828fb98 100644 --- a/pages/api_integration-guides/how_to_interpret_block_data_for_trades.md +++ b/pages/api_integration-guides/how_to_interpret_block_data_for_trades.md @@ -8,7 +8,7 @@ In dYdX Chain trading, quantities and prices are represented in quantums (for qu The smallest increment of position size. Determined from `atomicResolution`. -atomicResolution - Determines the size of a quantum. [For example](https://github.com/dydxprotocol/v4-testnets/blob/aa1c7ac589d6699124942a66c2362acad2e6f50d/dydx-testnet-4/genesis.json#L5776), an `atomicResolution` of 10 for `BTC`, means that 1 quantum is `1e-10` `BTC`. +atomicResolution - Determines the size of a quantum. [For example](https://github.com/dydxprotocol/v4-testnets/blob/aa1c7ac589d6699124942a66c2362acad2e6f50d/dydx-testnet-4/genesis.json#L5776), an `atomicResolution` of -10 for `BTC`, means that 1 quantum is `1e-10` `BTC`. ### Subticks @@ -18,21 +18,21 @@ Units in V4 protocol: `quote quantums/base quantums` e.g. (`1e-14 USDC/1e-10 BTC Determined by `quantum_conversion_exponent`, this allows for flexibility in the case that an asset’s prices plummet, since prices are represent in subticks, decreasing `subticks_per_tick` would allow for ticks to denote smaller increments between prices. -E.g. 1 `subtick` = `1e-14 USDC/1e-10 BTC` and if BTC was at 20,000 USDC/BTC, a `tick` being 100 USDC/BTC (`subtick_per_tick` = 10000) may make sense. +E.g. 1 `subtick` = `1e-14 USDC/1e-10 BTC` and if BTC was at 20,000 USDC/BTC, a `tick` being 100 USDC/BTC (`subtick_per_tick` = 10000) may make sense. If BTC drops to 200 USDC/BTC, a `tick` being 100 USDC/BTC no longer makes sense, and we may want a `tick` to be 1 USDC/BTC, which lets us set `subtick_per_tick` to 100 to get to a `tick` size of 1 USDC/BTC. ### Now back to the interpretation of the above image: -1. First, notice column I is negative. That means this trade is a sell by the taker account. If It was positive, it would be a buy. +1. First, notice column I is negative. That means this trade is a sell by the taker account. If It was positive, it would be a buy. Result: Determined if this is a buy or a sell -2. Next, look at column N. The perpetual_id is 7, which maps to AVAX-USD market. You can see all the mappings from this endpoint for the dYdX Chain deployment by dYdX Operations Services Ltd. https://indexer.dydx.trade/v4/perpetualMarkets where the clobPairId is the perpetual_id. +2. Next, look at column N. The perpetual_id is 7, which maps to AVAX-USD market. You can see all the mappings from this endpoint for the dYdX Chain deployment by dYdX Operations Services Ltd. https://indexer.dydx.trade/v4/perpetualMarkets where the clobPairId is the perpetual_id. Result: Determined the market -3. Next, we need to get the decimals for this market. First, get the atomicResolution from that endpoint above which we see is -7. Now we can get the size of the trade. From column I and J, take this number -500000000 and multiply by 10^(AtomicResolution) and you get: -500000000 x 10^-7 = 50, so the quantity is 50. +3. Next, we need to get the decimals for this market. First, get the atomicResolution from that endpoint above which we see is -7. Now we can get the size of the trade. From column I and J, take this number -500000000 and multiply by 10^(AtomicResolution) and you get: -500000000 x 10^-7 = 50, so the quantity is 50. Result: Determined the quantity @@ -40,7 +40,7 @@ Result: Determined the quantity ![Interpret2](../../artifacts/interpret_block_data_2.png) -The price of the trade is either `abs((G+E)/I)*10e(-6 - AtomicResolution)`, or `abs((H+F)/J)*10e(-6 - AtomicResolution)`, either one is the same. Note that the ‘-6’ is because the AtomicResolution of USDC is -6. +The price of the trade is either `abs((G+E)/I)*10e(-6 - AtomicResolution)`, or `abs((H+F)/J)*10e(-6 - AtomicResolution)`, either one is the same. Note that the ‘-6’ is because the AtomicResolution of USDC is -6. `abs((1479130125 + 369875)/-500000000)*10e(-6 + 7) = 29.59`