effortcapital1Peformance by Timezone
Updated 2023-02-09
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 timezone_price_data as (
select cast(block_timestamp as date) as date,
row_number() over (order by date asc) as row_number,
avg(case when (cast(date_trunc('minute',block_timestamp) as time) >= '12:50:00'
and cast(date_trunc('minute',block_timestamp) as time) <= '13:10:00')
then LATEST_ANSWER_UNADJ/pow(10,8) end) as US_Open_Price,
avg(case when (cast(date_trunc('minute',block_timestamp) as time) >= '21:50:00'
and cast(date_trunc('minute',block_timestamp) as time) <= '22:10:00')
then LATEST_ANSWER_UNADJ/pow(10,8) end) as US_Close_Price,
avg(case when (cast(date_trunc('minute',block_timestamp) as time) >= '07:50:00'
and cast(date_trunc('minute',block_timestamp) as time) <= '08:10:00')
then LATEST_ANSWER_UNADJ/pow(10,8) end) as Europe_Open_Price,
avg(case when (cast(date_trunc('minute',block_timestamp) as time) >= '16:50:00'
and cast(date_trunc('minute',block_timestamp) as time) <= '17:10:00')
then LATEST_ANSWER_UNADJ/pow(10,8) end) as Europe_Close_Price,
avg(case when (cast(date_trunc('minute',block_timestamp) as time) >= '00:00:00'
and cast(date_trunc('minute',block_timestamp) as time) <= '00:30:00')
then LATEST_ANSWER_UNADJ/pow(10,8) end) as Asia_Open_Price,
avg(case when (cast(date_trunc('minute',block_timestamp) as time) >= '08:50:00'
and cast(date_trunc('minute',block_timestamp) as time) <= '09:10:00')
then LATEST_ANSWER_UNADJ/pow(10,8) end) as Asia_Close_Price
from ethereum.chainlink.ez_oracle_feeds
where feed_name = concat('{{Token}}',' / ','{{Base_Token}}') AND
(date >= '{{Start_Date}}' and date<= '{{End_Date}}')
group by 1
order by date asc
),
daily_performance as (
select
date,
row_number() over (order by date asc) as row_number,
(US_Close_Price-US_Open_Price)/US_Open_Price as US_Performance,
US_Performance+1 as usp,
(Europe_Close_Price-Europe_Open_Price)/Europe_Open_Price as Europe_Performance,
Run a query to Download Data