sharebook-kr / pyupbit

python wrapper for upbit API
Apache License 2.0
480 stars 290 forks source link

get_ohlcv 함수에서 history가 200개 밖에 import 되지 않는 오류 #22

Closed 2MB-creative closed 3 years ago

2MB-creative commented 3 years ago

pyupbit.get_ohlcv 함수를 이용해서 과거 거래기록을 불러올 때, count에 어떤 숫자를 넣어도 200개 이상은 리턴이 되지 않습니다. upbit API의 원래 문제인가요? 아니면 pyupbit 라이브러리의 문제인가요?

jamin12 commented 3 years ago

200개가 최대라고 나와있습니다.

Codejune commented 3 years ago

업비트 공식 문서에 따르면 캔들데이터의 최대 개수는 주어진 시점으로부터 200개까지 제공됩니다. 더 많은 과거 데이터가 필요하실 경우 to 파라미터를 통해 필요하신 과거 데이터를 반복문을 통하여 요청하셔야 합니다

mr-yoo commented 3 years ago

최근 버전에서는 200개 이상도 조회 되도록 pypi 업데이트 예정입니다.

0.1초 단위로 200개씩 조회합니다. 400개를 조회하니 총 0.2초가 걸립니다.

df = get_ohlcv("KRW-BTC", interval="minute1", count=400)
print(len(df))

다른 API와의 사용을 고려해서 조회 주기 (period)를 설정할 수 도 있습니다.
다음은 1초에 200개씩 데이터를 조회합니다.

df = get_ohlcv("KRW-BTC", interval="minute1", count=400, period=1)
print(len(df))