amirkhannoriiCompare DYDX,GMX, and GNS
Updated 2022-11-16
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 priceTb as ( --@credited to @0xHaM☰d
select
hour::date as p_date,
TOKEN_ADDRESS,
symbol,
DECIMALS,
avg(price) as price
from ethereum.core.fact_hourly_token_prices
group by 1,2,3,4
)
, escaper_from_FTX as (
SELECT
block_timestamp::date as date,
to_address
FROM ethereum.core.ez_token_transfers LEFT outer join ethereum.core.dim_labels on address = from_address
WHERE label iLIKE any ('%alameda%', 'ftx')
AND block_timestamp > '2022-11-01'
GROUP BY 1,2
)
, gmxTb as (
select
block_timestamp,
tx_hash,
origin_from_address,
case
when contract_address = '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8' then 'USDC' -- 6
when contract_address = '0xf97f4df75117a78c1a5a0dbb814af92458539fb4' then 'LINK' --18
when contract_address = '0x82af49447d8a07e3bd95bd0d56f35241523fbab1' then 'WETH' -- 18
when contract_address = '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f' then 'WBTC' -- 8
when contract_address = '0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0' then 'UNI' --18
when contract_address = '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1' then 'DAI' --18
when contract_address = '0x17fc002b466eec40dae837fc4be5c67993ddbd6f' then 'FRAX' --18
when contract_address = '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9' then 'USDT' --6
else contract_address end as symbol,
CASE
WHEN symbol in ('USDC', 'USDT') THEN RAW_AMOUNT/1e6
Run a query to Download Data