rezarwzTraders in the Marketplace(PNL) copy
Updated 2024-08-01
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
›
⌄
-- forked from Traders in the Marketplace(PNL) @ https://flipsidecrypto.xyz/studio/queries/45df56d5-1709-4ec3-af28-47d29f81f9df
with matched_trades AS (
SELECT
b.tx_hash AS buy_tx_hash,
b.block_timestamp AS buy_timestamp,
b.buyer,
b.trade_amount AS buy_amount,
b.tokenId,
s.tx_hash AS sell_tx_hash,
s.block_timestamp AS sell_timestamp,
s.seller,
s.trade_amount AS sell_amount
FROM
(
SELECT
lo.tx_hash,
block_timestamp,
origin_from_Address as buyer,
DECODED_LOG:sell:price / pow(10, 18) as trade_amount,
DECODED_LOG:sell:tokenId as tokenId
FROM
blast.core.ez_decoded_event_logs lo
WHERE
lo.contract_address in( '0x56bfb3a51a7a2d4f685e5107cee05a58a0f1ad61','0x5b8c52f4ebdb7c1eb01405a6e03916bba2a974c9')
and event_name = 'Buy'
and block_Timestamp >= DATEADD(day, -30, CURRENT_TIMESTAMP)
union
all
SELECT
lo.tx_hash,
block_timestamp,
CAST(DECODED_LOG:buyOrder:trader as text) as buyer,
DECODED_LOG:buyOrder:price / pow(10, 18) as trade_amount,
DECODED_LOG:buyOrder:tokenId as tokenId
FROM
QueryRunArchived: QueryRun has been archived