rezarwzAll markets questions Data copy
Updated 2024-10-16
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 All markets questions Data @ https://flipsidecrypto.xyz/studio/queries/750a0669-b8ef-47ec-b122-254ab90c1c8e
-- forked from All markets Data @ https://flipsidecrypto.xyz/studio/queries/97e8302b-ec6b-483e-8773-e8e6769ceb80
with markets_data as (
WITH api_data AS (
SELECT
PARSE_JSON(
livequery.live.udf_api(
'https://api.dune.com/api/v1/query/4114067/results/?api_key=lJ1CV9LcjSB6qiqiOZOjZEVLFzwHNfmM'
)
) AS resp
)
SELECT
VALUE:Title as Market_Title,
value:q_Title as Question_Title,
value:token0 as token0,
value:token1 as token1
FROM
api_data,
LATERAL FLATTEN(input = > resp:data:result:rows)
),
all_bets as (
SELECT
ev.tx_hash as tx_hash,
ev.block_Timestamp as block_Timestamp,
DECODED_LOG:fee / pow(10, 18) as fee,
DECODED_LOG:maker as maker,
DECODED_LOG:makerAmountFilled / pow(10, 18) as maker_amount,
DECODED_LOG:makerAssetId as makerAssetId,
DECODED_LOG:taker as taker,
DECODED_LOG:takerAmountFilled / pow(10, 18) as taker_amount,
DECODED_LOG:takerAssetId as takerAssetId,
CASE
WHEN decoded_log:takerAssetId = 0 then decoded_log:takerAmountFilled
when decoded_log:makerAssetId = 0 then decoded_log:makerAmountFilled
end / 1e18 as Amount_USD,
CASE
QueryRunArchived: QueryRun has been archived