get_all_day_data#

pyqqq.data.minutes.get_all_day_data(date: date, codes: list[str] | str, period: timedelta = datetime.timedelta(seconds=60), source: str = 'ebest', adjusted: bool = True, ascending: bool = True, exchange: str | DataExchange = 'KRX') dict[str, DataFrame] | DataFrame[source]#

지정된 날짜에 대해 하나 이상의 주식 코드에 대한 전체 분별 OHLCV(시가, 고가, 저가, 종가, 거래량) 데이터를 검색하여 반환합니다.

2024년 4월 26일 데이터 부터 조회 가능합니다.

NXT 거래소 데이터의 조회 가능 시작일은 데이터 소스에 따라 다릅니다. kis는 2025년 3월 4일부터, ebest는 2025년 5월 12일부터 데이터를 조회할 수 있습니다.

Parameters:
  • date (datetime.date) – 데이터를 검색할 날짜.

  • codes (list[str]) – 조회할 주식 코드들의 리스트. 최대 20개까지 지정할 수 있습니다.

  • period (datetime.timedelta, optional) – 반환된 데이터의 시간 간격. 기본값은 1분입니다. 30초 이상의 값을 30초간격으로 지정할 수 있습니다.

  • source (str, optional) – 데이터를 검색할 API. ‘ebest’ 또는 ‘kis’를 지정할 수 있습니다. 기본값은 ‘ebest’입니다.

  • adjusted (bool) – 수정주가 여부. 기본값은 True.

  • ascending (bool) – 오름차순 여부. 기본값은 True.

  • exchange (Union[str, DataExchange]) – 거래소. 기본값은 KRX. (cf. NXT의 경우 해당되지 않는 종목은 Empty DataFrame이 반환됩니다.)

Returns:

주식 코드를 키로 하고, 해당 주식의 일일 OHLCV 데이터가 포함된 pandas DataFrame을 값으로 하는 딕셔너리. 각 DataFrame에는 변환된 ‘time’ 열이 포함되어 있으며, 이는 조회된 데이터의 시간을 나타냅니다. ‘time’ 열은 DataFrame의 인덱스로 설정되고 오름차순으로 정렬됩니다.

DataFrame의 열은 다음과 같습니다:

  • open (int): 시가

  • high (int): 고가

  • low (int): 저가

  • close (int): 종가

  • volume (int): 누적거래량

  • sign (str): 대비부호 (1:상한가 2:상승, 3:보합 4:하한가, 5:하락)

  • change (str): 전일 대비 가격 변화

  • diff (float): 전일 대비 등락율

  • chdegree (float): 체결강도

  • mdvolume (int): 매도체결수량

  • msvolume (int): 매수체결수량

  • revolume (int): 순매수체결량

  • mdchecnt (int): 매도체결건수

  • mschecnt (int): 매수체결건수

  • rechecnt (int): 순체결건수

  • cvolume (int): 체결량

  • mdchecnttm (int): 시간별매도체결건수

  • mschecnttm (int): 시간별매수체결건수

  • totofferrem (int): 매도잔량

  • totbidrem (int): 매수잔량

  • mdvolumetm (int): 시간별매도체결량

  • msvolumetm (int): 시간별매수체결량

Return type:

dict[str, pd.DataFrame]

Raises:

requests.exceptions.RequestException – PYQQQ API로부터 데이터를 검색하는 과정에서 오류가 발생한 경우.

Examples

>>> result = get_all_day_data(datetime.date(2024, 4, 26), ["005930", "319640"], datetime.timedelta(minutes=1))
>>> print(result["069500"])
                    open   high    low  close   volume sign  change  diff          time
2024-04-26 09:00:00  77800  77900  77400  77600  1629535    2    1300  1.70
2024-04-26 09:01:00  77500  77700  77300  77600  2155263    2    1300  1.70
2024-04-26 09:02:00  77600  77700  77400  77500  2600420    2    1200  1.57
2024-04-26 09:03:00  77500  77500  77200  77500  3033307    2    1200  1.57
2024-04-26 09:04:00  77400  77600  77400  77500  3268502    2    1200  1.57