diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application.sql new file mode 100644 index 00000000..0e6080a3 --- /dev/null +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_application.sql @@ -0,0 +1,19 @@ +{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +select + date + , chain + , symbol + , count(distinct case when stablecoin_daily_txns > 0 then from_address end) as stablecoin_dau + , sum(stablecoin_transfer_volume) as stablecoin_transfer_volume + , sum(stablecoin_daily_txns) as stablecoin_daily_txns + , count(distinct case when stablecoin_daily_txns > 0 then from_address end) as artemis_stablecoin_dau + , sum(artemis_stablecoin_transfer_volume) as artemis_stablecoin_transfer_volume + , sum(artemis_stablecoin_daily_txns) as artemis_stablecoin_daily_txns + , count(distinct case when stablecoin_daily_txns > 0 then from_address end) as p2p_stablecoin_dau + , sum(p2p_stablecoin_transfer_volume) as p2p_stablecoin_transfer_volume + , sum(p2p_stablecoin_daily_txns) as p2p_stablecoin_daily_txns + , sum(stablecoin_supply) as stablecoin_supply + , sum(case when is_wallet::number = 1 then stablecoin_supply else 0 end) as p2p_stablecoin_supply +from {{ ref("agg_daily_stablecoin_breakdown_silver") }} +group by date, symbol, chain +order by date \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category.sql new file mode 100644 index 00000000..503997a8 --- /dev/null +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category.sql @@ -0,0 +1,31 @@ +{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +select + date + , category + , count(distinct case when stablecoin_daily_txns > 0 then from_address end) as stablecoin_dau + , sum(stablecoin_transfer_volume) as stablecoin_transfer_volume + , sum(stablecoin_daily_txns) as stablecoin_daily_txns + , case + when sum(stablecoin_daily_txns) > 0 then sum(stablecoin_transfer_volume) / sum(stablecoin_daily_txns) + else 0 + end as stablecoin_avg_txn_value + , count(distinct case when artemis_stablecoin_daily_txns > 0 then from_address end) as artemis_stablecoin_dau + , sum(artemis_stablecoin_transfer_volume) as artemis_stablecoin_transfer_volume + , sum(artemis_stablecoin_daily_txns) as artemis_stablecoin_daily_txns + , case + when sum(artemis_stablecoin_daily_txns) > 0 then sum(artemis_stablecoin_transfer_volume) / sum(artemis_stablecoin_daily_txns) + else 0 + end as artemis_stablecoin_avg_txn_value + , count(distinct case when p2p_stablecoin_daily_txns > 0 then from_address end) as p2p_stablecoin_dau + , sum(p2p_stablecoin_transfer_volume) as p2p_stablecoin_transfer_volume + , sum(p2p_stablecoin_daily_txns) as p2p_stablecoin_daily_txns + , case + when sum(p2p_stablecoin_daily_txns) > 0 then sum(p2p_stablecoin_transfer_volume) / sum(p2p_stablecoin_daily_txns) + else 0 + end as p2p_stablecoin_avg_txn_value + + , sum(stablecoin_supply) as stablecoin_supply + , sum(case when is_wallet::number = 1 then stablecoin_supply else 0 end) as p2p_stablecoin_supply +from {{ ref("agg_daily_stablecoin_breakdown_silver") }} +group by date, category +order by date \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_chain.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_chain.sql new file mode 100644 index 00000000..17f7b95a --- /dev/null +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_chain.sql @@ -0,0 +1,32 @@ +{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +select + date + , chain + , category + , count(distinct case when stablecoin_daily_txns > 0 then from_address end) as stablecoin_dau + , sum(stablecoin_transfer_volume) as stablecoin_transfer_volume + , sum(stablecoin_daily_txns) as stablecoin_daily_txns + , case + when sum(stablecoin_daily_txns) > 0 then sum(stablecoin_transfer_volume) / sum(stablecoin_daily_txns) + else 0 + end as stablecoin_avg_txn_value + , count(distinct case when artemis_stablecoin_daily_txns > 0 then from_address end) as artemis_stablecoin_dau + , sum(artemis_stablecoin_transfer_volume) as artemis_stablecoin_transfer_volume + , sum(artemis_stablecoin_daily_txns) as artemis_stablecoin_daily_txns + , case + when sum(artemis_stablecoin_daily_txns) > 0 then sum(artemis_stablecoin_transfer_volume) / sum(artemis_stablecoin_daily_txns) + else 0 + end as artemis_stablecoin_avg_txn_value + , count(distinct case when p2p_stablecoin_daily_txns > 0 then from_address end) as p2p_stablecoin_dau + , sum(p2p_stablecoin_transfer_volume) as p2p_stablecoin_transfer_volume + , sum(p2p_stablecoin_daily_txns) as p2p_stablecoin_daily_txns + , case + when sum(p2p_stablecoin_daily_txns) > 0 then sum(p2p_stablecoin_transfer_volume) / sum(p2p_stablecoin_daily_txns) + else 0 + end as p2p_stablecoin_avg_txn_value + + , sum(stablecoin_supply) as stablecoin_supply + , sum(case when is_wallet::number = 1 then stablecoin_supply else 0 end) as p2p_stablecoin_supply +from {{ ref("agg_daily_stablecoin_breakdown_silver") }} +group by date, category, chain +order by date \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol_chain.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol_chain.sql new file mode 100644 index 00000000..f62c2c53 --- /dev/null +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol_chain.sql @@ -0,0 +1,33 @@ +{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +select + date + , chain + , category + , symbol + , count(distinct case when stablecoin_daily_txns > 0 then from_address end) as stablecoin_dau + , sum(stablecoin_transfer_volume) as stablecoin_transfer_volume + , sum(stablecoin_daily_txns) as stablecoin_daily_txns + , case + when sum(stablecoin_daily_txns) > 0 then sum(stablecoin_transfer_volume) / sum(stablecoin_daily_txns) + else 0 + end as stablecoin_avg_txn_value + , count(distinct case when artemis_stablecoin_daily_txns > 0 then from_address end) as artemis_stablecoin_dau + , sum(artemis_stablecoin_transfer_volume) as artemis_stablecoin_transfer_volume + , sum(artemis_stablecoin_daily_txns) as artemis_stablecoin_daily_txns + , case + when sum(artemis_stablecoin_daily_txns) > 0 then sum(artemis_stablecoin_transfer_volume) / sum(artemis_stablecoin_daily_txns) + else 0 + end as artemis_stablecoin_avg_txn_value + , count(distinct case when p2p_stablecoin_daily_txns > 0 then from_address end) as p2p_stablecoin_dau + , sum(p2p_stablecoin_transfer_volume) as p2p_stablecoin_transfer_volume + , sum(p2p_stablecoin_daily_txns) as p2p_stablecoin_daily_txns + , case + when sum(p2p_stablecoin_daily_txns) > 0 then sum(p2p_stablecoin_transfer_volume) / sum(p2p_stablecoin_daily_txns) + else 0 + end as p2p_stablecoin_avg_txn_value + + , sum(stablecoin_supply) as stablecoin_supply + , sum(case when is_wallet::number = 1 then stablecoin_supply else 0 end) as p2p_stablecoin_supply +from {{ ref("agg_daily_stablecoin_breakdown_silver") }} +group by date, category, symbol, chain +order by date diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_chain.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_chain.sql new file mode 100644 index 00000000..819faf62 --- /dev/null +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_chain.sql @@ -0,0 +1,31 @@ +{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +select + date + , chain + , count(distinct case when stablecoin_daily_txns > 0 then from_address end) as stablecoin_dau + , sum(stablecoin_transfer_volume) as stablecoin_transfer_volume + , sum(stablecoin_daily_txns) as stablecoin_daily_txns + , case + when sum(stablecoin_daily_txns) > 0 then sum(stablecoin_transfer_volume) / sum(stablecoin_daily_txns) + else 0 + end as stablecoin_avg_txn_value + , count(distinct case when artemis_stablecoin_daily_txns > 0 then from_address end) as artemis_stablecoin_dau + , sum(artemis_stablecoin_transfer_volume) as artemis_stablecoin_transfer_volume + , sum(artemis_stablecoin_daily_txns) as artemis_stablecoin_daily_txns + , case + when sum(artemis_stablecoin_daily_txns) > 0 then sum(artemis_stablecoin_transfer_volume) / sum(artemis_stablecoin_daily_txns) + else 0 + end as artemis_stablecoin_avg_txn_value + , count(distinct case when p2p_stablecoin_daily_txns > 0 then from_address end) as p2p_stablecoin_dau + , sum(p2p_stablecoin_transfer_volume) as p2p_stablecoin_transfer_volume + , sum(p2p_stablecoin_daily_txns) as p2p_stablecoin_daily_txns + , case + when sum(p2p_stablecoin_daily_txns) > 0 then sum(p2p_stablecoin_transfer_volume) / sum(p2p_stablecoin_daily_txns) + else 0 + end as p2p_stablecoin_avg_txn_value + + , sum(stablecoin_supply) as stablecoin_supply + , sum(case when is_wallet::number = 1 then stablecoin_supply else 0 end) as p2p_stablecoin_supply +from {{ ref("agg_daily_stablecoin_breakdown_silver") }} +group by date, chain +order by date \ No newline at end of file diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol.sql new file mode 100644 index 00000000..9d844b42 --- /dev/null +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol.sql @@ -0,0 +1,31 @@ +{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} +select + date + , symbol + , count(distinct case when stablecoin_daily_txns > 0 then from_address end) as stablecoin_dau + , sum(stablecoin_transfer_volume) as stablecoin_transfer_volume + , sum(stablecoin_daily_txns) as stablecoin_daily_txns + , case + when sum(stablecoin_daily_txns) > 0 then sum(stablecoin_transfer_volume) / sum(stablecoin_daily_txns) + else 0 + end as stablecoin_avg_txn_value + , count(distinct case when artemis_stablecoin_daily_txns > 0 then from_address end) as artemis_stablecoin_dau + , sum(artemis_stablecoin_transfer_volume) as artemis_stablecoin_transfer_volume + , sum(artemis_stablecoin_daily_txns) as artemis_stablecoin_daily_txns + , case + when sum(artemis_stablecoin_daily_txns) > 0 then sum(artemis_stablecoin_transfer_volume) / sum(artemis_stablecoin_daily_txns) + else 0 + end as artemis_stablecoin_avg_txn_value + , count(distinct case when p2p_stablecoin_daily_txns > 0 then from_address end) as p2p_stablecoin_dau + , sum(p2p_stablecoin_transfer_volume) as p2p_stablecoin_transfer_volume + , sum(p2p_stablecoin_daily_txns) as p2p_stablecoin_daily_txns + , case + when sum(p2p_stablecoin_daily_txns) > 0 then sum(p2p_stablecoin_transfer_volume) / sum(p2p_stablecoin_daily_txns) + else 0 + end as p2p_stablecoin_avg_txn_value + + , sum(stablecoin_supply) as stablecoin_supply + , sum(case when is_wallet::number = 1 then stablecoin_supply else 0 end) as p2p_stablecoin_supply +from {{ ref("agg_daily_stablecoin_breakdown_silver") }} +group by date, symbol +order by date diff --git a/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol_chain.sql b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol_chain.sql new file mode 100644 index 00000000..2aefa092 --- /dev/null +++ b/models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol_chain.sql @@ -0,0 +1,32 @@ +{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} +select + date + , chain + , symbol + , count(distinct case when stablecoin_daily_txns > 0 then from_address end) as stablecoin_dau + , sum(stablecoin_transfer_volume) as stablecoin_transfer_volume + , sum(stablecoin_daily_txns) as stablecoin_daily_txns + , case + when sum(stablecoin_daily_txns) > 0 then sum(stablecoin_transfer_volume) / sum(stablecoin_daily_txns) + else 0 + end as stablecoin_avg_txn_value + , count(distinct case when artemis_stablecoin_daily_txns > 0 then from_address end) as artemis_stablecoin_dau + , sum(artemis_stablecoin_transfer_volume) as artemis_stablecoin_transfer_volume + , sum(artemis_stablecoin_daily_txns) as artemis_stablecoin_daily_txns + , case + when sum(artemis_stablecoin_daily_txns) > 0 then sum(artemis_stablecoin_transfer_volume) / sum(artemis_stablecoin_daily_txns) + else 0 + end as artemis_stablecoin_avg_txn_value + , count(distinct case when p2p_stablecoin_daily_txns > 0 then from_address end) as p2p_stablecoin_dau + , sum(p2p_stablecoin_transfer_volume) as p2p_stablecoin_transfer_volume + , sum(p2p_stablecoin_daily_txns) as p2p_stablecoin_daily_txns + , case + when sum(p2p_stablecoin_daily_txns) > 0 then sum(p2p_stablecoin_transfer_volume) / sum(p2p_stablecoin_daily_txns) + else 0 + end as p2p_stablecoin_avg_txn_value + + , sum(stablecoin_supply) as stablecoin_supply + , sum(case when is_wallet::number = 1 then stablecoin_supply else 0 end) as p2p_stablecoin_supply +from {{ ref("agg_daily_stablecoin_breakdown_silver") }} +group by date, symbol, chain +order by date