forked from fasiondog/hikyuu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request fasiondog#135 from fasiondog/feature/tools
Feature/tools example/notebook 未打入安装包
- Loading branch information
Showing
7 changed files
with
73 additions
and
52 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.0.1" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf8 -*- | ||
# | ||
# Create on: 2023-12-06 | ||
# Author: fasiondog | ||
|
||
# | ||
# 用于清除 mysql 最后一日的数据。 | ||
# 防止在开市时间段内,不小心导入了数据,导致当天数据错误。 | ||
# | ||
|
||
import datetime | ||
import mysql.connector | ||
from hikyuu.util import * | ||
|
||
|
||
@hku_catch(trace=True) | ||
def get_all_tables(conn, market, typ): | ||
cur = conn.cursor() | ||
sql = f"SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema='{market}_{typ}'" | ||
cur.execute(sql) | ||
x = cur.fetchall() | ||
cur.close() | ||
return [f'`{v[0]}`.`{v[1]}`' for v in x] | ||
def clear_today_day_data(conn, market, typ): | ||
tables = get_all_tables(conn, market, typ) | ||
today = datetime.date.today() | ||
# yyyy mm dd hh mm | ||
t = today.year * 100000000 + today.month * 1000000 + today.day * 10000 | ||
if typ == 'trans': | ||
# yyyy mm dd hh mm ss | ||
t = t * 100 | ||
cur = conn.cursor() | ||
for table in tables: | ||
hku_info(f"clear {table}") | ||
sql = f"delete from {table} where date>={t}" | ||
cur.execute(sql) | ||
cur.close() | ||
conn.commit() | ||
if __name__ == '__main__': | ||
host = '127.0.0.1' | ||
port = 3306 | ||
usr = 'root' | ||
pwd = '' | ||
|
||
conn = mysql.connector.connect(user=usr, password=pwd, host=host, port=port) | ||
|
||
x = get_all_tables(conn, 'bj', 'day') | ||
market_list = ['sh', 'sz', 'bj'] | ||
typ_list = ['time', 'trans', 'day', 'week', 'month', 'quarter', | ||
'halfyear', 'year', 'min', 'min5', 'min15', 'min30', 'min60'] | ||
for market in market_list: | ||
for typ in typ_list: | ||
clear_today_day_data(conn, market, typ) | ||
|
||
conn.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/env python | ||
#-*- coding:utf-8 -*- | ||
# -*- coding:utf-8 -*- | ||
|
||
import platform | ||
try: | ||
|
@@ -34,7 +34,7 @@ def parse_requirements(filename): | |
py_version = int(py_version[0]) * 10 + int(py_version[1]) | ||
|
||
hku_name = "hikyuu" | ||
#hku_version = "1.0.9" | ||
# hku_version = "1.0.9" | ||
hku_author = "fasiondog" | ||
hku_author_email = "[email protected]" | ||
|
||
|
@@ -66,6 +66,9 @@ def parse_requirements(filename): | |
'hikyuu/data/sqlite_mem_sql', | ||
'hikyuu/data_driver', | ||
'hikyuu/examples', | ||
'hikyuu/examples/notebook', | ||
'hikyuu/examples/notebook/images', | ||
'hikyuu/examples/notebook/Demo', | ||
'hikyuu/flat', | ||
'hikyuu/fetcher', | ||
'hikyuu/fetcher/proxy', | ||
|
@@ -78,7 +81,7 @@ def parse_requirements(filename): | |
'hikyuu/shell', | ||
'hikyuu/strategy', | ||
'hikyuu/strategy/demo', | ||
#'hikyuu/test', | ||
'hikyuu/test', | ||
'hikyuu/tools', | ||
'hikyuu/trade_manage', | ||
'hikyuu/trade_sys', | ||
|
@@ -97,12 +100,12 @@ def parse_requirements(filename): | |
keywords=hku_keywords, | ||
platforms=hku_platforms, | ||
url=hku_url, | ||
packages=packages, #find_packages(), | ||
packages=packages, # find_packages(), | ||
zip_safe=False, | ||
include_package_data=True, | ||
package_data={ | ||
'': [ | ||
'*.rst', '*.pyd', '*.ini', '*.sql', '*.properties', '*.xml', | ||
'*.rst', '*.pyd', '*.png', '*.md', '*.ipynb', '*.ini', '*.sql', '*.properties', '*.xml', | ||
'LICENSE.txt', '*.dll', '*.exe', '*.ico', '*.so', '*.dylib', | ||
'*.so.*', '*.qm', 'libboost_serialization*', | ||
'libboost_python{}*'.format(py_version) | ||
|
@@ -143,4 +146,4 @@ def parse_requirements(filename): | |
] | ||
}, | ||
install_requires=requirements, | ||
) | ||
) |