Beispiel #1
0
def match_announcement(announcement_dir, history_dir, output_dir, origin_file):
    """匹配公告数据与历史股价数据"""
    keywords = ["分配"]
    stopwords = []
    ou.check_ret(
        su.match_announcement(ou.check_path(announcement_dir),
                              ou.check_path(history_dir),
                              ou.check_path(output_dir), origin_file, keywords,
                              stopwords, True))
Beispiel #2
0
(options, args) = parser.parse_args()

keywords = []
stopwords = []

if __name__ == "__main__":
    if len(args) != 1:
        help()

    with codecs.open(options.keywords, "r", "utf-8") as f:
        for word in f:
            if len(word) > 1:
                keywords.append(word[:-1])
    with codecs.open(options.stopwords, "r", "utf-8") as f:
        for word in f:
            if len(word) > 1:
                stopwords.append(word[:-1])

    print(keywords)
    print(stopwords)

    begin = datetime.datetime.now()
    if args[0] == "summary":
        ou.check_ret(summarization(options.input, options.output))
    else:
        help()
    end = datetime.datetime.now()
    ou.split_line()
    print("执行用时: ")
    print(end - begin)
Beispiel #3
0
def macro_enco_data(output_dir):
    """获取宏观经济数据"""
    ou.check_ret(su.get_macro_enco_data(ou.check_path(output_dir)))
Beispiel #4
0
def fundamental_data(output_dir):
    """获取基本面数据"""
    ou.check_ret(su.get_fundamental_data(ou.check_path(output_dir)))
Beispiel #5
0
def get_all_history(list_file, interval, output):
    """获取指定时间间隔的全部股价数据"""
    ou.check_file(list_file, "请先使用 stock-list 命令来获取")
    # 读取默认输出文件夹中的 stock_basics.csv 来获取股票列表
    ou.check_ret(
        su.get_all_history_data(interval, list_file, ou.check_path(output)))
Beispiel #6
0
def get_history_data(code, interval, output):
    """获取指定股票指定时间间隔的股价数据"""
    ou.check_ret(su.get_history_data(code, interval, ou.check_path(output)))
Beispiel #7
0
def daily(list_file, output):
    """获取 A 股的股票列表及对应详情"""
    intervals = ["5", "15", "30", "60"]
    for i in intervals:
        ou.check_ret(su.daily_crawler(i, list_file, ou.check_path(output)))
Beispiel #8
0
def get_stock_list(output):
    """获取 A 股的股票列表及对应详情"""
    ou.check_ret(su.get_stock_list(ou.check_path(output)))
Beispiel #9
0
def generate_label_data(input_dir, output_dir):
    """生成用于标注的公告数据"""
    ou.check_ret(
        su.generate_label_data(ou.check_path(input_dir),
                               ou.check_path(output_dir)))
Beispiel #10
0
def keyword_cluster(input_dir, output_dir):
    """根据指定关键词聚类公告"""
    ou.check_ret(
        su.cluster_announcement(ou.check_path(input_dir),
                                ou.check_path(output_dir)))