mns-common 1.3.3.5__py3-none-any.whl → 1.5.7.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.
- mns_common/api/akshare/__init__.py +0 -1
- mns_common/api/akshare/k_line_api.py +20 -82
- mns_common/api/akshare/stock_bid_ask_api.py +22 -97
- mns_common/api/akshare/stock_zb_pool.py +2 -0
- mns_common/api/akshare/stock_zt_pool_api.py +1 -1
- mns_common/api/em/gd/__init__.py +7 -0
- mns_common/api/em/{east_money_stock_gdfx_free_top_10_api.py → gd/east_money_stock_gdfx_free_top_10_api.py} +64 -9
- mns_common/api/em/real_time/__init__.py +7 -0
- mns_common/api/em/{east_money_debt_api.py → real_time/east_money_debt_api.py} +154 -69
- mns_common/api/em/{east_money_etf_api.py → real_time/east_money_etf_api.py} +149 -27
- mns_common/api/em/real_time/east_money_stock_a_api.py +301 -0
- mns_common/api/em/real_time/east_money_stock_a_v2_api.py +340 -0
- mns_common/api/em/real_time/east_money_stock_common_api.py +174 -0
- mns_common/api/em/real_time/east_money_stock_hk_api.py +288 -0
- mns_common/api/em/real_time/east_money_stock_hk_gtt_api.py +260 -0
- mns_common/api/em/real_time/east_money_stock_multi_thread_api_v3.py +154 -0
- mns_common/api/em/{east_money_stock_us_api.py → real_time/east_money_stock_us_api.py} +149 -72
- mns_common/api/em/real_time/real_time_quotes_repeat_api.py +195 -0
- mns_common/api/k_line/stock_k_line_data_api.py +11 -1
- mns_common/api/k_line/stock_minute_data_api.py +1 -0
- mns_common/api/kpl/common/kpl_common_api.py +35 -0
- mns_common/api/kpl/symbol/symbol_his_quotes_api.py +1 -1
- mns_common/api/proxies/__init__.py +7 -0
- mns_common/api/proxies/liu_guan_proxy_api.py +115 -0
- mns_common/api/ths/company/company_product_area_industry_index_query.py +46 -0
- mns_common/api/ths/company/ths_company_info_api.py +13 -9
- mns_common/api/ths/company/ths_company_info_web.py +159 -0
- mns_common/api/ths/concept/app/ths_concept_index_app.py +3 -1
- mns_common/api/ths/wen_cai/ths_wen_cai_api.py +10 -7
- mns_common/api/ths/zt/ths_stock_zt_pool_api.py +21 -4
- mns_common/api/ths/zt/ths_stock_zt_pool_v2_api.py +111 -40
- mns_common/api/xueqiu/__init__.py +7 -0
- mns_common/api/xueqiu/xue_qiu_k_line_api.py +83 -0
- mns_common/component/__init__.py +1 -1
- mns_common/component/classify/symbol_classify_api.py +7 -7
- mns_common/component/common_service_fun_api.py +66 -6
- mns_common/component/company/company_common_service_api.py +21 -1
- mns_common/component/company/company_common_service_new_api.py +4 -1
- mns_common/component/cookie/cookie_enum.py +15 -0
- mns_common/component/cookie/cookie_info_service.py +9 -4
- mns_common/component/data/data_init_api.py +13 -8
- mns_common/component/deal/deal_service_api.py +70 -8
- mns_common/component/deal/deal_service_v2_api.py +167 -0
- mns_common/component/em/__init__.py +7 -0
- mns_common/component/em/em_real_time_quotes_api.py +56 -0
- mns_common/component/em/em_stock_info_api.py +48 -0
- mns_common/component/exception/ExceptionMonitor.py +86 -0
- mns_common/component/exception/__init__.py +7 -0
- mns_common/component/k_line/common/k_line_common_service_api.py +4 -0
- mns_common/component/main_line/__init__.py +7 -0
- mns_common/component/main_line/main_line_zt_reason_service.py +237 -0
- mns_common/component/proxies/__init__.py +7 -0
- mns_common/component/proxies/proxy_common_api.py +252 -0
- mns_common/component/self_choose/__init__.py +13 -0
- mns_common/component/tfp/stock_tfp_api.py +82 -12
- mns_common/component/us/__init__.py +7 -0
- mns_common/component/us/us_stock_etf_info_api.py +125 -0
- mns_common/constant/__init__.py +1 -0
- mns_common/constant/db_name_constant.py +65 -34
- mns_common/constant/extra_income_db_name.py +154 -0
- mns_common/constant/strategy_classify.py +72 -0
- mns_common/db/MongodbUtil.py +2 -1
- mns_common/db/MongodbUtilLocal.py +1 -0
- mns_common/db/v2/MongodbUtilV2.py +0 -4
- mns_common-1.5.7.2.dist-info/METADATA +4 -0
- {mns_common-1.3.3.5.dist-info → mns_common-1.5.7.2.dist-info}/RECORD +70 -45
- {mns_common-1.3.3.5.dist-info → mns_common-1.5.7.2.dist-info}/WHEEL +1 -1
- mns_common/api/em/east_money_stock_api.py +0 -222
- mns_common/api/em/east_money_stock_hk_api.py +0 -318
- mns_common/api/em/east_money_stock_v2_api.py +0 -219
- mns_common/api/ths/concept/web/ths_company_info_web.py +0 -163
- mns_common/component/qmt/qmt_buy_service.py +0 -172
- mns_common-1.3.3.5.dist-info/METADATA +0 -4
- /mns_common/{component/qmt → api/em/concept}/__init__.py +0 -0
- /mns_common/api/em/{em_concept_index_api.py → concept/em_concept_index_api.py} +0 -0
- {mns_common-1.3.3.5.dist-info → mns_common-1.5.7.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
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
|
+
from loguru import logger
|
|
9
|
+
import requests
|
|
10
|
+
import time
|
|
11
|
+
import hashlib
|
|
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
|
|
20
|
+
|
|
21
|
+
# 提取订单
|
|
22
|
+
"""
|
|
23
|
+
orderId:提取订单号
|
|
24
|
+
secret:用户密钥
|
|
25
|
+
num:提取IP个数
|
|
26
|
+
pid:省份
|
|
27
|
+
cid:城市
|
|
28
|
+
type:请求类型,1=http/https,2=socks5
|
|
29
|
+
unbindTime:使用时长,秒/s为单位
|
|
30
|
+
noDuplicate:去重,0=不去重,1=去重
|
|
31
|
+
lineSeparator:分隔符
|
|
32
|
+
singleIp:切换,0=切换,1=不切换
|
|
33
|
+
"""
|
|
34
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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)
|
|
79
|
+
pid = "-1"
|
|
80
|
+
cid = ""
|
|
81
|
+
noDuplicate = "1"
|
|
82
|
+
lineSeparator = "0"
|
|
83
|
+
singleIp = "0"
|
|
84
|
+
time_str = str(int(time.time())) # 时间戳
|
|
85
|
+
|
|
86
|
+
# 计算sign
|
|
87
|
+
txt = "orderId=" + order_id + "&" + "secret=" + secret + "&" + "time=" + time_str
|
|
88
|
+
sign = hashlib.md5(txt.encode()).hexdigest()
|
|
89
|
+
# 访问URL获取IP
|
|
90
|
+
url = (
|
|
91
|
+
"http://api.hailiangip.com:8422/api/getIp?type=1" + "&num=" + num + "&pid=" + pid
|
|
92
|
+
+ "&unbindTime=" + unbind_time + "&cid=" + cid
|
|
93
|
+
+ "&orderId=" + order_id + "&time=" + time_str + "&sign=" + sign + "&dataType=0"
|
|
94
|
+
+ "&lineSeparator=" + lineSeparator + "&noDuplicate=" + noDuplicate + "&singleIp=" + singleIp)
|
|
95
|
+
my_response = requests.get(url).content
|
|
96
|
+
js_res = json.loads(my_response)
|
|
97
|
+
ip_pool_list = []
|
|
98
|
+
for dic in js_res["data"]:
|
|
99
|
+
try:
|
|
100
|
+
ip = dic["ip"]
|
|
101
|
+
port = dic["port"]
|
|
102
|
+
ip_port = ip + ":" + str(port)
|
|
103
|
+
ip_pool_list.append(ip_port)
|
|
104
|
+
except BaseException as e:
|
|
105
|
+
logger.error("获取ip地址异常:{}", e)
|
|
106
|
+
return None
|
|
107
|
+
return ip_pool_list
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
if __name__ == '__main__':
|
|
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)
|
|
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¤cy=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¤cy=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)
|
|
@@ -155,14 +155,17 @@ def get_company_hot_info(symbol, ths_cookie):
|
|
|
155
155
|
}
|
|
156
156
|
response = requests.get(url, headers=headers, cookies=cookies)
|
|
157
157
|
soup = BeautifulSoup(response.content, "html.parser")
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
158
|
+
analysis_txt = ''
|
|
159
|
+
for a in soup.find_all("a", class_="check_details f12"):
|
|
160
|
+
if "涨停分析" in a.get_text():
|
|
161
|
+
# 找到其后的兄弟节点中 class 为 check_else 的 div,包含详细内容
|
|
162
|
+
parent = a.find_parent("span", class_="performance_trailer")
|
|
163
|
+
if parent:
|
|
164
|
+
detail_div = parent.find("div", class_="check_else")
|
|
165
|
+
if detail_div:
|
|
166
|
+
analysis_txt = detail_div.get_text(separator="\n", strip=True)
|
|
167
|
+
break # 如果只要第一条,找到就结束
|
|
168
|
+
return analysis_txt
|
|
166
169
|
except BaseException as e:
|
|
167
170
|
logger.error("获取公司参股公司信息异常:{},{}", symbol, e)
|
|
168
171
|
return ''
|
|
@@ -174,5 +177,6 @@ mongodb_util = MongodbUtil('27017')
|
|
|
174
177
|
if __name__ == '__main__':
|
|
175
178
|
stock_account_info = mongodb_util.find_query_data('stock_account_info', {"type": "ths_cookie", })
|
|
176
179
|
ths_cookie_test = list(stock_account_info['cookie'])[0]
|
|
177
|
-
company_df_test = get_company_hot_info('
|
|
180
|
+
company_df_test = get_company_hot_info('600756', ths_cookie_test)
|
|
181
|
+
target_title = company_df_test.split("\n")[0] # 关键修改:提取第一行
|
|
178
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
|
-
|
|
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']
|
|
@@ -8,7 +8,7 @@ sys.path.append(project_path)
|
|
|
8
8
|
from loguru import logger
|
|
9
9
|
import pywencai
|
|
10
10
|
import mns_common.utils.data_frame_util as data_frame_util
|
|
11
|
-
|
|
11
|
+
import mns_common.component.cookie.cookie_info_service as cookie_info_service
|
|
12
12
|
'''
|
|
13
13
|
|
|
14
14
|
# https://github.com/zsrl/pywencai 文档
|
|
@@ -27,7 +27,8 @@ import mns_common.utils.data_frame_util as data_frame_util
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def wen_cai_api(question, q_type):
|
|
30
|
-
|
|
30
|
+
cookie = cookie_info_service.get_ths_cookie()
|
|
31
|
+
response = pywencai.get(question=question, loop=True, query_type=q_type, cookie=cookie)
|
|
31
32
|
return response
|
|
32
33
|
|
|
33
34
|
|
|
@@ -114,8 +115,10 @@ def get_concept_detail_by_wen_cai(concept_name):
|
|
|
114
115
|
|
|
115
116
|
|
|
116
117
|
if __name__ == '__main__':
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
print(
|
|
118
|
+
zt_df = wen_cai_api('001203涨停分析', 'stock', )
|
|
119
|
+
print(zt_df)
|
|
120
|
+
# concept_detail_df = get_concept_detail_by_wen_cai("光纤概念")
|
|
121
|
+
# concept_df = get_concept_index_by_wen_cai()
|
|
122
|
+
# print(concept_df)
|
|
123
|
+
# industry_index = get_industry_index_by_wen_cai()
|
|
124
|
+
# print(industry_index)
|
|
@@ -31,7 +31,7 @@ import mns_common.component.company.company_common_service_api as company_common
|
|
|
31
31
|
# 当设置具体数值n时,循环请求n页,返回n页合并数据。
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
import mns_common.
|
|
34
|
+
import mns_common.component.em.em_real_time_quotes_api as em_real_time_quotes_api
|
|
35
35
|
from mns_common.db.MongodbUtil import MongodbUtil
|
|
36
36
|
import pandas as pd
|
|
37
37
|
import mns_common.component.common_service_fun_api as common_service_fun_api
|
|
@@ -122,7 +122,7 @@ def get_real_time_zt_info():
|
|
|
122
122
|
zt_df = get_zt_reason(str_day)
|
|
123
123
|
if data_frame_util.is_empty(zt_df):
|
|
124
124
|
return None
|
|
125
|
-
real_time_df =
|
|
125
|
+
real_time_df = em_real_time_quotes_api.get_real_time_quotes_now(None, None)
|
|
126
126
|
|
|
127
127
|
zt_df = merge_high_chg(real_time_df, zt_df)
|
|
128
128
|
|
|
@@ -274,7 +274,24 @@ def zt_reason_group(zt_pool_df):
|
|
|
274
274
|
return result_group_df
|
|
275
275
|
|
|
276
276
|
|
|
277
|
-
|
|
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
|
+
|
|
278
294
|
|
|
279
295
|
if __name__ == '__main__':
|
|
280
|
-
|
|
296
|
+
zt_analyse_reason('003027')
|
|
297
|
+
# get_real_time_zt_info()
|