Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding metis fundamental metrics #469

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions models/projects/metis/core/ez_metis_metrics.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{
config(
materialized = "table",
snowflake_warehouse = "METIS",
database = "METIS",
schema = "CORE",
alias = "ez_metrics"
)
}}

with fees as (
select
date,
fees_usd
from {{ref("fact_metis_fees")}}
),
txns as (
select
date,
txns
from {{ref("fact_metis_txns")}}
)
, daus as (
select
date,
dau
from {{ref("fact_metis_dau")}}
)

select
coalesce(fees.date, txns.date, daus.date) as date,
dau,
txns,
fees_usd as fees
from fees
left join txns on fees.date = txns.date
left join daus on fees.date = daus.date
10 changes: 10 additions & 0 deletions models/staging/metis/__metis__sources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sources:
- name: PROD_LANDING
schema: PROD_LANDING
database: LANDING_DATABASE
tables:
- name: raw_metis_trading_volume
- name: raw_metis_txns
- name: raw_metis_gas_used
- name: raw_metis_avg_gas_price
- name: raw_metis_dau
3 changes: 3 additions & 0 deletions models/staging/metis/fact_metis_dau.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{
convert_routescan_api_daus_for_chain(chain="metis")
}}
15 changes: 15 additions & 0 deletions models/staging/metis/fact_metis_fees.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

with prices as (
select
date(hour) as date,
avg(price) as price
from ethereum_flipside.price.ez_prices_hourly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking we should create an intermediate table that creates avg daily prices for all tokens that we could then use throughout the codebase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree that would be useful!

where lower(token_address) = lower('0x9e32b13ce7f2e80a01932b42553652e053d6ed8e')
group by 1
)
select
f.date,
f.fees_native * p.price as fees_usd
from {{ref("fact_metis_fees_native")}} f
left join prices p on p.date = f.date
where date(f.date) < to_date(sysdate())
3 changes: 3 additions & 0 deletions models/staging/metis/fact_metis_fees_native.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{
convert_routescan_api_fees_native_for_chain(chain="metis")
}}
3 changes: 3 additions & 0 deletions models/staging/metis/fact_metis_txns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{
convert_routescan_api_txns_for_chain(chain="metis")
}}
Loading