Exemple #1
0
def write_manager_name_to_sql():
    #
    models.delete_all_company_manager()
    pro = ts.pro_api(
        '65d978be5ed23ecc8e71f573fea23125ba1319fe6838ce50e9243242')
    data = pro.stock_basic(exchange='',
                           list_status='L',
                           fields='ts_code,symbol,name')
    company_info = [tuple(xi) for xi in data.values]
    for ones in company_info:
        try:
            names = base_dao.get_one_company_to_relation_node(ones[1], '是管理层')
            if len(names) == 0:
                continue
            one_line_list = []
            for one_n in names:
                one_line_list.append(one_n['姓名'])
            one_line_list = basic_util.delete_repeat(one_line_list)
            name_string = list_to_string(one_line_list)
            print(name_string)
            models.save_company_manager(ones[1], name_string)
            # time.sleep(0.8)
        except Exception as e:
            print(e)
            pass
Exemple #2
0
def get_current_industry_contain(one_domain):
    """
    :param one_domain:
    :return:
    """
    industry = get_industry(one_domain)
    companies = stock_industry_service.get_one_industry_contain(industry)
    companies = basic_util.delete_repeat(companies)
    return companies, industry
Exemple #3
0
def get_industry_from_question(question):
    """
    从问题中获取行业
    :param question:
    :return:
    """
    industry = []
    for one in all_industry:
        if one.industry_name in question:
            industry.append(one)
    return basic_util.delete_repeat(industry)  # type:list[IndustryNamedEntity]
Exemple #4
0
def get_concept_from_question(question):
    """
    从问题中获取概念
    :param question:
    :return:
    """
    concept_list = []
    for one in all_concept:
        if one in question:
            concept_list.append(one)
    return basic_util.delete_repeat(concept_list)  # type:list[str]
Exemple #5
0
def get_stock_code_by_short_name(question):
    """
    通过股票简称获得股票的代码
    :param question:
    :return:
    """
    domains = []
    for one_company in all_company_name:
        # 检查股票代码或者当前股票名称是否包含其中
        if one_company.short_name == '':
            continue
        if one_company.short_name in question or one_company.short_name == question:
            domains.append(one_company)
    return basic_util.delete_repeat(domains)  # type:list[CompanyNamedEntity]
Exemple #6
0
def get_stock_code_by_full_name(question):
    """
    根据股票的全程,获得股票的信息
    :param question:
    :return:
    """
    domains = []
    for one_company in all_company_name:
        # 检查股票代码或者当前股票名称是否包含其中
        if one_company.stock_num in question or one_company.stock_name in question:
            domains.append(one_company)
            continue

        # 检查用户是否输入的是旧名字
        now_old_short_name = one_company.name_string.split(',')[1:]
        for one_name in now_old_short_name:
            if one_name in question:
                domains.append(one_company)
    return basic_util.delete_repeat(domains)  # type:list[CompanyNamedEntity]