728x90
최대주주 현황 API 코드를 작성해보자.
import json
import pandas as pd
import requests
def get_the_largest_shareholder(api_key, code, year, report_code):
fullUrl = 'https://opendart.fss.or.kr/api/hyslrSttus.json?crtfc_key=%s&corp_code=%s&' \
'bsns_year=%s&reprt_code=%s' % (api_key, code, year, report_code)
response = requests.get(fullUrl, headers={'User-Agent': 'Mozilla/5.0'})
result = response.text
result = json.loads(result)
if result['status'] == '000':
data = pd.DataFrame(result['list'])
return data
if __name__ == '__main__':
api_key ='*'
code = '00126380'
year = '2018'
report_code = '11011'
the_largest_shareholder = get_the_largest_shareholder(api_key, code, year, report_code)
print(the_largest_shareholder)
결과 값
rcept_no corp_cls ... trmend_posesn_stock_co trmend_posesn_stock_qota_rt
0 20190401004781 Y ... 249,273,200 4.18
1 20190401004781 Y ... 19,048,733 0.32
2 20190401004781 Y ... 1,268,546 0.15
3 20190401004781 Y ... 88,802,052 1.49
4 20190401004781 Y ... 28,500 0.00
5 20190401004781 Y ... 175,000 0.00
6 20190401004781 Y ... 99,750 0.00
7 20190401004781 Y ... 50,000 0.00
8 20190401004781 Y ... 0 0.00
9 20190401004781 Y ... 619,900 0.08
10 20190401004781 Y ... 298,818,100 5.01
11 20190401004781 Y ... 4,484,150 0.08
12 20190401004781 Y ... 1,880,750 0.03
13 20190401004781 Y ... 54,153,600 0.91
14 20190401004781 Y ... 42,020,150 0.70
15 20190401004781 Y ... 508,157,148 8.51
16 20190401004781 Y ... 43,950 0.01
17 20190401004781 Y ... 1,266,991,133 21.22
18 20190401004781 Y ... 1,932,396 0.23
728x90
'Data Science > Data Collection' 카테고리의 다른 글
[04. 금융감독원 API] 009. 사업보고서 주요정보 – 소액주주 현황 (0) | 2020.02.14 |
---|---|
[04. 금융감독원 API] 008. 사업보고서 주요정보 – 최대주주 변동 현황 (0) | 2020.02.14 |
[04. 금융감독원 API] 006. 사업보고서 주요정보 – 자기주식 취득 및 처분 현황 (0) | 2020.02.14 |
[04. 금융감독원 API] 005. 사업보고서 주요정보 – 배당에 관한 사항 (0) | 2020.02.14 |
[04. 금융감독원 API] 004. 사업보고서 주요정보 – 증자(감자) 현황 (0) | 2020.02.14 |