mns-common 1.3.9.2__py3-none-any.whl → 1.6.1.4__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.

Potentially problematic release.


This version of mns-common might be problematic. Click here for more details.

Files changed (67) hide show
  1. mns_common/__init__.py +1 -0
  2. mns_common/api/akshare/__init__.py +0 -1
  3. mns_common/api/akshare/k_line_api.py +20 -82
  4. mns_common/api/akshare/stock_bid_ask_api.py +21 -14
  5. mns_common/api/akshare/stock_zb_pool.py +2 -0
  6. mns_common/api/akshare/stock_zt_pool_api.py +1 -1
  7. mns_common/api/em/gd/east_money_stock_gdfx_free_top_10_api.py +62 -7
  8. mns_common/api/em/real_time/__init__.py +1 -1
  9. mns_common/api/em/real_time/east_money_debt_api.py +168 -71
  10. mns_common/api/em/real_time/east_money_etf_api.py +165 -27
  11. mns_common/api/em/real_time/east_money_stock_a_api.py +37 -38
  12. mns_common/api/em/real_time/east_money_stock_a_v2_api.py +97 -53
  13. mns_common/api/em/real_time/east_money_stock_common_api.py +174 -0
  14. mns_common/api/em/real_time/east_money_stock_hk_api.py +252 -271
  15. mns_common/api/em/real_time/east_money_stock_hk_gtt_api.py +291 -0
  16. mns_common/api/em/real_time/east_money_stock_multi_thread_api_v3.py +154 -0
  17. mns_common/api/em/real_time/east_money_stock_us_api.py +210 -82
  18. mns_common/api/em/real_time/real_time_quotes_repeat_api.py +195 -0
  19. mns_common/api/foreign_exchange/foreign_exchange_api.py +38 -0
  20. mns_common/api/k_line/stock_k_line_data_api.py +11 -1
  21. mns_common/api/kpl/common/__init__.py +3 -2
  22. mns_common/api/kpl/common/kpl_common_api.py +35 -0
  23. mns_common/api/kpl/symbol/symbol_his_quotes_api.py +1 -1
  24. mns_common/api/kpl/theme/kpl_theme_api.py +69 -0
  25. mns_common/api/kpl/yidong/__init__.py +7 -0
  26. mns_common/api/kpl/yidong/stock_bid_yi_dong_api.py +52 -0
  27. mns_common/api/proxies/liu_guan_proxy_api.py +55 -5
  28. mns_common/api/ths/company/company_product_area_industry_index_query.py +46 -0
  29. mns_common/api/ths/company/ths_company_info_api.py +2 -1
  30. mns_common/api/ths/company/ths_company_info_web.py +159 -0
  31. mns_common/api/ths/concept/app/ths_concept_index_app.py +3 -1
  32. mns_common/api/ths/wen_cai/ths_wen_cai_api.py +1 -1
  33. mns_common/api/ths/zt/ths_stock_zt_pool_api.py +20 -1
  34. mns_common/api/ths/zt/ths_stock_zt_pool_v2_api.py +105 -29
  35. mns_common/api/ths/zt/ths_stock_zt_reason_web_api.py +100 -0
  36. mns_common/api/us/ths_us_company_info_api.py +131 -0
  37. mns_common/api/xueqiu/xue_qiu_k_line_api.py +31 -23
  38. mns_common/component/common_service_fun_api.py +28 -8
  39. mns_common/component/company/company_common_service_new_api.py +2 -0
  40. mns_common/component/cookie/cookie_enum.py +16 -0
  41. mns_common/component/cookie/cookie_info_service.py +18 -8
  42. mns_common/component/data/data_init_api.py +13 -8
  43. mns_common/component/deal/deal_service_api.py +70 -8
  44. mns_common/component/deal/deal_service_v2_api.py +167 -0
  45. mns_common/component/em/em_stock_info_api.py +12 -3
  46. mns_common/component/exception/ExceptionMonitor.py +86 -0
  47. mns_common/component/exception/__init__.py +7 -0
  48. mns_common/component/main_line/__init__.py +7 -0
  49. mns_common/component/main_line/main_line_zt_reason_service.py +257 -0
  50. mns_common/component/proxies/proxy_common_api.py +199 -31
  51. mns_common/component/tfp/stock_tfp_api.py +82 -12
  52. mns_common/component/us/__init__.py +7 -0
  53. mns_common/component/us/us_stock_etf_info_api.py +130 -0
  54. mns_common/constant/db_name_constant.py +75 -26
  55. mns_common/constant/extra_income_db_name.py +97 -11
  56. mns_common/constant/strategy_classify.py +72 -0
  57. mns_common/db/MongodbUtil.py +3 -0
  58. mns_common/db/MongodbUtilLocal.py +3 -0
  59. {mns_common-1.3.9.2.dist-info → mns_common-1.6.1.4.dist-info}/METADATA +1 -1
  60. {mns_common-1.3.9.2.dist-info → mns_common-1.6.1.4.dist-info}/RECORD +64 -47
  61. mns_common/api/ths/concept/web/ths_company_info_web.py +0 -163
  62. mns_common/component/qmt/qmt_buy_service.py +0 -172
  63. mns_common/component/task/real_time_data_sync_check.py +0 -97
  64. /mns_common/{component/qmt → api/foreign_exchange}/__init__.py +0 -0
  65. /mns_common/{component/task → api/kpl/theme}/__init__.py +0 -0
  66. {mns_common-1.3.9.2.dist-info → mns_common-1.6.1.4.dist-info}/WHEEL +0 -0
  67. {mns_common-1.3.9.2.dist-info → mns_common-1.6.1.4.dist-info}/top_level.txt +0 -0
@@ -9,6 +9,7 @@ sys.path.append(project_path)
9
9
  import pandas as pd
10
10
  import mns_common.utils.data_frame_util as data_frame_util
11
11
  import mns_common.api.kpl.common.kpl_common_field_constant as kpl_common_field_constant
12
+ from loguru import logger
12
13
 
13
14
  BEST_CHOOSE = '7'
14
15
  AREA = '6'
@@ -117,7 +118,41 @@ def get_plate_index_his(index, index_type, str_day, begin, end):
117
118
  return data_df_his
118
119
 
119
120
 
121
+ # 获取开盘啦 股票入选概念原因
122
+ def get_kpl_concept_choose_reason(plate_id, symbol_list_str):
123
+ try:
124
+ response = requests.get(
125
+ url="https://apphwshhq.longhuvip.com/w1/api/index.php",
126
+ params={
127
+ "PhoneOSNew": "2",
128
+ "PlateID": plate_id,
129
+ "Stocks": symbol_list_str,
130
+ "VerSion": "5.21.0.3",
131
+ "a": "PlateIntroduction_Info",
132
+ "apiv": "w42",
133
+ "c": "ZhiShuRanking"
134
+ },
135
+ headers={
136
+ "User-Agent": "lhb/5.21.3 (com.kaipanla.www; build:0; iOS 18.6.2) Alamofire/4.9.1"
137
+ }
138
+ )
139
+
140
+ json_result = response.json()
141
+ symbol_list_reason = json_result.get('List')
142
+
143
+ df_simple = pd.DataFrame(symbol_list_reason, columns=['symbol', 'choose_reason', 'flag', 'remark'])
144
+ return df_simple
145
+ except BaseException as e:
146
+ logger.error("获取开盘啦股票入选原因异常:{},{},{}", plate_id, symbol_list_str, e)
147
+ return pd.DataFrame()
148
+
149
+
120
150
  if __name__ == '__main__':
151
+ plate_id_test = '801133'
152
+ symbol_list_str_test = "002017,002104,301678,003040,300689,300608,300698,600941,002313,002881,002467,300579,002355,300205,300638,002049"
153
+
154
+ df_simple_test = get_kpl_concept_choose_reason(plate_id_test, symbol_list_str_test)
155
+
121
156
  df = plate_detail_info('801359')
122
157
 
123
158
  df = get_plate_index(7)
@@ -115,7 +115,7 @@ if __name__ == '__main__':
115
115
  # 2021-10-25,45,0925,0955 2023-09-15,11,0925,1005
116
116
 
117
117
  # get_stock_quotes_his('2023-09-20', 11, '0925', '1005')
118
- df = sync_stock_his_quotes('2024-04-18', '0935', '0940')
118
+ df = sync_stock_his_quotes('2025-04-18', '0935', '0940')
119
119
  get_stock_count('2023-09-14', 0, '0925', '1500')
120
120
 
121
121
  his_test('2021-10-20')
@@ -0,0 +1,69 @@
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
+
9
+ import requests
10
+
11
+
12
+ def kpl_theme_index(theme_id, kpl_token):
13
+ # 1. 定义请求的基础信息
14
+ url = "https://applhb.longhuvip.com/w1/api/index.php"
15
+
16
+ # 2. 构造请求头(Headers),与你提供的完全一致
17
+ headers = {
18
+ "Host": "applhb.longhuvip.com",
19
+ "Content-Type": "application/x-www-form-urlencoded; charset=utf-8",
20
+ "Connection": "keep-alive",
21
+ "Accept": "*/*",
22
+ "User-Agent": "lhb/5.22.5 (com.kaipanla.www; build:1; iOS 18.6.2) Alamofire/4.9.1",
23
+ "Accept-Language": "en-US;q=1.0, zh-Hans-US;q=0.9",
24
+ "Accept-Encoding": "gzip;q=1.0, compress;q=0.5"
25
+ }
26
+
27
+ # 3. 构造表单数据(POST Body)
28
+ data = {
29
+ "DeviceID": "712e04ccbd13c8e55930ab11b1ca2ee76e7f0e80",
30
+ "ID": str(theme_id),
31
+ "PhoneOSNew": "2",
32
+ "Token": kpl_token,
33
+ "UserID": "3838941",
34
+ "VerSion": "5.22.0.5",
35
+ "a": "InfoGet",
36
+ "apiv": "w43",
37
+ "c": "Theme"
38
+ }
39
+
40
+ try:
41
+ # 4. 发送POST请求
42
+ response = requests.post(
43
+ url=url,
44
+ headers=headers,
45
+ data=data, # 表单数据用data参数,会自动按x-www-form-urlencoded编码
46
+ timeout=10 # 设置10秒超时,避免请求挂起
47
+ )
48
+
49
+ # 5. 打印响应结果
50
+
51
+ json_data = response.json()
52
+ return json_data
53
+ # 如果响应是JSON格式,也可以解析成字典
54
+ # print("JSON格式响应:", response.json())
55
+
56
+ except requests.exceptions.RequestException as e:
57
+ # 捕获请求相关的异常(超时、连接失败等)
58
+ print("请求出错:", str(e))
59
+
60
+
61
+ import time
62
+
63
+ if __name__ == '__main__':
64
+ theme_id_test = 9
65
+ while theme_id_test < 300:
66
+ json_data = kpl_theme_index(theme_id_test)
67
+ theme_id_test = theme_id_test + 1
68
+ print(json_data)
69
+ time.sleep(1)
@@ -0,0 +1,7 @@
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)
@@ -0,0 +1,52 @@
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 requests
9
+ from loguru import logger
10
+
11
+
12
+ def get_stock_yi_dong_info(kpl_token):
13
+ # 接口请求地址
14
+ url = "https://apphwshhq.longhuvip.com/w1/api/index.php"
15
+
16
+ # 请求头,完全复刻你抓包的所有请求头,缺一不可(接口校验用)
17
+ headers = {
18
+ "Host": "apphwshhq.longhuvip.com",
19
+ "Content-Type": "application/x-www-form-urlencoded; charset=utf-8",
20
+ "Connection": "keep-alive",
21
+ "Accept": "*/*",
22
+ "User-Agent": "lhb/5.22.5 (com.kaipanla.www; build:1; iOS 18.6.2) Alamofire/4.9.1",
23
+ "Accept-Language": "en-US;q=1.0, zh-Hans-US;q=0.9",
24
+ "Accept-Encoding": "gzip;q=1.0, compress;q=0.5"
25
+ }
26
+
27
+ # POST表单请求参数,完全复制你抓包的参数,键值对一一对应
28
+ data = {
29
+ "DeviceID": "712e04ccbd13c8e55930ab11b1ca2ee76e7f0e80",
30
+ "PhoneOSNew": "2",
31
+ "Token": kpl_token,
32
+ "UserID": "3838941",
33
+ "VerSion": "5.22.0.5",
34
+ "ZDJK_Type": "1",
35
+ "a": "GetPianLiZhi_Index",
36
+ "apiv": "w43",
37
+ "c": "StockBidYiDong"
38
+ }
39
+
40
+ # 发送POST请求(核心)
41
+ try:
42
+ # verify=False 忽略HTTPS证书校验(部分域名会有证书问题,加上无影响)
43
+ response = requests.post(url, headers=headers, data=data, verify=False, timeout=10)
44
+ result = response.json()
45
+ return result
46
+
47
+ except Exception as e:
48
+ logger.error("接口请求失败,错误信息:{}", str(e))
49
+
50
+
51
+ if __name__ == '__main__':
52
+ get_stock_yi_dong_info('1b3144e108bb84bda145e7ae2abd5c4f')
@@ -10,6 +10,13 @@ import requests
10
10
  import time
11
11
  import hashlib
12
12
  import json
13
+ from mns_common.db.MongodbUtil import MongodbUtil
14
+ from functools import lru_cache
15
+ import mns_common.constant.db_name_constant as db_name_constant
16
+
17
+ mongodb_util = MongodbUtil('27017')
18
+
19
+ import random
13
20
 
14
21
  # 提取订单
15
22
  """
@@ -26,8 +33,49 @@ import json
26
33
  """
27
34
 
28
35
 
36
+ @lru_cache(maxsize=None)
37
+ def query_province_and_city_info():
38
+ return mongodb_util.find_all_data(db_name_constant.IP_PROXY_CITY_PROVINCE)
39
+
40
+
29
41
  def get_proxy_api(order_id, secret, unbind_time):
42
+ province_and_city_info_df = query_province_and_city_info()
43
+ random_row = province_and_city_info_df.sample(n=1)
44
+ cid = str(list(random_row['cid'])[0])
45
+ pid = str(list(random_row['pid'])[0])
46
+
30
47
  num = "1"
48
+ noDuplicate = "1"
49
+ lineSeparator = "0"
50
+ singleIp = "0"
51
+ time_str = str(int(time.time())) # 时间戳
52
+
53
+ # 计算sign
54
+ txt = "orderId=" + order_id + "&" + "secret=" + secret + "&" + "time=" + time_str
55
+ sign = hashlib.md5(txt.encode()).hexdigest()
56
+ # 访问URL获取IP
57
+ url = (
58
+ "http://api.hailiangip.com:8422/api/getIp?type=1" + "&num=" + num + "&pid=" + pid
59
+ + "&unbindTime=" + unbind_time + "&cid=" + cid
60
+ + "&orderId=" + order_id + "&time=" + time_str + "&sign=" + sign + "&dataType=0"
61
+ + "&lineSeparator=" + lineSeparator + "&noDuplicate=" + noDuplicate + "&singleIp=" + singleIp)
62
+ my_response = requests.get(url).content
63
+ js_res = json.loads(my_response)
64
+ for dic in js_res["data"]:
65
+ try:
66
+ ip = dic["ip"]
67
+ # ip = dic["realIp"]
68
+ port = dic["port"]
69
+ ip_port = ip + ":" + str(port)
70
+ return ip_port
71
+ except BaseException as e:
72
+ logger.error("获取ip地址异常:{}", e)
73
+ return None
74
+
75
+
76
+ # 线程池
77
+ def get_proxy_pool_api(order_id, secret, unbind_time, ip_num):
78
+ num = str(ip_num)
31
79
  pid = "-1"
32
80
  cid = ""
33
81
  noDuplicate = "1"
@@ -46,20 +94,22 @@ def get_proxy_api(order_id, secret, unbind_time):
46
94
  + "&lineSeparator=" + lineSeparator + "&noDuplicate=" + noDuplicate + "&singleIp=" + singleIp)
47
95
  my_response = requests.get(url).content
48
96
  js_res = json.loads(my_response)
97
+ ip_pool_list = []
49
98
  for dic in js_res["data"]:
50
99
  try:
51
100
  ip = dic["ip"]
52
101
  port = dic["port"]
53
102
  ip_port = ip + ":" + str(port)
54
- return ip_port
103
+ ip_pool_list.append(ip_port)
55
104
  except BaseException as e:
56
105
  logger.error("获取ip地址异常:{}", e)
57
106
  return None
107
+ return ip_pool_list
58
108
 
59
109
 
60
110
  if __name__ == '__main__':
61
- order_id = ''
62
- secret = ''
63
- unbind_time = str(60 * 10)
64
- ip = get_proxy_api(order_id, secret, unbind_time)
111
+ order_id_test = ''
112
+ secret_test = ''
113
+ unbind_time_test = str(60 * 10)
114
+ ip = get_proxy_api(order_id_test, secret_test, unbind_time_test)
65
115
  print(ip)
@@ -0,0 +1,46 @@
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
+
9
+ import requests
10
+
11
+
12
+ def company_product_area_industry(symbol, market, date):
13
+ if date is None:
14
+ url = (
15
+ f"https://basic.10jqka.com.cn/basicapi/operate/index/v1/product_index_query/?code={symbol}&market={market}"
16
+ f"&type=stock&account=1&timeField=date&analysisTypes=product,area,industry&sortIndex=income&currency=CNY&level=1&expands=product_introduction&locale=zh_CN")
17
+ else:
18
+
19
+ url = (
20
+ f"https://basic.10jqka.com.cn/basicapi/operate/index/v1/product_index_query/?code={symbol}&market={market}&date={date}"
21
+ f"&type=stock&account=1&timeField=date&analysisTypes=product,area,industry&sortIndex=income&currency=CNY&level=1&expands=product_introduction&locale=zh_CN")
22
+
23
+ headers = {
24
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
25
+ "Accept-Language": "zh-CN,zh;q=0.9",
26
+ "Cache-Control": "max-age=0",
27
+ "Connection": "keep-alive",
28
+ "Sec-Fetch-Dest": "document",
29
+ "Sec-Fetch-Mode": "navigate",
30
+ "Sec-Fetch-Site": "cross-site",
31
+ "Sec-Fetch-User": "?1",
32
+ "Upgrade-Insecure-Requests": "1",
33
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
34
+ "sec-ch-ua": "\"Google Chrome\";v=\"129\", \"Not=A?Brand\";v=\"8\", \"Chromium\";v=\"129\"",
35
+ "sec-ch-ua-mobile": "?0",
36
+ "sec-ch-ua-platform": "\"Windows\"",
37
+ }
38
+
39
+ response = requests.get(url, headers=headers)
40
+ data_json = response.json()
41
+ data_list = data_json['data']
42
+ return data_list
43
+
44
+
45
+ if __name__ == '__main__':
46
+ company_product_area_industry('688551', '17', None)
@@ -177,5 +177,6 @@ mongodb_util = MongodbUtil('27017')
177
177
  if __name__ == '__main__':
178
178
  stock_account_info = mongodb_util.find_query_data('stock_account_info', {"type": "ths_cookie", })
179
179
  ths_cookie_test = list(stock_account_info['cookie'])[0]
180
- company_df_test = get_company_hot_info('002331', ths_cookie_test)
180
+ company_df_test = get_company_hot_info('600756', ths_cookie_test)
181
+ target_title = company_df_test.split("\n")[0] # 关键修改:提取第一行
181
182
  print(company_df_test)
@@ -0,0 +1,159 @@
1
+ import sys
2
+ import os
3
+
4
+ file_path = os.path.abspath(__file__)
5
+ end = file_path.index('mns') + 14
6
+ project_path = file_path[0:end]
7
+ sys.path.append(project_path)
8
+
9
+ from loguru import logger
10
+ import pandas as pd
11
+ import requests
12
+ from bs4 import BeautifulSoup
13
+
14
+
15
+ # 获取股票基本信息
16
+ # https://basic.10jqka.com.cn/mobile/301016/companyprofilen.html?showtab=1&broker=anelicaiapp
17
+ def get_company_info(symbol: str = "688272") -> pd.DataFrame:
18
+ url = f"http://basic.10jqka.com.cn/mobile/{symbol}/companyprofilen.html?broker=pingan"
19
+ headers = {
20
+ "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iOS AYLCAPP/9.1.2.0/h4526a24eb9445522492fd64caae11b1f scheme/anelicaiapp deviceinfo/I|9.1.2.0|NA|h4526a24eb9445522492fd64caae11b1f pastheme/0",
21
+ "Cookie": "ps_login_app_name=AYLCAPP;ps_login_token_id=N_C993F777ACC500B354C762A2627A8862348FC8163799A08EBEB2301C28A2135D220475787D0E81425C1134E15D8CC8761D639FEDBD46C00FE8EA6482C1E42D9801B19918FB3F5C34;ps_login_union_id=edc29089a2b64e3882062297030a0386;PAS.CURRENTUNIONID=edc29089a2b64e3882062297030a0386"
22
+ }
23
+ r = requests.get(url, headers=headers)
24
+ soup = BeautifulSoup(r.content.decode("utf-8"), 'lxml')
25
+ soup.find('table', attrs={'class': 'leveldatail-tab'}).find_all('tr')
26
+ temp_df = pd.read_html(r.content)[0]
27
+ temp_df = temp_df.T
28
+ temp_df = temp_df.iloc[1:2]
29
+ temp_df.rename(columns={
30
+ 0: "name",
31
+ 1: "former_name",
32
+ 2: "registered_address",
33
+ 3: "chairman",
34
+ 4: "board_secretary",
35
+ 5: "main_business",
36
+ 6: "company_type",
37
+ 7: "controlling_shareholder",
38
+ 8: "actual_controller",
39
+ 9: "ultimate_controller",
40
+ 10: "list_date",
41
+ 11: "issue_price",
42
+ 12: "number_workers",
43
+ 13: "tel",
44
+ 14: "url",
45
+ 15: "email"
46
+ }, inplace=True)
47
+
48
+ return temp_df
49
+
50
+
51
+ # 获取股票详细信息
52
+ # HK市场 https://basic.10jqka.com.cn/mobile/HK1456/profile.html https://basic.10jqka.com.cn/mobile/HK1456/company.html
53
+ # https://basic.10jqka.com.cn/new/HK1456/company.html
54
+ # https://basic.10jqka.com.cn/astockph/briefinfo/index.html?showhead=0&fromshare=1&code=300430&marketid=33&client_userid=ESgcM&back_source=hyperlink&share_hxapp=isc&fontzoom=no#/company/ziliao
55
+ def get_company_info_detail(symbol: str = "688272", market_id: str = "31") -> pd.DataFrame:
56
+ url = f'https://basic.10jqka.com.cn/basicapi/company_info/merge_info/v1/base_info/?code={symbol}&market={market_id}&type=stock'
57
+ headers = {
58
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0',
59
+ 'Host': 'basic.10jqka.com.cn',
60
+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
61
+ 'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
62
+ 'Accept-Encoding': 'gzip, deflate, br',
63
+ 'Connection': 'keep-alive',
64
+ 'Cookie': 'v=A0CN8EBXN21LtMtpV6ldAxf6Ec8XySSbxq14l7rRDNvuNe77Ytn0Ixa9SDQJ',
65
+ 'Upgrade-Insecure-Requests': '1',
66
+
67
+ }
68
+ r = requests.get(url, headers=headers)
69
+ data_json = r.json()
70
+ status_code = data_json['status_code']
71
+ status_msg = data_json['status_msg']
72
+ if status_code != 0 or status_msg != 'success':
73
+ logger.error("获取symbol公司详细信息异常:{}", symbol)
74
+ return pd.DataFrame()
75
+ if len(data_json['data']['industry']) == 0:
76
+ return pd.DataFrame()
77
+ data_df = pd.DataFrame(data_json['data']['industry'], index=[0])
78
+ data_df = data_df[[
79
+ 'hy',
80
+ 'hycode',
81
+ 'hy2',
82
+ 'hy2code',
83
+ 'hy3',
84
+ 'hy3code',
85
+ ]]
86
+
87
+ business_nature = data_json['data']['business_nature']
88
+ name = data_json['data']['code_name']
89
+ intro = data_json['data']['intro']
90
+ base_business = data_json['data']['base_business']
91
+
92
+ address = data_json['data']['address']
93
+ data_df['symbol'] = symbol
94
+ data_df['name'] = name
95
+
96
+ data_df['business_nature'] = business_nature
97
+
98
+ if len(data_json['data']['management']['holder_controller']) > 0:
99
+ holder_controller = pd.DataFrame(data_json['data']['management']['holder_controller'])
100
+ holder_controller_name = str(list(holder_controller['name'])).strip('[').strip(']').replace("'", "")
101
+ holder_controller_rate = holder_controller['rate']
102
+ data_df['holder_controller_name'] = holder_controller_name
103
+ data_df['holder_controller_rate'] = sum(holder_controller_rate)
104
+ else:
105
+ data_df['holder_controller_name'] = '暂无'
106
+ data_df['holder_controller_rate'] = 0
107
+ if len(data_json['data']['management']['final_controller']) > 0:
108
+ final_controller = pd.DataFrame(data_json['data']['management']['final_controller'])
109
+ final_controller_name = str(list(final_controller['name'])).strip('[').strip(']').replace("'", "")
110
+ final_controller_rate = sum(final_controller['rate'])
111
+ data_df['final_controller_name'] = final_controller_name
112
+ data_df['final_controller_rate'] = final_controller_rate
113
+ else:
114
+ data_df['final_controller_name'] = '暂无'
115
+ data_df['final_controller_rate'] = 0
116
+ if len(data_json['data']['management']['actual_controller']) > 0:
117
+ actual_controller = pd.DataFrame(data_json['data']['management']['actual_controller'])
118
+ actual_controller_name = str(list(actual_controller['name'])).strip('[').strip(']').replace("'", "")
119
+ actual_controller_rate = sum(actual_controller['rate'])
120
+ data_df['actual_controller_name'] = actual_controller_name
121
+ data_df['actual_controller_rate'] = actual_controller_rate
122
+ else:
123
+ data_df['actual_controller_name'] = '暂无'
124
+ data_df['actual_controller_rate'] = 0
125
+
126
+ data_df['base_business'] = base_business
127
+ data_df['intro'] = intro
128
+ data_df['address'] = address
129
+ market_id = data_json['data']['market_id']
130
+ data_df['market_id'] = market_id
131
+ # 初始化数据
132
+ data_df['main_business_list'] = [[]]
133
+ data_df['most_profitable_business'] = ''
134
+ data_df['most_profitable_business_rate'] = ''
135
+ data_df['most_profitable_business_profit'] = ''
136
+
137
+ # 业务构成
138
+ main_business_list = data_json['data']['main_business']
139
+
140
+ if len(main_business_list) > 0:
141
+ # 最盈利业务
142
+ profitable_business = data_json['data']['profitable_business']
143
+
144
+ data_df['main_business_list'] = [main_business_list]
145
+
146
+ most_profitable_business = profitable_business['name']
147
+
148
+ most_profitable_business_rate = profitable_business['profit_rate']
149
+
150
+ most_profitable_business_profit = profitable_business['profit']
151
+
152
+ data_df['most_profitable_business'] = most_profitable_business
153
+ data_df['most_profitable_business_rate'] = most_profitable_business_rate
154
+ data_df['most_profitable_business_profit'] = most_profitable_business_profit
155
+ return data_df
156
+
157
+
158
+ if __name__ == '__main__':
159
+ get_company_info_detail('603683','17')
@@ -152,7 +152,9 @@ from mns_common.db.MongodbUtil import MongodbUtil
152
152
 
153
153
  mongodb_util = MongodbUtil('27017')
154
154
  if __name__ == '__main__':
155
- end_time_test = '20241011093000'
155
+ get_new_concept_from_app_search('886104')
156
+
157
+ end_time_test = '20241011093500'
156
158
  result_df_test = get_ths_concept_his_info('20241011093000', end_time_test, 500, 2)
157
159
  result_df_test['block_code'] = result_df_test['block_code'].astype(int)
158
160
  result_df_test['_id'] = result_df_test['block_code']
@@ -115,7 +115,7 @@ def get_concept_detail_by_wen_cai(concept_name):
115
115
 
116
116
 
117
117
  if __name__ == '__main__':
118
- zt_df = wen_cai_api('涨停', 'stock', )
118
+ zt_df = wen_cai_api('001203涨停分析', 'stock', )
119
119
  print(zt_df)
120
120
  # concept_detail_df = get_concept_detail_by_wen_cai("光纤概念")
121
121
  # concept_df = get_concept_index_by_wen_cai()
@@ -274,5 +274,24 @@ def zt_reason_group(zt_pool_df):
274
274
  return result_group_df
275
275
 
276
276
 
277
+ def zt_analyse_reason(symbol):
278
+ try:
279
+ key = symbol + '涨停分析'
280
+ zt_dict = ths_wen_cai_api.wen_cai_api(key, 'stock')
281
+ zt_analyse_detail = zt_dict['涨停揭秘'][0]['content']['value']
282
+ zt_reason = zt_dict['涨停揭秘'][0]['title']['value']
283
+
284
+ result_dict = {
285
+ 'zt_analyse_detail': zt_analyse_detail,
286
+ 'zt_reason': zt_reason
287
+ }
288
+
289
+ return result_dict
290
+ except BaseException as e:
291
+ logger.error("获取涨停分享异常b:{},{}", symbol, str(e))
292
+ return ''
293
+
294
+
277
295
  if __name__ == '__main__':
278
- get_real_time_zt_info()
296
+ zt_analyse_reason('003027')
297
+ # get_real_time_zt_info()