文章目录
- 1. 第一步:安装requests库
- 2. 第二步:获取爬虫所需的header和cookie
- 3. 第三步:获取网页
- 4. 第四步:解析网页
- 5. 第五步:解析 json 结构数据体
- 6. 代码实例以及结果展示
python爬虫五部曲:
-
第一步:安装requests库
-
第二步:获取爬虫所需的header和cookie
-
第三步:获取网页
-
第四步:解析网页
-
第五步:分析得到的Json数据
1. 第一步:安装requests库
在程序中引用两个库的书写是这样的:
import requests
以pycharm为例,在pycharm上安装这个库的方法。在菜单【文件】–>【设置】->【项目】–>【Python解释器】中,在所选框中,点击软件包上的+号就可以进行查询插件安装了。有过编译器插件安装的hxd估计会比较好入手。具体情况就如下图所示。
2. 第二步:获取爬虫所需的header和cookie
以爬取 雪球网 自选股 行情 的爬虫程序为例。获取header和cookie是一个爬虫程序必须的,它直接决定了爬虫程序能不能准确的找到网页位置进行爬取。
- 首先通过浏览器,打开雪球网,进行注册并登录,然后进入自选股页面,添加自己关注的股票
打开雪球网 https://xueqiu.com/
进入自选股页面,添加自己关注的股票
- [x]按下F12,就会出现网页的js语言设计部分,找到网页上的Network部分。并选中“放大镜(过滤)”,如下图所示:
- 然后按下ctrl+R刷新页面,此时发现右边 NetWork 部分出现很多信息。(如果进入后就有所需要的信息,就不用刷新了),当然刷新了也没啥问题。
- 在选中放大镜后的输入框中,输入其中一个关注的股票,比如:00418,通过 放大镜 搜索 功能,搜索自己关注的信息,如:通用电梯,并点击 ”刷新按钮“,就会在Search 结果中,显示相关的信息
双击选中上述查询结果中的某一条数据(上图中 红色框的部分),此时会发现右下部分 网络信息 也会同步自动选中某一行信息吗,如下图所示:
-
也可以通过 Network --> Filter 功能,搜索网址中的关键信息 的方式进行过滤
在 Network --> Filter 中,依据网页中的关键信息进行过滤,如输入: 00418
-
拷贝其 cURL 信息
在 Network --> Filter 中,关键信息进行过滤后,我们浏览Name这部分,找到我们想要爬取的文件(网络信息),鼠标右键,选择copy,复制下网页的URL。
过滤后,有效信息会少很多,如下所示。选中所需的条目,右键 --> Copy --> Copy as cURL
- 利用工具 Convert curl commands to code https://curlconverter.com/python/ 进行转换
转换后信息如下图所示,选择【Copy to clipboard】,并黏贴到Pycharm开发环境中即可直接使用:
转换后信息如下图所示,请关注:header 中的 传输格式为: Json
选择【Copy to clipboard】,并黏贴到Pycharm开发环境中即可直接使用:
选择【Copy to clipboard】, 拷贝到 pycharm 中,可直接作为源代码使用:
import requests
cookies = {
'cookiesu': '241712922404752',
'device_id': '6a73424ed3aae5c44aeb59b0ddfbc91b',
'Hm_lvt_1db88642e346389874251b5a1eded6e3': '1712922406',
's': 'bo11shkdxf',
'remember': '1',
'xq_a_token': '7ef03deb28d3396dc9d555329881fd9986211657',
'xqat': '7ef03deb28d3396dc9d555329881fd9986211657',
'xq_id_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1aWQiOjE4NzgxNDkwNzEsImlzcyI6InVjIiwiZXhwIjoxNzE1NjYzMDk3LCJjdG0iOjE3MTMwNzEwOTczOTMsImNpZCI6ImQ5ZDBuNEFadXAifQ.it0vlCz3lYJQWuyvFGxWj3g-ACQjfUgLUdb5_XFqqgkd0U9rn1sLzHDmas6HB8po7WHut8dAFiOT8_JKJufjdIuzW_TC2wGWErmBuxNwvTR2Vm6wPzRU-HWwTHcZDuHO6nbvH0olaXqMcnRtx7b10o-V9w8FLUCqNhMw0t84d8dcSewNQtmbYSDunHRpUzu33uXyQOKdqSV8MVPmMKfhFxqSxbFienLwk-K3g8c02p9RKdclJLX77FjFt2LXUlfZbSBJ_8QVHzRgqCbXV_gcDF4akPgjCzSFNTD4xJd030N0J-SCH-WxMfqO5AQDBbo5G1Jupc2GdlHht_uvZ1dBbA',
'xq_r_token': '62e0ff828b86cfa501f1520ad6570a99838e72e5',
'xq_is_login': '1',
'u': '1878149071',
'is_overseas': '0',
'Hm_lpvt_1db88642e346389874251b5a1eded6e3': '1713076110',
}
headers = {
'authority': 'stock.xueqiu.com',
'accept': 'application/json, text/plain, */*',
'accept-language': 'zh-CN,zh;q=0.9',
# 'cookie': 'cookiesu=241712922404752; device_id=6a73424ed3aae5c44aeb59b0ddfbc91b; Hm_lvt_1db88642e346389874251b5a1eded6e3=1712922406; s=bo11shkdxf; remember=1; xq_a_token=7ef03deb28d3396dc9d555329881fd9986211657; xqat=7ef03deb28d3396dc9d555329881fd9986211657; xq_id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1aWQiOjE4NzgxNDkwNzEsImlzcyI6InVjIiwiZXhwIjoxNzE1NjYzMDk3LCJjdG0iOjE3MTMwNzEwOTczOTMsImNpZCI6ImQ5ZDBuNEFadXAifQ.it0vlCz3lYJQWuyvFGxWj3g-ACQjfUgLUdb5_XFqqgkd0U9rn1sLzHDmas6HB8po7WHut8dAFiOT8_JKJufjdIuzW_TC2wGWErmBuxNwvTR2Vm6wPzRU-HWwTHcZDuHO6nbvH0olaXqMcnRtx7b10o-V9w8FLUCqNhMw0t84d8dcSewNQtmbYSDunHRpUzu33uXyQOKdqSV8MVPmMKfhFxqSxbFienLwk-K3g8c02p9RKdclJLX77FjFt2LXUlfZbSBJ_8QVHzRgqCbXV_gcDF4akPgjCzSFNTD4xJd030N0J-SCH-WxMfqO5AQDBbo5G1Jupc2GdlHht_uvZ1dBbA; xq_r_token=62e0ff828b86cfa501f1520ad6570a99838e72e5; xq_is_login=1; u=1878149071; is_overseas=0; Hm_lpvt_1db88642e346389874251b5a1eded6e3=1713076110',
'origin': 'https://xueqiu.com',
'referer': 'https://xueqiu.com/',
'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Linux"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
}
response = requests.get(
'https://stock.xueqiu.com/v5/stock/batch/quote.json?symbol=SZ300229,SZ002129&extend=detail&is_delay_hk=true',
cookies=cookies,
headers=headers,
)
print(f'response= {response}')
print(f'response.text= {response.text}')
print(f'response.json= {response.json()}')
3. 第三步:获取网页
通过requests.get() 即可获取网页内容:
response = requests.get(
'https://stock.xueqiu.com/v5/stock/batch/quote.json?symbol=SZ300750,SZ002371,SH601857,SZ002594,SZ000338,SZ300462,SH601390,SZ000656,SZ000002,SZ000672,SZ000401,SH601012,SZ000802,SH600663,SZ002439,SH600536,SH600149,SH600271,SZ300418,SZ300229,SZ002129&extend=detail&is_delay_hk=true',
cookies=cookies,
headers=headers,
)
print(f'response= {response}')
print(f'response.text= {response.text}')
print(f'response.json= {response.json()}')
json_content = response.json()
print(f'json_content.error_code = {json_content["error_code"]}')
print(f'json_content.error_description = {json_content["error_description"]}')
print(f'json_content.data.items_size = {json_content["data"]["items_size"]}')
4. 第四步:解析网页
由于 get 的结果,就是 json 数据,所以后续只需要针对 json格式进行解析即可:
格式化后应答数据内容如下:
{
"data": {
"items": [
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ300750",
"code": "300750",
"exchange": "SZ",
"name": "宁德时代",
"type": 11,
"sub_type": "3",
"status": 1,
"current": 189.6,
"currency": "CNY",
"percent": -0.17,
"chg": -0.33,
"timestamp": 1713944082000,
"time": 1713944082000,
"lot_size": 100,
"tick_size": 0.01,
"open": 192,
"last_close": 189.93,
"high": 192.4,
"low": 186.4,
"avg_price": 189.08,
"volume": 15154279,
"amount": 2865374635.48,
"turnover_rate": 0.39,
"amplitude": 3.16,
"market_capital": 834058218346,
"float_market_capital": 738464072299,
"total_shares": 4399041236,
"float_shares": 3894852702,
"issue_date": 1528646400000,
"lock_set": null,
"current_year_percent": 16.13,
"high52w": 251.33,
"low52w": 140.4,
"limit_up": 227.92,
"limit_down": 151.94,
"volume_ratio": 0.88,
"eps": 10.19,
"pe_ttm": 18.614,
"pe_forecast": 19.84,
"pe_lyr": 18.904,
"navps": 47.22,
"pb": 4.015,
"dividend": 1.761,
"dividend_yield": 0.929,
"profit": 44121248300,
"profit_four": 44808906400,
"profit_forecast": 42039692800,
"pledge_ratio": 0.68,
"goodwill_in_net_assets": 0.42742759281700615,
"timestamp_ext": 1713944040000,
"current_ext": 189.6,
"volume_ext": 500,
"traded_amount_ext": 94800,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ002371",
"code": "002371",
"exchange": "SZ",
"name": "北方华创",
"type": 11,
"sub_type": "1",
"status": 1,
"current": 305,
"currency": "CNY",
"percent": 0.71,
"chg": 2.14,
"timestamp": 1713942282000,
"time": 1713942282000,
"lot_size": 100,
"tick_size": 0.01,
"open": 304,
"last_close": 302.86,
"high": 308.8,
"low": 302.47,
"avg_price": 305.1,
"volume": 3338809,
"amount": 1018665691.15,
"turnover_rate": 0.63,
"amplitude": 2.09,
"market_capital": 161739482120,
"float_market_capital": 161587820870,
"total_shares": 530293384,
"float_shares": 529796134,
"issue_date": 1268668800000,
"lock_set": null,
"current_year_percent": 24.13,
"high52w": 348.9217,
"low52w": 213.42,
"limit_up": 333.15,
"limit_down": 272.57,
"volume_ratio": 0.71,
"eps": 6.7,
"pe_ttm": 45.55,
"pe_forecast": 42.058,
"pe_lyr": 68.746,
"navps": 42.58,
"pb": 7.163,
"dividend": 0.445,
"dividend_yield": 0.146,
"profit": 2352726657.86,
"profit_four": 3550839490.65,
"profit_forecast": 3845622238,
"pledge_ratio": null,
"goodwill_in_net_assets": 0.12210001551812207,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SH601857",
"code": "601857",
"exchange": "SH",
"name": "中国石油",
"type": 11,
"sub_type": "ASH",
"status": 1,
"current": 10.43,
"currency": "CNY",
"percent": 0.77,
"chg": 0.08,
"timestamp": 1713942000000,
"time": 1713942000000,
"lot_size": 100,
"tick_size": 0.01,
"open": 10.39,
"last_close": 10.35,
"high": 10.45,
"low": 10.24,
"avg_price": 10.364,
"volume": 158228408,
"amount": 1639942725,
"turnover_rate": 0.1,
"amplitude": 2.03,
"market_capital": 1908908798642,
"float_market_capital": 1688847271642,
"total_shares": 183020977818,
"float_shares": 161922077818,
"issue_date": 1194192000000,
"lock_set": null,
"current_year_percent": 47.73,
"high52w": 11.06,
"low52w": 6.6385,
"limit_up": 11.39,
"limit_down": 9.32,
"volume_ratio": 0.58,
"eps": 0.88,
"pe_ttm": 11.846,
"pe_forecast": 11.846,
"pe_lyr": 11.846,
"navps": 7.9,
"pb": 1.32,
"dividend": 0.43,
"dividend_yield": 4.123,
"profit": 161144000000,
"profit_four": 161144000000,
"profit_forecast": 161144000000,
"pledge_ratio": 0,
"goodwill_in_net_assets": 0.5145152480970125,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": null,
"no_profit_desc": null,
"weighted_voting_rights": null,
"weighted_voting_rights_desc": null,
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": null,
"is_vie_desc": null,
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ002594",
"code": "002594",
"exchange": "SZ",
"name": "比亚迪",
"type": 11,
"sub_type": "1",
"status": 1,
"current": 207.42,
"currency": "CNY",
"percent": 1.16,
"chg": 2.38,
"timestamp": 1713942255000,
"time": 1713942255000,
"lot_size": 100,
"tick_size": 0.01,
"open": 206.89,
"last_close": 205.04,
"high": 208.8,
"low": 204.5,
"avg_price": 206.323,
"volume": 7497892,
"amount": 1546983915.54,
"turnover_rate": 0.64,
"amplitude": 2.1,
"market_capital": 603829250984,
"float_market_capital": 241491234618,
"total_shares": 2911142855,
"float_shares": 1164262051,
"issue_date": 1309363200000,
"lock_set": null,
"current_year_percent": 4.76,
"high52w": 276.58,
"low52w": 162.77,
"limit_up": 225.54,
"limit_down": 184.54,
"volume_ratio": 0.76,
"eps": 10.32,
"pe_ttm": 20.1,
"pe_forecast": 20.1,
"pe_lyr": 20.1,
"navps": 47.68,
"pb": 4.35,
"dividend": 1.142,
"dividend_yield": 0.551,
"profit": 30040811000,
"profit_four": 30040811000,
"profit_forecast": 30040811000,
"pledge_ratio": 4.98,
"goodwill_in_net_assets": 3.1896613548880626,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ000338",
"code": "000338",
"exchange": "SZ",
"name": "潍柴动力",
"type": 11,
"sub_type": "1",
"status": 1,
"current": 17.79,
"currency": "CNY",
"percent": 1.48,
"chg": 0.26,
"timestamp": 1713942282000,
"time": 1713942282000,
"lot_size": 100,
"tick_size": 0.01,
"open": 17.27,
"last_close": 17.53,
"high": 17.82,
"low": 17.27,
"avg_price": 17.662,
"volume": 43977873,
"amount": 776734155.86,
"turnover_rate": 0.88,
"amplitude": 3.14,
"market_capital": 155245445846,
"float_market_capital": 88445336589,
"total_shares": 8726556821,
"float_shares": 4971632186,
"issue_date": 1177862400000,
"lock_set": null,
"current_year_percent": 30.33,
"high52w": 19.02,
"low52w": 10.824,
"limit_up": 19.28,
"limit_down": 15.78,
"volume_ratio": 0.79,
"eps": 1.03,
"pe_ttm": 17.223,
"pe_forecast": 17.223,
"pe_lyr": 17.223,
"navps": 9.09,
"pb": 1.957,
"dividend": 0.384,
"dividend_yield": 2.159,
"profit": 9013894024.19,
"profit_four": 9013894024.19,
"profit_forecast": 9013894024,
"pledge_ratio": null,
"goodwill_in_net_assets": 31.33327742061711,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ300462",
"code": "300462",
"exchange": "SZ",
"name": "华铭智能",
"type": 11,
"sub_type": "3",
"status": 1,
"current": 7.97,
"currency": "CNY",
"percent": 5.98,
"chg": 0.45,
"timestamp": 1713944070000,
"time": 1713944070000,
"lot_size": 100,
"tick_size": 0.01,
"open": 7.54,
"last_close": 7.52,
"high": 8.1,
"low": 7.54,
"avg_price": 7.875,
"volume": 5265463,
"amount": 41467978.7,
"turnover_rate": 3.86,
"amplitude": 7.45,
"market_capital": 1444338846,
"float_market_capital": 1089773272,
"total_shares": 181221938,
"float_shares": 136734413,
"issue_date": 1432656000000,
"lock_set": null,
"current_year_percent": -32.4,
"high52w": 14.69,
"low52w": 5.1,
"limit_up": 9.02,
"limit_down": 6.02,
"volume_ratio": 1.04,
"eps": -0.15,
"pe_ttm": -53.848,
"pe_forecast": -19.366,
"pe_lyr": -248.154,
"navps": 7.79,
"pb": 1.023,
"dividend": 0.068,
"dividend_yield": 0.853,
"profit": -5820344,
"profit_four": -26822524.44,
"profit_forecast": -74580940,
"pledge_ratio": 1.78,
"goodwill_in_net_assets": 0.24650652467572762,
"timestamp_ext": 1713944070000,
"current_ext": 7.97,
"volume_ext": 0,
"traded_amount_ext": 0,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SH601390",
"code": "601390",
"exchange": "SH",
"name": "中国中铁",
"type": 11,
"sub_type": "ASH",
"status": 1,
"current": 6.91,
"currency": "CNY",
"percent": 0.44,
"chg": 0.03,
"timestamp": 1713942000000,
"time": 1713942000000,
"lot_size": 100,
"tick_size": 0.01,
"open": 6.88,
"last_close": 6.88,
"high": 6.93,
"low": 6.84,
"avg_price": 6.888,
"volume": 72456052,
"amount": 499058085,
"turnover_rate": 0.35,
"amplitude": 1.31,
"market_capital": 171026852035,
"float_market_capital": 141098400336,
"total_shares": 24750629817,
"float_shares": 20419450121,
"issue_date": 1196611200000,
"lock_set": null,
"current_year_percent": 21.65,
"high52w": 9.3494,
"low52w": 5.35,
"limit_up": 7.57,
"limit_down": 6.19,
"volume_ratio": 0.55,
"eps": 1.35,
"pe_ttm": 5.108,
"pe_forecast": 5.108,
"pe_lyr": 5.108,
"navps": 11.43,
"pb": 0.605,
"dividend": 0.2,
"dividend_yield": 2.894,
"profit": 33482775000,
"profit_four": 33482775000,
"profit_forecast": 33482775000,
"pledge_ratio": null,
"goodwill_in_net_assets": 0.5040222893868488,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": null,
"no_profit_desc": null,
"weighted_voting_rights": null,
"weighted_voting_rights_desc": null,
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": null,
"is_vie_desc": null,
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ000656",
"code": "000656",
"exchange": "SZ",
"name": "*ST金科",
"type": 11,
"sub_type": "1",
"status": 1,
"current": 1.14,
"currency": "CNY",
"percent": -5,
"chg": -0.06,
"timestamp": 1713942240000,
"time": 1713942240000,
"lot_size": 100,
"tick_size": 0.01,
"open": 1.14,
"last_close": 1.2,
"high": 1.14,
"low": 1.14,
"avg_price": 1.14,
"volume": 30021700,
"amount": 34224738,
"turnover_rate": 0.57,
"amplitude": 0,
"market_capital": 6087276030,
"float_market_capital": 6051548659,
"total_shares": 5339715816,
"float_shares": 5308376017,
"issue_date": 849110400000,
"lock_set": null,
"current_year_percent": -37.02,
"high52w": 2.75,
"low52w": 0.77,
"limit_up": 1.26,
"limit_down": 1.14,
"volume_ratio": 0.22,
"eps": -3.64,
"pe_ttm": -0.313,
"pe_forecast": -1.941,
"pe_lyr": -0.285,
"navps": 1.9,
"pb": 0.6,
"dividend": null,
"dividend_yield": null,
"profit": -21392041770.47,
"profit_four": -19460545462.33,
"profit_forecast": -3135909195,
"pledge_ratio": 8.2,
"goodwill_in_net_assets": 0.026054622061568715,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": "5"
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ000002",
"code": "000002",
"exchange": "SZ",
"name": "万科A",
"type": 11,
"sub_type": "1",
"status": 1,
"current": 6.54,
"currency": "CNY",
"percent": -0.46,
"chg": -0.03,
"timestamp": 1713942285000,
"time": 1713942285000,
"lot_size": 100,
"tick_size": 0.01,
"open": 6.59,
"last_close": 6.57,
"high": 6.61,
"low": 6.48,
"avg_price": 6.53,
"volume": 157054069,
"amount": 1025027313.23,
"turnover_rate": 1.62,
"amplitude": 1.98,
"market_capital": 78026839940,
"float_market_capital": 63548760557,
"total_shares": 11930709471,
"float_shares": 9716935865,
"issue_date": 665078400000,
"lock_set": null,
"current_year_percent": -37.48,
"high52w": 15.1017,
"low52w": 6.48,
"limit_up": 7.23,
"limit_down": 5.91,
"volume_ratio": 0.69,
"eps": 1.02,
"pe_ttm": 6.415,
"pe_forecast": 6.415,
"pe_lyr": 6.415,
"navps": 21.15,
"pb": 0.309,
"dividend": 0.68,
"dividend_yield": 10.398,
"profit": 12162684368.86,
"profit_four": 12162684368.86,
"profit_forecast": 12162684369,
"pledge_ratio": 2.65,
"goodwill_in_net_assets": 2.1567393529397187,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ000672",
"code": "000672",
"exchange": "SZ",
"name": "上峰水泥",
"type": 11,
"sub_type": "1",
"status": 1,
"current": 7.14,
"currency": "CNY",
"percent": -1.11,
"chg": -0.08,
"timestamp": 1713942261000,
"time": 1713942261000,
"lot_size": 100,
"tick_size": 0.01,
"open": 7.16,
"last_close": 7.22,
"high": 7.23,
"low": 7.07,
"avg_price": 7.117,
"volume": 5688260,
"amount": 40483181.2,
"turnover_rate": 0.59,
"amplitude": 2.22,
"market_capital": 6921483513,
"float_market_capital": 6921483513,
"total_shares": 969395450,
"float_shares": 969395450,
"issue_date": 850838400000,
"lock_set": null,
"current_year_percent": -11.41,
"high52w": 10.9694,
"low52w": 6.39,
"limit_up": 7.94,
"limit_down": 6.5,
"volume_ratio": 1.01,
"eps": 0.77,
"pe_ttm": 9.299,
"pe_forecast": 9.299,
"pe_lyr": 9.299,
"navps": 9.12,
"pb": 0.783,
"dividend": 0.35,
"dividend_yield": 4.902,
"profit": 744285615.64,
"profit_four": 744285615.64,
"profit_forecast": 744285616,
"pledge_ratio": 12.1,
"goodwill_in_net_assets": 1.7713500901307806,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ000401",
"code": "000401",
"exchange": "SZ",
"name": "冀东水泥",
"type": 11,
"sub_type": "1",
"status": 1,
"current": 4.93,
"currency": "CNY",
"percent": -1,
"chg": -0.05,
"timestamp": 1713942276000,
"time": 1713942276000,
"lot_size": 100,
"tick_size": 0.01,
"open": 4.99,
"last_close": 4.98,
"high": 5.02,
"low": 4.91,
"avg_price": 4.94,
"volume": 8190135,
"amount": 40456127.65,
"turnover_rate": 0.53,
"amplitude": 2.21,
"market_capital": 13104998880,
"float_market_capital": 7628186451,
"total_shares": 2658214783,
"float_shares": 1547299483,
"issue_date": 834681600000,
"lock_set": null,
"current_year_percent": -22.85,
"high52w": 9.1623,
"low52w": 4.91,
"limit_up": 5.48,
"limit_down": 4.48,
"volume_ratio": 0.92,
"eps": -0.56,
"pe_ttm": -8.746,
"pe_forecast": -8.746,
"pe_lyr": -8.746,
"navps": 10.69,
"pb": 0.461,
"dividend": 0.15,
"dividend_yield": 3.043,
"profit": -1498372974.14,
"profit_four": -1498372974.14,
"profit_forecast": -1498372974,
"pledge_ratio": null,
"goodwill_in_net_assets": 1.391046353700251,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SH601012",
"code": "601012",
"exchange": "SH",
"name": "隆基绿能",
"type": 11,
"sub_type": "ASH",
"status": 1,
"current": 18.5,
"currency": "CNY",
"percent": -1.49,
"chg": -0.28,
"timestamp": 1713942000000,
"time": 1713942000000,
"lot_size": 100,
"tick_size": 0.01,
"open": 18.8,
"last_close": 18.78,
"high": 18.84,
"low": 18.35,
"avg_price": 18.485,
"volume": 70340445,
"amount": 1300237522,
"turnover_rate": 0.93,
"amplitude": 2.61,
"market_capital": 140193825063,
"float_market_capital": 140193685462,
"total_shares": 7578044598,
"float_shares": 7578037052,
"issue_date": 1334073600000,
"lock_set": null,
"current_year_percent": -19.21,
"high52w": 36.7959,
"low52w": 17.6,
"limit_up": 20.66,
"limit_down": 16.9,
"volume_ratio": 0.69,
"eps": 2.05,
"pe_ttm": 9.028,
"pe_forecast": 8.992,
"pe_lyr": 9.465,
"navps": 9.36,
"pb": 1.976,
"dividend": 0.4,
"dividend_yield": 2.162,
"profit": 14811576797.86,
"profit_four": 15529221215.91,
"profit_forecast": 15591621811,
"pledge_ratio": 1.86,
"goodwill_in_net_assets": 0.23094610583130648,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": null,
"no_profit_desc": null,
"weighted_voting_rights": null,
"weighted_voting_rights_desc": null,
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": null,
"is_vie_desc": null,
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ000802",
"code": "000802",
"exchange": "SZ",
"name": "北京文化",
"type": 11,
"sub_type": "1",
"status": 1,
"current": 5.74,
"currency": "CNY",
"percent": -0.17,
"chg": -0.01,
"timestamp": 1713942252000,
"time": 1713942252000,
"lot_size": 100,
"tick_size": 0.01,
"open": 5.7,
"last_close": 5.75,
"high": 5.78,
"low": 5.58,
"avg_price": 5.69,
"volume": 6811500,
"amount": 38733219,
"turnover_rate": 0.95,
"amplitude": 3.48,
"market_capital": 4109267464,
"float_market_capital": 4106770564,
"total_shares": 715900255,
"float_shares": 715465255,
"issue_date": 884188800000,
"lock_set": null,
"current_year_percent": -20.94,
"high52w": 9.9,
"low52w": 4.96,
"limit_up": 6.33,
"limit_down": 5.18,
"volume_ratio": 0.7,
"eps": -0.39,
"pe_ttm": -14.579,
"pe_forecast": -74.981,
"pe_lyr": -14.68,
"navps": 1.73,
"pb": 3.318,
"dividend": null,
"dividend_yield": null,
"profit": -279919393.57,
"profit_four": -281860128.36,
"profit_forecast": -54803977,
"pledge_ratio": 0.35,
"goodwill_in_net_assets": 7.473587107982101,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SH600663",
"code": "600663",
"exchange": "SH",
"name": "陆家嘴",
"type": 11,
"sub_type": "ASH",
"status": 1,
"current": 8.14,
"currency": "CNY",
"percent": -1.09,
"chg": -0.09,
"timestamp": 1713942000000,
"time": 1713942000000,
"lot_size": 100,
"tick_size": 0.01,
"open": 8.2,
"last_close": 8.23,
"high": 8.23,
"low": 8.06,
"avg_price": 8.119,
"volume": 3881620,
"amount": 31515175,
"turnover_rate": 0.13,
"amplitude": 2.07,
"market_capital": 39177262060,
"float_market_capital": 23878376122,
"total_shares": 4812931457,
"float_shares": 2933461440,
"issue_date": 741196800000,
"lock_set": null,
"current_year_percent": -6.97,
"high52w": 11.23,
"low52w": 7.7,
"limit_up": 9.05,
"limit_down": 7.41,
"volume_ratio": 0.98,
"eps": 0.16,
"pe_ttm": 51.325,
"pe_forecast": 35.116,
"pe_lyr": 36.117,
"navps": 4.67,
"pb": 1.743,
"dividend": 0.113,
"dividend_yield": 1.388,
"profit": 1084739736.76,
"profit_four": 763315167.44,
"profit_forecast": 1115658120,
"pledge_ratio": null,
"goodwill_in_net_assets": 3.8730211437146114,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": null,
"no_profit_desc": null,
"weighted_voting_rights": null,
"weighted_voting_rights_desc": null,
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": null,
"is_vie_desc": null,
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ002439",
"code": "002439",
"exchange": "SZ",
"name": "启明星辰",
"type": 11,
"sub_type": "1",
"status": 1,
"current": 19.33,
"currency": "CNY",
"percent": 2.28,
"chg": 0.43,
"timestamp": 1713942270000,
"time": 1713942270000,
"lot_size": 100,
"tick_size": 0.01,
"open": 19.05,
"last_close": 18.9,
"high": 19.34,
"low": 18.95,
"avg_price": 19.199,
"volume": 12720539,
"amount": 244219665.03,
"turnover_rate": 1.75,
"amplitude": 2.06,
"market_capital": 23714214665,
"float_market_capital": 14024111412,
"total_shares": 1226808829,
"float_shares": 725510161,
"issue_date": 1277222400000,
"lock_set": null,
"current_year_percent": -28.41,
"high52w": 35.8414,
"low52w": 16.75,
"limit_up": 20.79,
"limit_down": 17.01,
"volume_ratio": 1.06,
"eps": 0.6,
"pe_ttm": 31.997,
"pe_forecast": 31.997,
"pe_lyr": 31.997,
"navps": 9.4,
"pb": 2.056,
"dividend": 0.154,
"dividend_yield": 0.797,
"profit": 741142340.21,
"profit_four": 741142340.21,
"profit_forecast": 741142340,
"pledge_ratio": 1.05,
"goodwill_in_net_assets": 5.872419139836679,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SH600536",
"code": "600536",
"exchange": "SH",
"name": "中国软件",
"type": 11,
"sub_type": "ASH",
"status": 1,
"current": 28.88,
"currency": "CNY",
"percent": 2.92,
"chg": 0.82,
"timestamp": 1713942000000,
"time": 1713942000000,
"lot_size": 100,
"tick_size": 0.01,
"open": 28.16,
"last_close": 28.06,
"high": 28.88,
"low": 28.01,
"avg_price": 28.571,
"volume": 14061331,
"amount": 401741903,
"turnover_rate": 1.67,
"amplitude": 3.1,
"market_capital": 24827979355,
"float_market_capital": 24344535490,
"total_shares": 859694576,
"float_shares": 842954830,
"issue_date": 1021564800000,
"lock_set": null,
"current_year_percent": -20.35,
"high52w": 57.43,
"low52w": 23.1,
"limit_up": 30.87,
"limit_down": 25.25,
"volume_ratio": 1.16,
"eps": 0.02,
"pe_ttm": 1699.682,
"pe_forecast": -44.107,
"pe_lyr": 547.687,
"navps": 2.45,
"pb": 11.788,
"dividend": 0.016,
"dividend_yield": 0.055,
"profit": 45332444.27,
"profit_four": 14607425.56,
"profit_forecast": -562907978,
"pledge_ratio": null,
"goodwill_in_net_assets": 0.07163674017839616,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": null,
"no_profit_desc": null,
"weighted_voting_rights": null,
"weighted_voting_rights_desc": null,
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": null,
"is_vie_desc": null,
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SH600149",
"code": "600149",
"exchange": "SH",
"name": "廊坊发展",
"type": 11,
"sub_type": "ASH",
"status": 1,
"current": 3.46,
"currency": "CNY",
"percent": 1.76,
"chg": 0.06,
"timestamp": 1713942000000,
"time": 1713942000000,
"lot_size": 100,
"tick_size": 0.01,
"open": 3.39,
"last_close": 3.4,
"high": 3.46,
"low": 3.38,
"avg_price": 3.431,
"volume": 6075033,
"amount": 20845404,
"turnover_rate": 1.6,
"amplitude": 2.35,
"market_capital": 1315353600,
"float_market_capital": 1315353600,
"total_shares": 380160000,
"float_shares": 380160000,
"issue_date": 939830400000,
"lock_set": null,
"current_year_percent": -38.54,
"high52w": 7.29,
"low52w": 2.85,
"limit_up": 3.74,
"limit_down": 3.06,
"volume_ratio": 0.46,
"eps": -0.04,
"pe_ttm": -88.228,
"pe_forecast": -88.228,
"pe_lyr": -88.228,
"navps": 0.39,
"pb": 8.872,
"dividend": null,
"dividend_yield": null,
"profit": -14908569.4,
"profit_four": -14908569.4,
"profit_forecast": -14908569,
"pledge_ratio": null,
"goodwill_in_net_assets": 27.413793532144933,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": null,
"no_profit_desc": null,
"weighted_voting_rights": null,
"weighted_voting_rights_desc": null,
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": null,
"is_vie_desc": null,
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SH600271",
"code": "600271",
"exchange": "SH",
"name": "航天信息",
"type": 11,
"sub_type": "ASH",
"status": 1,
"current": 9.2,
"currency": "CNY",
"percent": 1.77,
"chg": 0.16,
"timestamp": 1713942000000,
"time": 1713942000000,
"lot_size": 100,
"tick_size": 0.01,
"open": 9.04,
"last_close": 9.04,
"high": 9.21,
"low": 9,
"avg_price": 9.129,
"volume": 13367705,
"amount": 122035405,
"turnover_rate": 0.72,
"amplitude": 2.32,
"market_capital": 17046538670,
"float_market_capital": 17046538670,
"total_shares": 1852884638,
"float_shares": 1852884638,
"issue_date": 1057852800000,
"lock_set": null,
"current_year_percent": -13.53,
"high52w": 15.5913,
"low52w": 7.72,
"limit_up": 9.94,
"limit_down": 8.14,
"volume_ratio": 1.1,
"eps": 0.11,
"pe_ttm": 84.091,
"pe_forecast": 84.091,
"pe_lyr": 84.091,
"navps": 7.58,
"pb": 1.214,
"dividend": 0.175,
"dividend_yield": 1.902,
"profit": 202715323.39,
"profit_four": 202715323.39,
"profit_forecast": 202715323,
"pledge_ratio": null,
"goodwill_in_net_assets": 5.24499958215718,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": null,
"no_profit_desc": null,
"weighted_voting_rights": null,
"weighted_voting_rights_desc": null,
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": null,
"is_vie_desc": null,
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ300418",
"code": "300418",
"exchange": "SZ",
"name": "昆仑万维",
"type": 11,
"sub_type": "3",
"status": 1,
"current": 39.18,
"currency": "CNY",
"percent": 6.5,
"chg": 2.39,
"timestamp": 1713944085000,
"time": 1713944085000,
"lot_size": 100,
"tick_size": 0.01,
"open": 38.49,
"last_close": 36.79,
"high": 39.73,
"low": 37.88,
"avg_price": 38.795,
"volume": 59717422,
"amount": 2316715476.3,
"turnover_rate": 5.4,
"amplitude": 5.03,
"market_capital": 47603982253,
"float_market_capital": 43347731753,
"total_shares": 1215007204,
"float_shares": 1106373960,
"issue_date": 1421769600000,
"lock_set": null,
"current_year_percent": 4.76,
"high52w": 70.66,
"low52w": 26.22,
"limit_up": 44.15,
"limit_down": 29.43,
"volume_ratio": 0.97,
"eps": 1.04,
"pe_ttm": 37.83,
"pe_forecast": 37.83,
"pe_lyr": 37.83,
"navps": 12.49,
"pb": 3.137,
"dividend": null,
"dividend_yield": null,
"profit": 1258361202.56,
"profit_four": 1258361202.56,
"profit_forecast": 1258361203,
"pledge_ratio": 0.02,
"goodwill_in_net_assets": 35.09141290859045,
"timestamp_ext": 1713944085000,
"current_ext": 39.18,
"volume_ext": 4300,
"traded_amount_ext": 168474,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ300229",
"code": "300229",
"exchange": "SZ",
"name": "拓尔思",
"type": 11,
"sub_type": "3",
"status": 1,
"current": 14.35,
"currency": "CNY",
"percent": 4.44,
"chg": 0.61,
"timestamp": 1713944085000,
"time": 1713944085000,
"lot_size": 100,
"tick_size": 0.01,
"open": 13.89,
"last_close": 13.74,
"high": 14.39,
"low": 13.77,
"avg_price": 14.13,
"volume": 22443899,
"amount": 317120994.22,
"turnover_rate": 2.82,
"amplitude": 4.51,
"market_capital": 11412439497,
"float_market_capital": 11403661616,
"total_shares": 795291951,
"float_shares": 794680252,
"issue_date": 1308067200000,
"lock_set": null,
"current_year_percent": -14.89,
"high52w": 34.8,
"low52w": 9.56,
"limit_up": 16.49,
"limit_down": 10.99,
"volume_ratio": 1.14,
"eps": 0.05,
"pe_ttm": 312.961,
"pe_forecast": 312.961,
"pe_lyr": 312.961,
"navps": 4.21,
"pb": 3.409,
"dividend": 0.04,
"dividend_yield": 0.279,
"profit": 36465973.39,
"profit_four": 36465973.39,
"profit_forecast": 36465973,
"pledge_ratio": null,
"goodwill_in_net_assets": 14.474781438257715,
"timestamp_ext": 1713944085000,
"current_ext": 13.74,
"volume_ext": 4800,
"traded_amount_ext": 68880,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
},
{
"market": {
"status_id": 1,
"region": "CN",
"status": "未开盘",
"time_zone": "Asia/Shanghai",
"time_zone_desc": null,
"delay_tag": 0
},
"quote": {
"symbol": "SZ002129",
"code": "002129",
"exchange": "SZ",
"name": "TCL中环",
"type": 11,
"sub_type": "1",
"status": 1,
"current": 9.79,
"currency": "CNY",
"percent": -1.81,
"chg": -0.18,
"timestamp": 1713942273000,
"time": 1713942273000,
"lot_size": 100,
"tick_size": 0.01,
"open": 9.94,
"last_close": 9.97,
"high": 9.97,
"low": 9.7,
"avg_price": 9.799,
"volume": 88603349,
"amount": 868254188.8,
"turnover_rate": 2.19,
"amplitude": 2.71,
"market_capital": 39582103418,
"float_market_capital": 39548852975,
"total_shares": 4043115773,
"float_shares": 4039719405,
"issue_date": 1176998400000,
"lock_set": null,
"current_year_percent": -37.4,
"high52w": 34.2004,
"low52w": 9.7,
"limit_up": 10.97,
"limit_down": 8.97,
"volume_ratio": 1.22,
"eps": 1.98,
"pe_ttm": 4.944,
"pe_forecast": 4.797,
"pe_lyr": 5.805,
"navps": 10.83,
"pb": 0.904,
"dividend": 0.08,
"dividend_yield": 0.817,
"profit": 6818653821.89,
"profit_four": 8006086185.83,
"profit_forecast": 8250766702,
"pledge_ratio": 0,
"goodwill_in_net_assets": 3.1844244506068082,
"timestamp_ext": null,
"current_ext": null,
"volume_ext": null,
"traded_amount_ext": null,
"no_profit": "N",
"no_profit_desc": "已盈利",
"weighted_voting_rights": "N",
"weighted_voting_rights_desc": "无差异",
"is_registration": "N",
"is_registration_desc": "否",
"is_vie": "N",
"is_vie_desc": "否",
"security_status": null
},
"others": {
"cyb_switch": true
},
"tags": []
}
],
"items_size": 21
},
"error_code": 0,
"error_description": ""
}
5. 第五步:解析 json 结构数据体
json_content = response.json()
print(f'json_content.error_code = {json_content["error_code"]}')
print(f'json_content.error_description = {json_content["error_description"]}')
print(f'json_content.data.items_size = {json_content["data"]["items_size"]}')
for item in json_content["data"]["items"]:
if item["quote"]["percent"] > 3:
print(f'\033[31m', end="")
elif item["quote"]["percent"] > 0:
print(f'\033[34m', end="")
elif item["quote"]["percent"] == 0:
print(f'\033[37m', end="")
elif item["quote"]["percent"] > -3:
print(f'\033[36m', end="")
elif item["quote"]["percent"] > -8:
print(f'\033[33m', end="")
elif item["quote"]["percent"] > -10:
print(f'\033[32m', end="")
else:
print(f'\033[32m', end="")
print(f'symbol = {item["quote"]["symbol"]}, name_en = {get_chinese_initials(item["quote"]["name"]).ljust(6)}, '
f'percent = {item["quote"]["percent"]}%, current = {item["quote"]["current"]}, '
f'high = {item["quote"]["high"]}, low = {item["quote"]["low"]}, '
f'limit_up = {item["quote"]["limit_up"]}, limit_down = {item["quote"]["limit_down"]},'
f'name_cn = {item["quote"]["name"]}\033[39m')
6. 代码实例以及结果展示
import requests
from pypinyin import pinyin, Style
def get_chinese_initials(chinese_string):
return ''.join([word[0][0] for word in pinyin(chinese_string, style=Style.TONE3)])
import requests
cookies = {
'cookiesu': '241712922404752',
'device_id': '6a73424ed3aae5c44aeb59b0ddfbc91b',
's': 'bo11shkdxf',
'remember': '1',
'xq_a_token': '7ef03deb28d3396dc9d555329881fd9986211657',
'xqat': '7ef03deb28d3396dc9d555329881fd9986211657',
'xq_id_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1aWQiOjE4NzgxNDkwNzEsImlzcyI6InVjIiwiZXhwIjoxNzE1NjYzMDk3LCJjdG0iOjE3MTMxMDA5Mjc2MjYsImNpZCI6ImQ5ZDBuNEFadXAifQ.XUMYCQrcozefxhq-MVz8kB39_b5LC-wfZIEk7wytUPoTufTNNsYGnlxmoaT09V1_jadkKemvEfeDbneSTs6OaEp_aTNjMTN12xSKmUxwqqfpqzjWgZrOsUAwW3ArHYNrbT0llkfZR0nAh36p54Zl2ln-auokNRuEiqkrF-Ivpd8FPxs_b5SVXhbIM1mRgdTGyjWwCiHE9TNa7AzG870_fwimq0HefT88pjEvZSJ2tGdYAgWTYK6rmY_4nrjais4IodjkcmXpP7sFM_-OYN5NanzonuMK9OhbbOBiWNusORBeXoRUSDAyUFdNwc7Vsn5iDOm08FzVp-QmUtRGo2ne-Q',
'xq_r_token': '62e0ff828b86cfa501f1520ad6570a99838e72e5',
'xq_is_login': '1',
'u': '1878149071',
'Hm_lvt_1db88642e346389874251b5a1eded6e3': '1712922406,1713336629',
'is_overseas': '0',
'Hm_lpvt_1db88642e346389874251b5a1eded6e3': '1713927638',
}
headers = {
'authority': 'stock.xueqiu.com',
'accept': 'application/json, text/plain, */*',
'accept-language': 'zh-CN,zh;q=0.9',
# 'cookie': 'cookiesu=241712922404752; device_id=6a73424ed3aae5c44aeb59b0ddfbc91b; s=bo11shkdxf; remember=1; xq_a_token=7ef03deb28d3396dc9d555329881fd9986211657; xqat=7ef03deb28d3396dc9d555329881fd9986211657; xq_id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1aWQiOjE4NzgxNDkwNzEsImlzcyI6InVjIiwiZXhwIjoxNzE1NjYzMDk3LCJjdG0iOjE3MTMxMDA5Mjc2MjYsImNpZCI6ImQ5ZDBuNEFadXAifQ.XUMYCQrcozefxhq-MVz8kB39_b5LC-wfZIEk7wytUPoTufTNNsYGnlxmoaT09V1_jadkKemvEfeDbneSTs6OaEp_aTNjMTN12xSKmUxwqqfpqzjWgZrOsUAwW3ArHYNrbT0llkfZR0nAh36p54Zl2ln-auokNRuEiqkrF-Ivpd8FPxs_b5SVXhbIM1mRgdTGyjWwCiHE9TNa7AzG870_fwimq0HefT88pjEvZSJ2tGdYAgWTYK6rmY_4nrjais4IodjkcmXpP7sFM_-OYN5NanzonuMK9OhbbOBiWNusORBeXoRUSDAyUFdNwc7Vsn5iDOm08FzVp-QmUtRGo2ne-Q; xq_r_token=62e0ff828b86cfa501f1520ad6570a99838e72e5; xq_is_login=1; u=1878149071; Hm_lvt_1db88642e346389874251b5a1eded6e3=1712922406,1713336629; is_overseas=0; Hm_lpvt_1db88642e346389874251b5a1eded6e3=1713927638',
'origin': 'https://xueqiu.com',
'referer': 'https://xueqiu.com/',
'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Linux"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
}
response = requests.get(
'https://stock.xueqiu.com/v5/stock/batch/quote.json?symbol=SZ300750,SZ002371,SH601857,SZ002594,SZ000338,SZ300462,SH601390,SZ000656,SZ000002,SZ000672,SZ000401,SH601012,SZ000802,SH600663,SZ002439,SH600536,SH600149,SH600271,SZ300418,SZ300229,SZ002129&extend=detail&is_delay_hk=true',
cookies=cookies,
headers=headers,
)
print(f'response= {response}')
print(f'response.text= {response.text}')
print(f'response.json= {response.json()}')
json_content = response.json()
print(f'json_content.error_code = {json_content["error_code"]}')
print(f'json_content.error_description = {json_content["error_description"]}')
print(f'json_content.data.items_size = {json_content["data"]["items_size"]}')
for item in json_content["data"]["items"]:
if item["quote"]["percent"] > 3:
print(f'\033[31m', end="")
elif item["quote"]["percent"] > 0:
print(f'\033[34m', end="")
elif item["quote"]["percent"] == 0:
print(f'\033[37m', end="")
elif item["quote"]["percent"] > -3:
print(f'\033[36m', end="")
elif item["quote"]["percent"] > -8:
print(f'\033[33m', end="")
elif item["quote"]["percent"] > -10:
print(f'\033[32m', end="")
else:
print(f'\033[32m', end="")
print(f'symbol = {item["quote"]["symbol"]}, name_en = {get_chinese_initials(item["quote"]["name"]).ljust(6)}, '
f'percent = {item["quote"]["percent"]}%, current = {item["quote"]["current"]}, '
f'high = {item["quote"]["high"]}, low = {item["quote"]["low"]}, '
f'limit_up = {item["quote"]["limit_up"]}, limit_down = {item["quote"]["limit_down"]},'
f'name_cn = {item["quote"]["name"]}\033[39m')
运行结果: