-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathdart_share.py
33 lines (29 loc) · 898 Bytes
/
dart_share.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import requests
import json
import pandas as pd
# 대량보유 상황보고
def major_shareholders(api_key, corp_code):
url = 'https://opendart.fss.or.kr/api/majorstock.json'
params = {
'crtfc_key': api_key,
'corp_code': corp_code,
}
r = requests.get(url, params=params)
jo = json.loads(r.text)
if jo['status'] != '000' or 'list' not in jo:
print(jo)
return pd.DataFrame()
return pd.DataFrame(jo['list'])
# 임원ㆍ주요주주 소유보고
def major_shareholders_exec(api_key, corp_code):
url = 'https://opendart.fss.or.kr/api/elestock.json'
params = {
'crtfc_key': api_key,
'corp_code': corp_code,
}
r = requests.get(url, params=params)
jo = json.loads(r.text)
if jo['status'] != '000' or 'list' not in jo:
print(jo)
return pd.DataFrame()
return pd.DataFrame(jo['list'])