├── .coveragerc
├── .gitattributes
├── .gitignore
├── .readthedocs.yml
├── Jenkinsfile
├── LICENSE
├── MANIFEST.in
├── README.md
├── conftest.py
├── dart_fss
├── __init__.py
├── _version.py
├── api
│ ├── __init__.py
│ ├── filings
│ │ ├── __init__.py
│ │ ├── company.py
│ │ ├── corp_code.py
│ │ ├── document.py
│ │ └── search_filings.py
│ ├── finance
│ │ ├── __init__.py
│ │ ├── fnltt_multi_acnt.py
│ │ ├── fnltt_singl_acnt.py
│ │ ├── fnltt_singl_acnt_all.py
│ │ ├── xbrl.py
│ │ └── xbrl_taxonomy.py
│ ├── helper.py
│ ├── info
│ │ ├── __init__.py
│ │ ├── accnut_adtor_nm_nd_adt_opinion.py
│ │ ├── accnut_adtor_non_adt_servc_cncls_sttus.py
│ │ ├── adt_servc_cncls_sttus.py
│ │ ├── alot_matter.py
│ │ ├── cndl_capl_scrits_nrdmp_blce.py
│ │ ├── cprnd_nrdmp_blce.py
│ │ ├── det_scrits_isu_acmslt.py
│ │ ├── drctr_adt_all_mendng_sttus_gmtsck_confm_amount.py
│ │ ├── drctr_adt_all_mendng_sttus_mendng_pymntamt_ty_cl.py
│ │ ├── emp_sttus.py
│ │ ├── entrprs_bil_scrits_nrdmp_blce.py
│ │ ├── exctv_sttus.py
│ │ ├── hmv_audit_all_sttus.py
│ │ ├── hmv_audit_indvdl_by_sttus.py
│ │ ├── hyslr_chg_sttus.py
│ │ ├── hyslr_sttus.py
│ │ ├── indvdl_by_pay.py
│ │ ├── irds_sttus.py
│ │ ├── mrhl_sttus.py
│ │ ├── new_capl_scrits_nrdmp_blce.py
│ │ ├── otr_cpr_invstmnt_sttus.py
│ │ ├── outcmpny_drctr_nd_change_sttus.py
│ │ ├── prvsrp_cptal_use_dtls.py
│ │ ├── pssrp_cptal_use_dtls.py
│ │ ├── srtpd_psndbt_nrdmp_blce.py
│ │ ├── stock_totqy_sttus.py
│ │ ├── tesstk_acqs_dsps_sttus.py
│ │ └── unrst_exctv_mendng_sttus.py
│ ├── issue
│ │ ├── __init__.py
│ │ ├── ast_inhtrf_etc_ptbk_opt.py
│ │ ├── bdwt_is_decsn.py
│ │ ├── bnk_mngt_pcbg.py
│ │ ├── bnk_mngt_pcsp.py
│ │ ├── bsn_inh_decsn.py
│ │ ├── bsn_sp.py
│ │ ├── bsn_trf_decsn.py
│ │ ├── cmp_dv_decsn.py
│ │ ├── cmp_dvmg_decsn.py
│ │ ├── cmp_mg_decsn.py
│ │ ├── cr_decsn.py
│ │ ├── ctrcvs_bgrq.py
│ │ ├── cvbd_is_decsn.py
│ │ ├── df_ocr.py
│ │ ├── ds_rs_ocr.py
│ │ ├── exbd_is_decsn.py
│ │ ├── fric_decsn.py
│ │ ├── lwst_lg.py
│ │ ├── otcpr_stk_invscr_inh_decsn.py
│ │ ├── otcpr_stk_invscr_trf_decsn.py
│ │ ├── ov_dlst.py
│ │ ├── ov_dlst_decsn.py
│ │ ├── ov_lst.py
│ │ ├── ov_lst_decsn.py
│ │ ├── pifric_decsn.py
│ │ ├── piic_decsn.py
│ │ ├── stk_extr_decsn.py
│ │ ├── stkrtbd_inh_decsn.py
│ │ ├── stkrtbd_trf_decsn.py
│ │ ├── tgast_inh_decsn.py
│ │ ├── tgast_trf_decsn.py
│ │ ├── tsstk_aq_decsn.py
│ │ ├── tsstk_aq_trctr_cc_decsn.py
│ │ ├── tsstk_aq_trctr_cns_decsn.py
│ │ ├── tsstk_dp_decsn.py
│ │ └── wd_cocobd_is_decsn.py
│ ├── market
│ │ ├── __init__.py
│ │ ├── stock_market.py
│ │ └── trading_halt.py
│ ├── registration
│ │ ├── __init__.py
│ │ ├── bd_rs.py
│ │ ├── dv_rs.py
│ │ ├── estk_rs.py
│ │ ├── extr_rs.py
│ │ ├── mg_rs.py
│ │ └── stkdp_rs.py
│ └── shareholder
│ │ ├── __init__.py
│ │ ├── elestock.py
│ │ └── majorstock.py
├── auth
│ ├── __init__.py
│ └── auth.py
├── corp
│ ├── __init__.py
│ ├── corp.py
│ └── corp_list.py
├── errors
│ ├── __init__.py
│ ├── checker.py
│ └── errors.py
├── filings
│ ├── __init__.py
│ ├── pages.py
│ ├── reports.py
│ ├── search.py
│ ├── search_result.py
│ └── xbrl_viewer.py
├── fs
│ ├── __init__.py
│ ├── extract.py
│ └── fs.py
├── tests
│ ├── __init__.py
│ ├── test_api_filings.py
│ ├── test_api_finance.py
│ ├── test_api_info.py
│ ├── test_api_issue.py
│ ├── test_api_market.py
│ ├── test_api_registration.py
│ ├── test_api_shareholder.py
│ ├── test_auth.py
│ ├── test_case
│ │ ├── crp_case.py
│ │ └── testcrp.py
│ ├── test_corp.py
│ ├── test_errors.py
│ ├── test_fs.py
│ ├── test_fs_search.py
│ ├── test_regex.py
│ ├── test_reports.py
│ ├── test_search_report.py
│ ├── test_utils.py
│ └── test_xbrl.py
├── utils
│ ├── __init__.py
│ ├── cache.py
│ ├── dataframe.py
│ ├── datetime.py
│ ├── file.py
│ ├── notebook.py
│ ├── regex.py
│ ├── request.py
│ ├── singleton.py
│ ├── spinner.py
│ └── string.py
└── xbrl
│ ├── __init__.py
│ ├── dart_xbrl.py
│ ├── helper.py
│ ├── table.py
│ └── xbrl.py
├── docs
├── Makefile
├── conf.py
├── dart_api.rst
├── dart_auth.rst
├── dart_corp.rst
├── dart_errors.rst
├── dart_fs.rst
├── dart_request.rst
├── dart_search.rst
├── dart_types.rst
├── dart_xbrl.rst
├── index.rst
├── license.rst
├── make.bat
├── requirements.txt
└── welcome.rst
├── pyproject.toml
├── requirements.txt
├── setup.cfg
├── setup.py
└── versioneer.py
/.coveragerc:
--------------------------------------------------------------------------------
1 | [run]
2 | omit =
3 | dart_fss/_version.py
4 |
5 | [report]
6 | exclude_lines =
7 | # Don't complain about missing debug-only code:
8 | def __repr__
9 | def _repr_html_
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | dart_fss/_version.py export-subst
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 | MANIFEST
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 | .pytest_cache/
49 |
50 | # Translations
51 | *.mo
52 | *.pot
53 |
54 | # Django stuff:
55 | *.log
56 | local_settings.py
57 | db.sqlite3
58 |
59 | # Flask stuff:
60 | instance/
61 | .webassets-cache
62 |
63 | # Scrapy stuff:
64 | .scrapy
65 |
66 | # Sphinx documentation
67 | docs/_build/
68 |
69 | # PyBuilder
70 | target/
71 |
72 | # Jupyter Notebook
73 | .ipynb_checkpoints
74 |
75 | # pyenv
76 | .python-version
77 |
78 | # celery beat schedule file
79 | celerybeat-schedule
80 |
81 | # SageMath parsed files
82 | *.sage.py
83 |
84 | # Environments
85 | .env
86 | .venv
87 | env/
88 | venv/
89 | ENV/
90 | env.bak/
91 | venv.bak/
92 | .idea/
93 |
94 | # Spyder project settings
95 | .spyderproject
96 | .spyproject
97 |
98 | # Rope project settings
99 | .ropeproject
100 |
101 | # mkdocs documentation
102 | /site
103 |
104 | # mypy
105 | .mypy_cache/
106 |
107 | #jupyter notebook
108 | *.ipynb
--------------------------------------------------------------------------------
/.readthedocs.yml:
--------------------------------------------------------------------------------
1 | # .readthedocs.yml
2 |
3 | version: 2
4 |
5 | build:
6 | os: "ubuntu-22.04"
7 | tools:
8 | python: "3.10"
9 |
10 | sphinx:
11 | configuration: docs/conf.py
12 |
13 | python:
14 | install:
15 | - requirements: docs/requirements.txt
16 |
--------------------------------------------------------------------------------
/Jenkinsfile:
--------------------------------------------------------------------------------
1 | pipeline {
2 | agent any
3 | stages {
4 | stage('Python3.7') {
5 | agent {
6 | docker {
7 | image 'python:3.7.16'
8 | args '-u root:sudo'
9 | }
10 |
11 | }
12 | post {
13 | cleanup {
14 | cleanWs()
15 | }
16 |
17 | }
18 | steps {
19 | sh 'pip install -r requirements.txt'
20 | sh 'pip install -U codecov pytest pytest-cov'
21 | sh 'pytest --cov-report=term-missing --cov=./dart_fss'
22 | sh 'codecov'
23 | }
24 | }
25 |
26 | stage('Python3.8') {
27 | agent {
28 | docker {
29 | image 'python:3.8.16'
30 | args '-u root:sudo'
31 | }
32 |
33 | }
34 | post {
35 | cleanup {
36 | cleanWs()
37 | }
38 |
39 | }
40 | steps {
41 | sh 'pip install -r requirements.txt'
42 | sh 'pip install -U codecov pytest pytest-cov'
43 | sh 'pytest --cov-report=term-missing --cov=./dart_fss'
44 | sh 'codecov'
45 | }
46 | }
47 |
48 | stage('Python3.9') {
49 | agent {
50 | docker {
51 | image 'python:3.9.16'
52 | args '-u root:sudo'
53 | }
54 |
55 | }
56 | post {
57 | cleanup {
58 | cleanWs()
59 | }
60 |
61 | }
62 | steps {
63 | sh 'pip install -r requirements.txt'
64 | sh 'pip install -U codecov pytest pytest-cov'
65 | sh 'pytest --cov-report=term-missing --cov=./dart_fss'
66 | sh 'codecov'
67 | }
68 | }
69 |
70 | stage('Python3.10') {
71 | agent {
72 | docker {
73 | image 'python:3.10.9'
74 | args '-u root:sudo'
75 | }
76 |
77 | }
78 | post {
79 | cleanup {
80 | cleanWs()
81 | }
82 |
83 | }
84 | steps {
85 | sh 'pip install -r requirements.txt'
86 | sh 'pip install -U codecov pytest pytest-cov'
87 | sh 'pytest --cov-report=term-missing --cov=./dart_fss'
88 | sh 'codecov'
89 | }
90 | }
91 |
92 | stage('Python3.11') {
93 | agent {
94 | docker {
95 | image 'python:3.11.7'
96 | args '-u root:sudo'
97 | }
98 |
99 | }
100 | post {
101 | cleanup {
102 | cleanWs()
103 | }
104 |
105 | }
106 | steps {
107 | sh 'pip install -r requirements.txt'
108 | sh 'pip install -U codecov pytest pytest-cov'
109 | sh 'pytest --cov-report=term-missing --cov=./dart_fss'
110 | sh 'codecov'
111 | }
112 | }
113 | stage('Python3.12') {
114 | agent {
115 | docker {
116 | image 'python:3.12.1'
117 | args '-u root:sudo'
118 | }
119 |
120 | }
121 | post {
122 | cleanup {
123 | cleanWs()
124 | }
125 |
126 | }
127 | steps {
128 | sh 'pip install -r requirements.txt'
129 | sh 'pip install -U codecov pytest pytest-cov'
130 | sh 'pytest --runslow --cov-report=term-missing --cov=./dart_fss'
131 | sh 'codecov'
132 | }
133 | }
134 |
135 | }
136 | environment {
137 | DART_API_KEY = credentials('DART_API_KEY')
138 | CODECOV_TOKEN = credentials('CODECOV_TOKEN')
139 | }
140 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019-2024 Sungwoo Jo
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include versioneer.py
2 | include dart_fss/_version.py
3 | include requirements.txt
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Dart-Fss
2 | [](https://pypi.org/project/dart-fss/)
3 | 
4 | 
5 | [](https://codecov.io/gh/josw123/dart-fss)
6 | [](https://www.codacy.com/app/josw123/dart-fss?utm_source=github.com&utm_medium=referral&utm_content=josw123/dart-fss&utm_campaign=Badge_Grade)
7 |
8 | 대한민국 금융감독원에서 운영하는 다트([DART](https://dart.fss.or.kr)) 사이트 크롤링 및 재무제표 추출을 위한 라이브러리
9 |
10 | - Source code: https://github.com/josw123/dart-fss
11 |
12 | ## Features
13 |
14 | - [Open DART](https://opendart.fss.or.kr/)의 오픈 API를 이용한 전자공시 조회
15 | - [DART](https://dart.fss.or.kr)의 전자공시 정보를 이용한 재무제표 추출
16 |
17 | ## Installation
18 |
19 | - Open DART 지원 / 신규 Open DART API Key 필요
20 | - Python 3.7 이상 지원
21 | - Documentation: https://dart-fss.readthedocs.io/
22 |
23 | ``` bash
24 | pip install -U dart-fss
25 | ```
26 |
27 | ## Usage
28 |
29 | ### Dart API Key 설정
30 |
31 | - [OPEN DART API 신청](https://opendart.fss.or.kr/)
32 | - 환경 변수 DART_API_KEY 설정 또는 패키지 사용전 아래와 같이 설정
33 |
34 | ### Quick Starts
35 |
36 | ```python
37 | import dart_fss as dart
38 |
39 | # Open DART API KEY 설정
40 | api_key='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
41 | dart.set_api_key(api_key=api_key)
42 |
43 | # DART 에 공시된 회사 리스트 불러오기
44 | corp_list = dart.get_corp_list()
45 |
46 | # 삼성전자 검색
47 | samsung = corp_list.find_by_corp_name('삼성전자', exactly=True)[0]
48 |
49 | # 2012년부터 연간 연결재무제표 불러오기
50 | fs = samsung.extract_fs(bgn_de='20120101')
51 |
52 | # 재무제표 검색 결과를 엑셀파일로 저장 ( 기본저장위치: 실행폴더/fsdata )
53 | fs.save()
54 | ```
55 |
56 | ## 주의사항
57 |
58 | - Open DART 및 DART 홈페이지의 경우 분당 1000회 이상 요청시 서비스가 제한될 수 있음
59 | - [관련 공지사항](https://opendart.fss.or.kr/cop/bbs/selectArticleList.do?bbsId=B0000000000000000002): [FAQ]->[오픈API 이용한도는 어떻게 되나요?]
60 |
61 | ## License
62 | This project is licensed under the MIT License
63 |
--------------------------------------------------------------------------------
/conftest.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 | import pytest
4 |
5 |
6 | def pytest_addoption(parser):
7 | print("add option")
8 | if sys.version_info[0] != 3:
9 | pytest.skip('This Python version({}) is not supported'.format(sys.version))
10 |
11 | parser.addoption("--loc", action="store", default="local", metavar="LOCATION",
12 | help="Test environment")
13 | parser.addoption(
14 | "--runslow", action="store_true", default=False, help="run slow tests"
15 | )
16 |
17 |
18 | def pytest_configure(config):
19 | config.addinivalue_line("markers", "slow: mark test as slow to run")
20 |
21 |
22 | def pytest_collection_modifyitems(config, items):
23 | if config.getoption("--runslow"):
24 | # --runslow given in cli: do not skip slow tests
25 | return
26 | skip_slow = pytest.mark.skip(reason="need --runslow option to run")
27 | for item in items:
28 | if "slow" in item.keywords:
29 | item.add_marker(skip_slow)
30 |
31 |
32 | @pytest.fixture(scope="session", autouse=True)
33 | def local(request):
34 | location = request.config.getoption("--loc")
35 | if location == 'local':
36 | return True
37 | elif location == 'remote':
38 | return False
39 | elif location == 'travis':
40 | return False
41 | else:
42 | raise ValueError('Unknown option')
43 |
44 |
45 | @pytest.fixture(scope="session")
46 | def dart(local):
47 | import dart_fss
48 | if local:
49 | env_key = 'DART_API_KEY'
50 | else:
51 | env_key = 'DART_API_TEST_KEY_V3{}'.format(sys.version_info[1])
52 | api_key = os.getenv(env_key)
53 | if api_key is None:
54 | pytest.skip('Please, set valid "{}" env variable'.format(env_key))
55 | dart_fss.set_api_key(api_key)
56 | dart_fss.enable_spinner(False)
57 | dart_fss.utils.request.set_delay(0.5)
58 | return dart_fss
59 |
--------------------------------------------------------------------------------
/dart_fss/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss import api, auth, corp, errors, filings, fs, utils, xbrl
3 | from dart_fss.auth import set_api_key, get_api_key
4 | from dart_fss.corp import get_corp_list
5 | from dart_fss.filings import search
6 | from dart_fss.fs import extract
7 | from dart_fss.xbrl import get_xbrl_from_file
8 | from dart_fss.utils import enable_spinner
9 |
10 | __all__ = [
11 | 'api',
12 | 'auth', 'set_api_key', 'get_api_key',
13 | 'corp', 'get_corp_list',
14 | 'errors',
15 | 'filings', 'search',
16 | 'fs', 'extract',
17 | 'utils',
18 | 'xbrl', 'get_xbrl_from_file',
19 | 'enable_spinner'
20 | ]
21 |
22 | from ._version import get_versions
23 | __version__ = get_versions()['version']
24 |
25 | del get_versions
26 |
--------------------------------------------------------------------------------
/dart_fss/api/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.api import filings, finance, info, issue, market, registration, shareholder
3 |
4 |
5 | __all__ = ['filings', 'finance', 'info', 'issue',
6 | 'market', 'registration', 'shareholder']
7 |
--------------------------------------------------------------------------------
/dart_fss/api/filings/__init__.py:
--------------------------------------------------------------------------------
1 | from .company import get_corp_info
2 | from .corp_code import get_corp_code
3 | from .document import download_document
4 | from .search_filings import search_filings
5 |
6 |
7 | __all__ = ['get_corp_info', 'get_corp_code',
8 | 'download_document', 'search_filings']
9 |
--------------------------------------------------------------------------------
/dart_fss/api/filings/company.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from ..helper import api_request
3 |
4 |
5 | def get_corp_info(corp_code: str):
6 | """ 기업 개황 조회
7 |
8 | Parameters
9 | ----------
10 | corp_code: str
11 | 공시대상회사의 고유번호(8자리)
12 |
13 | Returns
14 | -------
15 | dict
16 | 기업 개황
17 | """
18 | path = '/api/company.json'
19 |
20 | return api_request(path=path, corp_code=corp_code)
21 |
--------------------------------------------------------------------------------
/dart_fss/api/filings/corp_code.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from collections import OrderedDict
3 |
4 | from dart_fss.auth import get_api_key
5 | from dart_fss.utils import request, unzip, get_cache_folder, search_file, xml_to_dict
6 |
7 |
8 | def get_corp_code() -> OrderedDict:
9 | """ DART에 등록되어있는 공시대상회사의 고유번호,회사명,대표자명,종목코드, 최근변경일자 다운로드
10 |
11 | Returns
12 | -------
13 | OrderedDict
14 | 고유번호 및 회사 정보
15 | """
16 | import tempfile
17 |
18 | with tempfile.TemporaryDirectory() as path:
19 | url = 'https://opendart.fss.or.kr/api/corpCode.xml'
20 |
21 | # Set API KEY
22 | api_key = get_api_key()
23 | payload = {'crtfc_key': api_key}
24 |
25 | # Request Download
26 | resp = request.download(url=url, path=path, payload=payload)
27 | download_path = resp['full_path']
28 | cache_folder = get_cache_folder()
29 |
30 | # Unzip File in User Cache Folder
31 | unzip_path = unzip(file=download_path, path=cache_folder)
32 |
33 | # Search CORPCODE.xml
34 | files = search_file(
35 | path=unzip_path, filename='CORPCODE', extensions='xml')
36 | if len(files) == 0:
37 | raise FileNotFoundError('CORPCODE.xml Not Found')
38 |
39 | file = files[0]
40 | data = xml_to_dict(file)
41 | return data['result']['list']
42 |
--------------------------------------------------------------------------------
/dart_fss/api/filings/document.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.auth import get_api_key
3 | from dart_fss.utils import request
4 |
5 |
6 | def download_document(path: str, rcept_no: str) -> str:
7 | """ 공시서류원본파일 다운로드
8 |
9 | Parameters
10 | ----------
11 | path: str
12 | download path
13 | rcept_no: str
14 | 접수번호
15 |
16 | Returns
17 | -------
18 | str
19 | download full path
20 | """
21 | url = 'https://opendart.fss.or.kr/api/document.xml'
22 |
23 | # Set API KEY
24 | api_key = get_api_key()
25 | payload = {
26 | 'crtfc_key': api_key,
27 | 'rcept_no': rcept_no,
28 | }
29 |
30 | resp = request.download(url=url, path=path, payload=payload)
31 | return resp['full_path']
32 |
--------------------------------------------------------------------------------
/dart_fss/api/filings/search_filings.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Union, List
3 |
4 | from dart_fss.auth import get_api_key
5 | from dart_fss.utils import request, str_upper
6 | from dart_fss.errors import check_status
7 |
8 | str_or_list = Union[str, List[str]]
9 |
10 |
11 | def search_filings(corp_code: str = None,
12 | bgn_de: str = None,
13 | end_de: str = None,
14 | last_reprt_at: str = 'N',
15 | pblntf_ty: str_or_list = None,
16 | pblntf_detail_ty: str_or_list = None,
17 | corp_cls: str = None,
18 | sort: str = 'date',
19 | sort_mth: str = 'desc',
20 | page_no: int = 1,
21 | page_count: int = 10):
22 | """ 공시보고서 검색
23 |
24 | Parameters
25 | ----------
26 | corp_code: str, optional
27 | 공시대상회사의 고유번호(8자리), 고유번호(corp_code)가 없는 경우 검색기간은 3개월로 제한
28 | bgn_de: str, optional
29 | 검색시작 접수일자(YYYYMMDD), 없으면 종료일(end_de)
30 | end_de: str, optional
31 | 검색종료 접수일자(YYYYMMDD), 없으면 당일
32 | last_reprt_at: str, optional
33 | 최종보고서만 검색여부(Y or N), default : N
34 | pblntf_ty: str, optional
35 | 공시유형
36 | pblntf_detail_ty: str, optional
37 | 공시상세유형
38 | corp_cls: str, optional
39 | 법인구분 : Y(유가), K(코스닥), N(코넥스), E(기타), 없으면 전체조회
40 | sort: str, optional
41 | 정렬, {접수일자: date, 회사명: crp, 고서명: rpt}
42 | sort_mth: str, optional
43 | 오름차순(asc), 내림차순(desc), default : desc
44 | page_no: int, optional
45 | 페이지 번호(1~n) default : 1
46 | page_count: int, optional
47 | 페이지당 건수(1~100) 기본값 : 10, default : 100
48 |
49 | Returns
50 | -------
51 | dict
52 | Response data
53 | """
54 | url = 'https://opendart.fss.or.kr/api/list.json'
55 |
56 | api_key = get_api_key()
57 |
58 | last_reprt_at = str_upper(last_reprt_at)
59 | pblntf_ty = str_upper(pblntf_ty)
60 | pblntf_detail_ty = str_upper(pblntf_detail_ty)
61 |
62 | payload = {
63 | 'crtfc_key': api_key,
64 | 'corp_code': corp_code,
65 | 'bgn_de': bgn_de,
66 | 'end_de': end_de,
67 | 'last_reprt_at': last_reprt_at,
68 | 'pblntf_ty': pblntf_ty,
69 | 'pblntf_detail_ty': pblntf_detail_ty,
70 | 'corp_cls': corp_cls,
71 | 'sort': sort,
72 | 'sort_mth': sort_mth,
73 | 'page_no': page_no,
74 | 'page_count': page_count
75 | }
76 |
77 | resp = request.get(url=url, payload=payload)
78 | dataset = resp.json()
79 |
80 | # Check Error
81 | check_status(**dataset)
82 | return dataset
83 |
--------------------------------------------------------------------------------
/dart_fss/api/finance/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from .fnltt_singl_acnt import fnltt_singl_acnt
3 | from .fnltt_multi_acnt import fnltt_multi_acnt
4 | from .fnltt_singl_acnt_all import fnltt_singl_acnt_all
5 | from .xbrl_taxonomy import xbrl_taxonomy
6 | from .xbrl import download_xbrl
7 |
8 |
9 | __all__ = [
10 | 'fnltt_singl_acnt',
11 | 'fnltt_multi_acnt',
12 | 'fnltt_singl_acnt_all',
13 | 'xbrl_taxonomy',
14 | 'download_xbrl'
15 | ]
16 |
--------------------------------------------------------------------------------
/dart_fss/api/finance/fnltt_multi_acnt.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def fnltt_multi_acnt(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 상장법인(금융업 제외)이 제출한 정기보고서 내에 XBRL재무제표의 주요계정과목(재무상태표, 손익계산서)을 제공합니다.
13 |
14 | (상장법인 복수조회 가능)
15 |
16 | Parameters
17 | ----------
18 | corp_code: str
19 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
20 | bsns_year: str
21 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
22 | reprt_code: str
23 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
24 | api_key: str, optional
25 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
26 | Returns
27 | -------
28 | dict
29 | 다중회사 주요계정
30 | """
31 |
32 | path = '/api/fnlttMultiAcnt.json'
33 |
34 | return api_request(
35 | api_key=api_key,
36 | path=path,
37 | corp_code=corp_code,
38 | bsns_year=bsns_year,
39 | reprt_code=reprt_code,
40 | )
41 |
--------------------------------------------------------------------------------
/dart_fss/api/finance/fnltt_singl_acnt.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def fnltt_singl_acnt(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 상장법인(금융업 제외)이 제출한 정기보고서 내에 XBRL재무제표의 주요계정과목(재무상태표, 손익계산서)을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 단일회사 주요계정
28 | """
29 |
30 | path = '/api/fnlttSinglAcnt.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/finance/fnltt_singl_acnt_all.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def fnltt_singl_acnt_all(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | fs_div: str,
11 | api_key: str = None
12 | ) -> Dict:
13 | """ 상장법인(금융업 제외)이 제출한 정기보고서 내에 XBRL재무제표의 모든계정과목을 제공합니다.
14 |
15 | Parameters
16 | ----------
17 | corp_code: str
18 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
19 | bsns_year: str
20 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
21 | reprt_code: str
22 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
23 | fs_div: str
24 | CFS:연결재무제표, OFS:재무제표
25 | api_key: str, optional
26 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
27 | Returns
28 | -------
29 | dict
30 | 단일회사 전체 재무제표
31 | """
32 |
33 | path = '/api/fnlttSinglAcntAll.json'
34 |
35 | return api_request(
36 | api_key=api_key,
37 | path=path,
38 | corp_code=corp_code,
39 | bsns_year=bsns_year,
40 | reprt_code=reprt_code,
41 | fs_div=fs_div,
42 | )
43 |
--------------------------------------------------------------------------------
/dart_fss/api/finance/xbrl.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.auth import get_api_key
3 | from dart_fss.utils import request, unzip, search_file
4 |
5 |
6 | def download_xbrl(path: str, rcept_no: str, reprt_code: str = None) -> str:
7 | """ XBRL 파일 다운로드
8 |
9 | Parameters
10 | ----------
11 | path: str
12 | Download Path
13 | rcept_no: str
14 | 접수번호
15 | reprt_code: str, optinal
16 | 1분기보고서 : 11013 반기보고서 : 11012 3분기보고서 : 11014 사업보고서 : 11011
17 |
18 | Returns
19 | -------
20 | str
21 | xbrl file path
22 |
23 | """
24 | import tempfile
25 |
26 | with tempfile.TemporaryDirectory() as temp:
27 | url = 'https://opendart.fss.or.kr/api/fnlttXbrl.xml'
28 |
29 | # Set API KEY
30 | api_key = get_api_key()
31 | payload = {
32 | 'crtfc_key': api_key,
33 | 'rcept_no': rcept_no,
34 | 'reprt_code': reprt_code
35 | }
36 |
37 | # Request Download
38 | resp = request.download(url=url, path=temp, payload=payload)
39 | download_path = resp['full_path']
40 |
41 | # Unzip File in User Cache Folder
42 | unzip_path = unzip(file=download_path, path=path)
43 |
44 | # Search XBRL file
45 | files = search_file(path=unzip_path)
46 | if len(files) == 0:
47 | raise FileNotFoundError('XBRL File Not Found')
48 |
49 | file = files[0]
50 | return file
51 |
--------------------------------------------------------------------------------
/dart_fss/api/finance/xbrl_taxonomy.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def xbrl_taxonomy(
7 | sj_div: str,
8 | api_key: str = None
9 | ) -> Dict:
10 | """ 금융감독원 회계포탈에서 제공하는 IFRS 기반 XBRL 재무제표 공시용 표준계정과목체계(계정과목) 을 제공합니다.
11 |
12 | Parameters
13 | ----------
14 | sj_div: str
15 | (※재무제표구분 참조)
16 | api_key: str, optional
17 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
18 | Returns
19 | -------
20 | dict
21 | XBRL택사노미재무제표양식
22 | """
23 |
24 | path = '/api/xbrlTaxonomy.json'
25 |
26 | return api_request(
27 | api_key=api_key,
28 | path=path,
29 | sj_div=sj_div,
30 | )
31 |
--------------------------------------------------------------------------------
/dart_fss/api/helper.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import re
3 |
4 | from urllib.parse import urljoin
5 | from dart_fss.auth import get_api_key
6 | from dart_fss.utils import request
7 | from dart_fss.errors import check_status
8 |
9 | # corp_code check regular expression
10 | corp_code_checker = re.compile(r'^([0-9]{8})(,[0-9]{8})*$')
11 | # bsns_year check regular expression
12 | bsns_year_checker = re.compile(r'^[0-9]{4}$')
13 | # reprt_code check regular expression
14 | reptr_code_checker = re.compile(r'^1101[1-4]$')
15 | # date check regular expression
16 | date_checker = re.compile(r'^[0-9]{8}$')
17 | # fs_div check regular expression
18 | fs_div_checker = re.compile(r'CFS|OFS', re.IGNORECASE)
19 | # sj_div check list
20 | sj_div_checker = ('BS1', 'BS2', 'BS3', 'BS4', 'IS1', 'IS2', 'IS3', 'IS4', 'CIS1', 'CIS2', 'CIS3', 'CIS4', 'DCIS1',
21 | 'DCIS2', 'DCIS3', 'DCIS4', 'DCIS5', 'DCIS6', 'DCIS7', 'DCIS8', 'CF1', 'CF2', 'CF3', 'CF4', 'SCE1',
22 | 'SCE2')
23 |
24 |
25 | def api_request(
26 | path: str,
27 | corp_code: str = None,
28 | bsns_year: str = None,
29 | reprt_code: str = None,
30 | bgn_de: str = None,
31 | end_de: str = None,
32 | fs_div: str = None,
33 | sj_div: str = None,
34 | api_key: str = None
35 | ) -> dict:
36 | """ API Request Helper
37 |
38 | Parameters
39 | ----------
40 | path: str
41 | API Path
42 | corp_code: str
43 | Corporation Code (8 digits)
44 | bsns_year: str, optional
45 | Year (4 digits)
46 | reprt_code: str, optional
47 | Report code( Q1: 11013, half: 11012, Q3: 11014, Annual: 11011)
48 | bgn_de: str, optional
49 | Searching Start date (YYYYMMDD)
50 | end_de: str, optional
51 | Searching End date (YYYYMMDD)
52 | fs_div: str, optional
53 | CFS:Consolidated Financial Statements, OFS:Separate financial statements
54 | sj_div: str, optional
55 | Classification of financial statements(https://opendart.fss.or.kr/guide/detail.do?apiGrpCd=DS003&apiId=2020001)
56 | api_key: str, optional
57 | DART_API_KEY(If not set, use environment variable DART_API_KEY)
58 | Returns
59 | -------
60 | dict
61 | API Request Result
62 | """
63 |
64 | if corp_code and corp_code_checker.search(corp_code) is None:
65 | raise ValueError('corp_code must be 8 digits')
66 |
67 | if bsns_year and bsns_year_checker.search(bsns_year) is None:
68 | raise ValueError('bsns_year must be 4 digits')
69 |
70 | if reprt_code and reptr_code_checker.search(reprt_code) is None:
71 | raise ValueError('invalid reprt_code')
72 |
73 | if bgn_de and date_checker.search(bgn_de) is None:
74 | raise ValueError('invalid bgn_de')
75 |
76 | if end_de and date_checker.search(end_de) is None:
77 | raise ValueError('invalid end_de')
78 |
79 | if fs_div:
80 | if fs_div_checker.search(fs_div) is None:
81 | raise ValueError('fs_div must be CFS or OFS')
82 | fs_div = fs_div.upper()
83 |
84 | if sj_div:
85 | if sj_div not in sj_div_checker:
86 | raise ValueError('invalid sj_div')
87 |
88 | # Open DART Base URL
89 | base = 'https://opendart.fss.or.kr/'
90 | # Request URL
91 | url = urljoin(base, path)
92 |
93 | # Get DART_API_KEY
94 | if api_key is None:
95 | api_key = get_api_key()
96 |
97 | # Set payload
98 | payload = {
99 | 'crtfc_key': api_key,
100 | 'corp_code': corp_code,
101 | 'bsns_year': bsns_year,
102 | 'reprt_code': reprt_code,
103 | 'bgn_de': bgn_de,
104 | 'end_de': end_de,
105 | 'fs_div': fs_div,
106 | 'sj_div': sj_div,
107 | }
108 |
109 | payload = {k: v for k, v in payload.items() if v is not None}
110 |
111 | # Request Data
112 | resp = request.get(url=url, payload=payload)
113 |
114 | # Convert Response to json
115 | dataset = resp.json()
116 |
117 | # Status Code Check
118 | check_status(**dataset)
119 | return dataset
120 |
--------------------------------------------------------------------------------
/dart_fss/api/info/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from .cndl_capl_scrits_nrdmp_blce import cndl_capl_scrits_nrdmp_blce
3 | from .unrst_exctv_mendng_sttus import unrst_exctv_mendng_sttus
4 | from .cprnd_nrdmp_blce import cprnd_nrdmp_blce
5 | from .srtpd_psndbt_nrdmp_blce import srtpd_psndbt_nrdmp_blce
6 | from .entrprs_bil_scrits_nrdmp_blce import entrprs_bil_scrits_nrdmp_blce
7 | from .det_scrits_isu_acmslt import det_scrits_isu_acmslt
8 | from .prvsrp_cptal_use_dtls import prvsrp_cptal_use_dtls
9 | from .pssrp_cptal_use_dtls import pssrp_cptal_use_dtls
10 | from .drctr_adt_all_mendng_sttus_gmtsck_confm_amount import drctr_adt_all_mendng_sttus_gmtsck_confm_amount
11 | from .drctr_adt_all_mendng_sttus_mendng_pymntamt_ty_cl import drctr_adt_all_mendng_sttus_mendng_pymntamt_ty_cl
12 | from .stock_totqy_sttus import stock_totqy_sttus
13 | from .accnut_adtor_nm_nd_adt_opinion import accnut_adtor_nm_nd_adt_opinion
14 | from .adt_servc_cncls_sttus import adt_servc_cncls_sttus
15 | from .accnut_adtor_non_adt_servc_cncls_sttus import accnut_adtor_non_adt_servc_cncls_sttus
16 | from .outcmpny_drctr_nd_change_sttus import outcmpny_drctr_nd_change_sttus
17 | from .new_capl_scrits_nrdmp_blce import new_capl_scrits_nrdmp_blce
18 | from .irds_sttus import irds_sttus
19 | from .alot_matter import alot_matter
20 | from .tesstk_acqs_dsps_sttus import tesstk_acqs_dsps_sttus
21 | from .hyslr_sttus import hyslr_sttus
22 | from .hyslr_chg_sttus import hyslr_chg_sttus
23 | from .mrhl_sttus import mrhl_sttus
24 | from .exctv_sttus import exctv_sttus
25 | from .emp_sttus import emp_sttus
26 | from .hmv_audit_indvdl_by_sttus import hmv_audit_indvdl_by_sttus
27 | from .hmv_audit_all_sttus import hmv_audit_all_sttus
28 | from .indvdl_by_pay import indvdl_by_pay
29 | from .otr_cpr_invstmnt_sttus import otr_cpr_invstmnt_sttus
30 |
31 |
32 | __all__ = [
33 | 'cndl_capl_scrits_nrdmp_blce',
34 | 'unrst_exctv_mendng_sttus',
35 | 'cprnd_nrdmp_blce',
36 | 'srtpd_psndbt_nrdmp_blce',
37 | 'entrprs_bil_scrits_nrdmp_blce',
38 | 'det_scrits_isu_acmslt',
39 | 'prvsrp_cptal_use_dtls',
40 | 'pssrp_cptal_use_dtls',
41 | 'drctr_adt_all_mendng_sttus_gmtsck_confm_amount',
42 | 'drctr_adt_all_mendng_sttus_mendng_pymntamt_ty_cl',
43 | 'stock_totqy_sttus',
44 | 'accnut_adtor_nm_nd_adt_opinion',
45 | 'adt_servc_cncls_sttus',
46 | 'accnut_adtor_non_adt_servc_cncls_sttus',
47 | 'outcmpny_drctr_nd_change_sttus',
48 | 'new_capl_scrits_nrdmp_blce',
49 | 'irds_sttus',
50 | 'alot_matter',
51 | 'tesstk_acqs_dsps_sttus',
52 | 'hyslr_sttus',
53 | 'hyslr_chg_sttus',
54 | 'mrhl_sttus',
55 | 'exctv_sttus',
56 | 'emp_sttus',
57 | 'hmv_audit_indvdl_by_sttus',
58 | 'hmv_audit_all_sttus',
59 | 'indvdl_by_pay',
60 | 'otr_cpr_invstmnt_sttus',
61 | ]
62 |
--------------------------------------------------------------------------------
/dart_fss/api/info/accnut_adtor_nm_nd_adt_opinion.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def accnut_adtor_nm_nd_adt_opinion(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 회계감사인의 명칭 및 감사의견을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 회계감사인의 명칭 및 감사의견
28 | """
29 |
30 | path = '/api/accnutAdtorNmNdAdtOpinion.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/accnut_adtor_non_adt_servc_cncls_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def accnut_adtor_non_adt_servc_cncls_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 회계감사인과의 비감사용역 계약체결 현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 회계감사인과의 비감사용역 계약체결 현황
28 | """
29 |
30 | path = '/api/accnutAdtorNonAdtServcCnclsSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/adt_servc_cncls_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def adt_servc_cncls_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 감사용역체결현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 감사용역체결현황
28 | """
29 |
30 | path = '/api/adtServcCnclsSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/alot_matter.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def alot_matter(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 배당에 관한 사항을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 배당에 관한 사항
28 | """
29 |
30 | path = '/api/alotMatter.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/cndl_capl_scrits_nrdmp_blce.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def cndl_capl_scrits_nrdmp_blce(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 조건부 자본증권 미상환 잔액을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 조건부 자본증권 미상환 잔액
28 | """
29 |
30 | path = '/api/cndlCaplScritsNrdmpBlce.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/cprnd_nrdmp_blce.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def cprnd_nrdmp_blce(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 회사채 미상환 잔액을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 회사채 미상환 잔액
28 | """
29 |
30 | path = '/api/cprndNrdmpBlce.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/det_scrits_isu_acmslt.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def det_scrits_isu_acmslt(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 채무증권 발행실적을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 채무증권 발행실적
28 | """
29 |
30 | path = '/api/detScritsIsuAcmslt.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/drctr_adt_all_mendng_sttus_gmtsck_confm_amount.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def drctr_adt_all_mendng_sttus_gmtsck_confm_amount(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 이사·감사 전체의 보수현황(주주총회 승인금액)을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 이사·감사 전체의 보수현황(주주총회 승인금액)
28 | """
29 |
30 | path = '/api/drctrAdtAllMendngSttusGmtsckConfmAmount.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/drctr_adt_all_mendng_sttus_mendng_pymntamt_ty_cl.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def drctr_adt_all_mendng_sttus_mendng_pymntamt_ty_cl(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 이사·감사 전체의 보수현황(보수지급금액 - 유형별)을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 이사·감사 전체의 보수현황(보수지급금액 - 유형별)
28 | """
29 |
30 | path = '/api/drctrAdtAllMendngSttusMendngPymntamtTyCl.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/emp_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def emp_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 직원 현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 직원 현황
28 | """
29 |
30 | path = '/api/empSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/entrprs_bil_scrits_nrdmp_blce.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def entrprs_bil_scrits_nrdmp_blce(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 기업어음증권 미상환 잔액을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 기업어음증권 미상환 잔액
28 | """
29 |
30 | path = '/api/entrprsBilScritsNrdmpBlce.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/exctv_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def exctv_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 임원 현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 임원 현황
28 | """
29 |
30 | path = '/api/exctvSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/hmv_audit_all_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def hmv_audit_all_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 이사·감사 전체의 보수현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 이사·감사 전체의 보수현황
28 | """
29 |
30 | path = '/api/hmvAuditAllSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/hmv_audit_indvdl_by_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def hmv_audit_indvdl_by_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 이사·감사의 개인별 보수 현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 이사·감사의 개인별 보수 현황
28 | """
29 |
30 | path = '/api/hmvAuditIndvdlBySttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/hyslr_chg_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def hyslr_chg_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 최대주주 변동현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 최대주주 변동현황
28 | """
29 |
30 | path = '/api/hyslrChgSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/hyslr_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def hyslr_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 최대주주 현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 최대주주 현황
28 | """
29 |
30 | path = '/api/hyslrSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/indvdl_by_pay.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def indvdl_by_pay(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 개인별 보수지급 금액(5억이상 상위5인)을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 개인별 보수지급 금액(5억이상 상위5인)
28 | """
29 |
30 | path = '/api/indvdlByPay.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/irds_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def irds_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 증자(감자) 현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 증자(감자) 현황
28 | """
29 |
30 | path = '/api/irdsSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/mrhl_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def mrhl_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 소액주주 현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 소액주주 현황
28 | """
29 |
30 | path = '/api/mrhlSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/new_capl_scrits_nrdmp_blce.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def new_capl_scrits_nrdmp_blce(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 신종자본증권 미상환 잔액을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 신종자본증권 미상환 잔액
28 | """
29 |
30 | path = '/api/newCaplScritsNrdmpBlce.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/otr_cpr_invstmnt_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def otr_cpr_invstmnt_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 타법인 출자현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 타법인 출자현황
28 | """
29 |
30 | path = '/api/otrCprInvstmntSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/outcmpny_drctr_nd_change_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def outcmpny_drctr_nd_change_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 사외이사 및 그 변동현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 사외이사 및 그 변동현황
28 | """
29 |
30 | path = '/api/outcmpnyDrctrNdChangeSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/prvsrp_cptal_use_dtls.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def prvsrp_cptal_use_dtls(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 사모자금의 사용내역을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 사모자금의 사용내역
28 | """
29 |
30 | path = '/api/prvsrpCptalUseDtls.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/pssrp_cptal_use_dtls.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def pssrp_cptal_use_dtls(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 공모자금의 사용내역을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 공모자금의 사용내역
28 | """
29 |
30 | path = '/api/pssrpCptalUseDtls.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/srtpd_psndbt_nrdmp_blce.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def srtpd_psndbt_nrdmp_blce(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 단기사채 미상환 잔액을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 단기사채 미상환 잔액
28 | """
29 |
30 | path = '/api/srtpdPsndbtNrdmpBlce.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/stock_totqy_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def stock_totqy_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 주식의총수현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 주식의 총수 현황
28 | """
29 |
30 | path = '/api/stockTotqySttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/tesstk_acqs_dsps_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def tesstk_acqs_dsps_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 자기주식 취득 및 처분 현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 자기주식 취득 및 처분 현황
28 | """
29 |
30 | path = '/api/tesstkAcqsDspsSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/info/unrst_exctv_mendng_sttus.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def unrst_exctv_mendng_sttus(
7 | corp_code: str,
8 | bsns_year: str,
9 | reprt_code: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 정기보고서(사업, 분기, 반기보고서) 내에 미등기임원 보수현황을 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bsns_year: str
19 | 사업연도(4자리) ※ 2015년 이후 부터 정보제공
20 | reprt_code: str
21 | 1분기보고서 : 11013반기보고서 : 110123분기보고서 : 11014사업보고서 : 11011
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 미등기임원 보수현황
28 | """
29 |
30 | path = '/api/unrstExctvMendngSttus.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bsns_year=bsns_year,
37 | reprt_code=reprt_code,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from .df_ocr import df_ocr
3 | from .bsn_sp import bsn_sp
4 | from .ctrcvs_bgrq import ctrcvs_bgrq
5 | from .ds_rs_ocr import ds_rs_ocr
6 | from .piic_decsn import piic_decsn
7 | from .fric_decsn import fric_decsn
8 | from .pifric_decsn import pifric_decsn
9 | from .cr_decsn import cr_decsn
10 | from .bnk_mngt_pcbg import bnk_mngt_pcbg
11 | from .lwst_lg import lwst_lg
12 | from .ov_lst_decsn import ov_lst_decsn
13 | from .ov_dlst_decsn import ov_dlst_decsn
14 | from .ov_lst import ov_lst
15 | from .ov_dlst import ov_dlst
16 | from .cvbd_is_decsn import cvbd_is_decsn
17 | from .bdwt_is_decsn import bdwt_is_decsn
18 | from .exbd_is_decsn import exbd_is_decsn
19 | from .bnk_mngt_pcsp import bnk_mngt_pcsp
20 | from .wd_cocobd_is_decsn import wd_cocobd_is_decsn
21 | from .ast_inhtrf_etc_ptbk_opt import ast_inhtrf_etc_ptbk_opt
22 | from .otcpr_stk_invscr_trf_decsn import otcpr_stk_invscr_trf_decsn
23 | from .tgast_trf_decsn import tgast_trf_decsn
24 | from .tgast_inh_decsn import tgast_inh_decsn
25 | from .otcpr_stk_invscr_inh_decsn import otcpr_stk_invscr_inh_decsn
26 | from .bsn_trf_decsn import bsn_trf_decsn
27 | from .bsn_inh_decsn import bsn_inh_decsn
28 | from .tsstk_aq_trctr_cc_decsn import tsstk_aq_trctr_cc_decsn
29 | from .tsstk_aq_trctr_cns_decsn import tsstk_aq_trctr_cns_decsn
30 | from .tsstk_dp_decsn import tsstk_dp_decsn
31 | from .tsstk_aq_decsn import tsstk_aq_decsn
32 | from .stk_extr_decsn import stk_extr_decsn
33 | from .cmp_dvmg_decsn import cmp_dvmg_decsn
34 | from .cmp_dv_decsn import cmp_dv_decsn
35 | from .cmp_mg_decsn import cmp_mg_decsn
36 | from .stkrtbd_inh_decsn import stkrtbd_inh_decsn
37 | from .stkrtbd_trf_decsn import stkrtbd_trf_decsn
38 |
39 |
40 | __all__ = [
41 | 'df_ocr',
42 | 'bsn_sp',
43 | 'ctrcvs_bgrq',
44 | 'ds_rs_ocr',
45 | 'piic_decsn',
46 | 'fric_decsn',
47 | 'pifric_decsn',
48 | 'cr_decsn',
49 | 'bnk_mngt_pcbg',
50 | 'lwst_lg',
51 | 'ov_lst_decsn',
52 | 'ov_dlst_decsn',
53 | 'ov_lst',
54 | 'ov_dlst',
55 | 'cvbd_is_decsn',
56 | 'bdwt_is_decsn',
57 | 'exbd_is_decsn',
58 | 'bnk_mngt_pcsp',
59 | 'wd_cocobd_is_decsn',
60 | 'ast_inhtrf_etc_ptbk_opt',
61 | 'otcpr_stk_invscr_trf_decsn',
62 | 'tgast_trf_decsn',
63 | 'tgast_inh_decsn',
64 | 'otcpr_stk_invscr_inh_decsn',
65 | 'bsn_trf_decsn',
66 | 'bsn_inh_decsn',
67 | 'tsstk_aq_trctr_cc_decsn',
68 | 'tsstk_aq_trctr_cns_decsn',
69 | 'tsstk_dp_decsn',
70 | 'tsstk_aq_decsn',
71 | 'stk_extr_decsn',
72 | 'cmp_dvmg_decsn',
73 | 'cmp_dv_decsn',
74 | 'cmp_mg_decsn',
75 | 'stkrtbd_inh_decsn',
76 | 'stkrtbd_trf_decsn',
77 | ]
78 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/ast_inhtrf_etc_ptbk_opt.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def ast_inhtrf_etc_ptbk_opt(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(자산양수도(기타), 풋백옵션) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 자산양수도(기타), 풋백옵션
28 | """
29 |
30 | path = '/api/astInhtrfEtcPtbkOpt.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/bdwt_is_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def bdwt_is_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(신주인수권부사채권 발행결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 신주인수권부사채권 발행결정
28 | """
29 |
30 | path = '/api/bdwtIsDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/bnk_mngt_pcbg.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def bnk_mngt_pcbg(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(채권은행 등의 관리절차 개시) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 채권은행 등의 관리절차 개시
28 | """
29 |
30 | path = '/api/bnkMngtPcbg.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/bnk_mngt_pcsp.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def bnk_mngt_pcsp(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(채권은행 등의 관리절차 중단) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 채권은행 등의 관리절차 중단
28 | """
29 |
30 | path = '/api/bnkMngtPcsp.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/bsn_inh_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def bsn_inh_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(영업양수 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 영업양수 결정
28 | """
29 |
30 | path = '/api/bsnInhDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/bsn_sp.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def bsn_sp(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(영업정지) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 영업정지
28 | """
29 |
30 | path = '/api/bsnSp.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/bsn_trf_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def bsn_trf_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(영업양도 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 영업양도 결정
28 | """
29 |
30 | path = '/api/bsnTrfDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/cmp_dv_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def cmp_dv_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(회사분할 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 회사분할 결정
28 | """
29 |
30 | path = '/api/cmpDvDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/cmp_dvmg_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def cmp_dvmg_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(회사분할합병 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 회사분할합병 결정
28 | """
29 |
30 | path = '/api/cmpDvmgDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/cmp_mg_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def cmp_mg_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(회사합병 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 회사합병 결정
28 | """
29 |
30 | path = '/api/cmpMgDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/cr_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def cr_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(감자 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 감자 결정
28 | """
29 |
30 | path = '/api/crDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/ctrcvs_bgrq.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def ctrcvs_bgrq(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(회생절차 개시신청) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 회생절차 개시신청
28 | """
29 |
30 | path = '/api/ctrcvsBgrq.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/cvbd_is_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def cvbd_is_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(전환사채권 발행결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 전환사채권 발행결정
28 | """
29 |
30 | path = '/api/cvbdIsDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/df_ocr.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def df_ocr(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(부도발생) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 부도발생
28 | """
29 |
30 | path = '/api/dfOcr.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/ds_rs_ocr.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def ds_rs_ocr(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(해산사유 발생) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 해산사유 발생
28 | """
29 |
30 | path = '/api/dsRsOcr.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/exbd_is_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def exbd_is_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(교환사채권 발행결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 교환사채권 발행결정
28 | """
29 |
30 | path = '/api/exbdIsDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/fric_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def fric_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(무상증자 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 무상증자 결정
28 | """
29 |
30 | path = '/api/fricDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/lwst_lg.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def lwst_lg(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(소송 등의 제기) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 소송 등의 제기
28 | """
29 |
30 | path = '/api/lwstLg.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/otcpr_stk_invscr_inh_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def otcpr_stk_invscr_inh_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(타법인 주식 및 출자증권 양수결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 타법인 주식 및 출자증권 양수결정
28 | """
29 |
30 | path = '/api/otcprStkInvscrInhDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/otcpr_stk_invscr_trf_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def otcpr_stk_invscr_trf_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(타법인 주식 및 출자증권 양도결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 타법인 주식 및 출자증권 양도결정
28 | """
29 |
30 | path = '/api/otcprStkInvscrTrfDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/ov_dlst.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def ov_dlst(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(해외 증권시장 주권등 상장폐지) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 해외 증권시장 주권등 상장폐지
28 | """
29 |
30 | path = '/api/ovDlst.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/ov_dlst_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def ov_dlst_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(해외 증권시장 주권등 상장폐지 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 해외 증권시장 주권등 상장폐지 결정
28 | """
29 |
30 | path = '/api/ovDlstDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/ov_lst.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def ov_lst(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(해외 증권시장 주권등 상장) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 해외 증권시장 주권등 상장
28 | """
29 |
30 | path = '/api/ovLst.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/ov_lst_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def ov_lst_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(해외 증권시장 주권등 상장 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 해외 증권시장 주권등 상장 결정
28 | """
29 |
30 | path = '/api/ovLstDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/pifric_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def pifric_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(유무상증자 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 유무상증자 결정
28 | """
29 |
30 | path = '/api/pifricDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/piic_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def piic_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(유상증자 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 유상증자 결정
28 | """
29 |
30 | path = '/api/piicDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/stk_extr_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def stk_extr_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(주식교환·이전 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 주식교환·이전 결정
28 | """
29 |
30 | path = '/api/stkExtrDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/stkrtbd_inh_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def stkrtbd_inh_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(주권 관련 사채권 양수 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 주권 관련 사채권 양수 결정
28 | """
29 |
30 | path = '/api/stkrtbdInhDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/stkrtbd_trf_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def stkrtbd_trf_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(주권 관련 사채권 양도 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 주권 관련 사채권 양도 결정
28 | """
29 |
30 | path = '/api/stkrtbdTrfDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/tgast_inh_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def tgast_inh_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(유형자산 양수 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 유형자산 양수 결정
28 | """
29 |
30 | path = '/api/tgastInhDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/tgast_trf_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def tgast_trf_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(유형자산 양도 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 유형자산 양도 결정
28 | """
29 |
30 | path = '/api/tgastTrfDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/tsstk_aq_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def tsstk_aq_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(자기주식 취득 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 자기주식 취득 결정
28 | """
29 |
30 | path = '/api/tsstkAqDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/tsstk_aq_trctr_cc_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def tsstk_aq_trctr_cc_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(자기주식취득 신탁계약 해지 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 자기주식취득 신탁계약 해지 결정
28 | """
29 |
30 | path = '/api/tsstkAqTrctrCcDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/tsstk_aq_trctr_cns_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def tsstk_aq_trctr_cns_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(자기주식취득 신탁계약 체결 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 자기주식취득 신탁계약 체결 결정
28 | """
29 |
30 | path = '/api/tsstkAqTrctrCnsDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/tsstk_dp_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def tsstk_dp_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(자기주식 처분 결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 자기주식 처분 결정
28 | """
29 |
30 | path = '/api/tsstkDpDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/issue/wd_cocobd_is_decsn.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def wd_cocobd_is_decsn(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 주요사항보고서(상각형 조건부자본증권 발행결정) 내에 주요 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 상각형 조건부자본증권 발행결정
28 | """
29 |
30 | path = '/api/wdCocobdIsDecsn.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/market/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from .stock_market import get_stock_market_list
3 | from .trading_halt import get_trading_halt_list
4 |
5 | __all__ = ['get_stock_market_list', 'get_trading_halt_list']
6 |
--------------------------------------------------------------------------------
/dart_fss/api/market/stock_market.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.utils import request
3 | from bs4 import BeautifulSoup
4 |
5 |
6 | def get_stock_market_list(corp_cls: str, include_corp_name=True) -> dict:
7 | """ 상장 회사 dictionary 반환
8 |
9 | Parameters
10 | ----------
11 | corp_cls: str
12 | Y: stock market(코스피), K: kosdaq market(코스닥), N: konex Market(코넥스)
13 | include_corp_name: bool, optional
14 | if True, returning dictionary includes corp_name(default: True)
15 | Returns
16 | -------
17 | dict of {stock_code: information}
18 | 상장 회사 정보 dictionary 반환( 회사 이름, 섹터, 물품)
19 | """
20 |
21 | if corp_cls.upper() == 'E':
22 | raise ValueError('ETC market is not supported')
23 |
24 | corp_cls_to_market = {
25 | "Y": "stockMkt",
26 | "K": "kosdaqMkt",
27 | "N": "konexMkt",
28 | }
29 |
30 | url = 'https://kind.krx.co.kr/corpgeneral/corpList.do'
31 | referer = 'https://kind.krx.co.kr/corpgeneral/corpList.do?method=loadInitPage'
32 |
33 | market_type = corp_cls_to_market[corp_cls.upper()]
34 | payload = {
35 | 'method': 'download',
36 | 'pageIndex': 1,
37 | 'currentPageSize': 5000,
38 | 'orderMode': 3,
39 | 'orderStat': 'D',
40 | 'searchType': 13,
41 | 'marketType': market_type,
42 | 'fiscalYearEnd': 'all',
43 | 'location': 'all',
44 | }
45 |
46 | stock_market_list = dict()
47 |
48 | resp = request.post(url=url, payload=payload, referer=referer)
49 | html = BeautifulSoup(resp.text, 'html.parser')
50 | rows = html.find_all('tr')
51 |
52 | for row in rows:
53 | cols = row.find_all('td')
54 | if len(cols) > 0:
55 | corp_name = cols[0].text.strip()
56 | stock_code = cols[1].text.strip()
57 | sector = cols[2].text.strip()
58 | product = cols[3].text.strip()
59 | corp_info = {'sector': sector,
60 | 'product': product, 'corp_cls': corp_cls}
61 | if include_corp_name:
62 | corp_info['corp_name'] = corp_name
63 | stock_market_list[stock_code] = corp_info
64 |
65 | return stock_market_list
66 |
--------------------------------------------------------------------------------
/dart_fss/api/market/trading_halt.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.utils import request
3 | from bs4 import BeautifulSoup
4 |
5 |
6 | def get_trading_halt_list(corp_cls: str, include_corp_name=True) -> dict:
7 | """ 상장 회사 dictionary 반환
8 |
9 | Parameters
10 | ----------
11 | corp_cls: str
12 | Y: stock market(코스피), K: kosdaq market(코스닥), N: konex Market(코넥스)
13 | include_corp_name: bool, optional
14 | if True, returning dictionary includes corp_name(default: True)
15 | Returns
16 | -------
17 | dict of {stock_code: information}
18 | trading halt list
19 | """
20 |
21 | if corp_cls.upper() == 'E':
22 | raise ValueError('ETC market is not supported')
23 |
24 | corp_cls_to_market = {
25 | "Y": 1,
26 | "K": 2,
27 | "N": 6,
28 | }
29 |
30 | url = 'https://kind.krx.co.kr/investwarn/tradinghaltissue.do'
31 | referer = 'https://kind.krx.co.kr/investwarn/tradinghaltissue.do?method=searchTradingHaltIssueMain'
32 |
33 | market_type = corp_cls_to_market[corp_cls.upper()]
34 | payload = {
35 | 'method': 'searchTradingHaltIssueSub',
36 | 'currentPageSize': 3000,
37 | 'pageIndex': 1,
38 | 'searchMode': '',
39 | 'searchCodeType': '',
40 | 'searchCorpName': '',
41 | 'forward': 'tradinghaltissue_down',
42 | 'paxreq': '',
43 | 'outsvcno': '',
44 | 'marketType': market_type,
45 | 'repIsuSrtCd': '',
46 | }
47 |
48 | trading_halt_list = dict()
49 |
50 | resp = request.post(url=url, payload=payload, referer=referer)
51 | html = BeautifulSoup(resp.text, 'html.parser')
52 | rows = html.find_all('tr')
53 |
54 | for row in rows:
55 | cols = row.find_all('td')
56 | if len(cols) > 0:
57 | corp_name = cols[1].text.strip()
58 | stock_code = cols[2].text.strip()
59 | issue = cols[3].text.strip()
60 |
61 | corp_info = {'issue': issue, 'corp_cls': corp_cls}
62 | if include_corp_name:
63 | corp_info['corp_name'] = corp_name
64 | trading_halt_list[stock_code] = corp_info
65 |
66 | return trading_halt_list
67 |
--------------------------------------------------------------------------------
/dart_fss/api/registration/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from .extr_rs import extr_rs
3 | from .mg_rs import mg_rs
4 | from .stkdp_rs import stkdp_rs
5 | from .bd_rs import bd_rs
6 | from .estk_rs import estk_rs
7 | from .dv_rs import dv_rs
8 |
9 |
10 | __all__ = [
11 | 'extr_rs',
12 | 'mg_rs',
13 | 'stkdp_rs',
14 | 'bd_rs',
15 | 'estk_rs',
16 | 'dv_rs',
17 | ]
18 |
--------------------------------------------------------------------------------
/dart_fss/api/registration/bd_rs.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def bd_rs(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 증권신고서(채무증권) 내에 요약 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 채무증권
28 | """
29 |
30 | path = '/api/bdRs.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/registration/dv_rs.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def dv_rs(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 증권신고서(분할) 내에 요약 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 분할
28 | """
29 |
30 | path = '/api/dvRs.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/registration/estk_rs.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def estk_rs(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 증권신고서(지분증권) 내에 요약 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 지분증권
28 | """
29 |
30 | path = '/api/estkRs.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/registration/extr_rs.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def extr_rs(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 증권신고서(주식의포괄적교환·이전) 내에 요약 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 주식의포괄적교환·이전
28 | """
29 |
30 | path = '/api/extrRs.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/registration/mg_rs.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def mg_rs(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 증권신고서(합병) 내에 요약 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 합병
28 | """
29 |
30 | path = '/api/mgRs.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/registration/stkdp_rs.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def stkdp_rs(
7 | corp_code: str,
8 | bgn_de: str,
9 | end_de: str,
10 | api_key: str = None
11 | ) -> Dict:
12 | """ 증권신고서(증권예탁증권) 내에 요약 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | bgn_de: str
19 | 검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
20 | end_de: str
21 | 검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
22 | api_key: str, optional
23 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
24 | Returns
25 | -------
26 | dict
27 | 증권예탁증권
28 | """
29 |
30 | path = '/api/stkdpRs.json'
31 |
32 | return api_request(
33 | api_key=api_key,
34 | path=path,
35 | corp_code=corp_code,
36 | bgn_de=bgn_de,
37 | end_de=end_de,
38 | )
39 |
--------------------------------------------------------------------------------
/dart_fss/api/shareholder/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from .majorstock import majorstock
3 | from .elestock import elestock
4 |
5 |
6 | __all__ = [
7 | 'majorstock',
8 | 'elestock',
9 | ]
10 |
--------------------------------------------------------------------------------
/dart_fss/api/shareholder/elestock.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def elestock(
7 | corp_code: str,
8 | api_key: str = None
9 | ) -> Dict:
10 | """ 임원ㆍ주요주주특정증권등 소유상황보고서 내에 임원ㆍ주요주주 소유보고
11 |
12 | 정보를 제공합니다.
13 |
14 | Parameters
15 | ----------
16 | corp_code: str
17 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
18 | api_key: str, optional
19 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
20 | Returns
21 | -------
22 | dict
23 | 임원ㆍ주요주주 소유보고
24 | """
25 |
26 | path = '/api/elestock.json'
27 |
28 | return api_request(
29 | api_key=api_key,
30 | path=path,
31 | corp_code=corp_code,
32 | )
33 |
--------------------------------------------------------------------------------
/dart_fss/api/shareholder/majorstock.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 | from ..helper import api_request
4 |
5 |
6 | def majorstock(
7 | corp_code: str,
8 | api_key: str = None
9 | ) -> Dict:
10 | """ 주식등의 대량보유상황보고서 내에 대량보유 상황보고 정보를 제공합니다.
11 |
12 | Parameters
13 | ----------
14 | corp_code: str
15 | 공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
16 | api_key: str, optional
17 | DART_API_KEY, 만약 환경설정 DART_API_KEY를 설정한 경우 제공하지 않아도 됨
18 | Returns
19 | -------
20 | dict
21 | 대량보유 상황보고
22 | """
23 |
24 | path = '/api/majorstock.json'
25 |
26 | return api_request(
27 | api_key=api_key,
28 | path=path,
29 | corp_code=corp_code,
30 | )
31 |
--------------------------------------------------------------------------------
/dart_fss/auth/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.auth.auth import set_api_key, get_api_key
3 |
4 | __all__ = ['set_api_key', 'get_api_key']
--------------------------------------------------------------------------------
/dart_fss/auth/auth.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import os
3 |
4 | from dart_fss.utils import Singleton, request
5 | from dart_fss.errors import check_status
6 |
7 |
8 | def set_api_key(api_key: str) -> str:
9 | """ Set Open DART API KEY
10 |
11 | Parameters
12 | ----------
13 | api_key: str
14 | Open DART API KEY
15 | Returns
16 | -------
17 | str
18 | 설정된 API KEY
19 | """
20 | DartAuth().api_key = api_key
21 | auth = DartAuth()
22 | return auth.api_key
23 |
24 |
25 | def get_api_key() -> str:
26 | """ Get Open DART API KEY
27 |
28 | Returns
29 | -------
30 | str
31 | DART_API_KEY
32 | """
33 | return DartAuth().api_key
34 |
35 |
36 | class DartAuth(object, metaclass=Singleton):
37 | """DART 오픈 API 인증키 관련 클래스.
38 |
39 | DART 오픈 API 사용을 사용되는 인증키를 관리하는 클래스입니다.
40 | API 인증키를 직접 설정하는 방법과 환경 변수를 통해 설정하는 방법이 있습니다.
41 | 환경변수의 변수명은 DART_API_KEY 입니다.
42 |
43 | Note
44 | ----
45 | DART 인증키 발급은 https://opendart.fss.or.kr/ 를 참고하십시오.
46 |
47 | Attributes
48 | ----------
49 | api_key: str
50 | DART 인증키
51 |
52 | """
53 |
54 | def __init__(self, api_key=None):
55 | """ api_key 초기화 메서드
56 |
57 | api_key 초기값이 없을시 환경변수 DART_API_KEY 확인
58 |
59 | Parameters
60 | ----------
61 | api_key: str, optional
62 | DART API KEY 정보
63 | """
64 | super().__init__()
65 | self.__api_key = None
66 | if api_key is None:
67 | api_key = os.getenv('DART_API_KEY')
68 | if api_key:
69 | self.api_key = api_key
70 |
71 | @property
72 | def api_key(self) -> str:
73 | """ str: Dart 인증키 """
74 | if self.__api_key is None:
75 | raise ValueError('Unauthorized')
76 | return self.__api_key
77 |
78 | @api_key.setter
79 | def api_key(self, api_key: str) -> None:
80 | if not isinstance(api_key, str):
81 | raise ValueError('The Dart Api key must be provided through the api_key variable')
82 |
83 | # 기업개황 테스트
84 | url = 'https://opendart.fss.or.kr/api/company.json'
85 | # 요청인자
86 | # crtfc_key: API 인증키
87 | # corp_code: 공시대항회사 고유번호 / 00126380 삼성전자
88 | payload = {'crtfc_key': api_key, 'corp_code': '00126380'}
89 |
90 | resp = request.get(url=url, payload=payload)
91 | data = resp.json()
92 |
93 | check_status(**data)
94 | self.__api_key = api_key
95 |
96 | def __repr__(self) -> str:
97 | return 'API key: {}'.format(self.api_key)
98 |
99 |
--------------------------------------------------------------------------------
/dart_fss/corp/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.corp.corp import Corp
3 | from dart_fss.corp.corp_list import CorpList, get_corp_list
4 |
5 | __all__ = ['Corp', 'CorpList', 'get_corp_list']
--------------------------------------------------------------------------------
/dart_fss/errors/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.errors.checker import check_status
3 | from dart_fss.errors.errors import (APIKeyError, TemporaryLocked, OverQueryLimit, NoDataReceived,
4 | InvalidField, ServiceClose, UnknownError, NotFoundConsolidated)
5 |
6 | __all__ = ['check_status', 'APIKeyError', 'TemporaryLocked', 'OverQueryLimit', 'NoDataReceived',
7 | 'InvalidField', 'ServiceClose', 'UnknownError', 'NotFoundConsolidated']
8 |
--------------------------------------------------------------------------------
/dart_fss/errors/checker.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.errors.errors import (APIKeyError, TemporaryLocked, NoDataReceived,
3 | OverQueryLimit, InvalidField, ServiceClose, UnknownError)
4 |
5 |
6 | def check_error(status):
7 | errors = {
8 | '000': None,
9 | '010': APIKeyError,
10 | '011': TemporaryLocked,
11 | '013': NoDataReceived,
12 | '020': OverQueryLimit,
13 | '100': InvalidField,
14 | '800': ServiceClose,
15 | '900': UnknownError,
16 | }
17 | return errors.get(status, UnknownError)
18 |
19 |
20 | def check_status(**kwargs):
21 | """
22 | Open DART의 응답 결과중 status 값을 체크하는 함수
23 | Parameters
24 | ----------
25 | kwargs: dict
26 | DART 서버에서 전달받은 값
27 |
28 | Raises
29 | ------
30 | APIKeyError
31 | 등록되지 않은 API 키에 의해 발생하는 오류
32 | TemporaryLocked
33 | 오픈 API에 등록 되었으나, 일시적으로 사용 중지된 키에 의해 발생하는 오류
34 | OverQueryLimit
35 | 요청 제한을 초과하였을때 발생하는 오류
36 | InvalidField
37 | 요청한 필드에 부적절한 값이 있는 경우 발생하는 오류
38 | ServiceClose
39 | 원할한 공시서비스를 위해 오픈 API 서비스가 중지 되었을때 발생하는 오류
40 | UnknownError
41 | 정의되지 않은 오류
42 | """
43 | status = kwargs.get('status')
44 | err = check_error(status)
45 | if err is not None:
46 | msg = kwargs.get('message')
47 | raise err(msg)
48 |
--------------------------------------------------------------------------------
/dart_fss/errors/errors.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | class APIKeyError(ValueError):
3 | """
4 | 등록되지 않은 API 키에 의해 발생하는 오류
5 | """
6 | def __init__(self, msg='Unregistered API key'):
7 | super().__init__(msg)
8 |
9 |
10 | class TemporaryLocked(RuntimeError):
11 | """
12 | 오픈 API에 등록 되었으나, 일시적으로 사용 중지된 키에 의해 발생하는 오류
13 | """
14 | def __init__(self, msg='Temporarily locked'):
15 | super().__init__(msg)
16 |
17 |
18 | class NoDataReceived(ValueError):
19 | """
20 | 조회된 데이터가 없을때 발생하는 오류
21 | """
22 | def __init__(self, msg='No data received'):
23 | super().__init__(msg)
24 |
25 |
26 | class OverQueryLimit(RuntimeError):
27 | """
28 | 요청 제한을 초과하였을때 발생하는 오류
29 | """
30 | def __init__(self, msg='Over query limit'):
31 | super().__init__(msg)
32 |
33 |
34 | class InvalidField(ValueError):
35 | """
36 | 요청한 필드에 부적절한 값이 있는 경우 발생하는 오류
37 | """
38 | def __init__(self, msg='Invalid field'):
39 | super().__init__(msg)
40 |
41 |
42 | class ServiceClose(RuntimeError):
43 | """
44 | 원할한 공시서비스를 위해 오픈 API 서비스가 중지 되었을때 발생하는 오류
45 | """
46 | def __init__(self, msg='Open API was closed for web service'):
47 | super().__init__(msg)
48 |
49 |
50 | class UnknownError(RuntimeError):
51 | """
52 | 정의되지 않은 오류
53 | """
54 | def __init__(self, msg='Unknown error'):
55 | super().__init__(msg)
56 |
57 |
58 | class NotFoundConsolidated(ValueError):
59 | """
60 | 연결재무제표가 없을때 발생하는 오류
61 | """
62 | def __init__(self, err_msg='Could not find consolidated financial statements'):
63 | super().__init__(err_msg)
64 |
--------------------------------------------------------------------------------
/dart_fss/filings/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.filings.search import search
3 |
4 | __all__ = ['search']
--------------------------------------------------------------------------------
/dart_fss/filings/pages.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | import re
4 | import base64
5 |
6 | from typing import Dict
7 | from bs4 import BeautifulSoup
8 | from dart_fss.utils import request
9 |
10 |
11 | class Page(object):
12 | """ DART 공시 리포트의 페이지 클래스
13 |
14 | DART 공시 리포트의 개별 페이지 정보를 담고 있는 클래스.
15 | HTML 정보를 담고 있다.
16 |
17 | Attributes
18 | ----------
19 | title: str
20 | 페이지의 타이틀
21 | rcp_no: str
22 | 접수번호
23 | ele_id: str
24 | 리포트에서 페이지 번호
25 | dcm_no: str
26 | 페이저 관리 번호
27 |
28 | """
29 |
30 | _BASE_URL_ = 'https://dart.fss.or.kr/report/viewer.do'
31 |
32 | def __init__(self, title: str, rcp_no: str, dcm_no: str, ele_id: int,
33 | offset: str, length: str, dtd: str, lazy_loading=True):
34 | self.title = title
35 | self.rcp_no = rcp_no
36 | self.ele_id = ele_id
37 | self.dcm_no = dcm_no
38 | self._offset = offset
39 | self._length = length
40 | self._dtd = dtd
41 | self._html = None
42 | if not lazy_loading:
43 | self.load()
44 |
45 | @property
46 | def html(self):
47 | """ html 반환
48 |
49 | Returns
50 | -------
51 | str
52 | page html
53 |
54 | """
55 | if self._html is None:
56 | self.load()
57 | return self._html
58 |
59 | def load(self):
60 | """ page loading 함수 """
61 | def change_url(bs, tag):
62 | tags = bs.find_all(attrs={tag: re.compile(r'.*')})
63 | if tags:
64 | for t in tags:
65 | t[tag] = "https://dart.fss.or.kr" + t[tag]
66 | return bs
67 |
68 | def add_prefix(match_obj):
69 | return r"window.open('https://dart.fss.or.kr" + match_obj.group(1) + r"'"
70 |
71 | payload = {
72 | 'rcpNo': self.rcp_no,
73 | 'dcmNo': self.dcm_no,
74 | 'eleId': self.ele_id,
75 | 'offset': self._offset,
76 | 'length': self._length,
77 | 'dtd': self._dtd
78 | }
79 | html = request.get(url=self._BASE_URL_, payload=payload, referer=self._BASE_URL_).content
80 | try:
81 | html = html.decode()
82 | except UnicodeDecodeError:
83 | html = html.decode('cp949')
84 | finally:
85 | soup = BeautifulSoup(html, 'html.parser')
86 | meta = soup.find('meta', {'content': re.compile(r'charset')})
87 | if meta:
88 | meta['content'] = meta['content'].replace('euc-kr', 'utf-8')
89 |
90 | soup = change_url(soup, 'href')
91 | soup = change_url(soup, 'src')
92 |
93 | html = str(soup)
94 | html = re.sub(r'window.open\(\'(.*?)\'', add_prefix, html)
95 |
96 | self._html = html
97 |
98 | def to_dict(self, summary=True) -> Dict[str, str]:
99 | """ dict 타입으로 반환
100 |
101 | Returns
102 | -------
103 | dict
104 | title, rcp_no, ele_id를 dict 타입으로 반환
105 |
106 | """
107 | info = dict()
108 | info['title'] = self.title
109 | info['ele_id'] = self.ele_id
110 | if not summary:
111 | info['rcp_no'] = self.rcp_no
112 | info['dcm_no'] = self.dcm_no
113 | info['offset'] = self._offset
114 | info['length'] = self._length
115 | info['dtd'] = self._dtd
116 | return info
117 |
118 | def __repr__(self) -> str:
119 | from pprint import pformat
120 | return pformat(self.to_dict(summary=False))
121 |
122 | def _repr_html_(self) -> str:
123 | if self.html is None:
124 | self.load()
125 | if len(self.html) == 0:
126 | html = 'blank page'
127 | else:
128 | html = self.html
129 | base64_html = base64.b64encode(bytes(html, 'utf-8')).decode('utf-8')
130 | return r''
131 |
132 | def __str__(self) -> str:
133 | from pprint import pformat
134 | return pformat(self.to_dict())
135 |
136 |
--------------------------------------------------------------------------------
/dart_fss/filings/search.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Union, List
3 | from dart_fss.api.filings import search_filings
4 | from dart_fss.filings.search_result import SearchResults
5 | str_or_list = Union[str, List[str]]
6 |
7 |
8 | def search(corp_code: str = None,
9 | bgn_de: str = None,
10 | end_de: str = None,
11 | last_reprt_at: str = 'N',
12 | pblntf_ty: str_or_list = None,
13 | pblntf_detail_ty: str_or_list = None,
14 | corp_cls: str = None,
15 | sort: str = 'date',
16 | sort_mth: str = 'desc', # 현재 sort_mth 설정시 오류 발생
17 | page_no: int = 1,
18 | page_count: int = 10):
19 | """공시보고서 검색
20 |
21 | Parameters
22 | ----------
23 | corp_code: str, optional
24 | 공시대상회사의 고유번호(8자리), 고유번호(corp_code)가 없는 경우 검색기간은 3개월로 제한
25 | bgn_de: str, optional
26 | 검색시작 접수일자(YYYYMMDD), 없으면 종료일(end_de)
27 | end_de: str, optional
28 | 검색종료 접수일자(YYYYMMDD), 없으면 당일
29 | last_reprt_at: str, optional
30 | 최종보고서만 검색여부(Y or N), default : N
31 | pblntf_ty: str, optional
32 | 공시유형 / Open DART 공시정보 -> 공시검색 -> 상세유형 참고
33 | pblntf_detail_ty: str, optional
34 | 공시상세유형 / Open DART 공시정보 -> 공시검색 -> 상세유형 참고
35 | corp_cls: str, optional
36 | 법인구분 : Y(유가), K(코스닥), N(코넥스), E(기타), 없으면 전체조회
37 | sort: str, optional
38 | 정렬, {접수일자: date, 회사명: crp, 고서명: rpt}
39 | sort_mth: str, optional
40 | 오름차순(asc), 내림차순(desc), default : desc
41 | page_no: int, optional
42 | 페이지 번호(1~n) default : 1
43 | page_count: int, optional
44 | 페이지당 건수(1~100) 기본값 : 10, default : 100
45 |
46 | Returns
47 | -------
48 | SearchResults
49 | 검색결과
50 | """
51 | resp = search_filings(corp_code=corp_code,
52 | bgn_de=bgn_de,
53 | end_de=end_de,
54 | last_reprt_at=last_reprt_at,
55 | pblntf_ty=pblntf_ty,
56 | pblntf_detail_ty=pblntf_detail_ty,
57 | corp_cls=corp_cls,
58 | sort=sort,
59 | sort_mth=sort_mth,
60 | page_no=page_no,
61 | page_count=page_count)
62 | return SearchResults(resp)
--------------------------------------------------------------------------------
/dart_fss/filings/search_result.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Dict
3 |
4 | from dart_fss.utils import dict_to_html
5 | from dart_fss.filings.reports import Report
6 |
7 |
8 | class SearchResults(object):
9 | """ DART 검색결과 정보를 저장하는 클래스"""
10 |
11 | def __init__(self, resp):
12 | self._page_no = resp['page_no']
13 | self._page_count = resp['page_count']
14 | self._total_count = resp['total_count']
15 | self._total_page = resp['total_page']
16 | self._report_list = [Report(**x) for x in resp['list']]
17 |
18 | @property
19 | def page_no(self):
20 | """ 표시된 페이지 번호 """
21 | return self._page_no
22 |
23 | @property
24 | def page_count(self):
25 | """페이지당 표시할 리포트수"""
26 | return self._page_count
27 |
28 | @property
29 | def total_count(self):
30 | """int: 총 건수"""
31 | return self._total_count
32 |
33 | @property
34 | def total_page(self):
35 | """int: 총 페이지수"""
36 | return self._total_page
37 |
38 | @property
39 | def report_list(self):
40 | """list of Report: 검색된 리포트 리스트"""
41 | return self._report_list
42 |
43 | def to_dict(self) -> Dict:
44 | """ dict 타입으로 반환
45 |
46 | Returns
47 | -------
48 | dict of str
49 | 검색 결과 dict 타입로 반환
50 |
51 | """
52 | return {
53 | 'page_no': self.page_no,
54 | 'page_count': self.page_count,
55 | 'total_count': self.total_count,
56 | 'total_page': self.total_page,
57 | 'report_list': [x.to_dict() for x in self.report_list]
58 | }
59 |
60 | def pop(self, index=-1):
61 | """ 주어진 index 의 리포트를 반환하며, 리스트에서 삭제하는 함수"""
62 | return self._report_list.pop(index)
63 |
64 | def __repr__(self):
65 | from pprint import pformat
66 | return pformat(self.to_dict())
67 |
68 | def _repr_html_(self):
69 | return dict_to_html(self.to_dict(), exclude=['pages'], header=['Label', 'Data'])
70 |
71 | def __getitem__(self, item):
72 | return self._report_list[item]
73 |
74 | def __len__(self):
75 | return len(self._report_list)
--------------------------------------------------------------------------------
/dart_fss/fs/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.fs.extract import extract
3 | from dart_fss.fs.fs import FinancialStatement
4 |
5 | __all__ = ['extract', 'FinancialStatement']
--------------------------------------------------------------------------------
/dart_fss/fs/fs.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import pandas as pd
3 |
4 | from pandas import DataFrame
5 | from typing import Dict, Optional, Iterable
6 |
7 | from dart_fss.utils import dict_to_html, create_folder
8 |
9 |
10 | class FinancialStatement(object):
11 | """
12 | 재무제표 검색 결과를 저장하는 클래스
13 |
14 | DART 공시 리포트들의 재무제표 검색 결과를 저장하고 있는 클래스로 검색 결과 및 검증을 위한 추출된 데이터의 Label을 확인할 수 있는 클래스
15 |
16 |
17 | Attributes
18 | ----------
19 | info: dict
20 | 재무제표 검색 Parameters 값들
21 | """
22 | def __init__(self, statements: Dict[str, DataFrame], label_df: Dict[str, DataFrame], info: Dict[str, str]):
23 | if info.get('separator'):
24 | pd.options.display.float_format = '{:,}'.format
25 | else:
26 | pd.options.display.float_format = '{:}'.format
27 | self._statements = statements
28 | # Fix order
29 | self._order = [tp for tp in ('bs', 'is', 'cis', 'cf') if tp in self._statements]
30 | self._labels = label_df
31 | self.info = info
32 |
33 | @property
34 | def separator(self) -> bool:
35 | """ 1000 단위 구분점 표시 여부 """
36 | return self.info.get('separator', False)
37 |
38 | @separator.setter
39 | def separator(self, separator):
40 | """ 1000 단위 구분점 표시 여부 설정"""
41 | if separator:
42 | pd.options.display.float_format = '{:,}'.format
43 | else:
44 | pd.options.display.float_format = '{:}'.format
45 | self.info['separator'] = separator
46 |
47 | def show(self, tp, show_class: bool = True, show_depth: int = 10, show_concept: bool = True) -> Optional[DataFrame]:
48 | """
49 | 재무제표 정보를 표시해주는 Method
50 |
51 | Parameters
52 | ----------
53 | tp: str
54 | 표시할 재무제표 타입: 'fs' 재무상태표, 'is' 손익계산서, 'ci' 포괄손익계산서, 'cf' 현금흐름표
55 | show_class: bool
56 | class 표시 여부
57 | show_depth: bool
58 | 표시할 class의 깊이
59 | show_concept: bool
60 | concept_id 표시 여부
61 |
62 | Returns
63 | -------
64 | DataFrame
65 | 재무제표
66 | """
67 | from dart_fss.fs.extract import find_all_columns
68 |
69 | df = self._statements[tp]
70 | if df is None:
71 | return df
72 | class_columns = find_all_columns(df, 'class')
73 |
74 | if show_class is False:
75 | ncolumns = []
76 | columns = df.columns.tolist()
77 | for column in columns:
78 | if column not in class_columns:
79 | ncolumns.append(column)
80 | if len(ncolumns) > 0:
81 | ncolumns = pd.MultiIndex.from_tuples(ncolumns)
82 | df = df[ncolumns]
83 | else:
84 | drop_rows = []
85 | columns = df.columns.tolist()
86 | cdf = df[class_columns]
87 | for idx in range(len(cdf)):
88 | for class_idx, item in enumerate(cdf.iloc[idx]):
89 | if class_idx > show_depth and item is not None:
90 | drop_rows.append(idx)
91 | ncolumns = []
92 | for column in columns:
93 | if column not in class_columns[show_depth + 1:]:
94 | ncolumns.append(column)
95 | if len(ncolumns) > 0:
96 | ncolumns = pd.MultiIndex.from_tuples(ncolumns)
97 | df = df[ncolumns].drop(drop_rows)
98 |
99 | if show_concept is False:
100 | concept_colmuns = find_all_columns(df, 'concept_id')
101 | if len(concept_colmuns) == 1:
102 | ncolumns = []
103 | columns = df.columns.tolist()
104 | for column in columns:
105 | if column not in concept_colmuns:
106 | ncolumns.append(column)
107 | if len(ncolumns) > 0:
108 | ncolumns = pd.MultiIndex.from_tuples(ncolumns)
109 | df = df[ncolumns]
110 | return df
111 |
112 | @property
113 | def labels(self) -> Dict[str, DataFrame]:
114 | """ 검색된 label들의 정보를 담고 있는 DataFrame """
115 | return self._labels
116 |
117 | def to_dict(self) -> Dict[str, str]:
118 | """ FinancialStatement의 요약 정보를 Dictionary 로 반환"""
119 | info = self.info.copy()
120 | df_info = []
121 | for tp in self._order:
122 | df = self._statements.get(tp)
123 | if df is not None:
124 | df_info.append({'title': df.columns.tolist()[0][0]})
125 | else:
126 | df_info.append({'title': tp + ' is None'})
127 | info['financial statement'] = df_info
128 | return info
129 |
130 | def save(self, filename: str = None, path: str = None):
131 | """
132 | 재무제표 정보를 모두 엑셀파일로 일괄저장
133 |
134 | Parameters
135 | ----------
136 | filename: str
137 | 저장할 파일명(default: {corp_code}_{report_tp}.xlsx)
138 | path: str
139 | 저장할 폴더(default: 실행폴더/fsdata)
140 | """
141 | import os
142 |
143 | if path is None:
144 | path = os.getcwd()
145 | path = os.path.join(path, "fsdata")
146 | create_folder(path)
147 |
148 | if filename is None:
149 | filename = '{}_{}.xlsx'.format(self.info.get('corp_code'), self.info.get('report_tp'))
150 |
151 | file_path = os.path.join(path, filename)
152 | with pd.ExcelWriter(file_path) as writer:
153 | infodf = pd.DataFrame({"info": self.info})
154 | infodf.to_excel(writer, sheet_name="info")
155 | for tp in self._statements:
156 | fs = self._statements[tp]
157 | if fs is not None:
158 | sheet_name = "Data_" + tp
159 | fs.to_excel(writer, sheet_name=sheet_name)
160 | sheet_name = "Labels_" + tp
161 | label = self._labels[tp]
162 | label.to_excel(writer, sheet_name=sheet_name)
163 | return file_path
164 |
165 | @classmethod
166 | def load(cls, filepath):
167 | xl = pd.ExcelFile(filepath)
168 | statements = {
169 | 'bs': None,
170 | 'is': None,
171 | 'cis': None,
172 | 'cf': None
173 | }
174 |
175 | labels = {
176 | 'bs': None,
177 | 'is': None,
178 | 'cis': None,
179 | 'cf': None
180 | }
181 |
182 | for sheet in xl.sheet_names:
183 | if sheet == "info":
184 | info = xl.parse(sheet, index_col=0)
185 | info = info.where(pd.notnull(info), None)
186 | else:
187 | sheet_type, statement_tp = sheet.split("_")
188 | if sheet_type == "Data":
189 | statements[statement_tp] = xl.parse(
190 | sheet, header=[0, 1], index_col=0
191 | )
192 | elif sheet_type == "Labels":
193 | labels[statement_tp] = xl.parse(sheet, header=[0, 1], index_col=0)
194 | xl.close()
195 | return cls(statements, labels, info["info"].to_dict())
196 |
197 | def __getattr__(self, item):
198 | if item in self.info:
199 | return self.info[item]
200 | else:
201 | error = "'{}' object has no attribute '{}'".format(type(self).__name__, item)
202 | raise AttributeError(error)
203 |
204 | def __getitem__(self, item):
205 | if isinstance(item, str):
206 | return self._statements[item]
207 | else:
208 | return self._statements[self._order[item]]
209 |
210 | def __len__(self):
211 | return len(self._statements)
212 |
213 | def __repr__(self):
214 | from pprint import pformat
215 | info = self.to_dict()
216 | return pformat(info)
217 |
218 | def _repr_html_(self):
219 | return dict_to_html(self.to_dict(), header=['Label', 'Data'])
220 |
221 | def __dir__(self) -> Iterable[str]:
222 | dirs = super(FinancialStatement, self).__dir__()
223 | dirs = list(dirs)
224 | keys = self.to_dict()
225 | keys.pop('financial statement')
226 | dirs.extend(keys)
227 | return dirs
228 |
--------------------------------------------------------------------------------
/dart_fss/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/josw123/dart-fss/10267a41054e29fc0dc17788010e2f9aff31b393/dart_fss/tests/__init__.py
--------------------------------------------------------------------------------
/dart_fss/tests/test_api_filings.py:
--------------------------------------------------------------------------------
1 | def test_get_corp_code(dart):
2 | res = dart.api.filings.get_corp_code()
3 | actual = res[0].keys()
4 | expected = ['corp_code', 'corp_name', 'corp_eng_name', 'stock_code', 'modify_date'] # API UPDATED
5 | for act in actual:
6 | assert act in expected
7 |
8 |
9 | def test_get_corp_info(dart):
10 | se = dart.api.filings.get_corp_info('00126380')
11 | actual = se['est_dt']
12 | expected = '19690113'
13 | assert actual == expected
14 |
15 |
16 | def test_download_document(dart):
17 | import tempfile
18 | with tempfile.TemporaryDirectory() as path:
19 | res = dart.api.filings.download_document(path, '20190401004781')
20 | assert res is not None
21 |
22 |
23 | def test_search_filings(dart):
24 | f = dart.api.filings.search_filings(corp_code='00126380', bgn_de='20190101', end_de='20190301', last_reprt_at='Y')
25 | actual = f['total_count']
26 | expected = 29
27 | assert actual == expected
--------------------------------------------------------------------------------
/dart_fss/tests/test_api_finance.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.errors.errors import NoDataReceived
3 |
4 |
5 | def test_fnltt_singl_acnt(dart):
6 | try:
7 | _ = dart.api.finance.fnltt_singl_acnt(
8 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
9 | corp_code="00126380",
10 | bsns_year="2018",
11 | reprt_code="11011",
12 | )
13 | except NoDataReceived:
14 | pass
15 | except Exception as e:
16 | raise e
17 |
18 |
19 | def test_fnltt_multi_acnt(dart):
20 | try:
21 | _ = dart.api.finance.fnltt_multi_acnt(
22 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
23 | corp_code="00356370,00126380",
24 | bsns_year="2018",
25 | reprt_code="11011",
26 | )
27 | except NoDataReceived:
28 | pass
29 | except Exception as e:
30 | raise e
31 |
32 |
33 | def test_fnltt_singl_acnt_all(dart):
34 | try:
35 | _ = dart.api.finance.fnltt_singl_acnt_all(
36 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
37 | corp_code="00126380",
38 | bsns_year="2018",
39 | reprt_code="11011",
40 | fs_div="OFS",
41 | )
42 | except NoDataReceived:
43 | pass
44 | except Exception as e:
45 | raise e
46 |
47 |
48 | def test_xbrl_taxonomy(dart):
49 | try:
50 | _ = dart.api.finance.xbrl_taxonomy(
51 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
52 | sj_div="BS1",
53 | )
54 | except NoDataReceived:
55 | pass
56 | except Exception as e:
57 | raise e
58 |
59 |
60 | def test_download_xbrl(dart):
61 | import tempfile
62 | with tempfile.TemporaryDirectory() as temp:
63 | actual = dart.api.finance.download_xbrl(path=temp, rcept_no='20180402005019', reprt_code='11011')
64 | assert actual is not None
65 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_api_market.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | def test_stock_market_list(dart):
4 | _ = dart.api.market.get_stock_market_list('Y')
5 |
6 |
7 | def test_trading_halt_list(dart):
8 | _ = dart.api.market.get_trading_halt_list('Y')
9 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_api_registration.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.errors.errors import NoDataReceived
3 |
4 |
5 | def test_extr_rs(dart):
6 | try:
7 | _ = dart.api.registration.extr_rs(
8 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
9 | corp_code="00219097",
10 | bgn_de="20190101",
11 | end_de="20191231",
12 | )
13 | except NoDataReceived:
14 | pass
15 | except Exception as e:
16 | raise e
17 |
18 |
19 | def test_mg_rs(dart):
20 | try:
21 | _ = dart.api.registration.mg_rs(
22 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
23 | corp_code="00109718",
24 | bgn_de="20190101",
25 | end_de="20191231",
26 | )
27 | except NoDataReceived:
28 | pass
29 | except Exception as e:
30 | raise e
31 |
32 |
33 | def test_stkdp_rs(dart):
34 | try:
35 | _ = dart.api.registration.stkdp_rs(
36 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
37 | corp_code="01338724",
38 | bgn_de="20190101",
39 | end_de="20191231",
40 | )
41 | except NoDataReceived:
42 | pass
43 | except Exception as e:
44 | raise e
45 |
46 |
47 | def test_bd_rs(dart):
48 | try:
49 | _ = dart.api.registration.bd_rs(
50 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
51 | corp_code="00858364",
52 | bgn_de="20190101",
53 | end_de="20191231",
54 | )
55 | except NoDataReceived:
56 | pass
57 | except Exception as e:
58 | raise e
59 |
60 |
61 | def test_estk_rs(dart):
62 | try:
63 | _ = dart.api.registration.estk_rs(
64 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
65 | corp_code="00106395",
66 | bgn_de="20190101",
67 | end_de="20191231",
68 | )
69 | except NoDataReceived:
70 | pass
71 | except Exception as e:
72 | raise e
73 |
74 |
75 | def test_dv_rs(dart):
76 | try:
77 | _ = dart.api.registration.dv_rs(
78 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
79 | corp_code="00105271",
80 | bgn_de="20190101",
81 | end_de="20191231",
82 | )
83 | except NoDataReceived:
84 | pass
85 | except Exception as e:
86 | raise e
87 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_api_shareholder.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.errors.errors import NoDataReceived
3 |
4 |
5 | def test_majorstock(dart):
6 | try:
7 | _ = dart.api.shareholder.majorstock(
8 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
9 | corp_code="00126380",
10 | )
11 | except NoDataReceived:
12 | pass
13 | except Exception as e:
14 | raise e
15 |
16 |
17 | def test_elestock(dart):
18 | try:
19 | _ = dart.api.shareholder.elestock(
20 | api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
21 | corp_code="00126380",
22 | )
23 | except NoDataReceived:
24 | pass
25 | except Exception as e:
26 | raise e
27 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_auth.py:
--------------------------------------------------------------------------------
1 | def test_auth(dart):
2 | api_key = dart.get_api_key()
3 | assert api_key is not None
4 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_case/crp_case.py:
--------------------------------------------------------------------------------
1 | from .testcrp import TestCrp
2 |
3 | # 삼성전자
4 | samsung = TestCrp(corp_code='00126380', bgn_de='20110101',
5 | separate=False, report_tp='annual')
6 | samsung.add_test_value('bs', '20091231', 'concept_id',
7 | 'ifrs-full_Equity', 73045202000000)
8 | samsung.add_test_value('is', '20091231', 'concept_id',
9 | 'dart_OperatingIncomeLoss', 10925259000000)
10 | samsung.add_test_value('cis', '20091231', 'concept_id', 'ifrs-full_ComprehensiveIncome', 9098844000000) # Changed from label_ko to concept_id
11 | samsung.add_test_value('cf', '20091231', 'concept_id',
12 | 'dart_CashAndCashEquivalentsAtEndOfPeriodCf', 10149930000000)
13 | samsung.add_test_value('cf', '20151231', 'concept_id',
14 | 'ifrs-full_InterestPaidClassifiedAsOperatingActivities', -748256000000)
15 | samsung.add_test_value('is', '20151231', 'concept_id', 'ifrs-full_BasicEarningsLossPerShare', 126305)
16 |
17 | # XBRL Viewer 업데이트로 인한 테스트 케이스(#146)
18 | samsung2 = TestCrp(corp_code='00126380', bgn_de='20220101', end_de='20231231',
19 | separate=False, report_tp='quarter')
20 | samsung2.add_test_value('bs', '20220930', 'concept_id','ifrs-full_CurrentAssets', 250880637000000)
21 |
22 | # 현대자동차
23 | hyundai = TestCrp(corp_code='00164742', bgn_de='20120101',
24 | separate=False, report_tp='annual')
25 | hyundai.add_test_value('bs', '20101231', 'label_ko', '유동자산', 43520154000000)
26 | hyundai.add_test_value('is', '20101231', 'label_ko', '영업이익', 5885960000000)
27 | hyundai.add_test_value('cis', '20101231', 'concept_id',
28 | 'ifrs-full_ComprehensiveIncome', 6223342000000)
29 | hyundai.add_test_value('cf', '20101231', 'concept_id',
30 | 'dart_CashAndCashEquivalentsAtEndOfPeriodCf', 6215815000000)
31 |
32 | # 덱스터
33 | dexter = TestCrp(corp_code='01021949', bgn_de='20120101',
34 | separate=False, report_tp='annual')
35 | dexter.add_test_value('bs', '20141231', 'concept_id',
36 | 'ifrs-full_CurrentAssets', 14049343213)
37 | dexter.add_test_value('bs', '20161231', 'concept_id',
38 | 'ifrs-full_Equity', 78181834231)
39 |
40 | # 이십일스토어 (구: 두원석재)
41 | stone = TestCrp(corp_code='01183407', bgn_de='20120101', end_de='20201231', # 2024045 상장폐지로 인한 테스트 케이스 수정
42 | separate=True, report_tp='annual')
43 | stone.add_test_value('bs', '20161231', 'label_ko', 'I.유동자산', 5531436227)
44 |
45 | # 에스제이그룹
46 | sjgroup = TestCrp(corp_code='01222432', bgn_de='20190101',
47 | separate=False, report_tp='annual')
48 | sjgroup.add_test_value('bs', '20191231', 'label_ko', '유동자산', 70665507683)
49 |
50 | # 삼성에스디에스 분기 검색
51 | sds = TestCrp(corp_code='00126186', bgn_de='20130813',
52 | end_de='20150807', separate=False, report_tp='quarter')
53 | sds.add_test_value('bs', '20130630', 'label_ko', '유동자산', 2602291807082)
54 |
55 | # JTC
56 | jtc = TestCrp(corp_code='01041828', bgn_de='20190101',
57 | end_de='20200811', separate=False, report_tp='annual')
58 | jtc.add_test_value('cf', '20200229', 'concept_id',
59 | 'ifrs-full_CashFlowsFromUsedInOperatingActivities', 4810599061)
60 |
61 | # GS리테일
62 | gs_retail = TestCrp(corp_code='00140177', bgn_de='20160101', end_de='20250402', # 20110101에 연결재무제표가 없으므로 20160101로 변경
63 | separate=False, report_tp='annual')
64 | gs_retail.add_test_value('cis', '20161231', 'label_ko', '매출원가', 6015117323057)
65 | gs_retail.add_test_value('cis', '20161231', 'label_ko', '기타손실', 60931373946)
66 | gs_retail.add_test_value('cis', '20161231', 'label_ko',
67 | '판매비와관리비', 1168120874437)
68 | gs_retail.add_test_value('cis', '20161231', 'label_ko', '금융비용', 48502482146) # 금용원가->금융비용으로 변경
69 |
70 | # LG화학
71 | lg_chemical = TestCrp(corp_code='00356361', bgn_de='20180101',
72 | end_de='20201231', separate=False, report_tp='quarter')
73 | lg_chemical.add_test_value('cis', '20180701-20180930',
74 | 'concept_id', 'ifrs-full_ProfitLoss', 346600000000)
75 |
76 | # LG화학
77 | lg_chemical2 = TestCrp(corp_code='00356361', bgn_de='20120101',
78 | end_de='20201231', separate=False, report_tp='annual')
79 | lg_chemical2.add_test_value(
80 | 'is', '20120101-20121231', 'label_ko', '보통주기본주당이익', 20318)
81 |
82 | # 메리츠 화재 (#55)
83 | meritz_fire = TestCrp(corp_code='00117744', bgn_de='20140101',
84 | end_de='20141231', separate=False, report_tp='annual')
85 | meritz_fire.add_test_value('cis', '20130401-20131231',
86 | 'label_ko', 'Ⅷ.연결당기순이익', 135682814119)
87 |
88 | # 하나 금융 투자 (#54)
89 | hana_fn = TestCrp(corp_code='00547583', bgn_de='20120101',
90 |
91 | end_de='20121231', separate=False, report_tp='annual')
92 | hana_fn.add_test_value('bs', '20100101', 'label_ko', '부채총계', 139823866000000)
93 |
94 | # 아세아 제지 (#63)
95 | asia_paper = TestCrp(corp_code='00138729', bgn_de='20180101', end_de='20200331', separate=False, report_tp='annual')
96 | asia_paper.add_test_value('bs', '20181231', 'label_ko', '유동자산', 280262148456)
97 |
98 | # 부국증권 (#66)
99 | bookook = TestCrp(corp_code='00123772', bgn_de='20200101', end_de='20210503', separate=False, report_tp='annual')
100 | bookook.add_test_value('bs', '20201231', 'label_ko', '부채및자본총계', 1608864797228)
101 |
102 | # 바이온 (# 79)
103 | byon = TestCrp(corp_code='00232089', bgn_de='20100101', end_de='20100701', separate=True, report_tp=['quarter'])
104 | byon.add_test_value('bs', '20100331', 'label_ko', '유동자산', 2722479385)
105 |
106 |
107 | test_crp_list = [samsung, samsung2, hyundai, dexter, stone, sjgroup, sds,
108 | jtc, gs_retail, lg_chemical, lg_chemical2, meritz_fire, hana_fn, asia_paper, bookook, byon]
109 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_case/testcrp.py:
--------------------------------------------------------------------------------
1 | import pytest
2 | from dart_fss.fs.extract import find_all_columns
3 | from dart_fss.utils import str_compare
4 |
5 |
6 | class TestCrp(object):
7 | def __init__(self, corp_code, bgn_de, separate, report_tp, end_de=None):
8 | self.corp = None
9 | if corp_code:
10 | self.corp_code = corp_code
11 | else:
12 | pytest.fail('The parameter should be initialized: corp_code')
13 |
14 | self.bgn_de = bgn_de
15 | self.end_de = end_de
16 | self.separate = separate
17 | self.report_tp = report_tp
18 | self.test_set = []
19 |
20 | def set_corp_list(self, corp_list):
21 | if self.corp_code:
22 | self.corp = corp_list.find_by_corp_code(self.corp_code)
23 |
24 | def add_test_value(self, fs_tp, date, column, item, expected):
25 | test_set = {
26 | 'fs_tp': fs_tp,
27 | 'date': date,
28 | 'column': column,
29 | 'item': item,
30 | 'expected': expected
31 | }
32 | self.test_set.append(test_set)
33 |
34 | def run_test(self):
35 | if self.corp is None:
36 | pytest.fail('The corp_list should be initialized')
37 |
38 | fs = self.corp.extract_fs(bgn_de=self.bgn_de, end_de=self.end_de,
39 | separate=self.separate, report_tp=self.report_tp, skip_error=False)
40 | for test in self.test_set:
41 | tp = test['fs_tp']
42 | date = test['date']
43 | column = test['column']
44 | item = test['item']
45 | expected = test['expected']
46 |
47 | df = fs[tp]
48 | date_column = find_all_columns(df=df, query=date)
49 | label_column = find_all_columns(df=df, query=column)
50 | actual = None
51 |
52 | if isinstance(date_column, list) and len(date_column) > 0:
53 | date_column = date_column[0]
54 | elif len(date_column) > 0:
55 | date_column = date_column[0]
56 | else:
57 | date_column = None
58 |
59 | if isinstance(label_column, list) and len(label_column) > 0:
60 | label_column = label_column[0]
61 | elif len(label_column) > 0:
62 | label_column = label_column[0]
63 | else:
64 | label_column = None
65 |
66 | if label_column is not None and date_column is not None:
67 | for idx in range(len(df)):
68 | text = df[label_column].iloc[idx].replace(' ', '')
69 | if str_compare(text, item):
70 | actual = df[date_column].iloc[idx]
71 |
72 | if actual != expected:
73 | pytest.fail("Test failed: corp_code='{}', ".format(self.corp.corp_code) +
74 | "corp_name='{}', fs_tp='{}', ".format(self.corp.corp_name, tp) +
75 | "start_dt='{}', report_tp='{}', ".format(self.bgn_de, fs.info['report_tp']) +
76 | "date='{}', column='{}',".format(date, column) +
77 | "item='{}', actual='{}', expected='{}'".format(item, actual, expected))
78 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_corp.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 |
4 | @pytest.fixture(scope='session')
5 | def corp_list(dart):
6 | return dart.get_corp_list()
7 |
8 |
9 | def test_find_by_corp_name(corp_list):
10 | se = corp_list.find_by_corp_name('삼성전자', exactly=True)[0]
11 | actual = se.corp_code
12 | expected = '00126380'
13 | assert actual == expected
14 |
15 |
16 | def test_find_by_corp_name_with_market_type(corp_list):
17 | # Change test case from samsung to studio dragon
18 | res = corp_list.find_by_corp_name('스튜디오드래곤', market='K')
19 | actual = len(res)
20 | expected = 1
21 | assert actual == expected
22 |
23 |
24 | def test_find_by_product(corp_list):
25 | # Change test case from cell phone to mine
26 | res = corp_list.find_by_product('광산')
27 | actual = len(res)
28 | expected = 1
29 | assert actual == expected
30 |
31 |
32 | def test_find_by_sector(corp_list):
33 | res = corp_list.find_by_sector(corp_list.sectors[0])
34 | actual = len(res)
35 | expected = 21 #섹터 회사수 증가로 수정
36 | assert actual == expected
37 |
38 |
39 | def test_find_by_corp_code(corp_list):
40 | se_corp_code = '00126380'
41 | se = corp_list.find_by_corp_code(se_corp_code)
42 | actual = se.corp_code
43 | expected = '00126380'
44 | assert actual == expected
45 |
46 |
47 | def test_find_by_stock_code(corp_list):
48 | stock_code = '005930'
49 | se = corp_list.find_by_stock_code(stock_code)
50 | actual = se.corp_code
51 | expected = '00126380'
52 | assert actual == expected
53 |
54 |
55 | def test_corp_to_dict(corp_list):
56 | se = corp_list.find_by_corp_name('삼성전자', exactly=True)[0]
57 | samsung_dict = se.to_dict()
58 | actual = samsung_dict['stock_code']
59 | expected = '005930'
60 | assert actual == expected
61 |
62 |
63 | def test_corp_load(corp_list):
64 | se = corp_list.find_by_corp_name('삼성전자', exactly=True)[0]
65 | se.load()
66 | actual = se.jurir_no
67 | expected = '1301110006246'
68 | assert actual == expected
69 |
70 |
71 | def test_corp_get_major_shareholder(corp_list):
72 | se = corp_list.find_by_corp_name('삼성전자', exactly=True)[0]
73 | sh = se.get_major_shareholder()
74 | actual = sh.columns
75 | expected = 'stkqy_irds'
76 | assert expected in actual
77 |
78 |
79 | def test_corp_get_executive_shareholder(corp_list):
80 | se = corp_list.find_by_corp_name('삼성전자', exactly=True)[0]
81 | sh = se.get_executive_shareholder()
82 | actual = sh.columns
83 | expected = 'sp_stock_lmp_cnt'
84 | assert expected in actual
85 |
86 |
87 | def test_corp_search_filings(corp_list):
88 | se = corp_list.find_by_corp_name('삼성전자', exactly=True)[0]
89 | filings = se.search_filings(bgn_de='20190101', end_de='20190103')
90 | actual = filings.total_count
91 | expected = 1
92 | assert actual == expected
93 |
94 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_errors.py:
--------------------------------------------------------------------------------
1 | import pytest
2 | from .test_corp import corp_list
3 |
4 | def test_check_status(dart):
5 | ret_code = {
6 | 'status': '000',
7 | 'message': '정상'
8 | }
9 | dart.errors.check_status(**ret_code)
10 |
11 |
12 | def test_errors(dart):
13 | errors = [
14 | ('010', dart.errors.APIKeyError),
15 | ('011', dart.errors.TemporaryLocked),
16 | ('013', dart.errors.NoDataReceived),
17 | ('020', dart.errors.OverQueryLimit),
18 | ('100', dart.errors.InvalidField),
19 | ('800', dart.errors.ServiceClose),
20 | ('900', dart.errors.UnknownError),
21 | ]
22 | for status, err in errors:
23 | with pytest.raises(err):
24 | err_code = {
25 | 'status': status,
26 | }
27 | dart.errors.check_status(**err_code)
28 |
29 |
30 | def test_not_found_consolidated(dart, corp_list):
31 | with pytest.raises(dart.errors.NotFoundConsolidated):
32 | crp = corp_list.find_by_stock_code('204210') # 종목명 변경
33 | crp.extract_fs(bgn_de='20180101', end_de='20190101')
34 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_fs.py:
--------------------------------------------------------------------------------
1 | import pytest
2 | from dart_fss.fs.extract import find_all_columns
3 |
4 | from .test_case.crp_case import test_crp_list
5 | from .test_corp import corp_list
6 |
7 |
8 | @pytest.mark.slow
9 | @pytest.mark.parametrize("corp", test_crp_list)
10 | def test_crp_financial_statement(dart, corp, corp_list):
11 | dart.utils.request.update_user_agent(True)
12 | corp.set_corp_list(corp_list)
13 | corp.run_test()
14 |
15 |
16 | @pytest.fixture(scope='session')
17 | def fs_report(corp_list):
18 | # 00164779: SK하이닉스
19 | skhynix = corp_list.find_by_corp_code('00164779')
20 | return skhynix.extract_fs(bgn_de='20180101')
21 |
22 |
23 | def test_fs_class_false(fs_report):
24 | df = fs_report.show('bs', show_class=False)
25 | columns = find_all_columns(df, 'class')
26 | actual = len(columns)
27 | expected = 0
28 | assert actual == expected
29 |
30 |
31 | def test_fs_concept_false(fs_report):
32 | df = fs_report.show('bs', show_concept=False)
33 | columns = find_all_columns(df, 'concept')
34 | actual = len(columns)
35 | expected = 0
36 | assert actual == expected
37 |
38 |
39 | def test_fs_show_depth(fs_report):
40 | df = fs_report.show('bs', show_depth=1)
41 | columns = find_all_columns(df, 'class')
42 | actual = len(columns)
43 | expected = 2
44 | assert actual == expected
45 |
46 |
47 | def test_fs_to_dict(fs_report):
48 | info = fs_report.to_dict()
49 | actual = info['corp_code']
50 | expected = '00164779'
51 | assert actual == expected
52 |
53 |
54 | def test_fs_to_save(fs_report):
55 | import os
56 | import tempfile
57 | with tempfile.TemporaryDirectory() as path:
58 | file_path = fs_report.save(path=path)
59 | actual = os.path.isfile(file_path)
60 | expected = True
61 | assert actual == expected
62 |
63 |
64 | def test_fs_load(fs_report):
65 | import tempfile
66 | with tempfile.TemporaryDirectory() as path:
67 | expected = fs_report.info
68 | file_path = fs_report.save(path=path)
69 | loaded_report = fs_report.load(file_path)
70 | assert loaded_report.info == expected
71 |
72 |
73 | @pytest.fixture
74 | def test_cases_for_xbrl():
75 | return [
76 | {
77 | "stock_code": "051310",
78 | "date": "20120814",
79 | "report_tp": "half",
80 | "fs_tp": "cis",
81 | "expected": 29
82 | },
83 | {
84 | "stock_code": "000880",
85 | "date": "20171114",
86 | "report_tp": "quarter",
87 | "fs_tp": "cis",
88 | "expected": 19
89 | },
90 | {
91 | "stock_code": "007280",
92 | "date": "20130515",
93 | "report_tp": "quarter",
94 | "fs_tp": "bs",
95 | "expected": 52
96 | },
97 | {
98 | "stock_code": "011080",
99 | "date": "20121113",
100 | "report_tp": "quarter",
101 | "fs_tp": "cf",
102 | "expected": 190
103 | },
104 | {
105 | "stock_code": "016170",
106 | "date": "20171114",
107 | "report_tp": "quarter",
108 | "fs_tp": "bs",
109 | "expected": 34
110 | },
111 | {
112 | "stock_code": "016170",
113 | "date": "20171114",
114 | "report_tp": "quarter",
115 | "fs_tp": "cf",
116 | "expected": 66
117 | },
118 | {
119 | "stock_code": "038320",
120 | "date": "20120515",
121 | "report_tp": "quarter",
122 | "fs_tp": "cf",
123 | "expected": 135
124 | },
125 | {
126 | "stock_code": "038320",
127 | "date": "20120824",
128 | "report_tp": "half",
129 | "fs_tp": "cf",
130 | "expected": 145
131 | },
132 | {
133 | "stock_code": "009240",
134 | "date": "20130401",
135 | "report_tp": "annual",
136 | "fs_tp": "bs",
137 | "expected": 35
138 | },
139 | ]
140 |
141 |
142 | @pytest.fixture(scope='session')
143 | def test_extract_fs(test_cases_for_xbrl, corp_list):
144 | for test_case in test_cases_for_xbrl:
145 | corp = corp_list.find_by_stock_code(
146 | test_case["stock_code"], include_delisting=True
147 | )
148 | fs = corp.extract_fs(
149 | bgn_de=test_case["date"],
150 | end_de=test_case["date"],
151 | report_tp=[test_case["report_tp"]],
152 | separate=True,
153 | )
154 | actual = fs[test_case["fs_tp"]].shape[0]
155 | expected = test_case["expected"]
156 | assert actual == expected, (
157 | f"Failed for {test_case['stock_code']} "
158 | f"on {test_case['date']} "
159 | f"with report type {test_case['report_tp']} "
160 | f"and financial statement type {test_case['fs_tp']}. "
161 | f"Expected {expected}, but got {actual}."
162 | )
--------------------------------------------------------------------------------
/dart_fss/tests/test_fs_search.py:
--------------------------------------------------------------------------------
1 | import pytest
2 | from dart_fss.fs.extract import *
3 |
4 |
5 | def test_str_to_float_number():
6 | actual = str_to_float(1.0, 1.0)
7 | expected = 1.0
8 | assert actual == expected
9 |
10 |
11 | def test_str_to_float_raise_value_error():
12 | with pytest.raises(ValueError):
13 | _ = str_to_float([1, 2], 1.0)
14 |
15 |
16 | def test_extract_date_from_header():
17 | from bs4 import BeautifulSoup
18 |
19 | text = '
제21(당)기 2018년 01월 01일부터 12월 31일 까지'
20 | text = BeautifulSoup(text, 'html.parser')
21 |
22 | date_info = extract_date_from_header(text)
23 | actual = None
24 | if len(date_info) > 0:
25 | date_info = date_info[0]
26 | actual = '-'.join([x.strftime('%Y%m%d') for x in date_info])
27 | expected = '20180101-20181231'
28 | assert actual == expected
29 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_regex.py:
--------------------------------------------------------------------------------
1 | from dart_fss.utils.regex import str_to_regex
2 |
3 |
4 | def test_str_to_regex():
5 | query = '삼성 OR ( 하이 AND 닉스)'
6 | regex = str_to_regex(query=query)
7 | actual = regex.search('하이닉')
8 | expected = None
9 | assert actual == expected
10 |
11 |
12 | def test_str_to_regex_2():
13 | query = '삼성 OR 하이'
14 | regex = str_to_regex(query=query)
15 | actual = regex.search('삼성이닉스').group(0)
16 | expected = '삼성'
17 | assert actual == expected
18 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_reports.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 |
4 | @pytest.fixture(scope='module')
5 | def last_report(dart):
6 | corp_code = '00126380'
7 | return dart.search(corp_code=corp_code, bgn_de='20180101', end_de='20190101', pblntf_detail_ty='a001')[0]
8 |
9 |
10 | def test_reports(last_report):
11 | actual = last_report.rcp_no
12 | expected = '20180402005019'
13 | assert actual == expected
14 |
15 |
16 | def test_reports_pages(last_report):
17 | first_page = last_report[0]
18 | actual = first_page.ele_id
19 | expected = 1
20 | assert actual == expected
21 |
22 |
23 | def test_reports_to_dict(last_report):
24 | results = last_report.to_dict()
25 | actual = results['corp_name']
26 | expected = '삼성전자'
27 | assert actual == expected
28 |
29 |
30 | def test_reports_xbrl(last_report):
31 | xbrl_file = last_report.xbrl.filename
32 | assert xbrl_file is not None
33 |
34 |
35 | def test_reports_find_all(last_report):
36 | query = {
37 | 'includes': '전문가 AND 확인',
38 | 'excludes': '1'
39 | }
40 | page = last_report.find_all(**query)['pages'][0]
41 | actual = page.dcm_no
42 | expected = '6060273'
43 | assert actual == expected
44 |
45 |
46 | def test_reports_to_dict_summary_false(last_report):
47 | info = last_report.to_dict(summary=False)
48 | actual = info.get('xbrl')
49 | expected = '[삼성전자]사업보고서_IFRS(원문XBRL)(2018.04.02).zip'
50 | assert actual == expected
51 |
52 |
53 | def test_xbrlviewer(dart):
54 | corp_code = '00126380'
55 | report = dart.search(corp_code=corp_code, bgn_de='20230901', end_de='20231231', pblntf_ty='a')[0]
56 | actual = len(report.to_dict(summary=False)['xbrlviewer'])
57 | expected = 1
58 |
59 | assert actual == expected
--------------------------------------------------------------------------------
/dart_fss/tests/test_search_report.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 |
4 | @pytest.fixture(scope='module')
5 | def annual_reports(dart):
6 | corp_code = '00126380'
7 | return dart.search(corp_code=corp_code, bgn_de='20140101', end_de='20190101', pblntf_detail_ty='a001')
8 |
9 |
10 | def test_search_report_get_page_no(annual_reports):
11 | actual = annual_reports.page_no
12 | expected = 1
13 | assert actual == expected
14 |
15 |
16 | def test_search_report_total_count(annual_reports):
17 | actual = annual_reports.total_count
18 | expected = 5
19 | assert actual == expected
20 |
21 |
22 | def test_search_report_total_page(annual_reports):
23 | actual = annual_reports.total_page
24 | expected = 1
25 | assert actual == expected
26 |
27 |
28 | def test_search_report_report_list(annual_reports):
29 | actual = len(annual_reports.report_list)
30 | expected = 5
31 | assert actual == expected
32 |
33 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_utils.py:
--------------------------------------------------------------------------------
1 | from dart_fss.utils import dict_to_html, check_datetime
2 |
3 |
4 | def test_dict_to_html():
5 | from bs4 import BeautifulSoup
6 | from collections import OrderedDict
7 | data = OrderedDict()
8 | data['A'] = 1
9 | data['B'] = 2
10 | data['C'] = [{'D': 3}, {'E': 4}]
11 | html = dict_to_html(data)
12 | soup = BeautifulSoup(html, 'html.parser')
13 | tr = soup.find_all('tr')
14 | sub_tr = tr[2].find_all('tr')
15 |
16 | actual = (len(tr), len(sub_tr))
17 | expected = (6, 3)
18 |
19 | assert actual == expected
20 |
21 |
22 | def test_check_datetime():
23 | actual = check_datetime('20191231', '20190101', '20190201')
24 | expected = False
25 | assert actual == expected
26 |
--------------------------------------------------------------------------------
/dart_fss/tests/test_xbrl.py:
--------------------------------------------------------------------------------
1 | import pytest
2 | from dart_fss.fs.extract import find_all_columns
3 |
4 |
5 | @pytest.fixture(scope='module')
6 | def samsung_xbrl(dart):
7 | corp_code = '00126380'
8 | report = dart.search(corp_code=corp_code, bgn_de='20180101', end_de='20190101', pblntf_detail_ty='a001')[0]
9 | return report.xbrl
10 |
11 |
12 | def test_xbrl_tables(samsung_xbrl):
13 | expected = 131
14 | assert len(samsung_xbrl.tables) == expected
15 |
16 |
17 | def test_xbrl_get_document_information(samsung_xbrl):
18 | info = samsung_xbrl.get_document_information()
19 | actual = info.iloc[1].iloc[2]
20 | expected = '사업보고서'
21 | assert actual == expected
22 |
23 |
24 | def test_xbrl_get_period_information(samsung_xbrl):
25 | period = samsung_xbrl.get_period_information()
26 | actual = period.iloc[1].iloc[2]
27 | expected = '2017-01-01'
28 | assert actual == expected
29 |
30 |
31 | def test_xbrl_get_audit_infomation(samsung_xbrl):
32 | audit = samsung_xbrl.get_audit_information()
33 | actual = int(audit.iloc[5].iloc[3])
34 | expected = 260295
35 | assert actual == expected
36 |
37 |
38 | def test_xbrl_get_entity_information(samsung_xbrl):
39 | entity = samsung_xbrl.get_entity_information()
40 | actual = int(entity.iloc[2].iloc[2])
41 | expected = 126380
42 | assert actual == expected
43 |
44 |
45 | def test_xbrl_get_entity_address_information(samsung_xbrl):
46 | address = samsung_xbrl.get_entity_address_information()
47 | actual = address.iloc[2].iloc[2]
48 | expected = 'http://www.samsung.com/sec/'
49 | assert actual == expected
50 |
51 |
52 | def test_xbrl_get_author_information(samsung_xbrl):
53 | author = samsung_xbrl.get_author_information()
54 | column = find_all_columns(author, '공시담당자')[0]
55 | actual = author[column][3]
56 | expected = '031-277-7227'
57 | assert actual == expected
58 |
59 |
60 | def test_xbrl_get_financial_statement_information(samsung_xbrl):
61 | state = samsung_xbrl.get_financial_statement_information()
62 | actual = state.iloc[3][2]
63 | expected = 'D3001'
64 | assert actual == expected
65 |
66 |
67 | def test_xbrl_get_financial_statement(samsung_xbrl):
68 | fs = samsung_xbrl.get_financial_statement()[0]
69 | actual = fs.code
70 | expected = 'D210000'
71 | assert actual == expected
72 |
73 |
74 | def test_xbrl_to_Dataframe(samsung_xbrl):
75 | fs = samsung_xbrl.get_financial_statement()[0]
76 | actual = int(fs.to_DataFrame(show_concept=False, show_class=False, label='연결').iloc[0].iloc[2])
77 | expected = 146982464000000
78 | assert actual == expected
79 |
80 |
81 | def test_xbrl_get_value_by_concept_id(samsung_xbrl):
82 | fs = samsung_xbrl.get_financial_statement()[0]
83 | data = fs.get_value_by_concept_id('ifrs_CurrentAssets', start_dt='20170101', label='Consolidated')
84 | actual = data[('20171231', ('Consolidated',))]
85 | expected = 146982464000000
86 | assert actual == expected
87 |
88 |
89 | def test_xbrl_get_value_by_concept_id_casesensetive(dart):
90 | corp_code = '01513440'
91 | report = dart.search(corp_code=corp_code, bgn_de='20230601', end_de='20231231', pblntf_detail_ty='a003')[0]
92 | xbrl = report.xbrl
93 | cf = xbrl.get_cash_flows(separate=True)[0]
94 | test_concept_id = [
95 | 'entity01513440_IncreaseInLongTermLoansGrossOfCashFlowsFromUsedInInvestingActivities',
96 | 'entity01513440_IncreaseInLongtermLoansGrossOfCashFlowsFromUsedInInvestingActivities',
97 | ]
98 |
99 | expected = [
100 | -106167520.0,
101 | -20032480.0
102 | ]
103 |
104 | for idx, concept_id in enumerate(test_concept_id):
105 | data = cf.get_value_by_concept_id(concept_id, start_dt='20230101', end_dt='20230930', label='Separate')
106 | actual = list(data.values())[-1]
107 | assert actual == expected[idx]
108 |
--------------------------------------------------------------------------------
/dart_fss/utils/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from dart_fss.utils.cache import cache
3 | from dart_fss.utils.datetime import get_datetime, check_datetime
4 | from dart_fss.utils.file import unzip, xml_to_dict, search_file, create_folder, get_cache_folder
5 | from dart_fss.utils.notebook import dict_to_html, is_notebook
6 | from dart_fss.utils.request import get_user_agent, query_to_regex, request
7 | from dart_fss.utils.singleton import Singleton
8 | from dart_fss.utils.spinner import Spinner, enable_spinner
9 | from dart_fss.utils.string import str_compare, str_insert_whitespace, str_unit_to_number_unit, str_upper, get_currency_str
10 | from dart_fss.utils.regex import is_operator, precedence, infix_to_postfix, str_to_regex, str_to_pattern
11 | from dart_fss.utils.dataframe import dataframe_astype
12 |
13 |
14 | __all__ = ['cache', 'get_datetime', 'check_datetime', 'unzip', 'xml_to_dict',
15 | 'search_file', 'create_folder', 'get_cache_folder', 'dict_to_html',
16 | 'is_notebook', 'get_user_agent', 'query_to_regex', 'request',
17 | 'Singleton', 'Spinner', 'enable_spinner', 'str_compare', 'str_insert_whitespace',
18 | 'str_unit_to_number_unit', 'get_currency_str', 'str_upper', 'is_operator', 'precedence',
19 | 'infix_to_postfix', 'str_to_regex', 'str_to_pattern', 'dataframe_astype']
--------------------------------------------------------------------------------
/dart_fss/utils/cache.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | import functools
3 |
4 | # Default Time-To-Live
5 | CACHE_DEFAULT_TTL = datetime.timedelta(hours=1)
6 |
7 |
8 | def cache(ttl=CACHE_DEFAULT_TTL):
9 | """ TTL Cache Decorator
10 |
11 | Parameters
12 | ----------
13 | ttl: datetime.timedelta
14 | Time-To-Live
15 |
16 | Returns
17 | -------
18 | function
19 | Wrapped Function
20 | """
21 | def wrap(func):
22 | cached = {}
23 |
24 | @functools.wraps(func)
25 | def wrapped(*args, **kwargs):
26 | now = datetime.datetime.now()
27 | # see lru_cache for fancier alternatives
28 | key = tuple(args), frozenset(kwargs.items())
29 | if key not in cached or now - cached[key][0] > ttl:
30 | value = func(*args, **kwargs)
31 | cached[key] = (now, value)
32 | return cached[key][1]
33 | return wrapped
34 | return wrap
35 |
--------------------------------------------------------------------------------
/dart_fss/utils/dataframe.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from pandas import DataFrame
3 | from typing import List, Tuple
4 |
5 |
6 | def dataframe_astype(df: DataFrame, columns: List[Tuple[str, type]]):
7 | """ DataFrame Column Type converter
8 |
9 | Parameters
10 | ----------
11 | df: DataFrame
12 | Pandas DataFrame
13 | columns: list of tuple of str, type
14 | column name and type for type conversion
15 |
16 | Returns
17 | -------
18 | DataFrame
19 | Pandas DataFrame
20 | """
21 | for column, tp in columns:
22 | if tp == int or tp == float:
23 | df[column] = df[column].str.replace(',|-', '').astype(tp, errors='ignore')
24 | else:
25 | df[column] = df[column].astype(tp, errors='ignore')
26 | return df
27 |
--------------------------------------------------------------------------------
/dart_fss/utils/datetime.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from typing import Union
3 | from datetime import datetime
4 |
5 | str_or_datetime = Union[str, datetime]
6 |
7 |
8 | def get_datetime(date: str_or_datetime) -> datetime:
9 | """ 문자열을 datetime올 변환
10 |
11 | Parameters
12 | ----------
13 | date: str or datetime
14 | datetime 문자열
15 |
16 | Returns
17 | -------
18 | datetime
19 | 변환된 datetime
20 |
21 | """
22 | if isinstance(date, str):
23 | return datetime.strptime(date, '%Y%m%d')
24 | elif isinstance(date, datetime):
25 | return date
26 | else:
27 | raise ValueError('Invalid datetime format')
28 |
29 |
30 | def check_datetime(date: str_or_datetime,
31 | start_date: str_or_datetime = None,
32 | end_date: str_or_datetime = None) -> bool:
33 | """ Date가 올바른지 체크하는 함수
34 |
35 | Parameters
36 | ----------
37 | date: str or datetime
38 | 체크할 값
39 | start_date: str or datetime
40 | 시작 일자
41 | end_date: str or datetime
42 | 종료 일자
43 |
44 | Returns
45 | -------
46 | bool
47 | Date가 start_date와 end_date 사이에 있는지 여부
48 | """
49 | date = get_datetime(date)
50 | if start_date is not None:
51 | start_date = get_datetime(start_date)
52 | if date < start_date:
53 | return False
54 | if end_date is not None:
55 | end_date = get_datetime(end_date)
56 | if date > end_date:
57 | return False
58 | return True
59 |
--------------------------------------------------------------------------------
/dart_fss/utils/file.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import re
3 | import os
4 | import zipfile
5 | import xmltodict
6 | from collections import OrderedDict
7 |
8 | from typing import List
9 |
10 |
11 | def xml_to_dict(path: str, encoding: str = 'utf8') -> OrderedDict:
12 | """ Xml File to OrderedDict
13 |
14 | Parameters
15 | ----------
16 | path: str
17 | xml file path
18 | encoding: str
19 | file encoding
20 |
21 | Returns
22 | -------
23 | OrderedDict
24 | dictionary
25 | """
26 | with open(path, encoding=encoding) as f:
27 | res = xmltodict.parse(f.read())
28 | return res
29 |
30 |
31 | def unzip(file: str, path: str = None, newFolder: bool = True) -> str:
32 | """ unzip method
33 |
34 | Parameters
35 | ----------
36 | file: str
37 | zip 파일
38 | path: str
39 | unzip 경로
40 | newFolder: bool
41 | 폴더 생성여부
42 |
43 | Returns
44 | -------
45 | str
46 | unzip 경로
47 | """
48 | os.path.altsep = '\\' # fixed extract bug
49 | # Split the path into a pair head and tail
50 | head, tail = os.path.split(file)
51 |
52 | if path:
53 | extract_path = path
54 | else:
55 | extract_path = head
56 |
57 | with zipfile.ZipFile(file, 'r') as zip_ref:
58 | if newFolder:
59 | new_folder = tail.replace('.zip', '')
60 | extract_path = os.path.join(extract_path, new_folder)
61 | zip_ref.extractall(path=extract_path)
62 | return extract_path
63 |
64 |
65 | def search_file(path: str, filename: str = None, extensions: str = 'xbrl') -> List[str]:
66 | """ File 검색
67 |
68 | Parameters
69 | ----------
70 | path: str
71 | 파일 검색 위치
72 | filename: str
73 | 파일명
74 | extensions: str
75 | 파일 확장자
76 |
77 | Returns
78 | -------
79 | list of str
80 | 검색된 파일 리스트
81 | """
82 | file_list = []
83 | for root, _, files in os.walk(path):
84 | for file in files:
85 | if filename is not None and re.search(filename, file):
86 | file_list.append(os.path.join(root, file))
87 | if file.endswith('.' + extensions):
88 | file_list.append(os.path.join(root, file))
89 | return file_list
90 |
91 |
92 | def create_folder(path: str):
93 | """ 폴더생성
94 |
95 | Parameters
96 | ----------
97 | path: str
98 | 폴더 생성
99 |
100 | """
101 | import pathlib
102 | try:
103 | pathlib.Path(path).mkdir(parents=True, exist_ok=True)
104 | except FileExistsError:
105 | pass
106 | except OSError:
107 | raise
108 |
109 |
110 | def get_cache_folder():
111 | """ Create cache folder
112 |
113 | Returns
114 | -------
115 | str
116 | Cache Folder Path
117 | """
118 | from appdirs import user_cache_dir
119 | appname = 'dart-fss'
120 | cache_dir = user_cache_dir(appname)
121 | create_folder(cache_dir)
122 | return cache_dir
123 |
--------------------------------------------------------------------------------
/dart_fss/utils/notebook.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | def dict_to_html(dict_data: dict, exclude=None, header=None) -> str:
3 | """ Dictionary를 HTML table로 변환
4 |
5 | Parameters
6 | ----------
7 | dict_data: dict
8 | dictionary data
9 | exclude: list of str
10 | dictionary 중 HTML table 변환시 제외할 키 리스
11 | header: list of str
12 | Table Header
13 |
14 | Returns
15 | -------
16 | str
17 | HTML table
18 | """
19 | style = r'''
20 |
30 | '''
31 |
32 | table = r''''''
33 | if header is not None:
34 | table += r''
35 | for head in header:
36 | table += '{} | '.format(head)
37 | table += r' '
38 | table += r''
39 |
40 | for key, value in dict_data.items():
41 |
42 | if exclude and key in exclude:
43 | continue
44 |
45 | if isinstance(value, list):
46 | table += '{} | '.format(key)
47 | if len(value) > 0:
48 | if isinstance(value[0], dict):
49 | labels = list(value[0].keys())
50 |
51 | if exclude:
52 | labels = [x for x in labels if x not in exclude]
53 |
54 | table += 'No. | '
55 | for label in labels:
56 | table += '{} | '.format(label)
57 | table += ' '
58 | table += ''
59 | for idx, v in enumerate(value):
60 | table += '{} | '.format(idx)
61 | for l in labels:
62 | table += '{} | '.format(v.get(l))
63 | table += ' '
64 | table += ' '
65 | else:
66 | table += '[{}]'.format(', '.join(value))
67 | table += ' | '
68 | else:
69 | table += '{} | {} | '.format(key, value)
70 | table += ' '
71 |
72 | return style + table
73 |
74 |
75 | # Jupyter Notebook Checker
76 | def is_notebook():
77 | """ Jupyter Notebook을 사용하는지 확인하는 함수
78 |
79 | Returns
80 | -------
81 | bool
82 | Jupyter Notebook 사용시 True
83 | """
84 | try:
85 | from IPython import get_ipython
86 | if 'IPKernelApp' not in get_ipython().config:
87 | return False
88 | except Exception:
89 | return False
90 | return True
91 |
92 |
--------------------------------------------------------------------------------
/dart_fss/utils/regex.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import re
3 |
4 |
5 | def is_operator(item):
6 | """ 연산자 여부 검색
7 |
8 | Parameters
9 | ----------
10 | item : str
11 | 단어
12 |
13 | Returns
14 | -------
15 | bool
16 | True: 연산자 / False: 일단단어
17 |
18 | """
19 | if item in ['AND', 'OR']:
20 | return True
21 | return False
22 |
23 |
24 | def precedence(symbol):
25 | """ 연산자 우선수위
26 |
27 | Parameters
28 | ----------
29 | symbol: str
30 | 연산자
31 |
32 | Returns
33 | -------
34 | int
35 | 연산자 순위
36 |
37 | """
38 | if symbol in ['AND', 'OR']:
39 | return 1
40 | return 0
41 |
42 |
43 | def infix_to_postfix(infix):
44 | """ infix를 postfix로 변환하는 함수
45 |
46 | Parameters
47 | ----------
48 | infix: str
49 | infix 형태로 표현된 문장
50 |
51 | Returns
52 | -------
53 | str
54 | postfix로 변횐된 문장
55 | """
56 | stack = []
57 | results = []
58 | parenthesis = 0
59 | for item in infix:
60 | if item == '(':
61 | parenthesis = parenthesis + 1
62 | stack.append(item)
63 | elif item == ')':
64 | parenthesis = parenthesis - 1
65 | if parenthesis < 0:
66 | raise SyntaxError('Missing left parentheses.')
67 | while stack[-1] != '(':
68 | v = stack.pop()
69 | results.append(v)
70 | stack.pop()
71 | elif is_operator(item):
72 | if len(stack) > 0:
73 | if precedence(stack[-1]) < precedence(item):
74 | stack.append(item)
75 | else:
76 | v = stack.pop()
77 | stack.append(item)
78 | results.append(v)
79 | else:
80 | stack.append(item)
81 | else:
82 | results.append(item)
83 | while len(stack) > 0:
84 | results.append(stack.pop())
85 |
86 | if parenthesis > 0:
87 | raise SyntaxError('Missing right parentheses.')
88 |
89 | return results
90 |
91 |
92 | def str_to_regex(query):
93 | """ regular expression
94 |
95 | Parameters
96 | ----------
97 | query: str
98 | 검색 문구
99 |
100 | Returns
101 | -------
102 | Pattern
103 | regular expression pattern
104 | """
105 | return re.compile(str_to_pattern(query))
106 |
107 |
108 | def str_to_pattern(query):
109 | """ AND OR 등 연산자를 regular expression 표현으로 변경
110 |
111 | Parameters
112 | ----------
113 | query: str
114 | 검색 문구
115 |
116 | Returns
117 | -------
118 | str
119 | 검색 pattern
120 | """
121 | query = query.replace('(', ' ( ').replace(')', ' ) ').split()
122 | postfix = infix_to_postfix(query)
123 |
124 | stack = []
125 | for item in postfix:
126 | if is_operator(item):
127 | if item == 'AND':
128 | operand1 = stack.pop()
129 | operand2 = stack.pop()
130 | pattern = r'(?=.*{0})(?=.*{1})'.format(operand2, operand1)
131 | elif item == 'OR':
132 | operand1 = stack.pop()
133 | operand2 = stack.pop()
134 | pattern = r'({0}|{1})'.format(operand2, operand1)
135 | stack.append(pattern)
136 | else:
137 | stack.append(item)
138 | return stack.pop()
139 |
--------------------------------------------------------------------------------
/dart_fss/utils/singleton.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | class Singleton(type):
3 | """ Singleton metaclass """
4 | _instances = {}
5 |
6 | def __call__(cls, *args, **kwargs):
7 | if cls not in cls._instances:
8 | cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
9 | return cls._instances[cls]
10 |
--------------------------------------------------------------------------------
/dart_fss/utils/spinner.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from yaspin import yaspin
3 |
4 |
5 | class Spinner:
6 | spinner_enable = True
7 | """
8 | yaspin 라이브러리를 이용한 Spinner
9 | """
10 | def __init__(self, text):
11 | """ 초기화
12 | Parameters
13 | ----------
14 | text: str
15 | spinner 사용시 표시할 text
16 | """
17 | self.spinner = yaspin(text=text, spinner='dots')
18 |
19 | def start(self):
20 | """ Spinner Start"""
21 | if self.spinner_enable:
22 | self.spinner.start()
23 |
24 | def stop(self):
25 | """ Spinner Stop """
26 | if self.spinner_enable:
27 | self.spinner.stop()
28 |
29 |
30 | def enable_spinner(enable: bool):
31 | """
32 | Set spinner activation status
33 |
34 | Parameters
35 | ----------
36 | enable: bool
37 | Spinner activation state
38 | """
39 | Spinner.spinner_enable = enable
40 |
41 |
--------------------------------------------------------------------------------
/dart_fss/utils/string.py:
--------------------------------------------------------------------------------
1 | import re
2 | from typing import Union
3 | from dart_fss.utils.cache import cache
4 | from dart_fss.utils.regex import str_to_regex
5 |
6 |
7 | CURRENCY = {
8 | '원': 'KWR',
9 | '달러': 'USD',
10 | '엔': 'JPY',
11 | }
12 |
13 |
14 | def str_compare(str1: str, str2: str) -> bool:
15 | """문자열 비교
16 |
17 | Parameters
18 | ----------
19 | str1: str
20 | string
21 | str2: str
22 | string
23 |
24 | Returns
25 | -------
26 | bool
27 | 문자열이 동일하다면 True
28 | """
29 | if not isinstance(str1, str) or not isinstance(str2, str):
30 | return False
31 | str1 = str1.strip().lower()
32 | str2 = str2.strip().lower()
33 | return str1 == str2
34 |
35 |
36 | @cache()
37 | def str_unit_to_number_unit(str_unit: str) -> int:
38 | """ 통화 단위를 숫자로 변화
39 |
40 | Parameters
41 | ----------
42 | str_unit: str
43 | 통화 단위
44 |
45 | Returns
46 | -------
47 | int
48 | 환산값
49 | """
50 | str_unit = re.sub(r'\s+', '', str_unit)
51 |
52 | str_unit_to_unit = {
53 | '억원': 100000000,
54 | '천만원': 10000000,
55 | '백만원': 1000000,
56 | '십만원': 100000,
57 | '만원': 10000,
58 | '천원': 1000,
59 | '백원': 100,
60 | '십원': 10,
61 | }
62 |
63 | for k, v in CURRENCY.items():
64 | str_unit_to_unit[k] = 1
65 | str_unit_to_unit[v] = 1
66 |
67 | return str_unit_to_unit[str_unit]
68 |
69 |
70 | @cache()
71 | def get_currency_str(unit: str) -> Union[str, None]:
72 | regex_str = ' OR '.join(CURRENCY.keys())
73 | str_unit = str_to_regex(regex_str).search(unit)
74 | if str_unit:
75 | str_unit = str_unit.group(0)
76 | return CURRENCY[str_unit]
77 |
78 | regex_str = ' OR '.join([v for _, v in CURRENCY.items()])
79 | str_unit = str_to_regex(regex_str).search(unit)
80 | if str_unit:
81 | return str_unit.group(0)
82 |
83 | return None
84 |
85 |
86 | def str_insert_whitespace(word):
87 | return r'\s*'.join(word)
88 |
89 |
90 | def str_upper(strings):
91 | if strings is None:
92 | return strings
93 | elif isinstance(strings, str):
94 | return strings.upper()
95 | elif isinstance(strings, list):
96 | return [x.upper() for x in strings]
97 | else:
98 | raise ValueError('invalid type')
--------------------------------------------------------------------------------
/dart_fss/xbrl/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from .xbrl import get_xbrl_from_file
3 |
4 | __all__ = ['get_xbrl_from_file']
--------------------------------------------------------------------------------
/dart_fss/xbrl/xbrl.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import logging
3 | import os
4 | import sys
5 |
6 | from arelle import Cntlr
7 | from dart_fss.xbrl.dart_xbrl import DartXbrl
8 |
9 |
10 | def get_xbrl_from_file(file_path: str) -> DartXbrl:
11 | """ XBRL 파일 로드 함수
12 |
13 | XBRL 파일을 로드하기 위한 함수로 로딩완료 후 DartXbrl 클래스를 반환한다
14 |
15 | Parameters
16 | ----------
17 | file_path: str
18 | XBRL 파일 경로
19 | Returns
20 | -------
21 | DartXbrl
22 | DartXbrl 클래스
23 | """
24 | from dart_fss.utils.spinner import Spinner
25 | spinner = Spinner('XBRL Loading')
26 | spinner.start()
27 |
28 | # PyPI를 통해 설치된 Arelle 라이브러리 사용시 발생하는 오류 수정을 위한코드
29 | if sys.platform == 'win32':
30 | pass
31 | elif sys.platform == 'darwin':
32 | arelle_app_dir = os.path.join(os.path.expanduser('~/Library/Application Support'), 'Arelle')
33 | if not os.path.exists(arelle_app_dir):
34 | os.makedirs(arelle_app_dir)
35 | else:
36 | arelle_app_dir = os.path.join(os.path.expanduser("~/.config"), "arelle")
37 | if not os.path.exists(arelle_app_dir):
38 | os.makedirs(arelle_app_dir)
39 | cntlr = Cntlr.Cntlr(logFileName='logToStdErr')
40 | cntlr.logger.setLevel(logging.CRITICAL)
41 | model_xbrl = cntlr.modelManager.load(file_path)
42 | filename = file_path.split('\\')[-1]
43 | xbrl = DartXbrl(filename, model_xbrl)
44 |
45 | spinner.stop()
46 | return xbrl
47 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = .
9 | BUILDDIR = _build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/docs/conf.py:
--------------------------------------------------------------------------------
1 | # Configuration file for the Sphinx documentation builder.
2 | #
3 | # This file only contains a selection of the most common options. For a full
4 | # list see the documentation:
5 | # http://www.sphinx-doc.org/en/master/config
6 |
7 | # -- Path setup --------------------------------------------------------------
8 |
9 | # If extensions (or modules to document with autodoc) are in another directory,
10 | # add these directories to sys.path here. If the directory is relative to the
11 | # documentation root, use os.path.abspath to make it absolute, like shown here.
12 | #
13 | import os
14 | import sys
15 | sys.path.insert(0, os.path.abspath('..'))
16 |
17 | # -- Project information -----------------------------------------------------
18 |
19 | project = 'dart-fss documentation'
20 | copyright = '2024, Sungwoo Jo'
21 | author = 'Sungwoo Jo'
22 |
23 | # The full version, including alpha/beta/rc tags
24 | release = 'v0.4.3'
25 |
26 | # Removing the view page source link
27 | html_show_sourcelink = False
28 |
29 |
30 | # disabling auto summary
31 | numpydoc_show_inherited_class_members = False
32 | # -- General configuration ---------------------------------------------------
33 |
34 | # Add any Sphinx extension module names here, as strings. They can be
35 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
36 | # ones.
37 | extensions = [
38 | 'sphinx.ext.autodoc',
39 | 'sphinx.ext.autosummary',
40 | 'sphinx.ext.intersphinx',
41 | 'sphinx.ext.todo',
42 | 'sphinx.ext.viewcode',
43 | 'sphinx.ext.graphviz',
44 | 'sphinx.ext.inheritance_diagram',
45 | # 'sphinx_autodoc_typehints',
46 | 'sphinx_rtd_theme',
47 | 'numpydoc'
48 | ]
49 |
50 | # Add any paths that contain templates here, relative to this directory.
51 | templates_path = ['_templates']
52 |
53 | # The language for content autogenerated by Sphinx. Refer to documentation
54 | # for a list of supported languages.
55 | #
56 | # This is also used if you do content translation via gettext catalogs.
57 | # Usually you set "language" from the command line for these cases.
58 | language = 'ko'
59 |
60 | # List of patterns, relative to source directory, that match files and
61 | # directories to ignore when looking for source files.
62 | # This pattern also affects html_static_path and html_extra_path.
63 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
64 |
65 |
66 | # -- Options for HTML output -------------------------------------------------
67 |
68 | # The theme to use for HTML and HTML Help pages. See the documentation for
69 | # a list of builtin themes.
70 | #
71 | html_theme = 'sphinx_rtd_theme'
72 |
73 | # Add any paths that contain custom static files (such as style sheets) here,
74 | # relative to this directory. They are copied after the builtin static files,
75 | # so a file named "default.css" will overwrite the builtin "default.css".
76 | html_static_path = ['_static']
77 |
78 | # explicitly assign the master document
79 | master_doc = 'index'
80 |
--------------------------------------------------------------------------------
/docs/dart_api.rst:
--------------------------------------------------------------------------------
1 | Open DART API
2 | ==================================
3 |
4 | Open DART API Wrapper
5 |
6 | 공시정보
7 | ----------------------------------
8 |
9 | .. automodule:: dart_fss.api.filings
10 | :members:
11 |
12 | 사업보고서 주요정보
13 | ----------------------------------
14 | .. automodule:: dart_fss.api.info
15 | :members:
16 |
17 | 상장기업 재무정보
18 | ----------------------------------
19 | .. automodule:: dart_fss.api.finance
20 | :members:
21 |
22 | 지분공시 종합정보
23 | ----------------------------------
24 | .. automodule:: dart_fss.api.shareholder
25 | :members:
26 |
--------------------------------------------------------------------------------
/docs/dart_auth.rst:
--------------------------------------------------------------------------------
1 | Open DART Auth
2 | ==================================
3 |
4 | - DART-FSS 라이브러리 사용을 위해서는 Open DART API Key 설정 필요
5 |
6 | Open DART API Key 신청
7 | ----------------------------------
8 | - `OPEN DART API 신청 `_
9 |
10 |
11 | API Key 설정
12 | ----------------------------------
13 |
14 | .. note:: 환경 변수 설정 또는 set_api_key 사용을 통해 API Key 설정 필요
15 |
16 | 환경변수 설정
17 | ''''''''''''''''''''''''''''''''''
18 | 환경 변수 DART_API_KEY 설정을 통한 API Key 설정
19 |
20 | - 변수명: DART_API_KEY
21 | - 변수값: Open DART에서 발급받은 API KEY
22 |
23 | 라이브러리 함수 사용
24 | ''''''''''''''''''''''''''''''''''
25 | DART-FSS 라이브러리 함수를 이용한 API Key 설정
26 |
27 | .. code-block:: python
28 |
29 | import dart_fss as dart
30 |
31 | # Open DART API KEY 설정
32 | api_key='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
33 | dart.set_api_key(api_key=api_key)
34 |
35 |
36 | API Key 확인
37 | ----------------------------------
38 | 설정된 Open DART API Key 확인
39 |
40 | .. code-block:: python
41 |
42 | import dart_fss as dart
43 |
44 | api_key = dart.get_api_key()
45 |
46 |
--------------------------------------------------------------------------------
/docs/dart_corp.rst:
--------------------------------------------------------------------------------
1 | 기업정보검색
2 | ==================================
3 |
4 | 상장된 기업 정보 불러오기
5 | ----------------------------------
6 | DART에 공시된 회사리스트를 반환하는 클래스.
7 |
8 | .. autofunction:: dart_fss.corp.get_corp_list
9 |
10 | .. autoclass:: dart_fss.corp.CorpList
11 | :members:
12 |
13 | Example
14 | '''''''''''''
15 |
16 | .. code-block:: python
17 |
18 | from dart_fss import get_corp_list
19 |
20 | # 모든 상장된 기업 리스트 불러오기
21 | crp_list = get_corp_list()
22 |
23 | # 삼성전자를 이름으로 찾기 ( 리스트 반환 )
24 | samsung = corp_list.find_by_name('삼성전자', exactly=True)[0]
25 |
26 | # 증권 코드를 이용한 찾기
27 | samsung = corp_list.find_by_stock_code('005930')
28 |
29 | # 다트에서 사용하는 회사코드를 이용한 찾기
30 | samsung = corp_list.find_by_corp_code('00126380')
31 |
32 | # "삼성"을 포함한 모든 공시 대상 찾기
33 | corps = corp_list.find_by_name('삼성')
34 |
35 | # "삼성"을 포함한 모든 공시 대상중 코스피 및 코스닥 시장에 상장된 공시 대상 검색(Y: 코스피, K: 코스닥, N:코넥스, E:기타)
36 | # corps = corp_list.find_by_name('삼성', market=['Y','K']) # 아래와 동일
37 | corps = corp_list.find_by_name('삼성', market='YK')
38 |
39 | # "휴대폰" 생산품과 연관된 공시 대상
40 | corps = corp_list.find_by_product('휴대폰')
41 |
42 | # "휴대폰" 생산품과 연관된 공시 대상 중 코스피 시장에 상장된 대상만 검색
43 | corps = corp_list.find_by_product('휴대폰', market='Y')
44 |
45 | # 섹터 리스트 확인
46 | corp_list.sectors
47 |
48 | # "텔레비전 방송업" 섹터 검색
49 | corps = corp_list.find_by_sector('텔레비전 방송업')
50 |
51 | 기업정보(Crp)
52 | ----------------------------------
53 |
54 | .. autoclass:: dart_fss.corp.Corp
55 | :members:
56 |
57 | Example
58 | '''''''''''''
59 |
60 | .. code-block:: python
61 |
62 | # 2019년 3월 1일부터 2019년 5월 31일까지 삼성전자의 모든 공시 정보 조회
63 | reports = samsung.search_filings(bgn_de='20190301', end_de='20190531')
64 |
65 | # 2010년 1월 1일부터 현재까지 모든 사업보고서 검색
66 | reports = samsung.search_filings(bgn_de='20100101', pblntf_detail_ty='a001')
67 |
68 | # 2010년 1월 1일부터 현재까지 모든 사업보고서의 최종보고서만 검색
69 | reports = samsung.search_filings(bgn_de='20100101', pblntf_detail_ty='a001', last_reprt_at='Y')
70 |
71 | # 2010년 1월 1일부터 현재까지 사업보고서, 반기보고서, 분기보고서 검색
72 | reports = samsung.search_filings(bgn_de='20100101', pblntf_detail_ty=['a001', 'a002', 'a003'])
73 |
74 | # 2012년 1월 1일부터 현재까지 연간 연결재무제표 검색
75 | fs = samsung.extract_fs(bgn_de='20120101')
76 |
77 | # 2012년 1월 1일부터 현재까지 분기 연결재무제표 검색 (연간보고서, 반기보고서 포함)
78 | fs_quarter = samsung.extract_fs(bgn_de='20120101', report_tp='quarter')
79 |
80 | # 2012년 1월 1일부터 현재까지 개별재무제표 검색
81 | fs_separate = samsung.extract_fs(bgn_de='20120101', separate=True)
82 |
83 |
--------------------------------------------------------------------------------
/docs/dart_errors.rst:
--------------------------------------------------------------------------------
1 | Errors
2 | ==================================
3 |
4 | .. autoclass:: dart_fss.errors.APIKeyError
5 | :members:
6 |
7 | .. autoclass:: dart_fss.errors.TemporaryLocked
8 | :members:
9 |
10 | .. autoclass:: dart_fss.errors.NoDataReceived
11 | :members:
12 |
13 | .. autoclass:: dart_fss.errors.OverQueryLimit
14 | :members:
15 |
16 | .. autoclass:: dart_fss.errors.InvalidField
17 | :members:
18 |
19 | .. autoclass:: dart_fss.errors.ServiceClose
20 | :members:
21 |
22 | .. autoclass:: dart_fss.errors.UnknownError
23 | :members:
24 |
25 | .. autoclass:: dart_fss.errors.NotFoundConsolidated
26 | :members:
27 |
--------------------------------------------------------------------------------
/docs/dart_fs.rst:
--------------------------------------------------------------------------------
1 | 재무제표 일괄 추출
2 | =================================
3 |
4 | 재무제표 추출
5 | '''''''''''''
6 |
7 | .. autofunction:: dart_fss.fs.extract
8 |
9 | FinancialStatement 클래스
10 | ''''''''''''''''''''''''''''''''''''
11 |
12 | 재무제표 일괄 추출의 결과를 담고 있는 클래스
13 |
14 | .. autoclass:: dart_fss.fs.FinancialStatement
15 | :members:
16 |
17 | Example
18 | '''''''''''''
19 |
20 | .. code-block:: python
21 |
22 | import dart_fss as dart
23 |
24 | # 삼성전자 code
25 | corp_code = '00126380'
26 |
27 | # 모든 상장된 기업 리스트 불러오기
28 | crp_list = get_corp_list()
29 |
30 | # 삼성전자
31 | samsung = corp_list.find_by_corp_name(corp_code=corp_code)
32 |
33 | # 2012년 01월 01일 부터 연결재무제표 검색
34 | # fs = samsung.extract_fs(bgn_de='20120101') 와 동일
35 | fs = dart.fs.extract(corp_code=corp_code, bgn_de='20120101')
36 |
37 | # 연결재무상태표
38 | df_fs = fs['bs'] # 또는 df = fs[0] 또는 df = fs.show('bs')
39 | # 연결재무상태표 추출에 사용된 Label 정보
40 | labels_fs = fs.labels['bs']
41 |
42 | # 연결손익계산서
43 | df_is = fs['is'] # 또는 df = fs[1] 또는 df = fs.show('is')
44 | # 연결손익계산서 추출에 사용된 Label 정보
45 | labels_is = fs.labels['is']
46 |
47 | # 연결포괄손익계산서
48 | df_ci = fs['cis'] # 또는 df = fs[2] 또는 df = fs.show('cis')
49 | # 연결포괄손익계산서 추출에 사용된 Label 정보
50 | labels_ci = fs.labels['cis']
51 |
52 | # 현금흐름표
53 | df_cf = fs['cf'] # 또는 df = fs[3] 또는 df = fs.show('cf')
54 | # 현금흐름표 추출에 사용된 Label 정보
55 | labels_cf = fs.labels['cf']
56 |
57 | # 재무제표 일괄저장 (default: 실행폴더/fsdata/{corp_code}_{report_tp}.xlsx)
58 | fs.save()
59 |
60 | # 재무제표 일괄저장
61 | filename = '삼성전자'
62 | path = '/User/xxxxx/Desktop/'
63 | fs.save(filename=filename, path=path)
64 |
--------------------------------------------------------------------------------
/docs/dart_request.rst:
--------------------------------------------------------------------------------
1 | Request 설정
2 | =================================
3 |
4 | DART-FSS 라이브러리에서 사용하는 Request 관련 설정 방법입니다.
5 |
6 | .. note:: dart_fss.utils.request 로 접근이 가능하며, 아래의 Singleton Class로 구현되어 있습니다.
7 |
8 | request
9 | '''''''''''''
10 |
11 | - DART-FSS 라이브러리 Request 요청을 위한 클래스 (Singleton)
12 | - 접근 방법은 Example 참고
13 |
14 | .. autoclass:: dart_fss.utils.request.Request
15 | :members:
16 |
17 | Example
18 | '''''''''''''
19 |
20 | .. code-block:: python
21 |
22 | import dart_fss as dart
23 |
24 | # DART_FSS Request Delay 0.7s로 변경
25 | dart.utils.request.set_delay(0.7)
26 |
27 | # 프록시 설정
28 | proxies = {'http': 'http://xxxxxxxxx.xxx','https': 'https://xxxxxxxxx.xxx'}
29 | dart.utils.request.set_proxies(proxies)
30 |
31 | # User-Agent 강제 변경
32 | dart.utils.request.update_user_agent(force=True)
33 |
--------------------------------------------------------------------------------
/docs/dart_search.rst:
--------------------------------------------------------------------------------
1 | 공시정보 검색
2 | ==================================
3 |
4 | DART 공시 정보 검색
5 | ----------------------------------
6 | Open DART에서 제공하는 OPEN API를 이용하여 공시 정보를 검색하는 함수
7 |
8 | search_report
9 | '''''''''''''''''''
10 | .. autofunction:: dart_fss.filings.search
11 |
12 | .. note:: :doc:`공시유형 및 공시상세유형 참고 `
13 |
14 | Example
15 | '''''''''''''
16 |
17 | .. code-block:: python
18 |
19 | import dart_fss as dart
20 |
21 | # 2019년 1월 1일부터 2019년 3월 31일까지 검색 (crp_cd 미지정시 최대 3개월만 검색가능)
22 | reports = dart.filings.search(bgn_de='20190101', end_de='20190331')
23 |
24 | # 2019년 1월 1일부터 2019년 3월 31일까지 검색 (페이지당 표시 건수: 100)
25 | reports = dart.filings.search(bgn_de='20190101', end_de='20190331', page_count=100)
26 |
27 | # 2019년 5월 1일부터 2019년 7월 1일까지 연간보고서만 검색
28 | reports = dart.filings.search(bgn_de='20190501', end_de='20190701', pblntf_detail_ty='a001')
29 |
30 | # 2019년 5월 1일부터 2019년 7월 1일까지 연간보고서 및 반기보고서 검색
31 | reports = dart.filings.search(bgn_de='20190501', end_de='20190701', pblntf_detail_ty=['a001', 'a002'])
32 |
33 | SearchResults
34 | ----------------------------------
35 |
36 | .. autoclass:: dart_fss.filings.search.SearchResults
37 | :members:
38 |
39 | Example
40 | '''''''''''''
41 |
42 | .. code-block:: python
43 |
44 | import dart_fss as dart
45 |
46 | # 삼성전자 code
47 | corp_code = '00126380'
48 |
49 | # 모든 상장된 기업 리스트 불러오기
50 | crp_list = get_corp_list()
51 |
52 | # 삼성전자
53 | samsung = corp_list.find_by_corp_name(corp_code=corp_code)
54 |
55 | # 연간보고서 검색
56 | # reports = samsung.search_filings(bgn_de='20100101', pblntf_detail_ty='a001')
57 | reports = search_report(corp_code=corp_code, bgn_de='20100101', pblntf_detail_ty='a001')
58 |
59 | # Reports의 Index는 0부터 시작
60 | # 가장 최신 보고서 선택
61 | newest_report = reports[0]
62 |
63 | # 0-4번 보고서 선택
64 | zero_to_fourth_report = reports[0:5]
65 |
66 | # 짝수번째 보고서 선택
67 | even_report = reports[::2]
68 |
69 | # 가장 오래된 보고서 선택
70 | oldest_report = reports[-1]
71 |
72 |
--------------------------------------------------------------------------------
/docs/dart_types.rst:
--------------------------------------------------------------------------------
1 | REPORT TYPES
2 | ==================================
3 |
4 | .. code-block:: python
5 |
6 | pblntf_ty = {
7 | "A": "정기공시",
8 | "B": "주요사항보고",
9 | "C": "발행공시",
10 | "D": "지분공시",
11 | "E": "기타공시",
12 | "F": "외부감사관련",
13 | "G": "펀드공시",
14 | "H": "자산유동화",
15 | "I": "거래소공시",
16 | "J": "공정위공시"
17 | }
18 |
19 | pblntf_detail_ty = {
20 | "A001": "사업보고서",
21 | "A002": "반기보고서",
22 | "A003": "분기보고서",
23 | "A004": "등록법인결산서류(자본시장법이전)",
24 | "A005": "소액공모법인결산서류",
25 | "B001": "주요사항보고서",
26 | "B002": "주요경영사항신고(자본시장법 이전)",
27 | "B003": "최대주주등과의거래신고(자본시장법 이전)",
28 | "C001": "증권신고(지분증권)",
29 | "C002": "증권신고(채무증권)",
30 | "C003": "증권신고(파생결합증권)",
31 | "C004": "증권신고(합병등)",
32 | "C005": "증권신고(기타)",
33 | "C006": "소액공모(지분증권)",
34 | "C007": "소액공모(채무증권)",
35 | "C008": "소액공모(파생결합증권)",
36 | "C009": "소액공모(합병등)",
37 | "C010": "소액공모(기타)",
38 | "C011": "호가중개시스템을통한소액매출",
39 | "D001": "주식등의대량보유상황보고서",
40 | "D002": "임원ㆍ주요주주특정증권등소유상황보고서",
41 | "D003": "의결권대리행사권유",
42 | "D004": "공개매수",
43 | "E001": "자기주식취득/처분",
44 | "E002": "신탁계약체결/해지",
45 | "E003": "합병등종료보고서",
46 | "E004": "주식매수선택권부여에관한신고",
47 | "E005": "사외이사에관한신고",
48 | "E006": "주주총회소집공고",
49 | "E007": "시장조성/안정조작",
50 | "E008": "합병등신고서(자본시장법 이전)",
51 | "E009": "금융위등록/취소(자본시장법 이전)",
52 | "F001": "감사보고서",
53 | "F002": "연결감사보고서",
54 | "F003": "결합감사보고서",
55 | "F004": "회계법인사업보고서",
56 | "F005": "감사전재무제표미제출신고서",
57 | "G001": "증권신고(집합투자증권-신탁형)",
58 | "G002": "증권신고(집합투자증권-회사형)",
59 | "G003": "증권신고(집합투자증권-합병)",
60 | "H001": "자산유동화계획/양도등록",
61 | "H002": "사업/반기/분기보고서",
62 | "H003": "증권신고(유동화증권등)",
63 | "H004": "채권유동화계획/양도등록",
64 | "H005": "수시보고",
65 | "H006": "주요사항보고서",
66 | "I001": "수시공시",
67 | "I002": "공정공시",
68 | "I003": "시장조치/안내",
69 | "I004": "지분공시",
70 | "I005": "증권투자회사",
71 | "I006": "채권공시",
72 | "J001": "대규모내부거래관련",
73 | "J002": "대규모내부거래관련(구)",
74 | "J004": "기업집단현황공시",
75 | "J005": "비상장회사중요사항공시",
76 | "J006": "기타공정위공시"
77 | }
78 |
79 | corp_cls = {
80 | "Y": "유가증권",
81 | "K": "코스",
82 | "N": "코넥스",
83 | "E": "etc"
84 | }
85 |
86 | rm = {
87 | "유": "본 공시사항은 한국거래소 유가증권시장본부 소관임",
88 | "코": "본 공시사항은 한국거래소 코스닥시장본부 소관임",
89 | "채": "본 문서는 한국거래소 채권상장법인 공시사항임",
90 | "넥": "본 문서는 한국거래소 코넥스시장 소관임",
91 | "공": "본 공시사항은 공정거래위원회 소관임",
92 | "연": "본 보고서는 연결부분을 포함한 것임",
93 | "정": "본 보고서 제출 후 정정신고가 있으니 관련 보고서를 참조하시기 바람",
94 | "철": "본 보고서는 철회(간주)되었으니 관련 철회신고서(철회간주안내)를 참고하시기 바람"
95 | }
96 |
--------------------------------------------------------------------------------
/docs/dart_xbrl.rst:
--------------------------------------------------------------------------------
1 | XBRL 데이터 추출
2 | ======================================
3 |
4 | XBRL 파일 데이터 분석
5 | ----------------------------------
6 |
7 | .. autofunction:: dart_fss.xbrl.get_xbrl_from_file
8 |
9 |
10 | DartXbrl 클래스
11 | ----------------------------------
12 |
13 | .. autoclass:: dart_fss.xbrl.dart_xbrl.DartXbrl
14 | :members:
15 |
16 | Table 클래스
17 | ----------------------------------
18 |
19 | .. autoclass:: dart_fss.xbrl.table.Table
20 | :members:
21 |
22 | Example
23 | ----------------------------------
24 |
25 | .. code-block:: python
26 |
27 | import dart_fss as dart
28 |
29 |
30 | # 삼성전자 code
31 | corp_code = '00126380'
32 |
33 | # 모든 상장된 기업 리스트 불러오기
34 | corp_list = dart.get_corp_list()
35 |
36 | # 삼성전자
37 | samsung = corp_list.find_by_corp_code(corp_code=corp_code)
38 |
39 | # 사업보고서 검색
40 | reports = samsung.search_filings(bgn_de='20190101', pblntf_detail_ty='a001')
41 |
42 | # 첫번째 리포트 선택
43 | report = reports[0]
44 |
45 | # 리포트의 xbrl 데이터
46 | xbrl = report.xbrl
47 |
48 | # 연결재무제표 존재 여부 확인( True / False)
49 | xbrl.exist_consolidated()
50 |
51 | # 감사 정보 (영문) -> DataFrame 형태로 반환됨
52 | audit = xbrl.get_audit_information(lang='en')
53 |
54 | # 연결 현금흐름표 추출 (리스트 반환)
55 | cf = xbrl.get_cash_flows()
56 |
57 | # 연결 현금프름표
58 | cf = cf[0]
59 |
60 | # Pandas DataFrame으로 변환
61 | df = cf.to_DataFrame()
62 |
63 | # Pandas DataFrame으로 변환 / 분류 정보 제외
64 | df_wo_class = cf.to_DataFrame(show_class=False)
65 |
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. include:: welcome.rst
2 |
3 | .. toctree::
4 | :maxdepth: 1
5 | :hidden:
6 |
7 | welcome
8 |
9 | .. toctree::
10 | :caption: Documentation
11 | :maxdepth: 1
12 | :hidden:
13 |
14 | dart_auth
15 | dart_api
16 | dart_corp
17 | dart_search
18 | dart_fs
19 | dart_xbrl
20 | dart_request
21 | dart_types
22 | dart_errors
23 |
24 | .. toctree::
25 | :caption: License
26 |
27 | license
28 |
29 | .. toctree::
30 | :caption: Github
31 |
32 | Github
--------------------------------------------------------------------------------
/docs/license.rst:
--------------------------------------------------------------------------------
1 | MIT License
2 | ======================================
3 |
4 | MIT License
5 |
6 | Copyright (c) 2019 Sungwoo Jo
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in all
16 | copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | SOFTWARE.
25 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=.
11 | set BUILDDIR=_build
12 |
13 | if "%1" == "" goto help
14 |
15 | %SPHINXBUILD% >NUL 2>NUL
16 | if errorlevel 9009 (
17 | echo.
18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19 | echo.installed, then set the SPHINXBUILD environment variable to point
20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
21 | echo.may add the Sphinx directory to PATH.
22 | echo.
23 | echo.If you don't have Sphinx installed, grab it from
24 | echo.http://sphinx-doc.org/
25 | exit /b 1
26 | )
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | sphinx
2 | sphinx-autodoc-typehints
3 | sphinx-rtd-theme
4 | numpydoc
5 | arelle-release
6 | attrs
7 | backcall
8 | beautifulsoup4
9 | certifi
10 | chardet
11 | decorator
12 | fake-useragent
13 | idna
14 | ipython-genutils
15 | isodate
16 | numpy
17 | pandas
18 | pickleshare
19 | py
20 | python-dateutil
21 | pytz
22 | requests
23 | six
24 | soupsieve
25 | tqdm
26 | traitlets
27 | urllib3
28 | wcwidth
29 | lxml
30 | html5lib
31 | openpyxl
32 | yaspin
33 | xmltodict
34 | appdirs
35 |
--------------------------------------------------------------------------------
/docs/welcome.rst:
--------------------------------------------------------------------------------
1 | DART-FSS
2 | ===========================
3 |
4 | .. image:: https://img.shields.io/pypi/v/dart-fss.svg
5 | .. image:: https://img.shields.io/pypi/pyversions/dart-fss.svg
6 | .. image:: https://bit.ly/313BAwe
7 | .. image:: https://codecov.io/gh/josw123/dart-fss/branch/master/graphs/badge.svg
8 | .. image:: https://api.codacy.com/project/badge/Grade/7ebb506ba99d4a22b2bbcda2d85b3bde
9 |
10 | 대한민국 금융감독원에서 운영하는 다트(`DART `_) 사이트 크롤링 및 재무제표 추출을 위한 라이브러리
11 |
12 | Installation
13 | ---------------------------
14 |
15 | .. code::
16 |
17 | pip install dart-fss
18 |
19 | Open DART API Key 신청
20 | ---------------------------
21 | - `OPEN DART API 신청 `_
22 |
23 | Quick Starts
24 | ----------------------
25 | .. code-block:: python
26 |
27 | import dart_fss as dart
28 |
29 | # Open DART API KEY 설정
30 | api_key='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
31 | dart.set_api_key(api_key=api_key)
32 |
33 | # DART 에 공시된 회사 리스트 불러오기
34 | corp_list = dart.get_corp_list()
35 |
36 | # 삼성전자 검색
37 | samsung = corp_list.find_by_corp_name('삼성전자', exactly=True)[0]
38 |
39 | # 2012년부터 연간 연결재무제표 불러오기
40 | fs = samsung.extract_fs(bgn_de='20120101')
41 |
42 | # 재무제표 검색 결과를 엑셀파일로 저장 ( 기본저장위치: 실행폴더/fsdata )
43 | fs.save()
44 |
45 | 주의사항
46 | -------------
47 |
48 | - Open DART 및 DART 홈페이지의 경우 분당 100회 이상 요청시 서비스가 제한될 수 있음
49 | - `관련 공지사항 `_
50 |
51 |
52 | License
53 | -------------
54 | This project is licensed under the MIT License
55 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "dart-fss"
3 | description = "Web-scraping https://dart.fss.or.kr"
4 | readme = "README.md"
5 | requires-python = ">=3.7"
6 | license = {text = "MIT"}
7 | keywords = ["fss", "dart-fss", "scrapping", "financial_statement"]
8 | authors = [
9 | {name = "Sungwoo Jo", email = "nonswing.z@gmail.com"}
10 | ]
11 | maintainers = [
12 | {name = "Sungwoo Jo", email = "nonswing.z@gmail.com"}
13 | ]
14 | classifiers = [
15 | "Programming Language :: Python :: 3.7",
16 | "Programming Language :: Python :: 3.8",
17 | "Programming Language :: Python :: 3.9",
18 | "Programming Language :: Python :: 3.10",
19 | "Programming Language :: Python :: 3.11",
20 | "Programming Language :: Python :: 3.12",
21 | "Programming Language :: Python :: 3 :: Only"
22 | ]
23 |
24 | dependencies = [
25 | "xmltodict",
26 | "requests",
27 | "arelle-release",
28 | "numpy",
29 | "pandas",
30 | "tqdm",
31 | "yaspin",
32 | "fake-useragent>=1.5",
33 | "beautifulsoup4",
34 | "appdirs",
35 | ]
36 |
37 | dynamic = ["version"]
38 |
39 | [project.optional-dependencies]
40 | jupyter = ["jupyterlab", "ipywidgets"]
41 |
42 | [project.urls]
43 | homepage = "https://github.com/josw123/dart-fss"
44 | documentation = "https://dart-fss.readthedocs.io/"
45 | repository = "https://github.com/josw123/dart-fss.git"
46 |
47 | [tool.setuptools]
48 | license-files = []
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | xmltodict
2 | requests
3 | arelle-release
4 | numpy
5 | pandas
6 | tqdm
7 | yaspin
8 | fake-useragent>=1.5
9 | beautifulsoup4
10 | appdirs
--------------------------------------------------------------------------------
/setup.cfg:
--------------------------------------------------------------------------------
1 |
2 | # See the docstring in versioneer.py for instructions. Note that you must
3 | # re-run 'versioneer.py setup' after changing this section, and commit the
4 | # resulting files.
5 |
6 | [versioneer]
7 | VCS = git
8 | style = pep440
9 | versionfile_source = dart_fss/_version.py
10 | versionfile_build = dart_fss/_version.py
11 | tag_prefix = v
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 |
3 | import versioneer
4 |
5 | NAME = 'dart-fss'
6 |
7 | setup(
8 | version=versioneer.get_version(),
9 | cmdclass=versioneer.get_cmdclass(),
10 | )
11 |
--------------------------------------------------------------------------------
|