SocioAnalyticapnl over time
Updated 2024-01-11
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 main as (
SELECT
DISTINCT tx_id
FROM sei.core.fact_msg_attributes a
WHERE msg_type = 'execute'
AND attribute_key = '_contract_address'
AND block_timestamp:: date >= '2023-05-31'
AND ATTRIBUTE_VALUE IN (
'sei1zjryrejvtufeaaer7w55fxgxurqnajwlshdpuqf5lp4j00uzek8s6sktv3',
'sei14j7zhcj50qsk6vhu7dsa48r5e7v37nthnwwx0q8q4nd0h39udy6qhqq6dm',
'sei1jvl8avv45sj92q9x9c84fq2ymddya6dkwv9euf7y365tkzma38zq5xldpy'
)
)
,
close_position as (
SELECT
'close' as type,
block_timestamp,
tx_succeeded,
a.tx_id,
MSG_INDEX,
OBJECT_AGG(
attribute_key :: STRING,
attribute_value :: variant
) AS j,
j : "pos-owner" :: string as Trader,
j : leverage :: int as leverage,
j : direction :: string as direction,
j : "trading-fee-usd" :: double as fee_usd,
j : "deposit-collateral" :: double as amount,
j : "deposit-collateral-usd" :: double as amount_usd,
j : "active-collateral" :: double as active_collateral,
j : "pnl-usd" :: double as pnl_usd,
j : "take-profit-override" :: double as take_profit,
QueryRunArchived: QueryRun has been archived