Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c4e7a7e
- fist pass at market stats table
juls858 Jan 19, 2022
8bbbf1b
- sorted columns
juls858 Jan 19, 2022
368ae3d
test
juls858 Jan 20, 2022
23cfde1
undo test
juls858 Jan 21, 2022
af429d0
- wip
juls858 Jan 27, 2022
752bc79
merged in updates in main
Dec 23, 2021
a696c67
Current Solana Tables, Monday jan 10
Jan 10, 2022
bfd717f
Solana silver and gold tables
Jan 13, 2022
3478a60
Removed tables that do not have to go out ASAP
Jan 13, 2022
f6f95aa
add backfilled contracts to silver table
Jan 13, 2022
ad9041a
updating innertx test
nickpayiatis Jan 12, 2022
6d38f79
add coalesce for contract address and contract meta fields
Jan 13, 2022
9ead2a1
decimal updates
austinFlipside Jan 13, 2022
dac66c2
updated to add the 2 collateral tokens
XYGUAN Jan 14, 2022
8ed1b0f
Added MINE to oracle prices table
jkallogjeri Jan 17, 2022
61857fa
incremental load
jkallogjeri Jan 17, 2022
85f33c5
format
jkallogjeri Jan 6, 2022
2e27927
prod ready
jkallogjeri Jan 17, 2022
c7ce0e4
exclude nulls
austinFlipside Jan 19, 2022
4d84cfc
An 598 sol missing txs (#256)
jhuhnke Jan 19, 2022
5e9e278
Emergency typo fix - was pulling in wrong tx_to_address
Jan 19, 2022
0d3fae7
Solana gold view optimizations
Jan 19, 2022
e870dc2
initial working version
Jan 18, 2022
9d9bc3e
use the hours table instead of generating dynamically
Jan 18, 2022
0918e87
adjust hardcoded start date for prices data
desmond-hui Jan 19, 2022
a44a0aa
remove dependency on itself
desmond-hui Jan 19, 2022
1e001b9
use token address and hour for cross join
desmond-hui Jan 19, 2022
314aefe
initial tests
desmond-hui Jan 19, 2022
1a00f7b
remove unused source
desmond-hui Jan 19, 2022
c2e20a6
remove commented out code
desmond-hui Jan 19, 2022
7f6aa35
fixes issue where contract name was pulling in an address
Jan 20, 2022
d9a495e
fix eth prices due to null address, change decimal lookup
desmond-hui Jan 20, 2022
adcca8e
cap the hour to the current sysdate hour
desmond-hui Jan 20, 2022
da9880b
Update to contract name and disabled tests (#265)
jhuhnke Jan 21, 2022
6356f1d
Added missing currencies to oracle prices tables
jkallogjeri Jan 25, 2022
a96f0d1
very annoying change
jkallogjeri Jan 25, 2022
7fbf950
An 578/upgrading schema to 2.8 (#254)
nickpayiatis Jan 26, 2022
2346498
An 634/anchor tables updates (#269)
amasucci13 Jan 26, 2022
aee64a2
Update anchor__liquidations.sql
XYGUAN Jan 26, 2022
e368500
updated the liquidations and repay tables
XYGUAN Jan 27, 2022
e331b83
update the repay table
XYGUAN Jan 27, 2022
eb4b9e0
Terraswap pool reserves models
omkarb Jan 24, 2022
43313ed
An 573 solana events (#270)
jhuhnke Jan 27, 2022
5d7e7a9
adding typo
juls858 Jan 27, 2022
d099434
Merge branch 'main' into AN-536/silver-gold-prices_v2
juls858 Jan 27, 2022
287114a
- undo typo
juls858 Jan 27, 2022
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
23 changes: 23 additions & 0 deletions models/crosschain/gold/crosschain__f_market_stats_usd.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{ config(
materialized = "view",
unique_key = "_unique_key",
tags = ["crosschain", "gold", "fact", "f_stats_usd"]
) }}

SELECT
asset_id,
provider,
platform,
recorded_at,
circulating_supply,
market_cap,
price,
max_supply,
total_supply,
volume_24h,
_updated,
_unique_key
FROM
{{ ref(
"silver_crosschain__f_market_stats_usd"
) }}
38 changes: 38 additions & 0 deletions models/crosschain/gold/crosschain__f_market_stats_usd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 2
models:
- name: crosschain__f_market_stats_usd
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- NAME
- SYMBOL
- PROVIDER
- RECORDED_AT
columns:
- name: ASSET_ID
tests:
- not_null
- name: PROVIDER
tests:
- not_null
- name: NAME
tests:
- not_null
- name: SYMBOL
tests:
- not_null
- name: RECORDED_AT
tests:
- not_null
- name: CIRCULATING_SUPPLY
tests:
- not_null
- name: PRICE
tests:
- not_null
- name: _UPDATED
tests:
- not_null
- name: _UNIQUE_KEY
tests:
- not_null
107 changes: 107 additions & 0 deletions models/crosschain/gold/crosschain__f_market_stats_usd_agg_daily.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{{ config(
materialized = "incremental",
unique_key = "_unique_key",
incremental_strategy = "merge",
tags = ["crosschain", "gold", "fact", "f_stats_usd", "aggregate", "daily"]
) }}

SELECT
asset_id,
provider,
platform,
DATE_TRUNC(
DAY,
recorded_at
) AS recorded_at,
COUNT(*) AS n,
AVG(circulating_supply) AS avg_circulating_supply,
AVG(market_cap) AS avg_market_cap,
AVG(max_supply) AS avg_max_supply,
AVG(price) AS avg_price,
AVG(total_supply) AS avg_total_supply,
AVG(volume_24h) AS avg_volume_24h,
MAX(circulating_supply) AS max_circulating_supply,
MAX(market_cap) AS max_market_cap,
MAX(max_supply) AS max_max_supply,
MAX(price) AS max_price,
MAX(total_supply) AS max_total_supply,
MAX(volume_24h) AS max_volume_24h,
MEDIAN(circulating_supply) AS median_circulating_supply,
MEDIAN(market_cap) AS median_market_cap,
MEDIAN(max_supply) AS median_max_supply,
MEDIAN(price) AS median_price,
MEDIAN(total_supply) AS median_total_supply,
MEDIAN(volume_24h) AS median_volume_24h,
MIN(circulating_supply) AS min_circulating_supply,
MIN(market_cap) AS min_market_cap,
MIN(max_supply) AS min_max_supply,
MIN(price) AS min_price,
MIN(total_supply) AS min_total_supply,
MIN(volume_24h) AS min_volume_24h,
ARRAY_AGG(
OBJECT_CONSTRUCT(
'circulating_supply',
circulating_supply,
'market_cap',
market_cap,
'max_supply',
max_supply,
'price',
price,
'total_supply',
total_supply,
'volume_24h',
volume_24h,
'recorded_at',
recorded_at
)
) within GROUP (
ORDER BY
recorded_at
) AS DATA,
DATA [0] :market_cap AS first_market_cap,
DATA [0] :max_supply AS first_max_supply,
DATA [0] :price AS first_price,
DATA [0] :total_supply AS first_total_supply,
DATA [0] :volume_24h AS first_volume_24h,
DATA [ARRAY_SIZE(data)-1] :market_cap AS last_market_cap,
DATA [ARRAY_SIZE(data)-1] :max_supply AS last_max_supply,
DATA [ARRAY_SIZE(data)-1] :price AS last_price,
DATA [ARRAY_SIZE(data)-1] :total_supply AS last_total_supply,
DATA [ARRAY_SIZE(data)-1] :volume_24h AS last_volume_24h,
SYSDATE() AS _updated_timestamp,
concat_ws(
'-',
asset_id,
NAME,
symbol,
provider,
DATE_TRUNC(
DAY,
recorded_at
)
) AS _unique_key
FROM
{{ ref(
"silver_crosschain__f_market_stats_usd"
) }}

{% if is_incremental() %}
WHERE
recorded_at >= DATE_TRUNC(
DAY,(
SELECT
MAX(recorded_at)
FROM
{{ this }}
)
) - INTERVAL '2 DAYS'
{% endif %}
GROUP BY
asset_id,
provider,
platform,
DATE_TRUNC(
DAY,
recorded_at
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 2
models:
- name: crosschain__f_market_stats_usd_agg_daily
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- NAME
- SYMBOL
- PROVIDER
- RECORDED_AT
columns:
- name: ASSET_ID
tests:
- not_null
- name: PROVIDER
tests:
- not_null
- name: NAME
tests:
- not_null
- name: SYMBOL
tests:
- not_null
- name: RECORDED_AT
tests:
- not_null
- name: CIRCULATING_SUPPLY
tests:
- not_null
- name: PRICE
tests:
- not_null
- name: _UPDATED
tests:
- not_null
- name: _UNIQUE_KEY
tests:
- not_null
107 changes: 107 additions & 0 deletions models/crosschain/gold/crosschain__f_market_stats_usd_agg_hourly.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{{ config(
materialized = "incremental",
unique_key = "_unique_key",
incremental_strategy = "merge",
tags = ["crosschain", "gold", "fact", "f_stats_usd", "aggregate", "daily"]
) }}

SELECT
asset_id,
provider,
platform,
DATE_TRUNC(
HOUR,
recorded_at
) AS recorded_at,
COUNT(*) AS n,
AVG(circulating_supply) AS avg_circulating_supply,
AVG(market_cap) AS avg_market_cap,
AVG(max_supply) AS avg_max_supply,
AVG(price) AS avg_price,
AVG(total_supply) AS avg_total_supply,
AVG(volume_24h) AS avg_volume_24h,
MAX(circulating_supply) AS max_circulating_supply,
MAX(market_cap) AS max_market_cap,
MAX(max_supply) AS max_max_supply,
MAX(price) AS max_price,
MAX(total_supply) AS max_total_supply,
MAX(volume_24h) AS max_volume_24h,
MEDIAN(circulating_supply) AS median_circulating_supply,
MEDIAN(market_cap) AS median_market_cap,
MEDIAN(max_supply) AS median_max_supply,
MEDIAN(price) AS median_price,
MEDIAN(total_supply) AS median_total_supply,
MEDIAN(volume_24h) AS median_volume_24h,
MIN(circulating_supply) AS min_circulating_supply,
MIN(market_cap) AS min_market_cap,
MIN(max_supply) AS min_max_supply,
MIN(price) AS min_price,
MIN(total_supply) AS min_total_supply,
MIN(volume_24h) AS min_volume_24h,
ARRAY_AGG(
OBJECT_CONSTRUCT(
'circulating_supply',
circulating_supply,
'market_cap',
market_cap,
'max_supply',
max_supply,
'price',
price,
'total_supply',
total_supply,
'volume_24h',
volume_24h,
'recorded_at',
recorded_at
)
) within GROUP (
ORDER BY
recorded_at
) AS DATA,
DATA [0] :market_cap AS first_market_cap,
DATA [0] :max_supply AS first_max_supply,
DATA [0] :price AS first_price,
DATA [0] :total_supply AS first_total_supply,
DATA [0] :volume_24h AS first_volume_24h,
DATA [ARRAY_SIZE(data)-1] :market_cap AS last_market_cap,
DATA [ARRAY_SIZE(data)-1] :max_supply AS last_max_supply,
DATA [ARRAY_SIZE(data)-1] :price AS last_price,
DATA [ARRAY_SIZE(data)-1] :total_supply AS last_total_supply,
DATA [ARRAY_SIZE(data)-1] :volume_24h AS last_volume_24h,
SYSDATE() AS _updated_timestamp,
concat_ws(
'-',
asset_id,
NAME,
symbol,
provider,
DATE_TRUNC(
HOUR,
recorded_at
)
) AS _unique_key
FROM
{{ ref(
"silver_crosschain__f_market_stats_usd"
) }}

{% if is_incremental() %}
WHERE
recorded_at >= DATE_TRUNC(
HOUR,(
SELECT
MAX(recorded_at)
FROM
{{ this }}
)
) - INTERVAL '1 hour'
{% endif %}
GROUP BY
asset_id,
provider,
platform,
DATE_TRUNC(
HOUR,
recorded_at
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 2
models:
- name: crosschain__f_market_stats_usd_agg_hourly
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- NAME
- SYMBOL
- PROVIDER
- RECORDED_AT
columns:
- name: ASSET_ID
tests:
- not_null
- name: PROVIDER
tests:
- not_null
- name: NAME
tests:
- not_null
- name: SYMBOL
tests:
- not_null
- name: RECORDED_AT
tests:
- not_null
- name: CIRCULATING_SUPPLY
tests:
- not_null
- name: PRICE
tests:
- not_null
- name: _UPDATED
tests:
- not_null
- name: _UNIQUE_KEY
tests:
- not_null
Loading