mns-scheduler 1.1.8.4__py3-none-any.whl → 1.4.5.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mns_scheduler/__init__.py +1 -3
- mns_scheduler/auto_da_ban/auto_da_ban_service.py +89 -0
- mns_scheduler/company_info/clean/__init__.py +1 -1
- mns_scheduler/company_info/clean/company_info_clean_api.py +62 -21
- mns_scheduler/company_info/common/company_common_query_service.py +45 -0
- mns_scheduler/company_info/constant/__init__.py +1 -1
- mns_scheduler/company_info/constant/company_constant_data.py +335 -224
- mns_scheduler/company_info/de_list_stock/__init__.py +1 -1
- mns_scheduler/company_info/de_list_stock/de_list_stock_service.py +1 -1
- mns_scheduler/company_info/em_stock_info/sync_em_stock_info_sync.py +134 -0
- mns_scheduler/company_info/sync/company_info_set_service.py +208 -0
- mns_scheduler/company_info/sync/sync_company_info_task.py +203 -0
- mns_scheduler/company_info/task/company_announce_info_task.py +77 -0
- mns_scheduler/company_info/task/company_base_info_task.py +64 -0
- mns_scheduler/company_info/task/company_business_info_task.py +177 -0
- mns_scheduler/company_info/task/company_hold_info_task.py +66 -0
- mns_scheduler/company_info/task/company_industry_info_task.py +167 -0
- mns_scheduler/company_info/task/company_total_task.py +69 -0
- mns_scheduler/concept/clean/kpl_concept_clean_api.py +1 -1
- mns_scheduler/concept/clean/ths_concept_clean_api.py +20 -4
- mns_scheduler/concept/ths/common/ths_concept_sync_common_api.py +23 -18
- mns_scheduler/concept/ths/common/ths_concept_update_common_api.py +4 -1
- mns_scheduler/concept/ths/detaill/ths_concept_detail_api.py +7 -7
- mns_scheduler/concept/ths/sync_new_index/sync_ths_concept_new_index_api.py +9 -4
- mns_scheduler/concept/ths/update_concept_info/sync_one_symbol_all_concepts_api.py +2 -2
- mns_scheduler/db/col_move_service.py +3 -3
- mns_scheduler/db/script/__init__.py +1 -1
- mns_scheduler/db/script/col_move_script.py +1 -1
- mns_scheduler/db/script/db_move/__init__.py +7 -0
- mns_scheduler/db/script/db_move/col_move_one_service.py +34 -0
- mns_scheduler/db/script/sync/__init__.py +1 -1
- mns_scheduler/db/script/sync/remote_data_sync_to_local.py +65 -4
- mns_scheduler/db/script/sync/sync_hui_ce_test_data.py +80 -0
- mns_scheduler/db/script/sync/sync_hui_ce_test_data_01.py +69 -0
- mns_scheduler/db/script/update/__init__.py +7 -0
- mns_scheduler/db/script/update/update_col_field.py +36 -0
- mns_scheduler/finance/__init__.py +1 -1
- mns_scheduler/finance/em/__init__.py +7 -0
- mns_scheduler/finance/{em_financial_asset_liability_sync_service_api.py → em/em_financial_asset_liability_sync_service_api.py} +2 -2
- mns_scheduler/finance/{em_financial_profit_sync_service_api.py → em/em_financial_profit_sync_service_api.py} +27 -26
- mns_scheduler/finance/{finance_common_api.py → em/finance_common_api.py} +3 -3
- mns_scheduler/finance/{sync_financial_report_service_api.py → sync_financial_report_service_task.py} +80 -27
- mns_scheduler/finance/xue_qiu/__init__.py +7 -0
- mns_scheduler/finance/xue_qiu/down_load_xueqiu_report_api.py +77 -0
- mns_scheduler/finance/xue_qiu/sync_xue_qiu_fiance_data.py +161 -0
- mns_scheduler/hk/__init__.py +1 -1
- mns_scheduler/hk/hk_company_info_sync_service_api.py +4 -4
- mns_scheduler/hk/hk_industry_info_sync_service_api.py +3 -5
- mns_scheduler/industry/__init__.py +7 -0
- mns_scheduler/industry/ths/__init__.py +7 -0
- mns_scheduler/industry/ths/ths_industry_index_service.py +58 -0
- mns_scheduler/industry/ths/ths_industry_sync_service.py +68 -0
- mns_scheduler/irm/__init__.py +1 -1
- mns_scheduler/irm/api/__init__.py +1 -1
- mns_scheduler/irm/api/sh_stock_sns_sse_info_api.py +8 -58
- mns_scheduler/irm/api/sz_stock_sns_sse_info_api.py +15 -26
- mns_scheduler/irm/stock_irm_cninfo_service.py +43 -31
- mns_scheduler/irm/stock_question_id_service.py +169 -0
- mns_scheduler/k_line/clean/daily/__init__.py +1 -1
- mns_scheduler/k_line/clean/daily/daily_k_line_clean_common_service.py +52 -6
- mns_scheduler/k_line/clean/daily/daily_k_line_service.py +7 -2
- mns_scheduler/k_line/clean/k_line_info_clean_impl.py +3 -2
- mns_scheduler/k_line/clean/k_line_info_clean_task.py +42 -15
- mns_scheduler/k_line/clean/week_month/__init__.py +1 -1
- mns_scheduler/k_line/clean/week_month/normal_week_month_k_line_service.py +124 -26
- mns_scheduler/k_line/clean/week_month/sub_new_week_month_k_line_service.py +2 -2
- mns_scheduler/k_line/common/__init__.py +7 -0
- mns_scheduler/k_line/common/k_line_common_api.py +188 -0
- mns_scheduler/k_line/hot_stocks/__init__.py +1 -1
- mns_scheduler/k_line/hot_stocks/recent_hot_stocks_clean_service.py +1 -1
- mns_scheduler/k_line/{sync → month_week_daily}/bfq_k_line_sync.py +14 -29
- mns_scheduler/k_line/{sync → month_week_daily}/daily_week_month_line_sync.py +11 -12
- mns_scheduler/k_line/sync_status/__init__.py +7 -0
- mns_scheduler/k_line/sync_status/k_line_sync_status_check.py +54 -0
- mns_scheduler/k_line/test/__init__.py +1 -1
- mns_scheduler/k_line/test/k_line_info_clean_his_data.py +14 -3
- mns_scheduler/k_line/year_quarter/__init__.py +7 -0
- mns_scheduler/k_line/year_quarter/year_quarter_line_sync.py +76 -0
- mns_scheduler/kpl/selection/symbol/sync_best_choose_symbol.py +1 -2
- mns_scheduler/kpl/selection/symbol/sync_kpl_concept_symbol_choose_reason_api.py +108 -0
- mns_scheduler/kpl/selection/total/sync_kpl_best_total_sync_api.py +5 -0
- mns_scheduler/lhb/__init__.py +1 -1
- mns_scheduler/lhb/stock_lhb_sync_service.py +1 -1
- mns_scheduler/open/__init__.py +1 -1
- mns_scheduler/open/sync_one_day_open_data_to_db_service.py +2 -3
- mns_scheduler/risk/__init__.py +1 -1
- mns_scheduler/risk/compliance/undisclosed_annual_report_api.py +8 -2
- mns_scheduler/risk/financial/annual_report_audit_check_api.py +13 -3
- mns_scheduler/risk/financial/net_assets_check_api.py +21 -18
- mns_scheduler/risk/financial/profit_income_check_api.py +7 -2
- mns_scheduler/risk/financial_report_risk_check_api.py +1 -1
- mns_scheduler/risk/major_violations/register_and_investigate_stock_sync_api.py +1 -1
- mns_scheduler/risk/self/wei_pan_stock_api.py +1 -1
- mns_scheduler/risk/test/__init__.py +1 -1
- mns_scheduler/risk/test/fix_blask_list.py +4 -6
- mns_scheduler/risk/transactions/transactions_check_api.py +22 -4
- mns_scheduler/self_choose/__init__.py +1 -1
- mns_scheduler/self_choose/ths_self_choose_service.py +99 -43
- mns_scheduler/trade/auto_login/trader_auto_service.py +7 -4
- mns_scheduler/trade/auto_sell_service_api.py +4 -4
- mns_scheduler/trade/balance/__init__.py +7 -0
- mns_scheduler/trade/balance/ths_account_balance_service.py +7 -0
- mns_scheduler/trade/sync_position_api.py +39 -6
- mns_scheduler/trade/task/trader_task_service.py +38 -10
- mns_scheduler/trade/tfp/__init__.py +7 -0
- mns_scheduler/trade/tfp/stock_tfp_info_sync.py +56 -0
- mns_scheduler/zb/stock_zb_pool_sync.py +1 -16
- mns_scheduler/zt/high_chg/sync_high_chg_pool_service.py +2 -2
- mns_scheduler/zt/high_chg/sync_high_chg_real_time_quotes_service.py +1 -1
- mns_scheduler/zt/script/__init__.py +1 -1
- mns_scheduler/zt/script/fix_error_deal_day.py +41 -0
- mns_scheduler/zt/script/kcx_high_chg_open_his_data_handle.py +2 -2
- mns_scheduler/zt/script/sync_high_chg_pool_his_data.py +2 -2
- mns_scheduler/zt/script/sync_now_higt_chg_zt.py +8 -7
- mns_scheduler/zt/zt_pool/em_zt_pool_sync_api.py +260 -83
- mns_scheduler/zt/zt_pool/ths_zt_pool_sync_api.py +33 -90
- mns_scheduler/zt/zt_pool/update_null_zt_reason_api.py +27 -13
- mns_scheduler/zz_task/compensation/__init__.py +0 -0
- mns_scheduler/zz_task/compensation/compensate_task.py +161 -0
- mns_scheduler/zz_task/compensation/compensate_task_one_day.py +142 -0
- mns_scheduler/zz_task/data_sync_task.py +197 -103
- {mns_scheduler-1.1.8.4.dist-info → mns_scheduler-1.4.5.7.dist-info}/METADATA +1 -1
- mns_scheduler-1.4.5.7.dist-info/RECORD +176 -0
- {mns_scheduler-1.1.8.4.dist-info → mns_scheduler-1.4.5.7.dist-info}/WHEEL +1 -1
- mns_scheduler/2014-2015-test/2014_2015_chg_statistics.py +0 -87
- mns_scheduler/big_deal/ths_big_deal_sync.py +0 -98
- mns_scheduler/company_info/base/sync_company_base_info_api.py +0 -439
- mns_scheduler/company_info/base/sync_company_hold_info_api.py +0 -40
- mns_scheduler/company_info/remark/company_remark_info_sync.py +0 -46
- mns_scheduler/db/real_time_task_check.py +0 -84
- mns_scheduler/debt/kzz_bond_info_sync.py +0 -33
- mns_scheduler-1.1.8.4.dist-info/RECORD +0 -142
- /mns_scheduler/{2014-2015-test → auto_da_ban}/__init__.py +0 -0
- /mns_scheduler/company_info/{base → common}/__init__.py +0 -0
- /mns_scheduler/{big_deal → company_info/em_stock_info}/__init__.py +0 -0
- /mns_scheduler/company_info/{remark → sync}/__init__.py +0 -0
- /mns_scheduler/{debt → company_info/task}/__init__.py +0 -0
- /mns_scheduler/k_line/{sync → month_week_daily}/__init__.py +0 -0
- {mns_scheduler-1.1.8.4.dist-info → mns_scheduler-1.4.5.7.dist-info}/top_level.txt +0 -0
mns_scheduler/__init__.py
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
file_path = os.path.abspath(__file__)
|
|
6
|
+
end = file_path.index('mns') + 16
|
|
7
|
+
project_path = file_path[0:end]
|
|
8
|
+
sys.path.append(project_path)
|
|
9
|
+
|
|
10
|
+
from mns_common.db.MongodbUtil import MongodbUtil
|
|
11
|
+
import mns_common.constant.db_name_constant as db_name_constant
|
|
12
|
+
import mns_common.utils.data_frame_util as data_frame_util
|
|
13
|
+
import mns_common.component.deal.deal_service_api as deal_service_api
|
|
14
|
+
from loguru import logger
|
|
15
|
+
from mns_common.utils.async_fun import async_fun
|
|
16
|
+
import mns_common.component.common_service_fun_api as common_service_fun_api
|
|
17
|
+
import mns_common.utils.date_handle_util as date_handle_util
|
|
18
|
+
import pandas as pd
|
|
19
|
+
|
|
20
|
+
mongodb_util = MongodbUtil('27017')
|
|
21
|
+
from datetime import datetime
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def auto_da_ban_task():
|
|
25
|
+
logger.info("打板任务启动")
|
|
26
|
+
while True:
|
|
27
|
+
try:
|
|
28
|
+
now_date = datetime.now()
|
|
29
|
+
now_str_day = now_date.strftime('%Y-%m-%d')
|
|
30
|
+
if bool(1 - date_handle_util.is_trade_date(now_str_day)):
|
|
31
|
+
logger.info("非交易日不执行:{}", now_str_day)
|
|
32
|
+
break
|
|
33
|
+
else:
|
|
34
|
+
# 执行打板任务
|
|
35
|
+
auto_da_ban()
|
|
36
|
+
except BaseException as e:
|
|
37
|
+
logger.error("自动打板定时任务异常:{}", e)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def auto_da_ban():
|
|
41
|
+
now_date = datetime.now()
|
|
42
|
+
now_str_day = now_date.strftime('%Y-%m-%d')
|
|
43
|
+
over_night_da_ban_list = query_over_night_da_ban_list(now_str_day)
|
|
44
|
+
if data_frame_util.is_empty(over_night_da_ban_list):
|
|
45
|
+
return None
|
|
46
|
+
for stock_one in over_night_da_ban_list.itertuples():
|
|
47
|
+
try:
|
|
48
|
+
symbol = stock_one.symbol
|
|
49
|
+
buy_price = stock_one.zt_price
|
|
50
|
+
buy_volume = stock_one.buy_volume
|
|
51
|
+
xia_dan_to_qmt(symbol, buy_price, buy_volume, now_str_day)
|
|
52
|
+
except BaseException as e:
|
|
53
|
+
logger.error("隔夜委托出现异常:{},{}", symbol, e)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def xia_dan_to_qmt(symbol, buy_price, buy_volume, str_day):
|
|
57
|
+
symbol_prefix = common_service_fun_api.add_after_prefix_one(symbol)
|
|
58
|
+
|
|
59
|
+
deal_service_api.trade_buy(symbol_prefix, buy_price, buy_volume, 'qmt')
|
|
60
|
+
|
|
61
|
+
# 异步更新信息
|
|
62
|
+
handle_async_msg(str_day, symbol, symbol_prefix)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@async_fun
|
|
66
|
+
def handle_async_msg(str_day, symbol, symbol_prefix):
|
|
67
|
+
order_list = deal_service_api.query_orders('qmt')
|
|
68
|
+
order_list_df = pd.DataFrame(order_list)
|
|
69
|
+
# order_status ==57 费单
|
|
70
|
+
success_order_df = order_list_df.loc[
|
|
71
|
+
(order_list_df['stock_code'] == symbol_prefix) & (order_list_df['order_status'] != 57)]
|
|
72
|
+
# 多委托几个
|
|
73
|
+
time.sleep(1)
|
|
74
|
+
# 委托成功 更新状态
|
|
75
|
+
if data_frame_util.is_not_empty(success_order_df):
|
|
76
|
+
logger.info("隔夜委托成功:{}", symbol)
|
|
77
|
+
query = {"str_day": str_day, "symbol": symbol}
|
|
78
|
+
new_values = {"$set": {"valid": False}}
|
|
79
|
+
mongodb_util.update_many(query, new_values, db_name_constant.OVER_NIGHT_DA_BAN)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def query_over_night_da_ban_list(str_day):
|
|
83
|
+
query = {"str_day": str_day, "valid": True}
|
|
84
|
+
return mongodb_util.find_query_data(db_name_constant.OVER_NIGHT_DA_BAN, query)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
if __name__ == '__main__':
|
|
88
|
+
while True:
|
|
89
|
+
auto_da_ban()
|
|
@@ -2,7 +2,7 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
4
|
file_path = os.path.abspath(__file__)
|
|
5
|
-
end = file_path.index('mns') +
|
|
5
|
+
end = file_path.index('mns') + 17
|
|
6
6
|
project_path = file_path[0:end]
|
|
7
7
|
sys.path.append(project_path)
|
|
8
8
|
from mns_common.db.MongodbUtil import MongodbUtil
|
|
@@ -12,36 +12,45 @@ from loguru import logger
|
|
|
12
12
|
import mns_scheduler.company_info.constant.company_constant_data as company_constant_data
|
|
13
13
|
import mns_common.constant.db_name_constant as db_name_constant
|
|
14
14
|
import mns_scheduler.concept.ths.detaill.ths_concept_detail_api as ths_concept_detail_api
|
|
15
|
-
import mns_scheduler.company_info.
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import mns_scheduler.company_info.common.company_common_query_service as company_common_query_service
|
|
16
|
+
import mns_scheduler.company_info.sync.sync_company_info_task as sync_company_info_task
|
|
17
|
+
import mns_common.utils.data_frame_util as data_frame_util
|
|
18
18
|
import mns_common.component.common_service_fun_api as common_service_fun_api
|
|
19
19
|
import mns_common.component.company.company_common_service_api as company_common_service_api
|
|
20
20
|
|
|
21
|
+
mongodb_util = MongodbUtil('27017')
|
|
22
|
+
|
|
21
23
|
|
|
22
24
|
# 修改行业信息
|
|
23
|
-
def
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
def clean_company_info(symbol_list):
|
|
26
|
+
create_company_info_index()
|
|
27
|
+
|
|
28
|
+
if len(symbol_list) > 0:
|
|
29
|
+
query = {"symbol": {"$in": symbol_list}}
|
|
30
|
+
company_info_temp_df = mongodb_util.find_query_data(db_name_constant.COMPANY_INFO_TEMP, query)
|
|
27
31
|
else:
|
|
28
|
-
|
|
32
|
+
company_info_temp_df = mongodb_util.find_query_data(db_name_constant.COMPANY_INFO_TEMP, {})
|
|
33
|
+
|
|
34
|
+
company_info_temp_df = company_constant_data.fix_second_industry(company_info_temp_df)
|
|
29
35
|
|
|
30
|
-
company_info =
|
|
36
|
+
company_info = company_info_temp_df.set_index(['second_sw_industry'], drop=False)
|
|
37
|
+
|
|
38
|
+
# 修改行业名称
|
|
31
39
|
del company_info['industry']
|
|
32
40
|
# fix industry name
|
|
33
|
-
industry_final_fix_df = company_constant_data.
|
|
41
|
+
industry_final_fix_df = company_constant_data.get_fix_industry_name_df()
|
|
34
42
|
industry_final_fix_df = industry_final_fix_df.set_index(['second_sw_industry'], drop=True)
|
|
35
43
|
company_info = pd.merge(company_info, industry_final_fix_df, how='outer',
|
|
36
44
|
left_index=True, right_index=True)
|
|
37
|
-
|
|
45
|
+
|
|
46
|
+
# 将申万第三行业做为行业 拆分过大的二级行业 主要有通用设备 和专业设备
|
|
38
47
|
company_info = company_constant_data.fix_industry_use_sw_third(company_info.copy())
|
|
39
48
|
company_info['industry'] = company_info['industry'].fillna('综合')
|
|
40
49
|
company_info = company_constant_data.filed_sort(company_info)
|
|
41
50
|
company_info['company_type'] = company_info['business_nature']
|
|
42
51
|
|
|
43
52
|
# 将list_date列中的所有NaN值设置为99990909
|
|
44
|
-
company_info
|
|
53
|
+
company_info.fillna({'list_date': 19890604}, inplace=True)
|
|
45
54
|
|
|
46
55
|
# 将日期数值转换为日期时间格式
|
|
47
56
|
company_info['list_date_01'] = pd.to_datetime(company_info['list_date'], format='%Y%m%d')
|
|
@@ -63,9 +72,9 @@ def fix_company_industry(symbol):
|
|
|
63
72
|
sub_stock = ths_concept_detail_api.get_ths_concept_detail('885598', None)
|
|
64
73
|
sub_stock_symbol_list = list(sub_stock['symbol'])
|
|
65
74
|
except BaseException as e:
|
|
66
|
-
logger.error("出现异常:{},
|
|
75
|
+
logger.error("出现异常:{},", e)
|
|
67
76
|
query = {'concept_code': 885598}
|
|
68
|
-
ths_stock_concept_detail = mongodb_util.find_query_data(
|
|
77
|
+
ths_stock_concept_detail = mongodb_util.find_query_data(db_name_constant.THS_STOCK_CONCEPT_DETAIL, query)
|
|
69
78
|
sub_stock_symbol_list = list(ths_stock_concept_detail['symbol'])
|
|
70
79
|
company_info.loc[:, 'sub_stock'] = False
|
|
71
80
|
company_info.loc[company_info['symbol'].isin(sub_stock_symbol_list), 'sub_stock'] = True
|
|
@@ -73,11 +82,30 @@ def fix_company_industry(symbol):
|
|
|
73
82
|
try:
|
|
74
83
|
company_info.dropna(subset=['symbol'], axis=0, inplace=True)
|
|
75
84
|
company_info.dropna(subset=['_id'], axis=0, inplace=True)
|
|
85
|
+
ths_stock_industry_detail_df = mongodb_util.find_all_data(db_name_constant.THS_STOCK_INDUSTRY_DETAIL)
|
|
86
|
+
if data_frame_util.is_not_empty(ths_stock_industry_detail_df):
|
|
87
|
+
ths_stock_industry_detail_df = ths_stock_industry_detail_df[
|
|
88
|
+
['symbol', 'ths_industry_name', 'ths_industry_code']]
|
|
89
|
+
|
|
90
|
+
ths_stock_industry_detail_df = ths_stock_industry_detail_df.loc[
|
|
91
|
+
ths_stock_industry_detail_df['symbol'].isin(list(company_info['symbol']))]
|
|
92
|
+
ths_stock_industry_detail_df = ths_stock_industry_detail_df.set_index(['symbol'], drop=True)
|
|
93
|
+
company_info = company_info.set_index(['_id'], drop=False)
|
|
94
|
+
company_info = pd.merge(company_info, ths_stock_industry_detail_df, how='outer',
|
|
95
|
+
left_index=True, right_index=True)
|
|
96
|
+
company_info['ths_industry_code'] = company_info['ths_industry_code'].fillna('0')
|
|
97
|
+
company_info['ths_industry_name'] = company_info['ths_industry_name'].fillna('异常')
|
|
98
|
+
|
|
99
|
+
else:
|
|
100
|
+
company_info['ths_industry_code'] = '0'
|
|
101
|
+
company_info['ths_industry_name'] = '异常'
|
|
102
|
+
company_info.dropna(subset=['symbol'], axis=0, inplace=True)
|
|
103
|
+
company_info.dropna(subset=['_id'], axis=0, inplace=True)
|
|
76
104
|
mongodb_util.save_mongo(company_info, db_name_constant.COMPANY_INFO)
|
|
77
105
|
# 保存历史数据
|
|
78
106
|
save_company_info_his(company_info)
|
|
79
107
|
except BaseException as e:
|
|
80
|
-
logger.error("出现异常:{}
|
|
108
|
+
logger.error("出现异常:{}", e)
|
|
81
109
|
|
|
82
110
|
return company_info
|
|
83
111
|
|
|
@@ -97,17 +125,30 @@ def save_company_info_his(company_info_df):
|
|
|
97
125
|
|
|
98
126
|
# 更新新上市公司信息
|
|
99
127
|
def new_company_info_update():
|
|
100
|
-
east_money_stock_info =
|
|
101
|
-
new_stock = common_service_fun_api.get_new_stock(east_money_stock_info)
|
|
128
|
+
east_money_stock_info = company_common_query_service.get_company_info()
|
|
129
|
+
new_stock = common_service_fun_api.get_new_stock(east_money_stock_info.copy())
|
|
102
130
|
for company_one in new_stock.itertuples():
|
|
103
131
|
try:
|
|
104
|
-
|
|
105
|
-
|
|
132
|
+
sync_company_info_task.sync_company_base_info([company_one.symbol])
|
|
133
|
+
clean_company_info([company_one.symbol])
|
|
106
134
|
|
|
107
135
|
except BaseException as e:
|
|
108
136
|
logger.error("出现异常:{}", e)
|
|
109
137
|
company_common_service_api.company_info_industry_cache_clear
|
|
110
138
|
|
|
111
139
|
|
|
140
|
+
def create_company_info_index():
|
|
141
|
+
mongodb_util.create_index('company_info',
|
|
142
|
+
[("classification", 1)])
|
|
143
|
+
mongodb_util.create_index('company_info',
|
|
144
|
+
[("industry", 1)])
|
|
145
|
+
mongodb_util.create_index('company_info',
|
|
146
|
+
[("flow_mv", 1)])
|
|
147
|
+
mongodb_util.create_index('company_info',
|
|
148
|
+
[("list_date", 1)])
|
|
149
|
+
mongodb_util.create_index('company_info',
|
|
150
|
+
[("symbol", 1)])
|
|
151
|
+
|
|
152
|
+
|
|
112
153
|
if __name__ == '__main__':
|
|
113
|
-
|
|
154
|
+
clean_company_info(["688795"])
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
file_path = os.path.abspath(__file__)
|
|
5
|
+
end = file_path.index('mns') + 16
|
|
6
|
+
project_path = file_path[0:end]
|
|
7
|
+
sys.path.append(project_path)
|
|
8
|
+
import mns_common.component.em.em_stock_info_api as em_stock_info_api
|
|
9
|
+
import mns_common.component.company.company_common_service_api as company_common_service_api
|
|
10
|
+
import mns_common.component.common_service_fun_api as common_service_fun_api
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_company_info():
|
|
14
|
+
em_company_info_df = em_stock_info_api.get_a_stock_info()
|
|
15
|
+
em_company_info_df = em_company_info_df[['symbol',
|
|
16
|
+
'name',
|
|
17
|
+
"now_price",
|
|
18
|
+
'total_mv',
|
|
19
|
+
'flow_mv',
|
|
20
|
+
'pe_ttm',
|
|
21
|
+
'sz_sh',
|
|
22
|
+
'area',
|
|
23
|
+
'pb',
|
|
24
|
+
'list_date',
|
|
25
|
+
'ROE',
|
|
26
|
+
'total_share',
|
|
27
|
+
'flow_share',
|
|
28
|
+
'industry',
|
|
29
|
+
'amount',
|
|
30
|
+
"hk_stock_code",
|
|
31
|
+
"hk_stock_name",
|
|
32
|
+
'concept']]
|
|
33
|
+
|
|
34
|
+
em_company_info_df = em_company_info_df.sort_values(by=['list_date'], ascending=False)
|
|
35
|
+
|
|
36
|
+
de_listed_stock_list = company_common_service_api.get_de_list_company()
|
|
37
|
+
em_company_info_df = em_company_info_df.loc[~(
|
|
38
|
+
em_company_info_df['symbol'].isin(de_listed_stock_list))]
|
|
39
|
+
em_company_info_df = common_service_fun_api.exclude_ts_symbol(em_company_info_df)
|
|
40
|
+
|
|
41
|
+
return em_company_info_df
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if __name__ == '__main__':
|
|
45
|
+
get_company_info()
|