Understand tdx2db database tables and views
mainThe database uses a naming convention where raw_ prefixes indicate base data and v_ prefixes indicate processed views.
Base Tables (raw_)
_meta: Schema version and metadata (current: v6.0).raw_kline_daily: Daily K-lines (includes index/sector rise/fall counts).raw_kline_1min: 1-minute K-lines.raw_basic_daily: Stock/ETF previous close, turnover rate, and market cap.raw_adjust_factor: Post-adjustment factors.raw_gbbq: Capital changes.raw_holidays: Holiday calendar.raw_symbol_class: Symbol classification (stock, index, etf, etc.).raw_symbol_name: Online symbol names.raw_tdx_blocks_info: Online sector/concept/industry info.raw_tdx_blocks_member: Sector membership relations.
Processed Views (v_)
Views are named using the pattern v_<class>_<fq>, where <class> is stock or etf, and <fq> is the adjustment type: bfq (none), qfq (forward), or hfq (backward).
v_stock_{bfq,qfq,hfq}: Stock daily K-lines.v_etf_{bfq,qfq,hfq}: ETF daily K-lines.
Note: Stock prices are rounded to 2 decimal places; ETF prices are rounded to 3 decimal places.
-- Query stock with forward adjustment (qfq)
select * from v_stock_qfq where symbol='sz000001' order by date;
-- Query ETF with backward adjustment (hfq)
select * from v_etf_hfq where symbol='sh510300' order by date;