MLDZMNQ2
Updated 2023-08-12
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with price_tab as (
SELECT
HOUR::date as day,
SYMBOL,
TOKEN_ADDRESS,
avg(PRICE) as token_price
from polygon.core.fact_hourly_token_prices
group by 1,2,3),
--------------------------------------------------------------------------------
Quick as (
SELECT
*,
AMOUNT_IN*token_price as volume_in_usd
from polygon.core.ez_dex_swaps swaps
Left join price_tab price on swaps.TOKEN_IN=price.TOKEN_ADDRESS and swaps.BLOCK_TIMESTAMP::date=price.day
where PLATFORM = 'quickswap-v3'
and volume_in_usd is not null
and AMOUNT_IN>0
),
--------------------------------------------------------------------------------
-- Calculate swap fess on Quickswap V3
Fee as (
select
tx_hash,
(DECODED_LOG:fee)/1e6 as fee
from polygon.core.ez_decoded_event_logs
where tx_hash in (select tx_hash from Quick)
and TOPICS[0]='0x598b9f043c813aa6be3426ca60d1c65d17256312890be5118dab55b0775ebe2a'
)
Run a query to Download Data