mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-11-29 18:39:10 +08:00
fixed 权息导入时转送股被覆盖
This commit is contained in:
parent
802d9ae7e5
commit
32e0f583f8
2
hikyuu/data/mysql_upgrade/0018.sql
Normal file
2
hikyuu/data/mysql_upgrade/0018.sql
Normal file
@ -0,0 +1,2 @@
|
||||
delete from `hku_base`.`stkweight` where 1=1;
|
||||
UPDATE `hku_base`.`version` set `version` = 18;
|
@ -81,7 +81,7 @@ def pytdx_import_weight_to_mysql(pytdx_api, connect, market):
|
||||
update_last_db_weight = True
|
||||
if xdxr['suogu'] is not None:
|
||||
# etf 扩股
|
||||
new_last_db_weight[3] = 100000 * (xdxr['suogu']-1)
|
||||
new_last_db_weight[3] += 100000 * (xdxr['suogu']-1)
|
||||
update_last_db_weight = True
|
||||
if xdxr['peigu'] is not None:
|
||||
new_last_db_weight[4] = 10000 * xdxr['peigu']
|
||||
@ -103,7 +103,7 @@ def pytdx_import_weight_to_mysql(pytdx_api, connect, market):
|
||||
continue
|
||||
if date not in records:
|
||||
songzhuangu = 10000 * xdxr['songzhuangu'] if xdxr['songzhuangu'] is not None else 0
|
||||
songzhuangu = 100000 * (xdxr['suogu']-1) if xdxr['suogu'] is not None else 0
|
||||
songzhuangu += 100000 * (xdxr['suogu']-1) if xdxr['suogu'] is not None else 0
|
||||
records[date] = [
|
||||
stockid,
|
||||
date,
|
||||
@ -119,7 +119,7 @@ def pytdx_import_weight_to_mysql(pytdx_api, connect, market):
|
||||
if xdxr['songzhuangu'] is not None:
|
||||
records[date][2] = 10000 * xdxr['songzhuangu']
|
||||
if xdxr['suogu'] is not None:
|
||||
records[date][2] = 100000 * (xdxr['suogu']-1)
|
||||
records[date][2] += 100000 * (xdxr['suogu']-1)
|
||||
if xdxr['peigu'] is not None:
|
||||
records[date][3] = 10000 * xdxr['peigu']
|
||||
if xdxr['peigujia'] is not None:
|
||||
|
@ -23,7 +23,7 @@
|
||||
# SOFTWARE.
|
||||
|
||||
from pytdx.hq import TDXParams
|
||||
from .common_pytdx import to_pytdx_market
|
||||
from hikyuu.data.common_pytdx import to_pytdx_market
|
||||
|
||||
|
||||
def pytdx_import_weight_to_sqlite(pytdx_api, connect, market):
|
||||
@ -78,7 +78,7 @@ def pytdx_import_weight_to_sqlite(pytdx_api, connect, market):
|
||||
update_last_db_weight = True
|
||||
if xdxr['suogu'] is not None:
|
||||
# etf 扩股
|
||||
new_last_db_weight[3] = int(100000 * (xdxr['suogu']-1))
|
||||
new_last_db_weight[3] += int(100000 * (xdxr['suogu']-1))
|
||||
update_last_db_weight = True
|
||||
if xdxr['peigu'] is not None:
|
||||
new_last_db_weight[4] = int(10000 * xdxr['peigu'])
|
||||
@ -100,7 +100,7 @@ def pytdx_import_weight_to_sqlite(pytdx_api, connect, market):
|
||||
continue
|
||||
if date not in records:
|
||||
songzhuangu = int(10000 * xdxr['songzhuangu']) if xdxr['songzhuangu'] is not None else 0
|
||||
songzhuangu = int(100000 * (xdxr['suogu']-1)) if xdxr['suogu'] is not None else 0
|
||||
songzhuangu += int(100000 * (xdxr['suogu']-1)) if xdxr['suogu'] is not None else 0
|
||||
records[date] = [
|
||||
stockid,
|
||||
date,
|
||||
@ -118,7 +118,7 @@ def pytdx_import_weight_to_sqlite(pytdx_api, connect, market):
|
||||
if xdxr['songzhuangu'] is not None:
|
||||
records[date][2] = int(10000 * xdxr['songzhuangu'])
|
||||
if xdxr['suogu'] is not None:
|
||||
records[date][2] = int(100000 * (xdxr['suogu']-1))
|
||||
records[date][2] += int(100000 * (xdxr['suogu']-1))
|
||||
if xdxr['peigu'] is not None:
|
||||
records[date][3] = int(10000 * xdxr['peigu'])
|
||||
if xdxr['peigujia'] is not None:
|
||||
@ -170,12 +170,12 @@ if __name__ == '__main__':
|
||||
from hikyuu.data.common_sqlite3 import create_database
|
||||
starttime = time.time()
|
||||
|
||||
dest_dir = "c:\\stock"
|
||||
dest_dir = "d:\\stock"
|
||||
tdx_server = '119.147.212.81'
|
||||
tdx_port = 7709
|
||||
quotations = ['stock', 'fund']
|
||||
|
||||
connect = sqlite3.connect(dest_dir + "\\hikyuu.db")
|
||||
connect = sqlite3.connect(dest_dir + "\\stock.db")
|
||||
create_database(connect)
|
||||
|
||||
from pytdx.hq import TdxHq_API, TDXParams
|
||||
|
4
hikyuu/data/sqlite_upgrade/0019.sql
Normal file
4
hikyuu/data/sqlite_upgrade/0019.sql
Normal file
@ -0,0 +1,4 @@
|
||||
BEGIN TRANSACTION;
|
||||
DELETE FROM `stkWeight`;
|
||||
UPDATE `version` set `version` = 19;
|
||||
COMMIT;
|
Loading…
Reference in New Issue
Block a user