fixed linux 下 mysql 数据表名称都改为小写

This commit is contained in:
fasiondog 2022-10-16 17:46:58 +08:00
parent ebe7f538cd
commit fc55a5aa7e
19 changed files with 162 additions and 161 deletions

1
.gitignore vendored
View File

@ -22,6 +22,7 @@
.vscode
.vs
.ipynb_checkpoints
nohup.out
temp
file
temp.txt

View File

@ -1,26 +1,26 @@
CREATE TABLE IF NOT EXISTS `hku_base`.`Holiday` (
CREATE TABLE IF NOT EXISTS `hku_base`.`holiday` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`date` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY(`id`)
);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210101);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210211);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210212);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210215);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210216);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210217);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210405);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210501);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210503);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210504);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210505);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210614);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210920);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20210921);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20211001);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20211004);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20211005);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20211006);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20211007);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210101);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210211);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210212);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210215);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210216);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210217);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210405);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210501);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210503);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210504);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210505);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210614);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210920);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20210921);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20211001);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20211004);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20211005);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20211006);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20211007);
UPDATE `hku_base`.`version` set `version` = 4;

View File

@ -1,3 +1,3 @@
INSERT INTO `hku_base`.`StockTypeInfo` (`id`, `tickValue`,`precision`,`type`,`description`,`tick`,`minTradeNumber`,`maxTradeNumber`) VALUES (9, 0.01,2,9,'科创板',0.01,100,1000000);
INSERT INTO `hku_base`.`CodeRuleType` (`id`,`marketid`,`codepre`,`type`,`description`) VALUES (33, 1,'688',9,'科创板');
INSERT INTO `hku_base`.`stocktypeinfo` (`id`, `tickValue`,`precision`,`type`,`description`,`tick`,`minTradeNumber`,`maxTradeNumber`) VALUES (9, 0.01,2,9,'科创板',0.01,100,1000000);
INSERT INTO `hku_base`.`coderuletype` (`id`,`marketid`,`codepre`,`type`,`description`) VALUES (33, 1,'688',9,'科创板');
UPDATE `hku_base`.`version` set `version` = 5;

View File

@ -1,2 +1,2 @@
INSERT INTO `hku_base`.`CodeRuleType` (`id`,`marketid`,`codepre`,`type`,`description`) VALUES (34,2,'301',8,'创业板');
INSERT INTO `hku_base`.`coderuletype` (`id`,`marketid`,`codepre`,`type`,`description`) VALUES (34,2,'301',8,'创业板');
UPDATE `hku_base`.`version` set `version` = 6;

View File

@ -1,20 +1,20 @@
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220103);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220131);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220201);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220202);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220203);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220204);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220205);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220404);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220405);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220502);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220503);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220504);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220603);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20220912);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20221003);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20221004);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20221005);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20221006);
INSERT INTO `hku_base`.`Holiday` (`date`) VALUES (20221007);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220103);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220131);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220201);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220202);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220203);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220204);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220205);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220404);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220405);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220502);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220503);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220504);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220603);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20220912);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20221003);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20221004);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20221005);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20221006);
INSERT INTO `hku_base`.`holiday` (`date`) VALUES (20221007);
UPDATE `hku_base`.`version` set `version` = 7;

View File

@ -1,6 +1,6 @@
INSERT INTO `hku_base`.`Market` (`marketid`, `market`, `name`, `description`, `code`, `lastDate`, `openTime1`, `closeTime1`, `openTime2`, `closeTime2`) VALUES (3, "BJ", "北京证券交易所", "北京市场", "830799", 20200727, 930, 1130, 1300, 1500);
INSERT INTO `hku_base`.`CodeRuleType` (`id`, `marketid`, `codepre`, `type`, `description`) VALUES (35, 3, "43", 1, "北证A股");
INSERT INTO `hku_base`.`CodeRuleType` (`id`, `marketid`, `codepre`, `type`, `description`) VALUES (36, 3, "83", 1, "北证A股");
INSERT INTO `hku_base`.`CodeRuleType` (`id`, `marketid`, `codepre`, `type`, `description`) VALUES (37, 3, "87", 1, "北证A股");
INSERT INTO `hku_base`.`CodeRuleType` (`id`, `marketid`, `codepre`, `type`, `description`) VALUES (38, 3, "88", 1, "北证A股");
INSERT INTO `hku_base`.`market` (`marketid`, `market`, `name`, `description`, `code`, `lastDate`, `openTime1`, `closeTime1`, `openTime2`, `closeTime2`) VALUES (3, "BJ", "北京证券交易所", "北京市场", "830799", 20200727, 930, 1130, 1300, 1500);
INSERT INTO `hku_base`.`coderuletype` (`id`, `marketid`, `codepre`, `type`, `description`) VALUES (35, 3, "43", 1, "北证A股");
INSERT INTO `hku_base`.`coderuletype` (`id`, `marketid`, `codepre`, `type`, `description`) VALUES (36, 3, "83", 1, "北证A股");
INSERT INTO `hku_base`.`coderuletype` (`id`, `marketid`, `codepre`, `type`, `description`) VALUES (37, 3, "87", 1, "北证A股");
INSERT INTO `hku_base`.`coderuletype` (`id`, `marketid`, `codepre`, `type`, `description`) VALUES (38, 3, "88", 1, "北证A股");
UPDATE `hku_base`.`version` set `version` = 8;

View File

@ -12,8 +12,8 @@ CREATE TABLE `hku_base`.`market` (
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
INSERT INTO `hku_base`.`Market` (marketid,market,name,description,code,lastDate) VALUES (1,'SH','上海证劵交易所','上海市场','000001',19901219);
INSERT INTO `hku_base`.`Market` (marketid,market,name,description,code,lastDate) VALUES (2,'SZ','深圳证劵交易所','深圳市场','399001',19901219);
INSERT INTO `hku_base`.`market` (marketid,market,name,description,code,lastDate) VALUES (1,'SH','上海证劵交易所','上海市场','000001',19901219);
INSERT INTO `hku_base`.`market` (marketid,market,name,description,code,lastDate) VALUES (2,'SZ','深圳证劵交易所','深圳市场','399001',19901219);
CREATE TABLE `hku_base`.`stkweight` (
@ -63,15 +63,15 @@ CREATE TABLE `hku_base`.`stocktypeinfo` (
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
INSERT INTO `hku_base`.`StockTypeInfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (100,2,0,0,'Block',100,100,1000000);
INSERT INTO `hku_base`.`StockTypeInfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,1,1,'A股',0.01,100,1000000);
INSERT INTO `hku_base`.`StockTypeInfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,2,2,'指数',0.001,1,1000000);
INSERT INTO `hku_base`.`StockTypeInfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,3,3,'B股',0.001,100,1000000);
INSERT INTO `hku_base`.`StockTypeInfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,4,4,'基金不含ETF',0.001,100,1000000);
INSERT INTO `hku_base`.`StockTypeInfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,5,5,'ETF',0.001,1000,1000000);
INSERT INTO `hku_base`.`StockTypeInfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,6,6,'国债',0.01,10,10000);
INSERT INTO `hku_base`.`StockTypeInfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,7,7,'其他债券',0.01,10,10000);
INSERT INTO `hku_base`.`StockTypeInfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,8,8,'创业板',0.01,100,1000000);
INSERT INTO `hku_base`.`stocktypeinfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (100,2,0,0,'Block',100,100,1000000);
INSERT INTO `hku_base`.`stocktypeinfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,1,1,'A股',0.01,100,1000000);
INSERT INTO `hku_base`.`stocktypeinfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,2,2,'指数',0.001,1,1000000);
INSERT INTO `hku_base`.`stocktypeinfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,3,3,'B股',0.001,100,1000000);
INSERT INTO `hku_base`.`stocktypeinfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,4,4,'基金不含ETF',0.001,100,1000000);
INSERT INTO `hku_base`.`stocktypeinfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,5,5,'ETF',0.001,1000,1000000);
INSERT INTO `hku_base`.`stocktypeinfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,6,6,'国债',0.01,10,10000);
INSERT INTO `hku_base`.`stocktypeinfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,7,7,'其他债券',0.01,10,10000);
INSERT INTO `hku_base`.`stocktypeinfo` (tickValue,`precision`,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,8,8,'创业板',0.01,100,1000000);
CREATE TABLE `hku_base`.`coderuletype` (
`id` INT(11) NOT NULL,
@ -84,30 +84,30 @@ CREATE TABLE `hku_base`.`coderuletype` (
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (1,1,'000',2,'上证指数');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (2,1,'60',1,'上证A股');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (4,1,'900',3,'上证B股');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (5,2,'00',1,'深证A股');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (6,2,'20',3,'深证B股');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (7,2,'39',2,'深证指数');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (8,2,'150',4,'深证基金');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (9,2,'16',4,'深证基金');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (10,2,'18',4,'深证基金');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (11,2,'159',5,'深证ETF');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (12,1,'51',5,'上证ETF');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (13,1,'50',4,'上证基金');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (18,2,'300',8,'创业板');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (20,1,'519',4,'上证基金');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (21,1,'009',6,'国债');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (22,1,'010',6,'国债');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (23,1,'10',7,'可转债');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (24,1,'11',7,'可转债');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (25,1,'12',7,'其他债券');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (26,1,'13',7,'地方政府债');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (27,2,'100',6,'国债');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (28,2,'101',6,'国债');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (29,2,'108',7,'贴债');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (30,2,'109',7,'地方政府债');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (31,2,'11',7,'其他债券');
INSERT INTO `hku_base`.`CodeRuleType` (id,marketid,codepre,type,description) VALUES (32,2,'12',7,'其他债券');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (1,1,'000',2,'上证指数');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (2,1,'60',1,'上证A股');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (4,1,'900',3,'上证B股');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (5,2,'00',1,'深证A股');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (6,2,'20',3,'深证B股');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (7,2,'39',2,'深证指数');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (8,2,'150',4,'深证基金');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (9,2,'16',4,'深证基金');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (10,2,'18',4,'深证基金');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (11,2,'159',5,'深证ETF');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (12,1,'51',5,'上证ETF');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (13,1,'50',4,'上证基金');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (18,2,'300',8,'创业板');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (20,1,'519',4,'上证基金');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (21,1,'009',6,'国债');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (22,1,'010',6,'国债');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (23,1,'10',7,'可转债');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (24,1,'11',7,'可转债');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (25,1,'12',7,'其他债券');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (26,1,'13',7,'地方政府债');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (27,2,'100',6,'国债');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (28,2,'101',6,'国债');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (29,2,'108',7,'贴债');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (30,2,'109',7,'地方政府债');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (31,2,'11',7,'其他债券');
INSERT INTO `hku_base`.`coderuletype` (id,marketid,codepre,type,description) VALUES (32,2,'12',7,'其他债券');

View File

@ -77,7 +77,7 @@ def import_index_name(connect):
)
else:
marketid = MARKETID.SH if index['market_code'][:2] == MARKET.SH else MARKETID.SZ
sql = "insert into `hku_base`.`Stock` (marketid, code, name, type, valid, startDate, endDate) \
sql = "insert into `hku_base`.`stock` (marketid, code, name, type, valid, startDate, endDate) \
values (%s, '%s', '%s', %s, %s, %s, %s)" \
% (marketid, index['market_code'][2:], index['name'], STOCKTYPE.INDEX, 1, today, 99999999)
cur.execute(sql)
@ -152,7 +152,7 @@ def import_stock_name(connect, api, market, quotations=None):
if code[:length] == codepre[0]:
count += 1
#print(market, code, newStockDict[code], codepre)
sql = "insert into `hku_base`.`Stock` (marketid, code, name, type, valid, startDate, endDate) \
sql = "insert into `hku_base`.`stock` (marketid, code, name, type, valid, startDate, endDate) \
values (%s, '%s', '%s', %s, %s, %s, %s)" \
% (marketid, code, newStockDict[code], codepre[1], 1, today, 99999999)
cur.execute(sql)

View File

@ -30,13 +30,13 @@ from .common_pytdx import to_pytdx_market
def pytdx_import_weight_to_mysql(pytdx_api, connect, market):
"""导入钱龙格式的权息数据"""
cur = connect.cursor()
cur.execute("select marketid from `hku_base`.`Market` where market='%s'" % market)
cur.execute("select marketid from `hku_base`.`market` where market='%s'" % market)
marketid = [id[0] for id in cur.fetchall()]
marketid = marketid[0]
pytdx_market = to_pytdx_market(market)
total_count = 0
cur.execute("select stockid, code from `hku_base`.`Stock` where marketid=%s" % (marketid))
cur.execute("select stockid, code from `hku_base`.`stock` where marketid=%s" % (marketid))
stockid_list = [x for x in cur.fetchall()]
cur.close()
@ -135,7 +135,7 @@ def pytdx_import_weight_to_mysql(pytdx_api, connect, market):
cur = connect.cursor()
x = new_last_db_weight
cur.execute(
"UPDATE `hku_base`.`StkWeight` SET countAsGift=%s, countForSell=%s, priceForSell=%s, \
"UPDATE `hku_base`.`stkweight` SET countAsGift=%s, countForSell=%s, priceForSell=%s, \
bonus=%s, totalCount=%s, freeCount=%s \
where id=%s" % (x[3], x[4], x[5], x[6], x[8], x[9], x[0])
)
@ -145,7 +145,7 @@ def pytdx_import_weight_to_mysql(pytdx_api, connect, market):
if records:
cur = connect.cursor()
cur.executemany(
"INSERT INTO `hku_base`.`StkWeight` (stockid, date, countAsGift, \
"INSERT INTO `hku_base`.`stkweight` (stockid, date, countAsGift, \
countForSell, priceForSell, bonus, countOfIncreasement, totalCount, freeCount) \
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)", [x for x in records.values()]
)

View File

@ -1,6 +1,6 @@
BEGIN TRANSACTION;
alter table StockTypeInfo rename to StockTypeInfoOld;
CREATE TABLE `StockTypeInfo` (
CREATE TABLE `stocktypeinfo` (
`tickValue` NUMERIC,
`precision` INTEGER,
`id` INTEGER,

View File

@ -1,5 +1,5 @@
BEGIN TRANSACTION;
INSERT INTO `StockTypeInfo` (tickValue,precision,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,9,'科创板',0.01,100,1000000);
INSERT INTO `CodeRuleType` (marketid,codepre,type,description) VALUES (1,'688',9,'科创板');
INSERT INTO `stocktypeinfo` (tickValue,precision,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,9,'科创板',0.01,100,1000000);
INSERT INTO `coderuletype` (marketid,codepre,type,description) VALUES (1,'688',9,'科创板');
UPDATE `version` set `version` = 6;
COMMIT;

View File

@ -1,4 +1,4 @@
BEGIN TRANSACTION;
INSERT INTO `CodeRuleType` (marketid,codepre,type,description) VALUES (2,'301',8,'创业板');
INSERT INTO `coderuletype` (marketid,codepre,type,description) VALUES (2,'301',8,'创业板');
UPDATE `version` set `version` = 7;
COMMIT;

View File

@ -1,22 +1,22 @@
BEGIN TRANSACTION;
INSERT INTO `Holiday` (`date`) VALUES (20220103);
INSERT INTO `Holiday` (`date`) VALUES (20220131);
INSERT INTO `Holiday` (`date`) VALUES (20220201);
INSERT INTO `Holiday` (`date`) VALUES (20220202);
INSERT INTO `Holiday` (`date`) VALUES (20220203);
INSERT INTO `Holiday` (`date`) VALUES (20220204);
INSERT INTO `Holiday` (`date`) VALUES (20220205);
INSERT INTO `Holiday` (`date`) VALUES (20220404);
INSERT INTO `Holiday` (`date`) VALUES (20220405);
INSERT INTO `Holiday` (`date`) VALUES (20220502);
INSERT INTO `Holiday` (`date`) VALUES (20220503);
INSERT INTO `Holiday` (`date`) VALUES (20220504);
INSERT INTO `Holiday` (`date`) VALUES (20220603);
INSERT INTO `Holiday` (`date`) VALUES (20220912);
INSERT INTO `Holiday` (`date`) VALUES (20221003);
INSERT INTO `Holiday` (`date`) VALUES (20221004);
INSERT INTO `Holiday` (`date`) VALUES (20221005);
INSERT INTO `Holiday` (`date`) VALUES (20221006);
INSERT INTO `Holiday` (`date`) VALUES (20221007);
INSERT INTO `holiday` (`date`) VALUES (20220103);
INSERT INTO `holiday` (`date`) VALUES (20220131);
INSERT INTO `holiday` (`date`) VALUES (20220201);
INSERT INTO `holiday` (`date`) VALUES (20220202);
INSERT INTO `holiday` (`date`) VALUES (20220203);
INSERT INTO `holiday` (`date`) VALUES (20220204);
INSERT INTO `holiday` (`date`) VALUES (20220205);
INSERT INTO `holiday` (`date`) VALUES (20220404);
INSERT INTO `holiday` (`date`) VALUES (20220405);
INSERT INTO `holiday` (`date`) VALUES (20220502);
INSERT INTO `holiday` (`date`) VALUES (20220503);
INSERT INTO `holiday` (`date`) VALUES (20220504);
INSERT INTO `holiday` (`date`) VALUES (20220603);
INSERT INTO `holiday` (`date`) VALUES (20220912);
INSERT INTO `holiday` (`date`) VALUES (20221003);
INSERT INTO `holiday` (`date`) VALUES (20221004);
INSERT INTO `holiday` (`date`) VALUES (20221005);
INSERT INTO `holiday` (`date`) VALUES (20221006);
INSERT INTO `holiday` (`date`) VALUES (20221007);
UPDATE `version` set `version` = 8;
COMMIT;

View File

@ -1,8 +1,8 @@
BEGIN TRANSACTION;
INSERT INTO `Market` (`marketid`, `market`, `name`, `description`, `code`, `lastDate`, `openTime1`, `closeTime1`, `openTime2`, `closeTime2`) VALUES (3, "BJ", "北京证券交易所", "北京市场", "830799", 20200727, 930, 1130, 1300, 1500);
INSERT INTO `CodeRuleType` (`marketid`, `codepre`, `type`, `description`) VALUES (3, "43", 1, "北证A股");
INSERT INTO `CodeRuleType` (`marketid`, `codepre`, `type`, `description`) VALUES (3, "83", 1, "北证A股");
INSERT INTO `CodeRuleType` (`marketid`, `codepre`, `type`, `description`) VALUES (3, "87", 1, "北证A股");
INSERT INTO `CodeRuleType` (`marketid`, `codepre`, `type`, `description`) VALUES (3, "88", 1, "北证A股");
INSERT INTO `coderuletype` (`marketid`, `codepre`, `type`, `description`) VALUES (3, "43", 1, "北证A股");
INSERT INTO `coderuletype` (`marketid`, `codepre`, `type`, `description`) VALUES (3, "83", 1, "北证A股");
INSERT INTO `coderuletype` (`marketid`, `codepre`, `type`, `description`) VALUES (3, "87", 1, "北证A股");
INSERT INTO `coderuletype` (`marketid`, `codepre`, `type`, `description`) VALUES (3, "88", 1, "北证A股");
UPDATE `version` set `version` = 9;
COMMIT;

View File

@ -1,5 +1,5 @@
BEGIN TRANSACTION;
INSERT INTO `CodeRuleType` (`marketid`, `codepre`, `type`, `description`) VALUES (1, "56", 5, "上证ETF");
INSERT INTO `CodeRuleType` (`marketid`, `codepre`, `type`, `description`) VALUES (1, "58", 5, "上证ETF");
INSERT INTO `coderuletype` (`marketid`, `codepre`, `type`, `description`) VALUES (1, "56", 5, "上证ETF");
INSERT INTO `coderuletype` (`marketid`, `codepre`, `type`, `description`) VALUES (1, "58", 5, "上证ETF");
UPDATE `version` set `version` = 10;
COMMIT;

View File

@ -14,47 +14,47 @@ CREATE TABLE "stkWeight" (
FOREIGN KEY(stockid) REFERENCES "Stock" (stockid)
);
CREATE TABLE StockTypeInfo (tickValue NUMERIC, precision INTEGER, id INTEGER PRIMARY KEY, type INTEGER, description VARCHAR(100), tick NUMERIC, minTradeNumber INTEGER, maxTradeNumber INTEGER);
INSERT INTO `StockTypeInfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (100,2,0,0,'Block',100,100,1000000);
INSERT INTO `StockTypeInfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,1,1,'A股',0.01,100,1000000);
INSERT INTO `StockTypeInfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,2,2,'指数',0.001,1,1000000);
INSERT INTO `StockTypeInfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,3,3,'B股',0.001,100,1000000);
INSERT INTO `StockTypeInfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,4,4,'基金不含ETF',0.001,100,1000000);
INSERT INTO `StockTypeInfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,5,5,'ETF',0.001,1000,1000000);
INSERT INTO `StockTypeInfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,6,6,'国债',0.01,10,10000);
INSERT INTO `StockTypeInfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,7,7,'其他债券',0.01,10,10000);
INSERT INTO `StockTypeInfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,8,8,'创业板',0.01,100,1000000);
INSERT INTO `stocktypeinfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (100,2,0,0,'Block',100,100,1000000);
INSERT INTO `stocktypeinfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,1,1,'A股',0.01,100,1000000);
INSERT INTO `stocktypeinfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,2,2,'指数',0.001,1,1000000);
INSERT INTO `stocktypeinfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,3,3,'B股',0.001,100,1000000);
INSERT INTO `stocktypeinfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,4,4,'基金不含ETF',0.001,100,1000000);
INSERT INTO `stocktypeinfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.001,3,5,5,'ETF',0.001,1000,1000000);
INSERT INTO `stocktypeinfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,6,6,'国债',0.01,10,10000);
INSERT INTO `stocktypeinfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,7,7,'其他债券',0.01,10,10000);
INSERT INTO `stocktypeinfo` (tickValue,precision,id,type,description,tick,minTradeNumber,maxTradeNumber) VALUES (0.01,2,8,8,'创业板',0.01,100,1000000);
CREATE TABLE Stock (stockid INTEGER PRIMARY KEY, marketid INTEGER, code VARCHAR(20), name VARCHAR(60), type INTEGER, valid INTEGER, startDate INTEGER, endDate INTEGER);
CREATE TABLE Market (marketid INTEGER PRIMARY KEY, market VARCHAR(10), name VARCHAR(60), description VARCHAR(100), code VARCHAR(20), lastDate INTEGER);
INSERT INTO `Market` (marketid,market,name,description,code,lastDate) VALUES (1,'SH','上海证劵交易所','上海市场','000001',19901219);
INSERT INTO `Market` (marketid,market,name,description,code,lastDate) VALUES (2,'SZ','深圳证劵交易所','深圳市场','399001',19901219);
CREATE TABLE CodeRuleType (id INTEGER PRIMARY KEY, marketid INTEGER, codepre VARCHAR(20), type INTEGER, description VARCHAR(100));
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (1,1,'000',2,'上证指数');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (2,1,'60',1,'上证A股');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (4,1,'900',3,'上证B股');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (5,2,'00',1,'深证A股');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (6,2,'20',3,'深证B股');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (7,2,'39',2,'深证指数');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (8,2,'150',4,'深证基金');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (9,2,'16',4,'深证基金');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (10,2,'18',4,'深证基金');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (11,2,'159',5,'深证ETF');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (12,1,'51',5,'上证ETF');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (13,1,'50',4,'上证基金');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (18,2,'300',8,'创业板');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (20,1,'519',4,'上证基金');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (21,1,'009',6,'国债');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (22,1,'010',6,'国债');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (23,1,'10',7,'可转债');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (24,1,'11',7,'可转债');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (25,1,'12',7,'其他债券');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (26,1,'13',7,'地方政府债');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (27,2,'100',6,'国债');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (28,2,'101',6,'国债');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (29,2,'108',7,'贴债');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (30,2,'109',7,'地方政府债');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (31,2,'11',7,'其他债券');
INSERT INTO `CodeRuleType` (id,marketid,codepre,type,description) VALUES (32,2,'12',7,'其他债券');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (1,1,'000',2,'上证指数');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (2,1,'60',1,'上证A股');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (4,1,'900',3,'上证B股');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (5,2,'00',1,'深证A股');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (6,2,'20',3,'深证B股');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (7,2,'39',2,'深证指数');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (8,2,'150',4,'深证基金');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (9,2,'16',4,'深证基金');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (10,2,'18',4,'深证基金');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (11,2,'159',5,'深证ETF');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (12,1,'51',5,'上证ETF');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (13,1,'50',4,'上证基金');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (18,2,'300',8,'创业板');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (20,1,'519',4,'上证基金');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (21,1,'009',6,'国债');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (22,1,'010',6,'国债');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (23,1,'10',7,'可转债');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (24,1,'11',7,'可转债');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (25,1,'12',7,'其他债券');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (26,1,'13',7,'地方政府债');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (27,2,'100',6,'国债');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (28,2,'101',6,'国债');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (29,2,'108',7,'贴债');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (30,2,'109',7,'地方政府债');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (31,2,'11',7,'其他债券');
INSERT INTO `coderuletype` (id,marketid,codepre,type,description) VALUES (32,2,'12',7,'其他债券');
CREATE INDEX "ix_stkWeight_stockid" ON "stkWeight" (stockid);
CREATE INDEX "ix_stkWeight_date" ON "stkWeight" (date);
CREATE INDEX "ix_stkWeight" ON "stkWeight" (stockid, date);

View File

@ -62,7 +62,7 @@ def qianlong_import_weight(connect, src_dir, market):
sourcefile.close()
if records:
cur.executemany("INSERT INTO `hku_base`.`StkWeight` (stockid, date, countAsGift, \
cur.executemany("INSERT INTO `hku_base`.`stkweight` (stockid, date, countAsGift, \
countForSell, priceForSell, bonus, countOfIncreasement, totalCount, freeCount) \
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)",
records)

View File

@ -21,19 +21,19 @@ public:
public:
static const char* getInsertSQL() {
return "insert into `Stock` "
return "insert into `stock` "
"(`marketid`, `code`, `name`, `type`, `valid`, `startDate`, `endDate`) "
"values (?,?,?,?,?,?,?)";
}
static const char* getUpdateSQL() {
return "update `Stock` set `marketid`=?, `code`=?, `name`=?, `type`=?, "
return "update `stock` set `marketid`=?, `code`=?, `name`=?, `type`=?, "
"`valid`=?, `startDate`=?, `endDate`=?, `lastDate`=? where `stockid`=?";
}
static const char* getSelectSQL() {
return "select `stockid`,`marketid`, `code`, `name`, `type`, `valid`, "
"`startDate`, `endDate` from `Stock`";
"`startDate`, `endDate` from `stock`";
}
void save(const SQLStatementPtr& st) const {

View File

@ -60,21 +60,21 @@ public:
public:
static const char* getInsertSQL() {
return "insert into `StockTypeInfo` "
return "insert into `stocktypeinfo` "
"(`id`, `type`, `precision`, `tick`, `tickValue`, "
"`minTradeNumber`, `maxTradeNumber`, `description`) "
"values (?,?,?,?,?,?,?,?)";
}
static const char* getUpdateSQL() {
return "update `StockTypeInfo` set `type`=?, `precision`=?, `tick`=?, "
return "update `stocktypeinfo` set `type`=?, `precision`=?, `tick`=?, "
"`tickValue`=?, `minTradeNumber`=?, `maxTradeNumber`=?"
"`description`=? where `id`=?";
}
static const char* getSelectSQL() {
return "select `id`,`type`,`precision`, `tick`, `tickValue`, "
"`minTradeNumber`, `maxTradeNumber`, `description` from `StockTypeInfo`";
"`minTradeNumber`, `maxTradeNumber`, `description` from `stocktypeinfo`";
}
void save(const SQLStatementPtr& st) const {