본문 바로가기

Data Science/Data Collection

[04. 금융감독원 API] 009. 사업보고서 주요정보 – 소액주주 현황

728x90

소액주주 현황 API 코드를 작성해보자.

 

[그림 4.9] 소액주주 현황 개발가이드

 

import json
import pandas as pd
import requests

def get_minority_shareholder(api_key, code, year, report_code):
    fullUrl = 'https://opendart.fss.or.kr/api/mrhlSttus.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'

    minority_shareholder = get_minority_shareholder(api_key, code, year, report_code)
    print(minority_shareholder)


결과 값
rcept_no corp_cls  ... hold_stock_co hold_stock_rate
0  20190401004781        Y  ...             -               -
728x90