Flipside Data ScienceLimit Sell on GatorTrade EconiaLabs
Updated 2024-03-07
999
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 t0 as (
select
fe.block_timestamp,
fe.tx_hash as tx_id,
1 as action_count,
LOWER(fe.event_data:user::string) as address,
1 as quest_step,
'APT' as currency,
fe.event_data:size::float / pow(10, 3) * 13.4 as usd_amount,
fe.event_data:size::float / pow(10, 3) as token_amount,
TRUE as valid,
coalesce(tx.gas_used * tx.gas_unit_price / pow(10, 8), 0) as fee_amount,
1 as prn
from
aptos.core.fact_events fe
LEFT JOIN aptos.core.fact_transactions tx on fe.tx_hash = tx.tx_hash -- get token price
where
-- fe.block_timestamp > current_date - 2
-- and tx.block_timestamp > current_date - 2
-- and fe.tx_hash = '0xf2641329713b25ed2d73eb5d286ae38132518b4a0dda2a33e585f4fc7aa9ba0f'
LOWER(fe.event_data:user::string) in (:userAddresses)
and fe.block_timestamp :: date >= :startsAt
and tx.block_timestamp :: date >= :startsAt
and fe.event_resource = 'PlaceLimitOrderEvent'
and fe.event_address = '0xc0deb00c405f84c85dc13442e305df75d1288100cdd82675695f6148c7ece51c'
and lower(tx.payload:type_arguments[0]::string) = '0x1::aptos_coin::aptoscoin'
and fe.event_data:integrator::string = '0x63e39817ec41fad2e8d0713cc906a5f792e4cd2cf704f8b5fab6b2961281fa11'
and fe.event_data:side::string = 'true'
UNION ALL
select
fe.block_timestamp,
fe.tx_hash as tx_id,
1 as action_count,
QueryRunArchived: QueryRun has been archived