-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
64 lines (47 loc) · 1.91 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import save_tdx as custom
from QUANTAXIS.QASU import save_tdx as stdx
from QUANTAXIS.QASU import save_tdx_file as tdx_file
from QUANTAXIS.QASU import save_tushare as sts
from QUANTAXIS.QASU import save_financialfiles
from QUANTAXIS.QAUtil import DATABASE
def QA_SU_save_list(engine, type_='', client=DATABASE):
"""save data list like stock, index, etf, future
Arguments:
engine {[type]} -- [description]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
engine = select_save_engine(engine)
engine.QA_SU_save_list(type_=type_, client=client)
def QA_SU_save_short_freq(engine, type_='', min_list=[], client=DATABASE):
"""save short freq of data: given list of minute freq
Arguments:
engine {[type]} -- [description]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
engine = select_save_engine(engine)
engine.QA_SU_save_short_freq(type_=type_, min_list=min_list, client=client)
def QA_SU_save_long_freq(engine, type_='', client=DATABASE):
"""save long freq of data: like day, week etc
Arguments:
engine {[type]} -- [description]
Keyword Arguments:
client {[type]} -- [description] (default: {DATABASE})
"""
engine = select_save_engine(engine)
engine.QA_SU_save_long_freq(type_=type_, client=client)
def select_save_engine(engine):
'''
select save_engine , tushare ts Tushare 使用 Tushare 免费数据接口, tdx 使用通达信数据接口
:param engine: 字符串Str
:return: sts means save_tushare_py or stdx means save_tdx_py
'''
if engine in ['tushare', 'ts', 'Tushare']:
return sts
elif engine in ['tdx']:
return stdx
elif engine in ['custom']:
return custom
else:
print('QA Error QASU.main.py call select_save_engine with parameter %s is None of thshare, ts, Thshare, or tdx', engine)