沈楠
36638a7ddf
Some checks failed
MJN/finance-dbt/pipeline/head There was a failure building this commit
254 lines
7.7 KiB
YAML
254 lines
7.7 KiB
YAML
version: 2
|
||
sources:
|
||
- name: finance
|
||
schema: '{{ env_var("FINANCE_CLICKHOUSE_DATABASE") }}'
|
||
description: "The source for financial data"
|
||
tables:
|
||
- name: stg.tushare_trade_calendar
|
||
description: >
|
||
The source table for the trade calendar data from Tushare
|
||
tests:
|
||
- dbt_utils.unique_combination_of_columns:
|
||
combination_of_columns:
|
||
- exchange
|
||
- cal_date
|
||
columns:
|
||
- name: exchange
|
||
description: "The exchange code"
|
||
tests:
|
||
- not_null
|
||
- name: cal_date
|
||
description: "The date"
|
||
tests:
|
||
- not_null
|
||
- name: is_open
|
||
description: "Whether the exchange is open"
|
||
tests:
|
||
- not_null
|
||
- name: pretrade_date
|
||
description: "The previous trading date"
|
||
- name: stg.tushare_stock_basic
|
||
columns:
|
||
- name: ts_code
|
||
description: TS代码
|
||
tests:
|
||
- not_null
|
||
- name: symbol
|
||
description: 股票代码
|
||
- name: name
|
||
description: 股票名称
|
||
- name: area
|
||
description: 所在地域
|
||
- name: industry
|
||
description: 所属行业
|
||
- name: fullname
|
||
description: 股票全称
|
||
- name: enname
|
||
description: 英文全称
|
||
- name: cnspell
|
||
description: 拼音缩写
|
||
- name: market
|
||
description: 市场类型 (主板/中小板/创业板)
|
||
- name: exchange
|
||
description: 交易所代码
|
||
tests:
|
||
- not_null
|
||
- name: curr_type
|
||
description: 交易货币
|
||
- name: list_status
|
||
description: 上市状态: L上市 D退市 P暂停上市
|
||
- name: list_date
|
||
description: 上市日期
|
||
- name: delist_date
|
||
description: 退市日期
|
||
- name: is_hs
|
||
description: 是否沪深港通标的,N否 H沪股通 S深股通
|
||
- name: act_name
|
||
description: 实控人名称
|
||
- name: act_ent_type
|
||
description: 实控人企业性质
|
||
- name: dt
|
||
description: 最后修改时间
|
||
unique_composite:
|
||
- name: unique_exchange_ts_code
|
||
columns:
|
||
- exchange
|
||
- ts_code
|
||
- name: stg.tushare_daily
|
||
description: "沪深股票交易日线数据"
|
||
tests:
|
||
- dbt_utils.unique_combination_of_columns:
|
||
combination_of_columns:
|
||
- ts_code
|
||
- trade_date
|
||
columns:
|
||
- name: ts_code
|
||
description: TS代码
|
||
tests:
|
||
- not_null
|
||
- name: trade_date
|
||
description: 交易日期
|
||
tests:
|
||
- not_null
|
||
- name: open
|
||
description: 开盘价
|
||
tests:
|
||
- not_null
|
||
- name: high
|
||
description: 最高价
|
||
tests:
|
||
- not_null
|
||
- name: low
|
||
description: 最低价
|
||
tests:
|
||
- not_null
|
||
- name: close
|
||
description: 收盘价
|
||
tests:
|
||
- not_null
|
||
- name: pre_close
|
||
description: 昨收价
|
||
tests:
|
||
- not_null
|
||
- name: change
|
||
description: 涨跌额
|
||
tests:
|
||
- not_null
|
||
- name: pct_chg
|
||
description: 涨跌幅
|
||
tests:
|
||
- not_null
|
||
- name: vol
|
||
description: 成交量
|
||
tests:
|
||
- not_null
|
||
- name: amount
|
||
description: 成交额
|
||
- name: stg.tushare_daily_basic
|
||
description: "沪深股票每日指标数据"
|
||
tests:
|
||
- dbt_utils.unique_combination_of_columns:
|
||
combination_of_columns:
|
||
- ts_code
|
||
- trade_date
|
||
|
||
columns:
|
||
- name: ts_code
|
||
description: "股票代码"
|
||
data_type: String
|
||
- name: trade_date
|
||
description: "交易日期"
|
||
data_type: String
|
||
- name: close
|
||
description: "当日收盘价"
|
||
data_type: Nullable(Float32)
|
||
- name: turnover_rate
|
||
description: "换手率(%)"
|
||
data_type: Nullable(Float32)
|
||
- name: turnover_rate_f
|
||
description: "换手率(自由流通股)"
|
||
data_type: Nullable(Float32)
|
||
- name: volume_ratio
|
||
description: "量比"
|
||
data_type: Nullable(Float32)
|
||
- name: pe
|
||
description: "市盈率(总市值/净利润, 亏损的PE为空)"
|
||
data_type: Nullable(Float32)
|
||
- name: pe_ttm
|
||
description: "市盈率(TTM,亏损的PE为空)"
|
||
data_type: Nullable(Float32)
|
||
- name: pb
|
||
description: "市净率(总市值/净资产)"
|
||
data_type: Nullable(Float32)
|
||
- name: ps
|
||
description: "市销率"
|
||
data_type: Nullable(Float32)
|
||
- name: ps_ttm
|
||
description: "市销率(TTM)"
|
||
data_type: Nullable(Float32)
|
||
- name: dv_ratio
|
||
description: "股息率 (%)"
|
||
data_type: Nullable(Float32)
|
||
- name: dv_ttm
|
||
description: "股息率(TTM)(%)"
|
||
data_type: Nullable(Float32)
|
||
- name: total_share
|
||
description: "总股本 (万股)"
|
||
data_type: Nullable(Float32)
|
||
- name: float_share
|
||
description: "流通股本 (万股)"
|
||
data_type: Nullable(Float32)
|
||
- name: free_share
|
||
description: "自由流通股本 (万)"
|
||
data_type: Nullable(Float32)
|
||
- name: total_mv
|
||
description: "总市值 (万元)"
|
||
data_type: Nullable(Float32)
|
||
- name: circ_mv
|
||
description: "流通市值(万元)"
|
||
data_type: Nullable(Float32)
|
||
- name: stg.tushare_adj_factor
|
||
description: "沪深股票复权因子"
|
||
tests:
|
||
- dbt_utils.unique_combination_of_columns:
|
||
combination_of_columns:
|
||
- ts_code
|
||
- trade_date
|
||
columns:
|
||
- name: ts_code
|
||
description: "股票代码"
|
||
data_type: String
|
||
- name: trade_date
|
||
description: "交易日期"
|
||
data_type: String
|
||
- name: adj_factor
|
||
description: "复权因子"
|
||
data_type: Nullable(Decimal(16, 6))
|
||
- name: dt
|
||
description: "更新日期"
|
||
data_type: DateTime
|
||
- name: stg.tushare_minutes
|
||
description: "沪深分钟级交易数据"
|
||
tests:
|
||
- dbt_utils.unique_combination_of_columns:
|
||
combination_of_columns:
|
||
- ts_code
|
||
- trade_time
|
||
config:
|
||
where: "left(trade_time,7)>=concat(cast(year(today())-1 As String), '-01')"
|
||
columns:
|
||
- name: ts_code
|
||
description: "The stock code."
|
||
data_type: String
|
||
tests:
|
||
- not_null
|
||
- name: trade_time
|
||
description: "The trading time."
|
||
data_type: String
|
||
tests:
|
||
- not_null
|
||
- name: close
|
||
description: "The closing price."
|
||
data_type: Nullable(Float32)
|
||
- name: open
|
||
description: "The opening price."
|
||
data_type: Nullable(Float32)
|
||
- name: high
|
||
description: "The highest price."
|
||
data_type: Nullable(Float32)
|
||
- name: low
|
||
description: "The lowest price."
|
||
data_type: Nullable(Float32)
|
||
- name: vol
|
||
description: "The volume of trades."
|
||
data_type: Nullable(Float32)
|
||
- name: amount
|
||
description: "The amount of trades."
|
||
data_type: Nullable(Float32)
|
||
meta:
|
||
engine: ReplacingMergeTree
|
||
partition_by: "left(trade_time, 7)"
|
||
order_by: "(ts_code, trade_time)"
|
||
settings:
|
||
index_granularity: 8192
|