lxv0umOwn Arbitrage Bot performance (Profitable trade within 24 hours)
Updated 2022-10-29Copy Reference Fork
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 contract_addresses as (select DISTINCT msg_value:contract AS contract_address, block_timestamp from terra.msgs
where
msg_value:sender = 'terra18dc0shnv6nqnvw2zsl2xcjym56zzat60lxv0um'
and msg_value:execute_msg:ww IS NOT NULL),
arbitrage_entries as (
select block_timestamp as activity_date, tx_id,
case when event_attributes:profit > 0 then event_attributes:profit
else event_attributes:uusd_after - event_attributes:uusd_before
end as profit,
0 as gas,
event_attributes:final_balance as final_balance
from terra.msg_events
where
activity_date > DATEADD(DAY, -400, CURRENT_DATE())
and event_type = 'wasm'
and tx_id IN (SELECT tx_id FROM terra.msgs WHERE msg_value:contract IN
(select contract_address from contract_addresses)
and tx_status = 'SUCCEEDED')
UNION ALL
select block_timestamp as activity_date, tx_id, 0 as profit, 0 as gas, NULL as final_balance
from terra.msgs
where
activity_date > DATEADD(DAY, -400, CURRENT_DATE())
and msg_value:contract IN
(select contract_address from contract_addresses)
and tx_status = 'FAILED'
), fee_entries as (
SELECT block_timestamp as activity_date, tx_id, fee[0]:amount[0]:amount as gas
from terra.transactions
where
activity_date > DATEADD(DAY, -2, CURRENT_DATE())
Run a query to Download Data