kky111weth margin - synfutures open close matched data
Updated 2024-05-12
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 token_lookup AS (
SELECT
address AS contract_address,
name AS token_name
FROM (
VALUES
('0xdd56a994568e01eb16c69718dae13073098f4003', 'wif')
,('0x99660f7ade18a02f1f88f2bfc7a2515ceff9c9c6', 'steth')
,('0xeb9e8822142fc10c38faab7bb6c635d22eb20ff8', 'weth_usb') --weth as margin
,('0x0e1b878f5eddb7170b0a25ca63cb985291eb53d8', 'btc')
,('0xca9d4fdc71c6866b7a5ba1cc463044271bd799d7', 'yield')
,('0x5d59a8cea43f6729e336cb7278a3210590be6fa9', 'maneki')
,('0x99c1ca21a54d5d8d7e2ad52e0b3f7bd2326a92b4', 'Juice')
,('0x8cbb731d960c9be0e743cd3984c18245de447113', 'Mew')
,('0x379226d215509de2089103e0d5c425e54889830e', 'Yes')
,('0xfc37d560b7102ad725193cf1220690740d2601cf', 'Degen')
) AS T(address, name)
)
, ranked_transfers AS (
SELECT
open_trades.BLOCK_TIMESTAMP AS open_timestamp
, close_trades.BLOCK_TIMESTAMP AS close_timestamp
, open_trades.ORIGIN_FROM_ADDRESS AS trader_address
, open_trades.TO_ADDRESS AS token_perps_address
, CASE WHEN open_trades.contract_address = '0x4300000000000000000000000000000000000004'
THEN open_trades.RAW_AMOUNT/1e18 END AS open_amount
, CASE WHEN close_trades.contract_address = '0x4300000000000000000000000000000000000004'
THEN close_trades.RAW_AMOUNT/1e18 END AS close_amount
, open_trades.tx_hash as open_tx_hash
, close_trades.tx_hash as close_tx_hash
, ROW_NUMBER() OVER(PARTITION BY open_trades.tx_hash
ORDER BY ABS(DATEDIFF(MINUTE, open_trades.BLOCK_TIMESTAMP,
close_trades.BLOCK_TIMESTAMP))) AS row_num
FROM blast.core.fact_token_transfers AS open_trades
JOIN token_lookup AS t1
Auto-refreshes every 12 hours
QueryRunArchived: QueryRun has been archived