From c8b7331c2ff76aa8c6a9e41ac8d4d446b06399ef Mon Sep 17 00:00:00 2001 From: Troy Date: Thu, 10 Oct 2024 13:15:21 -0600 Subject: [PATCH] update oi tables --- ...t_perp_market_history_arbitrum_mainnet.sql | 110 +++++++++++++----- .../marts/arbitrum/mainnet/perp/schema.yml | 59 +++++++--- ...t_perp_market_history_arbitrum_sepolia.sql | 110 +++++++++++++----- .../marts/arbitrum/sepolia/perp/schema.yml | 59 +++++++--- .../fct_perp_market_history_base_mainnet.sql | 106 ++++++++++++----- .../models/marts/base/mainnet/perp/schema.yml | 59 +++++++--- .../fct_perp_market_history_base_sepolia.sql | 106 ++++++++++++----- .../models/marts/base/sepolia/perp/schema.yml | 59 +++++++--- 8 files changed, 500 insertions(+), 168 deletions(-) diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_market_history_arbitrum_mainnet.sql b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_market_history_arbitrum_mainnet.sql index f90e6ac1..ccdfe3c7 100644 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_market_history_arbitrum_mainnet.sql +++ b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/fct_perp_market_history_arbitrum_mainnet.sql @@ -1,4 +1,4 @@ -with arbitrum as ( +with base as ( select mu.id, mu.block_timestamp as ts, @@ -17,36 +17,90 @@ with arbitrum as ( {{ convert_wei('current_funding_rate') }} * 365.25 + {{ convert_wei('interest_rate') }} as long_rate_apr, {{ convert_wei('current_funding_rate') }} * -1 * 365.25 - + {{ convert_wei('interest_rate') }} as short_rate_apr + + {{ convert_wei('interest_rate') }} as short_rate_apr, + LAG({{ convert_wei('size') }}, 1, 0) over ( + partition by m.market_symbol + order by + mu.block_timestamp + ) as prev_size from - {{ ref('perp_market_updated_arbitrum_mainnet') }} - as mu - left join - {{ ref('fct_perp_markets_arbitrum_mainnet') }} - as m + {{ ref('perp_market_updated_arbitrum_mainnet') }} as mu + left join {{ ref('fct_perp_markets_arbitrum_mainnet') }} as m on mu.market_id = m.id +), + +oi as ( + select + id, + ts, + size * price as market_oi_usd, + LAG( + size * price, + 1, + 0 + ) over ( + partition by market_symbol + order by + ts asc + ) as prev_market_oi_usd, + ( + size + skew + ) * price / 2 as long_oi, + ( + size - skew + ) * price / 2 as short_oi, + case + when size * price = 0 then null + else ((size + skew) * price / 2) / ( + size * price + ) + end as long_oi_pct, + case + when size * price = 0 then null + else ((size - skew) * price / 2) / ( + size * price + ) + end as short_oi_pct + from + base +), + +total_oi as ( + select + id, + SUM( + market_oi_usd - prev_market_oi_usd + ) over ( + order by + ts asc + ) as total_oi_usd + from + oi ) select - *, - size * price as size_usd, - ( - size + skew - ) * price / 2 as long_oi, - ( - size - skew - ) * price / 2 as short_oi, - case - when size * price = 0 then null - else ((size + skew) * price / 2) / ( - size * price - ) - end as long_oi_pct, - case - when size * price = 0 then null - else ((size - skew) * price / 2) / ( - size * price - ) - end as short_oi_pct + base.*, + ROUND( + oi.market_oi_usd, + 2 + ) as market_oi_usd, + ROUND( + total_oi.total_oi_usd, + 2 + ) as total_oi_usd, + ROUND( + oi.long_oi, + 2 + ) as long_oi, + ROUND( + oi.short_oi, + 2 + ) as short_oi, + oi.long_oi_pct, + oi.short_oi_pct from - arbitrum + base +inner join oi + on base.id = oi.id +inner join total_oi + on base.id = total_oi.id diff --git a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/schema.yml b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/schema.yml index 67548aeb..23810db4 100644 --- a/transformers/synthetix/models/marts/arbitrum/mainnet/perp/schema.yml +++ b/transformers/synthetix/models/marts/arbitrum/mainnet/perp/schema.yml @@ -33,7 +33,7 @@ models: tests: - not_null - accepted_values: - values: ["InterestCharged"] + values: ["InterestCharged"] - name: account_id description: "ID of the account" data_type: numeric @@ -84,7 +84,7 @@ models: tests: - not_null - accepted_values: - values: ["CollateralModified"] + values: ["CollateralModified"] - name: synth_market_id description: "Synth market ID" data_type: numeric @@ -133,7 +133,7 @@ models: tests: - not_null - accepted_values: - values: ["PreviousOrderExpired"] + values: ["PreviousOrderExpired"] - name: market_id description: "ID of the market" data_type: numeric @@ -382,7 +382,7 @@ models: columns: - name: id description: "Market ID" - data_type: numeric + data_type: numeric tests: - not_null - dbt_utils.accepted_range: @@ -445,7 +445,7 @@ models: tests: - not_null - name: price - description: "Price (ETH)" + description: "Price (USD)" data_type: numeric tests: - not_null @@ -465,46 +465,75 @@ models: tests: - not_null - name: funding_rate - description: "Funding rate (ETH)" + description: "Funding rate (%)" data_type: numeric tests: - not_null - name: funding_velocity - description: "Funding velocity (ETH)" + description: "Funding velocity" data_type: numeric tests: - not_null - name: interest_rate - description: "Interest rate (ETH)" + description: "Interest rate (%)" data_type: numeric tests: - not_null - name: funding_rate_apr - description: "Funding rate APR (ETH)" + description: "Funding rate APR (%)" data_type: numeric tests: - not_null - name: long_rate_apr - description: "Long rate APR (ETH)" + description: "Long rate APR (%)" data_type: numeric tests: - not_null - name: short_rate_apr - description: "Short rate APR (ETH)" + description: "Short rate APR (%)" + data_type: numeric + tests: + - not_null + - name: prev_size + description: "Previous size (ETH)" data_type: numeric tests: - not_null - - name: size_usd - description: "Size (USD)" + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: market_oi_usd + description: "Market open interest (USD)" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: total_oi_usd + description: "Total open interest (USD)" data_type: numeric tests: - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: long_oi - description: "Long open interest (ETH)" + description: "Long open interest (USD)" data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: short_oi - description: "Short open interest (ETH)" + description: "Short open interest (USD)" data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: long_oi_pct description: "Long open interest (%)" data_type: numeric diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_market_history_arbitrum_sepolia.sql b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_market_history_arbitrum_sepolia.sql index 961e11bf..d87db8d5 100644 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_market_history_arbitrum_sepolia.sql +++ b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/fct_perp_market_history_arbitrum_sepolia.sql @@ -1,4 +1,4 @@ -with arbitrum as ( +with base as ( select mu.id, mu.block_timestamp as ts, @@ -17,36 +17,90 @@ with arbitrum as ( {{ convert_wei('current_funding_rate') }} * 365.25 + {{ convert_wei('interest_rate') }} as long_rate_apr, {{ convert_wei('current_funding_rate') }} * -1 * 365.25 - + {{ convert_wei('interest_rate') }} as short_rate_apr + + {{ convert_wei('interest_rate') }} as short_rate_apr, + LAG({{ convert_wei('size') }}, 1, 0) over ( + partition by m.market_symbol + order by + mu.block_timestamp + ) as prev_size from - {{ ref('perp_market_updated_arbitrum_sepolia') }} - as mu - left join - {{ ref('fct_perp_markets_arbitrum_sepolia') }} - as m + {{ ref('perp_market_updated_arbitrum_sepolia') }} as mu + left join {{ ref('fct_perp_markets_arbitrum_sepolia') }} as m on mu.market_id = m.id +), + +oi as ( + select + id, + ts, + size * price as market_oi_usd, + LAG( + size * price, + 1, + 0 + ) over ( + partition by market_symbol + order by + ts asc + ) as prev_market_oi_usd, + ( + size + skew + ) * price / 2 as long_oi, + ( + size - skew + ) * price / 2 as short_oi, + case + when size * price = 0 then null + else ((size + skew) * price / 2) / ( + size * price + ) + end as long_oi_pct, + case + when size * price = 0 then null + else ((size - skew) * price / 2) / ( + size * price + ) + end as short_oi_pct + from + base +), + +total_oi as ( + select + id, + SUM( + market_oi_usd - prev_market_oi_usd + ) over ( + order by + ts asc + ) as total_oi_usd + from + oi ) select - *, - size * price as size_usd, - ( - size + skew - ) * price / 2 as long_oi, - ( - size - skew - ) * price / 2 as short_oi, - case - when size * price = 0 then null - else ((size + skew) * price / 2) / ( - size * price - ) - end as long_oi_pct, - case - when size * price = 0 then null - else ((size - skew) * price / 2) / ( - size * price - ) - end as short_oi_pct + base.*, + ROUND( + oi.market_oi_usd, + 2 + ) as market_oi_usd, + ROUND( + total_oi.total_oi_usd, + 2 + ) as total_oi_usd, + ROUND( + oi.long_oi, + 2 + ) as long_oi, + ROUND( + oi.short_oi, + 2 + ) as short_oi, + oi.long_oi_pct, + oi.short_oi_pct from - arbitrum + base +inner join oi + on base.id = oi.id +inner join total_oi + on base.id = total_oi.id diff --git a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/schema.yml b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/schema.yml index 9836cc2b..134a94c4 100644 --- a/transformers/synthetix/models/marts/arbitrum/sepolia/perp/schema.yml +++ b/transformers/synthetix/models/marts/arbitrum/sepolia/perp/schema.yml @@ -33,7 +33,7 @@ models: tests: - not_null - accepted_values: - values: ["InterestCharged"] + values: ["InterestCharged"] - name: account_id description: "ID of the account" data_type: numeric @@ -84,7 +84,7 @@ models: tests: - not_null - accepted_values: - values: ["CollateralModified"] + values: ["CollateralModified"] - name: synth_market_id description: "Synth market ID" data_type: numeric @@ -133,7 +133,7 @@ models: tests: - not_null - accepted_values: - values: ["PreviousOrderExpired"] + values: ["PreviousOrderExpired"] - name: market_id description: "ID of the market" data_type: numeric @@ -382,7 +382,7 @@ models: columns: - name: id description: "Market ID" - data_type: numeric + data_type: numeric tests: - not_null - dbt_utils.accepted_range: @@ -445,7 +445,7 @@ models: tests: - not_null - name: price - description: "Price (ETH)" + description: "Price (USD)" data_type: numeric tests: - not_null @@ -465,46 +465,75 @@ models: tests: - not_null - name: funding_rate - description: "Funding rate (ETH)" + description: "Funding rate (%)" data_type: numeric tests: - not_null - name: funding_velocity - description: "Funding velocity (ETH)" + description: "Funding velocity" data_type: numeric tests: - not_null - name: interest_rate - description: "Interest rate (ETH)" + description: "Interest rate (%)" data_type: numeric tests: - not_null - name: funding_rate_apr - description: "Funding rate APR (ETH)" + description: "Funding rate APR (%)" data_type: numeric tests: - not_null - name: long_rate_apr - description: "Long rate APR (ETH)" + description: "Long rate APR (%)" data_type: numeric tests: - not_null - name: short_rate_apr - description: "Short rate APR (ETH)" + description: "Short rate APR (%)" + data_type: numeric + tests: + - not_null + - name: prev_size + description: "Previous size (ETH)" data_type: numeric tests: - not_null - - name: size_usd - description: "Size (USD)" + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: market_oi_usd + description: "Market open interest (USD)" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: total_oi_usd + description: "Total open interest (USD)" data_type: numeric tests: - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: long_oi - description: "Long open interest (ETH)" + description: "Long open interest (USD)" data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: short_oi - description: "Short open interest (ETH)" + description: "Short open interest (USD)" data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: long_oi_pct description: "Long open interest (%)" data_type: numeric diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_market_history_base_mainnet.sql b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_market_history_base_mainnet.sql index 14a4f131..ff995a29 100644 --- a/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_market_history_base_mainnet.sql +++ b/transformers/synthetix/models/marts/base/mainnet/perp/fct_perp_market_history_base_mainnet.sql @@ -17,36 +17,90 @@ with base as ( {{ convert_wei('current_funding_rate') }} * 365.25 + {{ convert_wei('interest_rate') }} as long_rate_apr, {{ convert_wei('current_funding_rate') }} * -1 * 365.25 - + {{ convert_wei('interest_rate') }} as short_rate_apr + + {{ convert_wei('interest_rate') }} as short_rate_apr, + LAG({{ convert_wei('size') }}, 1, 0) over ( + partition by m.market_symbol + order by + mu.block_timestamp + ) as prev_size from - {{ ref('perp_market_updated_base_mainnet') }} - as mu - left join - {{ ref('fct_perp_markets_base_mainnet') }} - as m + {{ ref('perp_market_updated_base_mainnet') }} as mu + left join {{ ref('fct_perp_markets_base_mainnet') }} as m on mu.market_id = m.id +), + +oi as ( + select + id, + ts, + size * price as market_oi_usd, + LAG( + size * price, + 1, + 0 + ) over ( + partition by market_symbol + order by + ts asc + ) as prev_market_oi_usd, + ( + size + skew + ) * price / 2 as long_oi, + ( + size - skew + ) * price / 2 as short_oi, + case + when size * price = 0 then null + else ((size + skew) * price / 2) / ( + size * price + ) + end as long_oi_pct, + case + when size * price = 0 then null + else ((size - skew) * price / 2) / ( + size * price + ) + end as short_oi_pct + from + base +), + +total_oi as ( + select + id, + SUM( + market_oi_usd - prev_market_oi_usd + ) over ( + order by + ts asc + ) as total_oi_usd + from + oi ) select - *, - size * price as size_usd, - ( - size + skew - ) * price / 2 as long_oi, - ( - size - skew - ) * price / 2 as short_oi, - case - when size * price = 0 then null - else ((size + skew) * price / 2) / ( - size * price - ) - end as long_oi_pct, - case - when size * price = 0 then null - else ((size - skew) * price / 2) / ( - size * price - ) - end as short_oi_pct + base.*, + ROUND( + oi.market_oi_usd, + 2 + ) as market_oi_usd, + ROUND( + total_oi.total_oi_usd, + 2 + ) as total_oi_usd, + ROUND( + oi.long_oi, + 2 + ) as long_oi, + ROUND( + oi.short_oi, + 2 + ) as short_oi, + oi.long_oi_pct, + oi.short_oi_pct from base +inner join oi + on base.id = oi.id +inner join total_oi + on base.id = total_oi.id diff --git a/transformers/synthetix/models/marts/base/mainnet/perp/schema.yml b/transformers/synthetix/models/marts/base/mainnet/perp/schema.yml index 330e93d3..fe0a8ce1 100644 --- a/transformers/synthetix/models/marts/base/mainnet/perp/schema.yml +++ b/transformers/synthetix/models/marts/base/mainnet/perp/schema.yml @@ -33,7 +33,7 @@ models: tests: - not_null - accepted_values: - values: ["InterestCharged"] + values: ["InterestCharged"] - name: account_id description: "ID of the account" data_type: numeric @@ -84,7 +84,7 @@ models: tests: - not_null - accepted_values: - values: ["CollateralModified"] + values: ["CollateralModified"] - name: synth_market_id description: "Synth market ID" data_type: numeric @@ -133,7 +133,7 @@ models: tests: - not_null - accepted_values: - values: ["PreviousOrderExpired"] + values: ["PreviousOrderExpired"] - name: market_id description: "ID of the market" data_type: numeric @@ -382,7 +382,7 @@ models: columns: - name: id description: "Market ID" - data_type: numeric + data_type: numeric tests: - not_null - dbt_utils.accepted_range: @@ -445,7 +445,7 @@ models: tests: - not_null - name: price - description: "Price (ETH)" + description: "Price (USD)" data_type: numeric tests: - not_null @@ -465,46 +465,75 @@ models: tests: - not_null - name: funding_rate - description: "Funding rate (ETH)" + description: "Funding rate (%)" data_type: numeric tests: - not_null - name: funding_velocity - description: "Funding velocity (ETH)" + description: "Funding velocity" data_type: numeric tests: - not_null - name: interest_rate - description: "Interest rate (ETH)" + description: "Interest rate (%)" data_type: numeric tests: - not_null - name: funding_rate_apr - description: "Funding rate APR (ETH)" + description: "Funding rate APR (%)" data_type: numeric tests: - not_null - name: long_rate_apr - description: "Long rate APR (ETH)" + description: "Long rate APR (%)" data_type: numeric tests: - not_null - name: short_rate_apr - description: "Short rate APR (ETH)" + description: "Short rate APR (%)" + data_type: numeric + tests: + - not_null + - name: prev_size + description: "Previous size (ETH)" data_type: numeric tests: - not_null - - name: size_usd - description: "Size (USD)" + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: market_oi_usd + description: "Market open interest (USD)" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: total_oi_usd + description: "Total open interest (USD)" data_type: numeric tests: - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: long_oi - description: "Long open interest (ETH)" + description: "Long open interest (USD)" data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: short_oi - description: "Short open interest (ETH)" + description: "Short open interest (USD)" data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: long_oi_pct description: "Long open interest (%)" data_type: numeric diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_market_history_base_sepolia.sql b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_market_history_base_sepolia.sql index 75e97b5a..4dd19065 100644 --- a/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_market_history_base_sepolia.sql +++ b/transformers/synthetix/models/marts/base/sepolia/perp/fct_perp_market_history_base_sepolia.sql @@ -17,36 +17,90 @@ with base as ( {{ convert_wei('current_funding_rate') }} * 365.25 + {{ convert_wei('interest_rate') }} as long_rate_apr, {{ convert_wei('current_funding_rate') }} * -1 * 365.25 - + {{ convert_wei('interest_rate') }} as short_rate_apr + + {{ convert_wei('interest_rate') }} as short_rate_apr, + LAG({{ convert_wei('size') }}, 1, 0) over ( + partition by m.market_symbol + order by + mu.block_timestamp + ) as prev_size from - {{ ref('perp_market_updated_base_sepolia') }} - as mu - left join - {{ ref('fct_perp_markets_base_sepolia') }} - as m + {{ ref('perp_market_updated_base_sepolia') }} as mu + left join {{ ref('fct_perp_markets_base_sepolia') }} as m on mu.market_id = m.id +), + +oi as ( + select + id, + ts, + size * price as market_oi_usd, + LAG( + size * price, + 1, + 0 + ) over ( + partition by market_symbol + order by + ts asc + ) as prev_market_oi_usd, + ( + size + skew + ) * price / 2 as long_oi, + ( + size - skew + ) * price / 2 as short_oi, + case + when size * price = 0 then null + else ((size + skew) * price / 2) / ( + size * price + ) + end as long_oi_pct, + case + when size * price = 0 then null + else ((size - skew) * price / 2) / ( + size * price + ) + end as short_oi_pct + from + base +), + +total_oi as ( + select + id, + SUM( + market_oi_usd - prev_market_oi_usd + ) over ( + order by + ts asc + ) as total_oi_usd + from + oi ) select - *, - size * price as size_usd, - ( - size + skew - ) * price / 2 as long_oi, - ( - size - skew - ) * price / 2 as short_oi, - case - when size * price = 0 then null - else ((size + skew) * price / 2) / ( - size * price - ) - end as long_oi_pct, - case - when size * price = 0 then null - else ((size - skew) * price / 2) / ( - size * price - ) - end as short_oi_pct + base.*, + ROUND( + oi.market_oi_usd, + 2 + ) as market_oi_usd, + ROUND( + total_oi.total_oi_usd, + 2 + ) as total_oi_usd, + ROUND( + oi.long_oi, + 2 + ) as long_oi, + ROUND( + oi.short_oi, + 2 + ) as short_oi, + oi.long_oi_pct, + oi.short_oi_pct from base +inner join oi + on base.id = oi.id +inner join total_oi + on base.id = total_oi.id diff --git a/transformers/synthetix/models/marts/base/sepolia/perp/schema.yml b/transformers/synthetix/models/marts/base/sepolia/perp/schema.yml index 114a32bf..bef97ab0 100644 --- a/transformers/synthetix/models/marts/base/sepolia/perp/schema.yml +++ b/transformers/synthetix/models/marts/base/sepolia/perp/schema.yml @@ -33,7 +33,7 @@ models: tests: - not_null - accepted_values: - values: ["InterestCharged"] + values: ["InterestCharged"] - name: account_id description: "ID of the account" data_type: numeric @@ -84,7 +84,7 @@ models: tests: - not_null - accepted_values: - values: ["CollateralModified"] + values: ["CollateralModified"] - name: synth_market_id description: "Synth market ID" data_type: numeric @@ -133,7 +133,7 @@ models: tests: - not_null - accepted_values: - values: ["PreviousOrderExpired"] + values: ["PreviousOrderExpired"] - name: market_id description: "ID of the market" data_type: numeric @@ -382,7 +382,7 @@ models: columns: - name: id description: "Market ID" - data_type: numeric + data_type: numeric tests: - not_null - dbt_utils.accepted_range: @@ -445,7 +445,7 @@ models: tests: - not_null - name: price - description: "Price (ETH)" + description: "Price (USD)" data_type: numeric tests: - not_null @@ -465,46 +465,75 @@ models: tests: - not_null - name: funding_rate - description: "Funding rate (ETH)" + description: "Funding rate (%)" data_type: numeric tests: - not_null - name: funding_velocity - description: "Funding velocity (ETH)" + description: "Funding velocity" data_type: numeric tests: - not_null - name: interest_rate - description: "Interest rate (ETH)" + description: "Interest rate (%)" data_type: numeric tests: - not_null - name: funding_rate_apr - description: "Funding rate APR (ETH)" + description: "Funding rate APR (%)" data_type: numeric tests: - not_null - name: long_rate_apr - description: "Long rate APR (ETH)" + description: "Long rate APR (%)" data_type: numeric tests: - not_null - name: short_rate_apr - description: "Short rate APR (ETH)" + description: "Short rate APR (%)" + data_type: numeric + tests: + - not_null + - name: prev_size + description: "Previous size (ETH)" data_type: numeric tests: - not_null - - name: size_usd - description: "Size (USD)" + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: market_oi_usd + description: "Market open interest (USD)" + data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true + - name: total_oi_usd + description: "Total open interest (USD)" data_type: numeric tests: - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: long_oi - description: "Long open interest (ETH)" + description: "Long open interest (USD)" data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: short_oi - description: "Short open interest (ETH)" + description: "Short open interest (USD)" data_type: numeric + tests: + - not_null + - dbt_utils.accepted_range: + min_value: 0 + inclusive: true - name: long_oi_pct description: "Long open interest (%)" data_type: numeric