82 lines
3.2 KiB
YAML
82 lines
3.2 KiB
YAML
version: 2
|
|
|
|
seeds:
|
|
- name: stg_seed__currencies
|
|
description: |
|
|
A list of valid current currencies according to ISO 4217.
|
|
|
|
The list was obtained from https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=isin
|
|
config:
|
|
column_types:
|
|
iso_4217_numeric_code: varchar(3)
|
|
columns:
|
|
- name: iso_4217_code
|
|
data_type: character varying
|
|
description: The 3 character ISO 4217 code for this currency, in Uppercase.
|
|
tests:
|
|
- not_null
|
|
- dbt_expectations.expect_column_values_to_match_regex:
|
|
regex: "^[A-Z]{3}$"
|
|
- name: iso_4217_numeric_code
|
|
data_type: character varying
|
|
description: The 3 digit ISO 4217 numeric code for this currency.
|
|
tests:
|
|
- not_null
|
|
- dbt_expectations.expect_column_values_to_match_regex:
|
|
regex: "^[0-9]{3}$"
|
|
- name: decimal_positions
|
|
data_type: int
|
|
description: |
|
|
The decimal positions that lead to this currency smallest unit.
|
|
|
|
For example: since Japanese Yen (JPY) have no cents, this value is 0.
|
|
|
|
On the other hand, since the US Dollar (USD) is composed of cents, and each dollar equals 100 cent, this value is 2.
|
|
|
|
To convert from normal unit (Dollar) to smallest unit (Cent), multiply by `10^decimal_positions`.
|
|
To convert from smallest unit (Cent) to normal unit (Dollar), divide by `10^decimal_positions`.
|
|
tests:
|
|
- not_null
|
|
- dbt_expectations.expect_column_values_to_be_between:
|
|
min_value: 0
|
|
max_value: 8
|
|
strictly: False
|
|
- name: stg_seed__hardcoded_currency_rates
|
|
description: |
|
|
A bunch of rates between currencies, taken from our invoicing cycle in February 2024.
|
|
|
|
These are hardcoded and so will become outdated, but it's the best we have now since we don't have a live feed for exchange rates.
|
|
config:
|
|
column_types:
|
|
from_currency: varchar(3)
|
|
to_currency: varchar(3)
|
|
rate: numeric
|
|
columns:
|
|
- name: from_currency
|
|
data_type: character varying
|
|
description: The 3 character ISO 4217 code for the base currency, in Uppercase.
|
|
tests:
|
|
- not_null
|
|
- dbt_expectations.expect_column_values_to_match_regex:
|
|
regex: "^[A-Z]{3}$"
|
|
columns:
|
|
- name: to_currency
|
|
data_type: character varying
|
|
description: The 3 character ISO 4217 code for the target currency, in Uppercase.
|
|
tests:
|
|
- not_null
|
|
- dbt_expectations.expect_column_values_to_match_regex:
|
|
regex: "^[A-Z]{3}$"
|
|
- name: rate
|
|
data_type: numeric
|
|
description: |
|
|
The rate between the two currencies. You should read it as the amount of target currency you get for each unit of base currency.
|
|
|
|
For example: for the combination EUR-GBP, a rate of 0.8 means you get 0.8 GBP for 1 EUR.
|
|
|
|
Rates between same-currency pairs are always one.
|
|
tests:
|
|
- not_null
|
|
- dbt_expectations.expect_column_values_to_be_between:
|
|
min_value: 0.00000000001
|
|
max_value: 999999999999
|