-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stablecoin V2: Adding new stablecoin models (#401)
- Loading branch information
1 parent
5f355ac
commit 39ea0b8
Showing
7 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% macro stablecoin_breakdown(breakdowns=[]) %} | ||
select | ||
date | ||
{% for breakdown in breakdowns %} | ||
, {{ breakdown }} | ||
{% endfor %} | ||
, 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 {% for breakdown in breakdowns %}, {{ breakdown }} {% endfor %} | ||
order by date | ||
|
||
|
||
|
||
{% endmacro %} |
3 changes: 3 additions & 0 deletions
3
models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} | ||
|
||
{{ stablecoin_breakdown(["category"]) }} |
3 changes: 3 additions & 0 deletions
3
models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_chain.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} | ||
|
||
{{stablecoin_breakdown(["chain", "category"])}} |
2 changes: 2 additions & 0 deletions
2
...s/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_category_symbol_chain.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} | ||
{{ stablecoin_breakdown(["chain", "category", "symbol"]) }} |
3 changes: 3 additions & 0 deletions
3
models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_chain.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} | ||
|
||
{{ stablecoin_breakdown(["chain"]) }} |
3 changes: 3 additions & 0 deletions
3
models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG") }} | ||
|
||
{{ stablecoin_breakdown(["symbol"]) }} |
3 changes: 3 additions & 0 deletions
3
models/metrics/stablecoins/breakdowns/agg_daily_stablecoin_breakdown_symbol_chain.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{ config(materialized="table", snowflake_warehouse="STABLECOIN_V2_LG_2") }} | ||
|
||
{{ stablecoin_breakdown(["symbol", "chain"]) }} |