Arioopen ordex
Updated 2024-10-08
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 open_ordex AS (
SELECT
tx_id,
block_timestamp,
DATE_TRUNC('day', block_timestamp) AS day,
'Open Ordex' AS marketplace,
tx1_in AS buyer,
tx2_in AS seller,
val2_out AS amount,
val2_out * price as amount_usd
FROM
(
SELECT
*
FROM
(
SELECT
tx_id,
MAX(block_timestamp) as block_timestamp,
MAX(CASE WHEN input.index = 0 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx1_in,
MAX(CASE WHEN input.index = 0 THEN input.VALUE END) as val1_in,
MAX(CASE WHEN input.index = 1 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx2_in,
MAX(CASE WHEN input.index = 1 THEN input.VALUE END) as val2_in,
MAX(CASE WHEN input.index = 2 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx3_in,
MAX(CASE WHEN input.index = 2 THEN input.VALUE END) as val3_in,
MAX(CASE WHEN input.index = 3 THEN input.PUBKEY_SCRIPT_ADDRESS END) as tx4_in,
MAX(CASE WHEN input.index = 3 THEN input.VALUE END) as val4_in,
MAX(CASE WHEN output.index = 0 THEN output.PUBKEY_SCRIPT_ADDRESS END) as tx1_out,
MAX(CASE WHEN output.index = 0 THEN output.VALUE END) as val1_out,
MAX(CASE WHEN output.index = 1 THEN output.PUBKEY_SCRIPT_ADDRESS END) as tx2_out,
MAX(CASE WHEN output.index = 1 THEN output.VALUE END) as val2_out,
MAX(CASE WHEN output.index = 2 THEN output.PUBKEY_SCRIPT_ADDRESS END) as tx3_out,
MAX(CASE WHEN output.index = 2 THEN output.VALUE END) as val3_out,
MAX(CASE WHEN output.index = 3 THEN output.PUBKEY_SCRIPT_ADDRESS END) as tx4_out,
MAX(CASE WHEN output.index = 3 THEN output.VALUE END) as val4_out
QueryRunArchived: QueryRun has been archived