KARTODRelationship between OP price and trade volume
Updated 2022-10-02
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 p AS (
SELECT
date(HOUR) AS Time,
AVG(price) AS OP_price
FROM optimism.core.fact_hourly_token_prices
WHERE TOKEN_ADDRESS = '0x4200000000000000000000000000000000000042'
group by Time
),
buy_volume AS (
select
date_trunc('day',BLOCK_TIMESTAMP) as days,
sum(AMOUNT_OUT) as amount_buy_usd,
sum(AMOUNT_OUT) as volume_usd_buy
from optimism.velodrome.ez_swaps
where "TOKEN_ADDRESS_OUT" = '0x4200000000000000000000000000000000000042'
group by days
),
sell_volume AS (
select
date_trunc('day',BLOCK_TIMESTAMP) as days,
- sum(AMOUNT_IN) as amount_sell_usd,
sum(AMOUNT_IN) as volume_usd_sell
from optimism.velodrome.ez_swaps
where "TOKEN_ADDRESS_IN" = '0x4200000000000000000000000000000000000042'
group by days
)
SELECT
A.days,
amount_buy_usd as "Bought amount",
amount_sell_usd as "Sold amount",
-amount_sell_usd as "Sold amount (ABS)",
volume_usd_sell + volume_usd_buy as "Daily amount",
Run a query to Download Data