financialdatapy.dartapi module

This module calls api key stored in .env file.

class financialdatapy.dartapi.DartApiKey(api_key: str | None = None)[source]

Bases: object

This class represents api key from opendart.fss.or.kr.

Parameters:

api_key (Optional[str], optional) – Api key from opendart.fss.or.kr, defaults to None.

property api_key: str

Getter method of property api_key.

Returns:

Api key from opendart.fss.or.kr

Return type:

str

class financialdatapy.dartapi.OpenDart[source]

Bases: DartApiKey

This class represents OPEN DART API.

Parameters:

api_key (str, optional) – Api key for opendart.fss.or.kr, defaults to None.

get_corp_code_file() → bytes[source]

Get the list of corporate code of a company listed in Korea Exchange.

Endpoint returns the list in XML file.

Returns:

XML file that contains the list of corporate code of a company.

Return type:

bytes

get_latest_report_info(corp_code: str, year: int) → datetime[source]

Get the latest date a financial report is submitted to dart.fss.or.kr

Parameters:
  • corp_code (str) – Corporate code of a company.

  • year (int) – Current year.

Returns:

Latest date a financial report is submitted.

Return type:

datetime.datetime

get_report(corp_code: str, period: str, year: int) → DataFrame[source]

Retrieve financial statement of a company from dart.fss.or.kr.

Parameters:
  • corp_code (str) – Corporate code of a company.

  • period (str) – Either ‘annual’ or ‘quarter’.

  • year (int) – Business year.

Returns:

Financial statement of a company.

Return type:

pandas.DataFrame