@@ -52,40 +52,59 @@ def run(self):
52
52
fc = "{}02" .format (security_item .code )
53
53
54
54
# 基本资料
55
- param = {"color" : "w" , "fc" : fc , "SecurityCode" : "SZ300059" }
56
- resp = requests .post ("https://emh5.eastmoney.com/api/GongSiGaiKuang/GetJiBenZiLiao" , json = param )
55
+ # param = {"color": "w", "fc": fc, "SecurityCode": "SZ300059"}
56
+
57
+ securities_code = f"{ security_item .code } .{ security_item .exchange .upper ()} "
58
+ param = {
59
+ "type" : "RPT_F10_ORG_BASICINFO" ,
60
+ "sty" : "ORG_PROFIE,MAIN_BUSINESS,FOUND_DATE,EM2016,BLGAINIAN,REGIONBK" ,
61
+ "filter" : f"(SECUCODE=\" { securities_code } \" )" ,
62
+ "client" : "app" ,
63
+ "source" : "SECURITIES" ,
64
+ "pageNumber" : 1 ,
65
+ "pageSize" : 1
66
+ }
67
+ resp = requests .get ("https://datacenter.eastmoney.com/securities/api/data/get" , params = param )
57
68
resp .encoding = "utf8"
58
69
59
- resp_json = resp .json ()["Result " ]["JiBenZiLiao" ]
70
+ resp_json = resp .json ()["result " ]["data" ][ 0 ]
60
71
61
- security_item .profile = resp_json ["CompRofile " ]
62
- security_item .main_business = resp_json ["MainBusiness " ]
63
- security_item .date_of_establishment = to_pd_timestamp (resp_json ["FoundDate " ])
72
+ security_item .profile = resp_json ["ORG_PROFIE " ]
73
+ security_item .main_business = resp_json ["MAIN_BUSINESS " ]
74
+ security_item .date_of_establishment = to_pd_timestamp (resp_json ["FOUND_DATE " ])
64
75
65
76
# 关联行业
66
- industries = "," .join (resp_json ["Industry " ].split ("-" ))
77
+ industries = "," .join (resp_json ["EM2016 " ].split ("-" ))
67
78
security_item .industries = industries
68
79
69
80
# 关联概念
70
- security_item .concept_indices = resp_json ["Block " ]
81
+ security_item .concept_indices = resp_json ["BLGAINIAN " ]
71
82
72
83
# 关联地区
73
- security_item .area_indices = resp_json ["Provice " ]
84
+ security_item .area_indices = resp_json ["REGIONBK " ]
74
85
75
86
self .sleep ()
76
87
77
88
# 发行相关
78
- param = {"color" : "w" , "fc" : fc }
79
- resp = requests .post ("https://emh5.eastmoney.com/api/GongSiGaiKuang/GetFaXingXiangGuan" , json = param )
89
+ param = {
90
+ "reportName" : "RPT_F10_ORG_ISSUEINFO" ,
91
+ "columns" : "AFTER_ISSUE_PE,ISSUE_PRICE,TOTAL_ISSUE_NUM,NET_RAISE_FUNDS,ONLINE_ISSUE_LWR" ,
92
+ "filter" : f"(SECUCODE=\" { securities_code } \" )(TYPENEW=\" 4\" )" ,
93
+ "client" : "app" ,
94
+ "source" : "SECURITIES" ,
95
+ "pageNumber" : 1 ,
96
+ "pageSize" : 1
97
+ }
98
+ resp = requests .get ("https://datacenter.eastmoney.com/securities/api/data/v1/get" , params = param )
80
99
resp .encoding = "utf8"
81
100
82
- resp_json = resp .json ()["Result " ]["FaXingXiangGuan" ]
101
+ resp_json = resp .json ()["result " ]["data" ][ 0 ]
83
102
84
- security_item .issue_pe = to_float ( resp_json ["PEIssued" ])
85
- security_item .price = to_float ( resp_json ["IssuePrice" ])
86
- security_item .issues = to_float ( resp_json ["ShareIssued" ])
87
- security_item .raising_fund = to_float (( resp_json [ "NetCollection" ]) )
88
- security_item .net_winning_rate = pct_to_float ( resp_json ["LotRateOn" ])
103
+ security_item .issue_pe = resp_json ["AFTER_ISSUE_PE" ]
104
+ security_item .price = resp_json ["ISSUE_PRICE" ]
105
+ security_item .issues = resp_json ["TOTAL_ISSUE_NUM" ]
106
+ security_item .raising_fund = resp_json . get ( "NET_RAISE_FUNDS" )
107
+ security_item .net_winning_rate = resp_json ["ONLINE_ISSUE_LWR" ]
89
108
90
109
self .session .commit ()
91
110
0 commit comments