macbook pro 本地
-- auto-generated definition
create table stock_basic
(
    ts_code      text null,
    symbol       text null,
    name         text null,
    area         text null,
    industry     text null,
    fullname     text null,
    enname       text null,
    cnspell      text null,
    market       text null,
    exchange     text null,
    curr_type    text null,
    list_status  text null,
    list_date    text null,
    delist_date  text null,
    is_hs        text null,
    act_name     text null,
    act_ent_type text null
);

-- auto-generated definition
create table stock_daily
(
    id         bigint auto_increment
        primary key,
    ts_code    varchar(20)    not null,
    symbol     varchar(10)    not null,
    trade_date date           not null,
    open       decimal(16, 4) null,
    high       decimal(16, 4) null,
    low        decimal(16, 4) null,
    close      decimal(16, 4) null,
    pre_close  decimal(16, 4) null,
    change_val decimal(16, 4) null,
    pct_chg    decimal(10, 4) null,
    vol        bigint         null,
    amount     bigint         null,
    constraint uniq_code_date
        unique (ts_code, trade_date)
)
    charset = utf8mb4;

-- auto-generated definition
create table stock_limit_combined_data
(
    id                     bigint auto_increment
        primary key,
    trade_date             date           not null comment '交易日期',
    symbol                 varchar(10)    not null comment '股票代码，以stock_daily为准',
    ts_code                varchar(20)    not null comment 'TS股票代码，以stock_daily为准',
    name                   varchar(50)    not null comment '股票名称，以stock_daily关联基础表为准',
    final_status           tinyint        not null comment '融合状态：1-涨停，2-炸板',
    source_count           int default 0  not null comment '命中的数据源数量',
    source_flags           varchar(50)    null comment '命中的数据源：calc,tushare',
    calc_status            tinyint        null comment '本地行情计算状态：1-涨停，2-炸板',
    calc_limit_price       decimal(16, 4) null comment '本地行情计算涨停价',
    calc_high              decimal(16, 4) null comment 'stock_daily最高价',
    calc_close             decimal(16, 4) null comment 'stock_daily收盘价',
    calc_pre_close         decimal(16, 4) null comment 'stock_daily前收盘价',
    calc_vol               bigint         null comment 'stock_daily成交量',
    market                 varchar(20)    null comment '所属板块',
    tushare_limit_type     varchar(1)     null comment 'Tushare-D跌停U涨停Z炸板',
    tushare_industry       varchar(100)   null comment 'Tushare-所属行业',
    tushare_name           varchar(50)    null comment 'Tushare-名称',
    tushare_close          decimal(16, 4) null comment 'Tushare-收盘价',
    tushare_pct_chg        decimal(10, 4) null comment 'Tushare-涨跌幅',
    tushare_amount         decimal(24, 4) null comment 'Tushare-成交额',
    tushare_limit_amount   decimal(24, 4) null comment 'Tushare-板上成交金额',
    tushare_float_mv       decimal(24, 4) null comment 'Tushare-流通市值',
    tushare_total_mv       decimal(24, 4) null comment 'Tushare-总市值',
    tushare_turnover_ratio decimal(10, 4) null comment 'Tushare-换手率',
    tushare_fd_amount      decimal(24, 4) null comment 'Tushare-封单金额',
    tushare_first_time     varchar(20)    null comment 'Tushare-首次封板时间',
    tushare_last_time      varchar(20)    null comment 'Tushare-最后封板时间',
    tushare_open_times     int            null comment 'Tushare-炸板/开板次数',
    tushare_up_stat        varchar(50)    null comment 'Tushare-涨停统计',
    tushare_limit_times    int            null comment 'Tushare-连板数',
    constraint uniq_date_code
        unique (trade_date, ts_code)
);

create index idx_symbol
    on stock_limit_combined_data (symbol);

create index idx_trade_date
    on stock_limit_combined_data (trade_date);

create index idx_trade_date_status
    on stock_limit_combined_data (trade_date, final_status);

-- auto-generated definition
create table trade_calendar
(
    cal_date      date        not null,
    exchange      varchar(10) not null,
    is_open       tinyint     null,
    pretrade_date date        null,
    primary key (cal_date, exchange)
)
    charset = utf8mb4;

阿里云
-- auto-generated definition
create table stock_basic
(
    ts_code      text null,
    symbol       text null,
    name         text null,
    area         text null,
    industry     text null,
    fullname     text null,
    enname       text null,
    cnspell      text null,
    market       text null,
    exchange     text null,
    curr_type    text null,
    list_status  text null,
    list_date    text null,
    delist_date  text null,
    is_hs        text null,
    act_name     text null,
    act_ent_type text null
);

-- auto-generated definition
create table stock_daily
(
    id         bigint auto_increment
        primary key,
    ts_code    varchar(20)    not null,
    symbol     varchar(10)    not null,
    trade_date date           not null,
    open       decimal(16, 4) null,
    high       decimal(16, 4) null,
    low        decimal(16, 4) null,
    close      decimal(16, 4) null,
    pre_close  decimal(16, 4) null,
    change_val decimal(16, 4) null,
    pct_chg    decimal(10, 4) null,
    vol        bigint         null,
    amount     bigint         null,
    constraint uniq_code_date
        unique (ts_code, trade_date)
);

-- auto-generated definition
create table trade_calendar
(
    cal_date      date        not null,
    exchange      varchar(10) not null,
    is_open       tinyint     null,
    pretrade_date date        null,
    primary key (cal_date, exchange)
)
    charset = utf8mb4;

