mns-scheduler 1.1.8.4__py3-none-any.whl → 1.4.3.2__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.
Files changed (129) hide show
  1. mns_scheduler/__init__.py +1 -3
  2. mns_scheduler/company_info/announce/company_announce_sync_service.py +65 -0
  3. mns_scheduler/company_info/base/__init__.py +1 -1
  4. mns_scheduler/company_info/base/sync_company_base_info_api.py +171 -79
  5. mns_scheduler/company_info/base/sync_company_hold_info_api.py +3 -6
  6. mns_scheduler/company_info/base/sync_company_product_area_industry.py +161 -0
  7. mns_scheduler/company_info/clean/__init__.py +1 -1
  8. mns_scheduler/company_info/clean/company_info_clean_api.py +29 -9
  9. mns_scheduler/company_info/constant/__init__.py +1 -1
  10. mns_scheduler/company_info/constant/company_constant_data.py +285 -184
  11. mns_scheduler/company_info/de_list_stock/__init__.py +1 -1
  12. mns_scheduler/company_info/de_list_stock/de_list_stock_service.py +1 -1
  13. mns_scheduler/company_info/em_stock_info/__init__.py +7 -0
  14. mns_scheduler/company_info/em_stock_info/sync_em_stock_info_sync.py +80 -0
  15. mns_scheduler/company_info/remark/__init__.py +1 -1
  16. mns_scheduler/company_info/remark/company_remark_info_sync.py +3 -3
  17. mns_scheduler/concept/clean/kpl_concept_clean_api.py +1 -1
  18. mns_scheduler/concept/clean/ths_concept_clean_api.py +20 -4
  19. mns_scheduler/concept/ths/common/ths_concept_sync_common_api.py +21 -16
  20. mns_scheduler/concept/ths/common/ths_concept_update_common_api.py +4 -1
  21. mns_scheduler/concept/ths/detaill/ths_concept_detail_api.py +7 -7
  22. mns_scheduler/concept/ths/sync_new_index/sync_ths_concept_new_index_api.py +9 -4
  23. mns_scheduler/concept/ths/update_concept_info/sync_one_symbol_all_concepts_api.py +3 -3
  24. mns_scheduler/db/col_move_service.py +3 -3
  25. mns_scheduler/db/script/__init__.py +1 -1
  26. mns_scheduler/db/script/col_move_script.py +1 -1
  27. mns_scheduler/db/script/db_move/__init__.py +7 -0
  28. mns_scheduler/db/script/db_move/col_move_one_service.py +34 -0
  29. mns_scheduler/db/script/sync/__init__.py +1 -1
  30. mns_scheduler/db/script/sync/remote_data_sync_to_local.py +57 -4
  31. mns_scheduler/db/script/sync/sync_hui_ce_test_data.py +80 -0
  32. mns_scheduler/db/script/sync/sync_hui_ce_test_data_01.py +69 -0
  33. mns_scheduler/db/script/update/__init__.py +7 -0
  34. mns_scheduler/db/script/update/update_col_field.py +36 -0
  35. mns_scheduler/finance/__init__.py +1 -1
  36. mns_scheduler/finance/{em_financial_asset_liability_sync_service_api.py → em/em_financial_asset_liability_sync_service_api.py} +2 -2
  37. mns_scheduler/finance/{em_financial_profit_sync_service_api.py → em/em_financial_profit_sync_service_api.py} +27 -26
  38. mns_scheduler/finance/{finance_common_api.py → em/finance_common_api.py} +3 -3
  39. mns_scheduler/finance/{sync_financial_report_service_api.py → sync_financial_report_service_task.py} +80 -27
  40. mns_scheduler/finance/xue_qiu/down_load_xueqiu_report_api.py +77 -0
  41. mns_scheduler/finance/xue_qiu/sync_xue_qiu_fiance_data.py +161 -0
  42. mns_scheduler/hk/__init__.py +1 -1
  43. mns_scheduler/hk/hk_company_info_sync_service_api.py +4 -4
  44. mns_scheduler/hk/hk_industry_info_sync_service_api.py +3 -5
  45. mns_scheduler/industry/__init__.py +7 -0
  46. mns_scheduler/industry/ths/__init__.py +7 -0
  47. mns_scheduler/industry/ths/ths_industry_index_service.py +58 -0
  48. mns_scheduler/industry/ths/ths_industry_sync_service.py +68 -0
  49. mns_scheduler/irm/__init__.py +1 -1
  50. mns_scheduler/irm/api/__init__.py +1 -1
  51. mns_scheduler/irm/api/sh_stock_sns_sse_info_api.py +1 -1
  52. mns_scheduler/irm/api/sz_stock_sns_sse_info_api.py +1 -1
  53. mns_scheduler/irm/stock_irm_cninfo_service.py +12 -8
  54. mns_scheduler/k_line/clean/daily/__init__.py +1 -1
  55. mns_scheduler/k_line/clean/daily/daily_k_line_clean_common_service.py +52 -6
  56. mns_scheduler/k_line/clean/daily/daily_k_line_service.py +7 -2
  57. mns_scheduler/k_line/clean/k_line_info_clean_impl.py +3 -2
  58. mns_scheduler/k_line/clean/k_line_info_clean_task.py +42 -15
  59. mns_scheduler/k_line/clean/week_month/__init__.py +1 -1
  60. mns_scheduler/k_line/clean/week_month/normal_week_month_k_line_service.py +124 -26
  61. mns_scheduler/k_line/clean/week_month/sub_new_week_month_k_line_service.py +2 -2
  62. mns_scheduler/k_line/common/__init__.py +7 -0
  63. mns_scheduler/k_line/common/k_line_common_api.py +188 -0
  64. mns_scheduler/k_line/hot_stocks/__init__.py +1 -1
  65. mns_scheduler/k_line/hot_stocks/recent_hot_stocks_clean_service.py +1 -1
  66. mns_scheduler/k_line/{sync → month_week_daily}/bfq_k_line_sync.py +14 -29
  67. mns_scheduler/k_line/{sync → month_week_daily}/daily_week_month_line_sync.py +11 -12
  68. mns_scheduler/k_line/sync_status/__init__.py +7 -0
  69. mns_scheduler/k_line/sync_status/k_line_sync_status_check.py +54 -0
  70. mns_scheduler/k_line/test/__init__.py +1 -1
  71. mns_scheduler/k_line/test/k_line_info_clean_his_data.py +14 -3
  72. mns_scheduler/k_line/year_quarter/__init__.py +7 -0
  73. mns_scheduler/k_line/year_quarter/year_quarter_line_sync.py +76 -0
  74. mns_scheduler/kpl/selection/symbol/sync_best_choose_symbol.py +1 -2
  75. mns_scheduler/kpl/selection/symbol/sync_kpl_concept_symbol_choose_reason_api.py +108 -0
  76. mns_scheduler/kpl/selection/total/sync_kpl_best_total_sync_api.py +5 -0
  77. mns_scheduler/lhb/__init__.py +1 -1
  78. mns_scheduler/lhb/stock_lhb_sync_service.py +1 -1
  79. mns_scheduler/open/__init__.py +1 -1
  80. mns_scheduler/open/sync_one_day_open_data_to_db_service.py +2 -3
  81. mns_scheduler/risk/__init__.py +1 -1
  82. mns_scheduler/risk/compliance/undisclosed_annual_report_api.py +8 -2
  83. mns_scheduler/risk/financial/annual_report_audit_check_api.py +13 -3
  84. mns_scheduler/risk/financial/net_assets_check_api.py +21 -18
  85. mns_scheduler/risk/financial/profit_income_check_api.py +7 -2
  86. mns_scheduler/risk/financial_report_risk_check_api.py +1 -1
  87. mns_scheduler/risk/major_violations/register_and_investigate_stock_sync_api.py +1 -1
  88. mns_scheduler/risk/self/wei_pan_stock_api.py +1 -1
  89. mns_scheduler/risk/test/__init__.py +1 -1
  90. mns_scheduler/risk/test/fix_blask_list.py +4 -6
  91. mns_scheduler/risk/transactions/transactions_check_api.py +22 -4
  92. mns_scheduler/self_choose/__init__.py +1 -1
  93. mns_scheduler/self_choose/ths_self_choose_service.py +60 -32
  94. mns_scheduler/trade/auto_login/trader_auto_service.py +6 -4
  95. mns_scheduler/trade/auto_sell_service_api.py +4 -4
  96. mns_scheduler/trade/balance/__init__.py +7 -0
  97. mns_scheduler/trade/balance/ths_account_balance_service.py +7 -0
  98. mns_scheduler/trade/sync_position_api.py +39 -6
  99. mns_scheduler/trade/task/trader_task_service.py +26 -9
  100. mns_scheduler/trade/tfp/__init__.py +7 -0
  101. mns_scheduler/trade/tfp/stock_tfp_info_sync.py +56 -0
  102. mns_scheduler/zb/stock_zb_pool_sync.py +1 -16
  103. mns_scheduler/zt/high_chg/sync_high_chg_pool_service.py +2 -2
  104. mns_scheduler/zt/high_chg/sync_high_chg_real_time_quotes_service.py +1 -1
  105. mns_scheduler/zt/script/__init__.py +1 -1
  106. mns_scheduler/zt/script/fix_error_deal_day.py +41 -0
  107. mns_scheduler/zt/script/kcx_high_chg_open_his_data_handle.py +2 -2
  108. mns_scheduler/zt/script/sync_high_chg_pool_his_data.py +2 -2
  109. mns_scheduler/zt/script/sync_now_higt_chg_zt.py +8 -7
  110. mns_scheduler/zt/zt_pool/em_zt_pool_sync_api.py +256 -55
  111. mns_scheduler/zt/zt_pool/ths_zt_pool_sync_api.py +33 -90
  112. mns_scheduler/zt/zt_pool/update_null_zt_reason_api.py +24 -13
  113. mns_scheduler/zz_task/compensation/__init__.py +0 -0
  114. mns_scheduler/zz_task/compensation/compensate_task.py +161 -0
  115. mns_scheduler/zz_task/compensation/compensate_task_one_day.py +142 -0
  116. mns_scheduler/zz_task/data_sync_task.py +177 -91
  117. {mns_scheduler-1.1.8.4.dist-info → mns_scheduler-1.4.3.2.dist-info}/METADATA +1 -1
  118. mns_scheduler-1.4.3.2.dist-info/RECORD +169 -0
  119. {mns_scheduler-1.1.8.4.dist-info → mns_scheduler-1.4.3.2.dist-info}/WHEEL +1 -1
  120. mns_scheduler/2014-2015-test/2014_2015_chg_statistics.py +0 -87
  121. mns_scheduler/big_deal/ths_big_deal_sync.py +0 -98
  122. mns_scheduler/db/real_time_task_check.py +0 -84
  123. mns_scheduler/debt/kzz_bond_info_sync.py +0 -33
  124. mns_scheduler-1.1.8.4.dist-info/RECORD +0 -142
  125. /mns_scheduler/{big_deal → company_info/announce}/__init__.py +0 -0
  126. /mns_scheduler/{2014-2015-test → finance/em}/__init__.py +0 -0
  127. /mns_scheduler/{debt → finance/xue_qiu}/__init__.py +0 -0
  128. /mns_scheduler/k_line/{sync → month_week_daily}/__init__.py +0 -0
  129. {mns_scheduler-1.1.8.4.dist-info → mns_scheduler-1.4.3.2.dist-info}/top_level.txt +0 -0
@@ -23,7 +23,7 @@ def get_fix_symbol_industry():
23
23
  ['300293', '蓝英装备', '640701', '机器人'],
24
24
  ['688630', '芯碁微装', '270108', '半导体设备'],
25
25
  ['001309', '德明利', '270104', '数字芯片设计'],
26
- ['600338', '西藏珠峰', '240603', ''],
26
+ ['600338', '西藏珠峰', '240303', '铅锌'],
27
27
  ['300042', '朗科科技', '270108', '半导体设备'],
28
28
  ['688507', '索辰科技', '710402', '横向通用软件'],
29
29
  ['301387', '光大同创', '270504', '消费电子零部件及组装'],
@@ -46,244 +46,340 @@ def get_fix_symbol_industry():
46
46
  ['830799', '艾融软件', '490101', '证券'],
47
47
  ['300033', '同花顺', '490101', '证券'],
48
48
  ['300399', '天利科技', '490201', '保险'],
49
-
49
+ # EDA软件
50
+ ['301269', '华大九天', '270108', '半导体设备'],
51
+ ['688206', '概伦电子', '270108', '半导体设备'],
52
+ ['301095', '广立微', '270108', '半导体设备'],
53
+ ['002131', '利欧股份', '720501', '营销代理'],
50
54
 
51
55
  ],
52
- columns=['symbol', 'name', 'new_industry_code', 'new_industry'])
56
+ columns=['symbol',
57
+ 'name',
58
+ 'new_industry_code', # 三级行业代码
59
+ 'new_industry'])
53
60
 
54
61
 
55
- def get_industry_final_fix_df():
62
+ # 修改二级行业分类的股票
63
+ def get_fix_second_industry_info():
56
64
  return pd.DataFrame([
57
- # 汽车
58
- ['汽车零部件', '汽车零部件'],
59
- ['汽车服务', '汽车服务'],
60
- ['乘用车', '汽车整车'], # = merge 汽车整车
61
- ['商用车', '汽车整车'],
65
+ ['110200', '渔业', "农林牧渔", "110000", '农业综合Ⅱ', '110900'],
62
66
 
63
- # 医药生物
64
- ['化学制药', '化学制药'],
65
- ['生物制品', '生物制品'],
66
- ['中药Ⅱ', '中药'],
67
- ['医疗器械', '医疗器械'],
68
- ['医疗服务', '医疗服务'],
69
- ['医药商业', '医药商业'],
67
+ ['110300', '林业', "农林牧渔", "110000", '农业综合Ⅱ', '110900'],
70
68
 
71
- # 电力设备
72
- ['电网设备', '电网设备'],
73
- ['电池', '电池'],
74
- ['电机Ⅱ', '电机'], #
75
- ['光伏设备', '光伏设备'],
76
- ['风电设备', '风电设备'],
77
- ['其他电源设备Ⅱ', '其他电源设备'],
69
+ ['450700', '旅游零售Ⅱ', '社会服务', '460000', '旅游及景区', '461000'],
78
70
 
79
- # 房地产
80
- ['房地产开发', '房地产'],
81
- ['房地产服务', '房地产'],
71
+ ['220700', '化工新材料Ⅱ', '基础化工', '220000', '非金属材料Ⅱ', '220900'],
82
72
 
83
- # 计算机 联动板块
84
- ['计算机设备', '计算机设备'],
85
- ['IT服务Ⅱ', 'IT服务'],
86
- ['软件开发', '软件开发'],
73
+ ['330700', '其他家电Ⅱ', '家用电器', '330000', '小家电', '330300'],
87
74
 
88
- # 环保
89
- ['环境治理', '环保'], # merge, 环保
90
- ['环保设备Ⅱ', '环保'], # merge '环保'
75
+ ['250100', '建筑材料', '建筑材料', '610000', '装修建材', '610300'],
91
76
 
92
- # 电子
93
- ['半导体', '半导体'],
94
- ['电子化学品Ⅱ', '电子化学品'],
95
- ['光学光电子', '光学光电子'],
96
- ['消费电子', '消费电子'],
97
- ['元件', '元件'],
98
- ['其他电子Ⅱ', '其他电子'], #
77
+ ['460600', '体育Ⅱ', '综合', '510000', '综合Ⅱ', '510100'],
99
78
 
100
- # 国防
101
- ['军工电子Ⅱ', '军工电子'], # todo merge 国防
102
- ['地面兵装Ⅱ', '地面兵装'], # todo merge 国防
103
- ['航天装备Ⅱ', '航天装备'],
104
- ['航空装备Ⅱ', '航空装备'], # todo merge 国防
105
- ['航海装备Ⅱ', '航海装备'],
79
+ ['770300', '医疗美容', '美容护理', '770000', '化妆品', '770200'],
106
80
 
107
- # 金融 互联网金融 参股券商
108
- ['证券Ⅱ', '证券'],
109
- ['国有大型银行Ⅱ', '银行'], # merge to 银行
110
- ['城商行Ⅱ', '银行'], #
111
- ['农商行Ⅱ', '银行'], # merge 银行
112
- ['股份制银行Ⅱ', '银行'], # merge to 银行
113
- ['保险Ⅱ', '保险'],
114
- ['多元金融', '多元金融'],
81
+ ],
82
+ columns=['original_second_industry_code',
83
+ 'original_second_industry_name',
84
+ 'first_sw_industry',
85
+ 'first_industry_code',
86
+ 'second_sw_industry', # 二级级行业代码
87
+ 'second_industry_code'])
115
88
 
116
- # 通信
117
- ['通信服务', '通信服务'],
118
- ['通信设备', '通信设备'],
119
89
 
120
- # 酒 喝死你
121
- ['白酒Ⅱ', '酒类'], # merge '酒类'
122
- ['非白酒', '酒类'], # merge '酒类'
90
+ def fix_second_industry(company_info):
91
+ fix_second_industry_df = get_fix_second_industry_info()
92
+ del fix_second_industry_df['original_second_industry_name']
93
+ fix_second_company_df = company_info.loc[
94
+ company_info['second_industry_code'].isin(fix_second_industry_df['original_second_industry_code'])]
123
95
 
124
- # 轻工制造
125
- ['造纸', '造纸'],
126
- ['包装印刷', '包装印刷'], #
127
- ['文娱用品', '文娱用品'], #
128
- ['家居用品', '家居用品'],
96
+ no_fix_second_company_df = company_info.loc[~(
97
+ company_info['second_industry_code'].isin(fix_second_industry_df['original_second_industry_code']))]
129
98
 
130
- # 纺织服装
131
- ['服装家纺', '纺织服装'], # merge 纺织服装
132
- ['纺织制造', '纺织服装'], # merge 纺织服装
133
- ['饰品', '饰品'], # todo exclude
99
+ fix_second_company_df = fix_second_company_df.set_index(['second_industry_code'], drop=True)
100
+ del fix_second_company_df['second_sw_industry']
101
+ del fix_second_company_df['first_industry_code']
102
+ del fix_second_company_df['first_sw_industry']
103
+ fix_second_industry_df = fix_second_industry_df.set_index(['original_second_industry_code'], drop=True)
134
104
 
135
- # 美容护理
136
- ['化妆品', '美容护理'], # merge to 美容护理
137
- ['医疗美容', '美容护理'], # merge 美容护理
138
- ['个护用品', '个护用品'],
105
+ fix_second_company_df = pd.merge(fix_second_company_df, fix_second_industry_df, how='outer',
106
+ left_index=True, right_index=True)
139
107
 
140
- # 食品饮料
141
- ['饮料乳品', '饮料乳品'], # merge 食品饮料
142
- ['食品加工', '食品加工'], # merge 食品饮料
143
- ['调味发酵品Ⅱ', '调味发酵品'], # merge to 食品饮料
144
- ['休闲食品', '休闲食品'], # merge '食品饮料'
108
+ return pd.concat([no_fix_second_company_df, fix_second_company_df])
145
109
 
146
- # 石油石化
147
- ['炼化及贸易', '石油行业'], # merge 石油行业
148
- ['油服工程', '采掘行业'], # merge '采掘行业'
149
- ['油气开采Ⅱ', '石油行业'], # merge to 石油行业
150
110
 
151
- # 钢铁
152
- ['普钢', '钢铁'], # merge 钢铁
153
- ['特钢Ⅱ', '钢铁'], # merge '钢铁'
154
- ['冶钢原料', '钢铁'], # merge to 钢铁
111
+ # 修改行业名
112
+ def get_fix_industry_name_df():
113
+ return pd.DataFrame([
155
114
 
156
- # 有色金属
157
- ['能源金属', '能源金属'], # merge
158
- ['小金属', '小金属'],
159
- ['贵金属', '贵金属'], #
160
- ['金属新材料', '金属新材料'],
161
- # 铅锌 铝 铜
162
- ['工业金属', '工业金属'],
115
+ # 交通运输 1
116
+ ['物流', '物流'],
117
+ ['铁路公路', '铁路公路'],
118
+ ['航运港口', '航运港口'],
119
+ ['航空机场', '航空机场'],
163
120
 
164
- # 建筑装饰
165
- ['基础建设', '工程建设'],
166
- ['房屋建设Ⅱ', '工程建设'], # merge 工程建设
167
- ['工程咨询服务Ⅱ', '工程咨询服务'],
168
- ['专业工程', '建筑工程'],
169
- ['装修装饰Ⅱ', '装修装饰'],
170
- ['工程机械', '工程机械'],
121
+ # 传媒 2
122
+ ['数字媒体', '数字媒体'],
123
+ ['电视广播Ⅱ', '电视广播'],
124
+ ['游戏Ⅱ', '游戏'],
125
+ ['出版', '出版'],
126
+ ['影视院线', '影视院线'],
127
+ ['广告营销', '广告营销'],
171
128
 
172
- # 建筑材料
173
- ['装修建材', '装修建材'], #
174
- ['建筑建材', '装修建材'], #
175
- ['玻璃玻纤', '玻璃玻纤'],
176
- ['水泥', '水泥'],
129
+ # 公用事业 3
130
+ ['燃气Ⅱ', '燃气'],
131
+ ['电力', '电力'],
177
132
 
178
- # 家用电器
179
- ['白色家电', '家用电器'], # merge 家用电器
180
- ['照明设备Ⅱ', '家用电器'], # merge 家用电器
181
- ['其他家电Ⅱ', '家用电器'], # merge 家用电器
182
- ['家电零部件Ⅱ', '家用电器'], # merge 家用电器
183
- ['小家电', '家用电器'], # merge '家用电器'
184
- ['黑色家电', '家用电器'], # merge 家用电器
185
- ['厨卫电器', '家用电器'], # merge 家用电器
133
+ # 农林牧渔 4
134
+ ['养殖业', '养殖业'],
135
+ ['农产品加工', '农产品加工'],
136
+ ['饲料', '饲料'],
137
+ ['渔业', '渔业'], # merge to 农业综合
138
+ ['动物保健Ⅱ', '动物保健'],
139
+ ['种植业', '种植业'],
140
+ # ['林业Ⅱ', '林业'], # merge 农业综合
141
+ ['农业综合Ⅱ', '农业综合'], #
142
+
143
+ # 医药生物 5
144
+ ['化学制药', '化学制药'],
145
+ ['生物制品', '生物制品'],
146
+ ['中药Ⅱ', '中药'],
147
+ ['医疗器械', '医疗器械'],
148
+ ['医疗服务', '医疗服务'],
149
+ ['医药商业', '医药商业'],
186
150
 
187
- # 基础化工
151
+ # 商贸零售 6
152
+ ['一般零售', '一般零售'],
153
+ ['互联网电商', '互联网电商'],
154
+ ['贸易Ⅱ', '贸易'], #
155
+ ['专业连锁Ⅱ', '零售专业连锁'], # 专业连锁 综合Ⅱ
156
+ # ['旅游零售Ⅱ', '旅游零售'], # merge旅游及景区
157
+
158
+ # 国防 7
159
+ ['军工电子Ⅱ', '军工电子'],
160
+ ['地面兵装Ⅱ', '地面兵装'],
161
+ ['航天装备Ⅱ', '航天装备'],
162
+ ['航空装备Ⅱ', '航空装备'],
163
+ ['航海装备Ⅱ', '航海装备'],
164
+
165
+ # 基础化工 8
188
166
  ['化学制品', '化学制品'],
189
167
  ['化学原料', '化学原料'],
190
168
  ['化学纤维', '化学纤维'],
191
169
  ['农化制品', '化肥农药'],
192
170
  ['塑料', '塑料'],
193
- ['橡胶', '橡胶'], # todo exclude
171
+ ['橡胶', '橡胶'],
194
172
  ['非金属材料Ⅱ', '非金属材料'],
195
173
 
196
- # 商贸零售
197
- ['一般零售', '一般零售'],
198
- ['互联网电商', '互联网电商'],
199
- ['贸易Ⅱ', '贸易'], #
174
+ # 家用电器 9
175
+ ['白色家电', '白色家电'], # merge 家用电器
176
+ ['照明设备Ⅱ', '照明设备'], # merge 家用电器
177
+ # ['其他家电Ⅱ', '其他家电'], # merge 小家电
178
+ ['家电零部件Ⅱ', '家电零部件'], # merge 家用电器
179
+ ['小家电', '小家电'], # merge '家用电器'
180
+ ['黑色家电', '黑色家电'], # merge 家用电器
181
+ ['厨卫电器', '厨卫电器'], # merge 家用电器
200
182
 
201
- # 农林牧渔
202
- ['养殖业', '农林牧渔'], # merge 农林牧渔
203
- ['农产品加工', '农林牧渔'], # merge 农林牧渔
204
- ['饲料', '农林牧渔'], # merge to 饲料
205
- ['渔业', '农林牧渔'], # merge to 渔业
206
- ['种植业', '种植业'], # merge 种植业
207
- ['动物保健Ⅱ', '动物保健'], # todo exclude
183
+ # 建筑材料 10
184
+ ['装修建材', '装修建材'], #
185
+ ['建筑建材', '装修建材'], #
186
+ ['玻璃玻纤', '玻璃玻纤'],
187
+ ['水泥', '水泥'],
208
188
 
209
- # 公用事业
210
- ['燃气Ⅱ', '燃气'],
211
- ['电力', '电力'],
189
+ # 建筑装饰 11
190
+ ['基础建设', '基础建设'],
191
+ ['房屋建设Ⅱ', '房屋建设'],
192
+ ['工程咨询服务Ⅱ', '工程咨询服务'],
193
+ ['专业工程', '建筑专业工程'],
194
+ ['装修装饰Ⅱ', '装修装饰'],
212
195
 
213
- # 传媒
214
- ['数字媒体', '数字媒体'],
215
- ['电视广播Ⅱ', '电视广播'],
216
- ['游戏Ⅱ', '游戏'],
217
- ['出版', '出版'],
218
- ['影视院线', '影视院线'],
219
- ['广告营销', '广告营销'],
196
+ # 房地产 12
197
+ ['房地产开发', '房地产'],
198
+ ['房地产服务', '房地产'],
220
199
 
221
- # 交通运输
222
- ['物流', '物流'],
223
- ['铁路公路', '铁路公路'],
224
- ['航运港口', '航运港口'],
225
- ['航空机场', '航空机场'],
200
+ # 有色金属 13
201
+ ['能源金属', '能源金属'],
202
+ ['小金属', '小金属'],
203
+ ['贵金属', '贵金属'], #
204
+ ['金属新材料', '金属新材料'],
205
+ ['工业金属', '工业金属'], # 铅锌 铝 铜
206
+
207
+ # 机械设备 14
208
+ ['自动化设备', '自动化设备'],
209
+ ['轨交设备Ⅱ', '轨交设备'],
210
+ ['通用设备', '通用设备'],
211
+ ['专用设备', '专用设备'],
212
+ ['工程机械', '工程机械'],
213
+
214
+ # 汽车 15
215
+ ['汽车零部件', '汽车零部件'],
216
+ ['汽车服务', '汽车服务'],
217
+ ['乘用车', '乘用车'], # = merge 汽车整车
218
+ ['商用车', '商用车'],
219
+ ['摩托车及其他', '摩托车及其他'],
220
+
221
+ # 煤炭 16
222
+ ['焦炭Ⅱ', '焦炭'], # merge to 煤炭
223
+ ['煤炭开采', '煤炭开采'], # merge 煤炭
226
224
 
227
- # 旅游酒店
228
- ['酒店餐饮', '旅游酒店'], # merge to 旅游酒店
229
- ['旅游零售Ⅱ', '旅游酒店'], # merge 旅游酒店 中国中免
230
- ['旅游及景区', '旅游酒店'], # merge 旅游酒店
225
+ # 环保 17
226
+ ['环境治理', '环境治理'], # merge, 环保
227
+ ['环保设备Ⅱ', '环保设备'], # merge '环保'
231
228
 
232
- # 煤炭
233
- ['焦炭Ⅱ', '煤炭'], # merge to 煤炭
234
- ['煤炭开采', '煤炭'], # merge 煤炭
229
+ # 电力设备 18
230
+ ['电网设备', '电网设备'],
231
+ ['电池', '电池'],
232
+ ['电机Ⅱ', '电机'], #
233
+ ['光伏设备', '光伏设备'],
234
+ ['风电设备', '风电设备'],
235
+ ['其他电源设备Ⅱ', '其他电源设备'],
235
236
 
237
+ # 电子 19
238
+ ['半导体', '半导体'],
239
+ ['电子化学品Ⅱ', '电子化学品'],
240
+ ['光学光电子', '光学光电子'],
241
+ ['消费电子', '消费电子'],
242
+ ['元件', '元件'],
243
+ ['其他电子Ⅱ', '其他电子'], #
244
+
245
+ # 石油石化 20
246
+ ['炼化及贸易', '石油行业'], # merge 石油行业
247
+ ['油服工程', '采掘行业'], # merge '采掘行业'
248
+ ['油气开采Ⅱ', '石油行业'], # merge to 石油行业
249
+
250
+ # 社会服务 21
251
+ ['专业服务', '社会专业服务'],
252
+ ['旅游及景区', '旅游及景区'],
253
+ ['酒店餐饮', '旅游酒店'],
236
254
  ['教育', '教育'],
255
+ # ['体育Ⅱ', '体育'],
237
256
 
238
- ['自动化设备', '自动化设备'],
239
- ['轨交设备Ⅱ', '轨交设备'],
257
+ # 纺织服装 22
258
+ ['服装家纺', '纺织服装'], # merge 纺织服装
259
+ ['纺织制造', '纺织服装'], # merge 纺织服装
260
+ ['饰品', '饰品'],
261
+
262
+ # 综合 23
263
+ ['综合Ⅱ', '综合'],
264
+
265
+ # 美容护理 24
266
+ ['化妆品', '化妆美容'], # merge to 化妆美容
267
+ # ['医疗美容', '化妆美容'], # merge 化妆美容
268
+ ['个护用品', '个护用品'],
269
+
270
+ # 计算机 25
271
+ ['计算机设备', '计算机设备'],
272
+ ['IT服务Ⅱ', 'IT服务'],
273
+ ['软件开发', '软件开发'],
274
+
275
+ # 轻工制造 26
276
+ ['造纸', '造纸'],
277
+ ['包装印刷', '包装印刷'], #
278
+ ['文娱用品', '文娱用品'], #
279
+ ['家居用品', '家居用品'],
280
+
281
+ # 通信 27
282
+ ['通信服务', '通信服务'],
283
+ ['通信设备', '通信设备'],
284
+
285
+ # 钢铁 28
286
+ ['普钢', '普钢'], #
287
+ ['特钢Ⅱ', '特钢'],
288
+ ['冶钢原料', '冶钢原料'],
289
+
290
+ # 银行 29
291
+ ['国有大型银行Ⅱ', '银行'], # merge to 银行
292
+ ['城商行Ⅱ', '银行'], #
293
+ ['农商行Ⅱ', '银行'], # merge 银行
294
+ ['股份制银行Ⅱ', '银行'], # merge to 银行
295
+
296
+ # 非银金融 30
297
+ ['证券Ⅱ', '证券'],
298
+ ['保险Ⅱ', '保险'],
299
+ ['多元金融', '多元金融'],
240
300
 
241
- # 机械设备 仪器仪表 农用机械 制冷空调设备 印刷包装机械 机床工具
242
- # 楼宇设备 磨具磨料 纺织服装设备 能源及重型设备 金属制品
243
- ['专用设备', '专用设备'], # todo exclude
244
- ['通用设备', '通用设备'], # todo exclude
245
- ['专业服务', '专业服务'], # todo exclude 无法具体分类
246
- ['摩托车及其他', '摩托车及其他'], # todo exclude
247
- ['专业连锁Ⅱ', '综合'], # merge 综合Ⅱ
248
- ['林业Ⅱ', '综合'], # merge 综合Ⅱ
249
- ['农业综合Ⅱ', '综合'], # merge 综合Ⅱ
250
- ['体育Ⅱ', '综合'], # merge 综合Ⅱ
251
- ['综合Ⅱ', '综合'] # todo exclude
301
+ # 食品饮料 31
302
+ ['饮料乳品', '饮料乳品'], # merge 食品饮料
303
+ ['食品加工', '食品加工'], # merge 食品饮料
304
+ ['调味发酵品Ⅱ', '调味发酵品'], # merge to 食品饮料
305
+ ['休闲食品', '休闲食品'], # merge '食品饮料'
306
+ ['白酒Ⅱ', '白酒'],
307
+ ['非白酒', '非白酒']
252
308
 
253
309
  ], columns=['second_sw_industry', 'industry'])
254
310
 
255
311
 
256
- # 第三行业作为筛选行业
312
+ # 第三行业作为行业
257
313
  def fix_industry_use_sw_third(company_info_df):
258
314
  # 细分工业金属行业
259
315
  company_info = company_info_df.copy()
260
316
  company_info.loc[company_info.third_industry_code == '240303', 'industry'] = '铅锌'
261
317
  company_info.loc[company_info.third_industry_code == '240301', 'industry'] = '铝'
262
318
  company_info.loc[company_info.third_industry_code == '240302', 'industry'] = '铜'
319
+
320
+ company_info.loc[company_info.third_industry_code == '240303', 'second_sw_industry'] = '铅锌'
321
+ company_info.loc[company_info.third_industry_code == '240301', 'second_sw_industry'] = '铝'
322
+ company_info.loc[company_info.third_industry_code == '240302', 'second_sw_industry'] = '铜'
323
+
324
+ company_info.loc[company_info.third_industry_code == '240303', 'second_industry_code'] = '240303'
325
+ company_info.loc[company_info.third_industry_code == '240301', 'second_industry_code'] = '240301'
326
+ company_info.loc[company_info.third_industry_code == '240302', 'second_industry_code'] = '240302'
327
+
263
328
  # 细分专业设备
264
329
  company_info.loc[company_info.third_industry_code == '640203', 'industry'] = '能源及重型设备'
265
330
  company_info.loc[company_info.third_industry_code == '640204', 'industry'] = '楼宇设备'
266
331
  company_info.loc[company_info.third_industry_code == '640206', 'industry'] = '纺织服装设备'
267
332
  company_info.loc[company_info.third_industry_code == '640207', 'industry'] = '农用机械'
268
333
  company_info.loc[company_info.third_industry_code == '640208', 'industry'] = '印刷包装机械'
334
+
335
+ company_info.loc[company_info.third_industry_code == '640203', 'second_sw_industry'] = '能源及重型设备'
336
+ company_info.loc[company_info.third_industry_code == '640204', 'second_sw_industry'] = '楼宇设备'
337
+ company_info.loc[company_info.third_industry_code == '640206', 'second_sw_industry'] = '纺织服装设备'
338
+ company_info.loc[company_info.third_industry_code == '640207', 'second_sw_industry'] = '农用机械'
339
+ company_info.loc[company_info.third_industry_code == '640208', 'second_sw_industry'] = '印刷包装机械'
340
+
341
+ company_info.loc[company_info.third_industry_code == '640203', 'second_industry_code'] = '640203'
342
+ company_info.loc[company_info.third_industry_code == '640204', 'second_industry_code'] = '640204'
343
+ company_info.loc[company_info.third_industry_code == '640206', 'second_industry_code'] = '640206'
344
+ company_info.loc[company_info.third_industry_code == '640207', 'second_industry_code'] = '640207'
345
+ company_info.loc[company_info.third_industry_code == '640208', 'second_industry_code'] = '640208'
346
+
269
347
  # todo 细分
270
348
  company_info.loc[company_info.third_industry_code == '640209', 'industry'] = '专用设备'
271
- company_info.loc[company_info.third_industry_code == '630402', 'industry'] = '专用设备'
272
- company_info.loc[company_info.third_industry_code == '220702', 'industry'] = '非金属材料'
349
+ company_info.loc[company_info.third_industry_code == '640209', 'second_sw_industry'] = '专用设备'
350
+ company_info.loc[company_info.third_industry_code == '640209', 'second_industry_code'] = '640208'
351
+
352
+ company_info.loc[company_info.third_industry_code == '260205', 'industry'] = '专用设备'
353
+ company_info.loc[company_info.third_industry_code == '260205', 'second_sw_industry'] = '专用设备'
354
+ company_info.loc[company_info.third_industry_code == '260205', 'second_industry_code'] = '260205'
355
+
273
356
  # 细分通用设备
274
357
  company_info.loc[company_info.third_industry_code == '640101', 'industry'] = '机床工具'
275
358
  company_info.loc[company_info.third_industry_code == '640103', 'industry'] = '磨具磨料'
276
359
  company_info.loc[company_info.third_industry_code == '640105', 'industry'] = '制冷空调设备'
277
360
  company_info.loc[company_info.third_industry_code == '640106', 'industry'] = '通用设备'
278
361
  company_info.loc[company_info.third_industry_code == '640107', 'industry'] = '仪器仪表'
279
- company_info.loc[company_info.third_industry_code == '640301', 'industry'] = '仪器仪表'
280
- # todo 细分
281
362
  company_info.loc[company_info.third_industry_code == '640108', 'industry'] = '金属制品'
363
+
364
+ company_info.loc[company_info.third_industry_code == '640101', 'second_sw_industry'] = '机床工具'
365
+ company_info.loc[company_info.third_industry_code == '640103', 'second_sw_industry'] = '磨具磨料'
366
+ company_info.loc[company_info.third_industry_code == '640105', 'second_sw_industry'] = '制冷空调设备'
367
+ company_info.loc[company_info.third_industry_code == '640106', 'second_sw_industry'] = '通用设备'
368
+ company_info.loc[company_info.third_industry_code == '640107', 'second_sw_industry'] = '仪器仪表'
369
+ company_info.loc[company_info.third_industry_code == '640108', 'second_sw_industry'] = '金属制品'
370
+
371
+ company_info.loc[company_info.third_industry_code == '640101', 'second_industry_code'] = '640101'
372
+ company_info.loc[company_info.third_industry_code == '640103', 'second_industry_code'] = '640103'
373
+ company_info.loc[company_info.third_industry_code == '640105', 'second_industry_code'] = '640105'
374
+ company_info.loc[company_info.third_industry_code == '640106', 'second_industry_code'] = '640106'
375
+ company_info.loc[company_info.third_industry_code == '640107', 'second_industry_code'] = '640107'
376
+ company_info.loc[company_info.third_industry_code == '640108', 'second_industry_code'] = '640108'
377
+
282
378
  return company_info
283
379
 
284
380
 
285
- def find_sw_third_industry(industry_id):
286
- sw_third_industry = mongodb_util.find_query_data('sw_industry', query={"_id": industry_id})
381
+ def find_sw_third_industry(new_third_industry_code):
382
+ sw_third_industry = mongodb_util.find_query_data('sw_industry', query={"_id": new_third_industry_code})
287
383
  first_sw_industry_name = list(sw_third_industry['first_sw_industry'])[0]
288
384
  second_sw_industry_name = list(sw_third_industry['second_sw_industry'])[0]
289
385
 
@@ -302,8 +398,9 @@ def find_sw_third_industry(industry_id):
302
398
  return sw_third_industry
303
399
 
304
400
 
305
- def fix_industry_data(industry_id, company_info):
306
- sw_industry = find_sw_third_industry(industry_id)
401
+ # 修改行业信息
402
+ def fix_industry_data(new_third_industry_code, company_info):
403
+ sw_industry = find_sw_third_industry(new_third_industry_code)
307
404
  company_info['first_sw_industry'] = sw_industry.first_sw_industry
308
405
  company_info['first_industry_code'] = sw_industry.industry_code
309
406
  company_info['second_sw_industry'] = sw_industry.second_sw_industry
@@ -313,24 +410,17 @@ def fix_industry_data(industry_id, company_info):
313
410
  return company_info
314
411
 
315
412
 
413
+ # 手动修改股票行业代码
316
414
  def fix_symbol_industry(company_info, symbol):
317
415
  fix_symbol_df = get_fix_symbol_industry()
318
416
  fix_symbol_df_one = fix_symbol_df.loc[fix_symbol_df['symbol'] == symbol]
319
417
  if data_frame_util.is_not_empty(fix_symbol_df_one):
320
- new_industry_code = list(fix_symbol_df_one['new_industry_code'])[0]
321
- company_info = fix_industry_data(new_industry_code, company_info)
418
+ new_third_industry_code = list(fix_symbol_df_one['new_industry_code'])[0]
419
+ company_info = fix_industry_data(new_third_industry_code, company_info)
322
420
 
323
421
  return company_info
324
422
 
325
423
 
326
- def fix_one_symbol():
327
- symbol = '300483'
328
- company_info = mongodb_util.find_query_data('company_info', query={'_id': symbol})
329
- company_info = fix_symbol_industry(company_info, symbol)
330
- company_info['industry'] = company_info['second_sw_industry']
331
- mongodb_util.save_mongo(company_info, 'company_info')
332
-
333
-
334
424
  def filed_sort(company_info):
335
425
  return company_info[[
336
426
  "_id",
@@ -353,6 +443,9 @@ def filed_sort(company_info):
353
443
  "final_controller_name",
354
444
  "final_controller_rate",
355
445
  "mv_circulation_ratio",
446
+ 'qfii_type',
447
+ 'qfii_number',
448
+ 'share_holder_sync_day',
356
449
  "flow_mv_sp",
357
450
  "total_mv_sp",
358
451
  "now_price",
@@ -371,6 +464,7 @@ def filed_sort(company_info):
371
464
  "ROE",
372
465
  "classification",
373
466
  "base_business",
467
+ "intro",
374
468
  "address",
375
469
  "market_id",
376
470
  "symbol",
@@ -379,18 +473,25 @@ def filed_sort(company_info):
379
473
  "ths_concept_list_info",
380
474
  'ths_concept_name_list_str',
381
475
  'ths_concept_count',
476
+ 'ths_concept_most_relative_name',
477
+ 'ths_concept_most_relative_code',
478
+ 'ths_concept_list',
382
479
  "kpl_plate_name",
383
480
  "kpl_most_relative_name",
384
481
  "kpl_plate_list_info",
385
482
  'operate_profit',
386
483
  'total_operate_income',
484
+ 'operate_date_name',
387
485
  'kzz_debt_list',
388
486
  'hk_stock_code',
389
- 'hk_stock_name'
487
+ 'hk_stock_name',
488
+ 'main_business_list',
489
+ 'most_profitable_business',
490
+ 'most_profitable_business_rate',
491
+ 'most_profitable_business_profit',
390
492
  ]]
391
493
 
392
494
 
393
495
  if __name__ == '__main__':
394
- fix_one_symbol()
395
- industry_df = get_industry_final_fix_df()
396
- print(industry_df)
496
+ industry_df_test = get_fix_industry_name_df()
497
+ print(industry_df_test)
@@ -2,6 +2,6 @@ import sys
2
2
  import os
3
3
 
4
4
  file_path = os.path.abspath(__file__)
5
- end = file_path.index('mns') + 16
5
+ end = file_path.index('mns') + 17
6
6
  project_path = file_path[0:end]
7
7
  sys.path.append(project_path)
@@ -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') + 16
5
+ end = file_path.index('mns') + 17
6
6
  project_path = file_path[0:end]
7
7
  sys.path.append(project_path)
8
8
  import pandas as pd
@@ -0,0 +1,7 @@
1
+ import sys
2
+ import os
3
+
4
+ file_path = os.path.abspath(__file__)
5
+ end = file_path.index('mns') + 17
6
+ project_path = file_path[0:end]
7
+ sys.path.append(project_path)