AI WaifuHourly Buy / Sell
Updated 2024-03-15
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
›
⌄
-- forked from Daily Buy / Sell @ https://flipsidecrypto.xyz/edit/queries/795ca2da-a232-4642-ab90-eea203ced339
with usdb_flows as (
select
block_timestamp,
tx_hash,
contract_address,
concat ('0x', substr(topics[1], 27, 40)) :: string as from_address,
concat ('0x', substr(topics[2], 27, 40)) :: string as to_address,
livequery.utils.udf_hex_to_int(SUBSTR(data, 3, 64)) / power (10, 18) as amt
from blast.core.fact_event_logs
where topics[0]::string = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' -- signifies token transfers
and contract_address = '0x4300000000000000000000000000000000000003'
and data != '0x'
and (from_address = '0xd78b925cde1a4ff99da2e14a9aa03b36a97d8563' or to_address = '0xd78b925cde1a4ff99da2e14a9aa03b36a97d8563')
and tx_hash != '0x33d0afb5ade657e1af0cb61e68c1833a8024c84f012d92a94e65e8900910510b' -- remove the deployer wallet
),
pos_net_flow as (
SELECT
date_trunc('hour', block_timestamp) as date_time,
sum(amt) as buys_total
FROM usdb_flows
WHERE to_address = '0xd78b925cde1a4ff99da2e14a9aa03b36a97d8563'
group by 1
),
neg_net_flow as (
SELECT
date_trunc('hour', block_timestamp) as date_time,
-sum(amt) as sells_total
FROM usdb_flows
WHERE from_address = '0xd78b925cde1a4ff99da2e14a9aa03b36a97d8563'
group by 1
),
QueryRunArchived: QueryRun has been archived