Files
pythonstock--stock/docker-compose/mysql/init.sql
T
2026-07-13 13:10:28 +08:00

202 lines
7.4 KiB
SQL

SET character_set_client = utf8;
-- 切库:
use stock_data;
-- 建表
-- 表里面都是使用 code 和 date 两个字段做联合主键的。
CREATE TABLE IF NOT EXISTS `stock_zh_a_spot_em` (
`date` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`last_price` double(20,2) DEFAULT NULL,
`change_percent` double(20,2) DEFAULT NULL,
`change_amount` double(20,2) DEFAULT NULL,
`volume` double(20,2) DEFAULT NULL,
`turnover` double(20,2) DEFAULT NULL,
`amplitude` double(20,2) DEFAULT NULL,
`high` double(20,2) DEFAULT NULL,
`low` double(20,2) DEFAULT NULL,
`open` double(20,2) DEFAULT NULL,
`closed` double(20,2) DEFAULT NULL,
`volume_ratio` double(20,2) DEFAULT NULL,
`turnover_rate` double(20,2) DEFAULT NULL,
`pe_ratio` double(20,2) DEFAULT NULL,
`pb_ratio` double(20,2) DEFAULT NULL,
`market_cap` double(20,2) DEFAULT NULL,
`circulating_market_cap` double(20,2) DEFAULT NULL,
`rise_speed` double(20,2) DEFAULT NULL,
`change_5min` double(20,2) DEFAULT NULL,
`change_ercent_60day` double(20,2) DEFAULT NULL,
`ytd_change_percent` double(20,2) DEFAULT NULL,
PRIMARY KEY (`code`,`date`),
KEY `idx_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS `stock_lhb_ggtj_sina` (
`date` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`ranking_times` double(20,2) DEFAULT NULL,
`sum_buy` double(20,2) DEFAULT NULL,
`sum_sell` double(20,2) DEFAULT NULL,
`net_amount` double(20,2) DEFAULT NULL,
`buy_seat` double(20,2) DEFAULT NULL,
`sell_seat` double(20,2) DEFAULT NULL,
PRIMARY KEY (`code`,`date`),
KEY `idx_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `stock_dzjy_mrtj` (
`date` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`quote_change` double(20,2) DEFAULT NULL,
`close_price` double(20,2) DEFAULT NULL,
`average_price` double(20,2) DEFAULT NULL,
`overflow_rate` double(20,2) DEFAULT NULL,
`trade_number` double(20,2) DEFAULT NULL,
`sum_volume` double(20,2) DEFAULT NULL,
`sum_turnover` double(20,2) DEFAULT NULL,
`turnover_market_rate` double(20,2) DEFAULT NULL,
PRIMARY KEY (`code`,`date`),
KEY `idx_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `guess_indicators_daily` (
`date` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`last_price` double(20,2) DEFAULT NULL,
`change_percent` double(20,2) DEFAULT NULL,
`change_amount` double(20,2) DEFAULT NULL,
`volume` double(20,2) DEFAULT NULL,
`turnover` double(20,2) DEFAULT NULL,
`amplitude` double(20,2) DEFAULT NULL,
`high` double(20,2) DEFAULT NULL,
`low` double(20,2) DEFAULT NULL,
`open` double(20,2) DEFAULT NULL,
`closed` double(20,2) DEFAULT NULL,
`volume_ratio` double(20,2) DEFAULT NULL,
`turnover_rate` double(20,2) DEFAULT NULL,
`pe_ratio` double(20,2) DEFAULT NULL,
`pb_ratio` double(20,2) DEFAULT NULL,
`market_cap` double(20,2) DEFAULT NULL,
`circulating_market_cap` double(20,2) DEFAULT NULL,
`rise_speed` double(20,2) DEFAULT NULL,
`change_5min` double(20,2) DEFAULT NULL,
`change_ercent_60day` double(20,2) DEFAULT NULL,
`ytd_change_percent` double(20,2) DEFAULT NULL,
`boll` double(20,2) DEFAULT NULL,
`boll_lb` double(20,2) DEFAULT NULL,
`boll_ub` double(20,2) DEFAULT NULL,
`kdjd` double(20,2) DEFAULT NULL,
`kdjj` double(20,2) DEFAULT NULL,
`kdjk` double(20,2) DEFAULT NULL,
`macd` double(20,2) DEFAULT NULL,
`macdh` double(20,2) DEFAULT NULL,
`macds` double(20,2) DEFAULT NULL,
`pdi` double(20,2) DEFAULT NULL,
`trix` double(20,2) DEFAULT NULL,
`trix_9_sma` double(20,2) DEFAULT NULL,
`vr` double(20,2) DEFAULT NULL,
`vr_6_sma` double(20,2) DEFAULT NULL,
`wr_10` double(20,2) DEFAULT NULL,
`wr_6` double(20,2) DEFAULT NULL,
PRIMARY KEY (`code`,`date`),
KEY `idx_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `guess_indicators_lite_buy_daily` (
`date` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`last_price` double(20,2) DEFAULT NULL,
`change_percent` double(20,2) DEFAULT NULL,
`change_amount` double(20,2) DEFAULT NULL,
`volume` double(20,2) DEFAULT NULL,
`turnover` double(20,2) DEFAULT NULL,
`amplitude` double(20,2) DEFAULT NULL,
`high` double(20,2) DEFAULT NULL,
`low` double(20,2) DEFAULT NULL,
`open` double(20,2) DEFAULT NULL,
`closed` double(20,2) DEFAULT NULL,
`volume_ratio` double(20,2) DEFAULT NULL,
`turnover_rate` double(20,2) DEFAULT NULL,
`pe_ratio` double(20,2) DEFAULT NULL,
`pb_ratio` double(20,2) DEFAULT NULL,
`market_cap` double(20,2) DEFAULT NULL,
`circulating_market_cap` double(20,2) DEFAULT NULL,
`rise_speed` double(20,2) DEFAULT NULL,
`change_5min` double(20,2) DEFAULT NULL,
`change_ercent_60day` double(20,2) DEFAULT NULL,
`ytd_change_percent` double(20,2) DEFAULT NULL,
`boll` double(20,2) DEFAULT NULL,
`boll_lb` double(20,2) DEFAULT NULL,
`boll_ub` double(20,2) DEFAULT NULL,
`kdjd` double(20,2) DEFAULT NULL,
`kdjj` double(20,2) DEFAULT NULL,
`kdjk` double(20,2) DEFAULT NULL,
`macd` double(20,2) DEFAULT NULL,
`macdh` double(20,2) DEFAULT NULL,
`macds` double(20,2) DEFAULT NULL,
`pdi` double(20,2) DEFAULT NULL,
`trix` double(20,2) DEFAULT NULL,
`trix_9_sma` double(20,2) DEFAULT NULL,
`vr` double(20,2) DEFAULT NULL,
`vr_6_sma` double(20,2) DEFAULT NULL,
`wr_10` double(20,2) DEFAULT NULL,
`wr_6` double(20,2) DEFAULT NULL,
PRIMARY KEY (`code`,`date`),
KEY `idx_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `guess_indicators_lite_sell_daily` (
`date` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`last_price` double(20,2) DEFAULT NULL,
`change_percent` double(20,2) DEFAULT NULL,
`change_amount` double(20,2) DEFAULT NULL,
`volume` double(20,2) DEFAULT NULL,
`turnover` double(20,2) DEFAULT NULL,
`amplitude` double(20,2) DEFAULT NULL,
`high` double(20,2) DEFAULT NULL,
`low` double(20,2) DEFAULT NULL,
`open` double(20,2) DEFAULT NULL,
`closed` double(20,2) DEFAULT NULL,
`volume_ratio` double(20,2) DEFAULT NULL,
`turnover_rate` double(20,2) DEFAULT NULL,
`pe_ratio` double(20,2) DEFAULT NULL,
`pb_ratio` double(20,2) DEFAULT NULL,
`market_cap` double(20,2) DEFAULT NULL,
`circulating_market_cap` double(20,2) DEFAULT NULL,
`rise_speed` double(20,2) DEFAULT NULL,
`change_5min` double(20,2) DEFAULT NULL,
`change_ercent_60day` double(20,2) DEFAULT NULL,
`ytd_change_percent` double(20,2) DEFAULT NULL,
`boll` double(20,2) DEFAULT NULL,
`boll_lb` double(20,2) DEFAULT NULL,
`boll_ub` double(20,2) DEFAULT NULL,
`kdjd` double(20,2) DEFAULT NULL,
`kdjj` double(20,2) DEFAULT NULL,
`kdjk` double(20,2) DEFAULT NULL,
`macd` double(20,2) DEFAULT NULL,
`macdh` double(20,2) DEFAULT NULL,
`macds` double(20,2) DEFAULT NULL,
`pdi` double(20,2) DEFAULT NULL,
`trix` double(20,2) DEFAULT NULL,
`trix_9_sma` double(20,2) DEFAULT NULL,
`vr` double(20,2) DEFAULT NULL,
`vr_6_sma` double(20,2) DEFAULT NULL,
`wr_10` double(20,2) DEFAULT NULL,
`wr_6` double(20,2) DEFAULT NULL,
PRIMARY KEY (`code`,`date`),
KEY `idx_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;