mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 11:26:52 +00:00
docs and core
This commit is contained in:
parent
2eefd48018
commit
254c9c7fd3
27
models/core/core__fact_prices.sql
Normal file
27
models/core/core__fact_prices.sql
Normal file
@ -0,0 +1,27 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
secure = true
|
||||
) }}
|
||||
|
||||
WITH oracle_prices AS (
|
||||
|
||||
SELECT
|
||||
block_timestamp AS TIMESTAMP,
|
||||
token,
|
||||
symbol,
|
||||
token_contract,
|
||||
price_usd,
|
||||
source
|
||||
FROM
|
||||
{{ ref('silver__prices_oracle') }}
|
||||
),
|
||||
FINAL AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
oracle_prices
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
FINAL
|
||||
63
models/core/core__fact_prices.yml
Normal file
63
models/core/core__fact_prices.yml
Normal file
@ -0,0 +1,63 @@
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: core__fact_prices
|
||||
description: |-
|
||||
This table presents asset prices for the NEAR blockchain from various sources. Presently, only the on-chain oracle is provide.
|
||||
|
||||
columns:
|
||||
- name: TIMESTAMP
|
||||
description: "{{ doc('timestamp')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_row_values_to_have_recent_data:
|
||||
datepart: day
|
||||
interval: 1
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
|
||||
- name: TOKEN
|
||||
description: "{{ doc('token')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: SYMBOL
|
||||
description: "{{ doc('symbol')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: TOKEN_CONTRACT
|
||||
description: "{{ doc('token_contract')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: PRICE_USD
|
||||
description: "{{ doc('price_usd')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- FLOAT
|
||||
- DOUBLE
|
||||
|
||||
- name: SOURCE
|
||||
description: "{{ doc('source')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
5
models/descriptions/index.md
Normal file
5
models/descriptions/index.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs index %}
|
||||
|
||||
The positon index for the record in question, if it was stored in a particular order.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/price_usd.md
Normal file
5
models/descriptions/price_usd.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs price_usd %}
|
||||
|
||||
The asset price, in US Dollars.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/source.md
Normal file
5
models/descriptions/source.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs source %}
|
||||
|
||||
The source of the information presented in the record.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/symbol.md
Normal file
5
models/descriptions/symbol.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs symbol %}
|
||||
|
||||
The shorthand symbol for the token, as used by common price feeds and exchanges.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/timestamp.md
Normal file
5
models/descriptions/timestamp.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs timestamp %}
|
||||
|
||||
The date and time for the record.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/token.md
Normal file
5
models/descriptions/token.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs token %}
|
||||
|
||||
The long-form name of the token.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/token_contract.md
Normal file
5
models/descriptions/token_contract.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs token_contract %}
|
||||
|
||||
The contract address corresponding to the token, view details of the contract by following this address on the chain explorer.
|
||||
|
||||
{% enddocs %}
|
||||
@ -53,7 +53,7 @@ prices AS (
|
||||
INDEX,
|
||||
VALUE :asset_id :: STRING AS token_contract,
|
||||
CASE
|
||||
WHEN asset_id = 'aurora' THEN VALUE :price :multiplier :: DOUBLE / pow (
|
||||
WHEN token_contract = 'aurora' THEN VALUE :price :multiplier :: DOUBLE / pow (
|
||||
10,
|
||||
7
|
||||
)
|
||||
|
||||
97
models/silver/silver__prices_oracle.yml
Normal file
97
models/silver/silver__prices_oracle.yml
Normal file
@ -0,0 +1,97 @@
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: silver__prices_oracle
|
||||
description: |-
|
||||
This table parses messages from the contract `priceoracle.near` and extracts the available price data.
|
||||
|
||||
columns:
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_row_values_to_have_recent_data:
|
||||
datepart: day
|
||||
interval: 1
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
|
||||
- name: TX_HASH
|
||||
description: "{{ doc('tx_hash')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: INDEX
|
||||
description: "{{ doc('index')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
|
||||
- name: TOKEN
|
||||
description: "{{ doc('token')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: SYMBOL
|
||||
description: "{{ doc('symbol')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: TOKEN_CONTRACT
|
||||
description: "{{ doc('token_contract')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: PRICE_USD
|
||||
description: "{{ doc('price_usd')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- FLOAT
|
||||
- DOUBLE
|
||||
|
||||
- name: SOURCE
|
||||
description: "{{ doc('source')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
|
||||
- name: _INSERTED_TIMESTAMP
|
||||
description: "{{ doc('_inserted_timestamp')}}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
Loading…
Reference in New Issue
Block a user