-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_stock_pagination.py
More file actions
26 lines (21 loc) · 1.19 KB
/
test_stock_pagination.py
File metadata and controls
26 lines (21 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from src.pub_api_client.services.stock import StockClient
import json
def test():
api_key = "lF2Troovy8WHzmjjGoOMyg7BPNXTkeri0//ATEYGBnEtQCSbdBmfB0SrE4gEHzAANPs5pegxILESomSg8kKCPQ=="
client = StockClient(service_key=api_key)
# 가설 검증: numOfRows=10000으로 설정했을 때 한 번에 모든 종목(약 2800개)이 오는지 확인
print("--- 2026년 2월 13일 주식 시세 가설 검증 (numOfRows=10000) ---")
results = client.fetch_stock_prices(base_date="20260213", num_of_rows=10000)
if not results:
print("데이터를 가져오지 못했습니다.")
else:
print(f"수집된 레코드 수: {len(results)}건")
if len(results) > 1000:
print("결과: 한 번의 요청으로 1000건 이상의 데이터를 가져올 수 있습니다.")
else:
print("결과: numOfRows를 크게 잡아도 서버에서 1000건 이하로 제한하고 있습니다.")
# 실제 데이터 샘플 (첫 번째와 마지막 데이터의 종목명 확인)
print(f"첫 번째 종목: {results[0]['item_name']}")
print(f"마지막 종목: {results[-1]['item_name']}")
if __name__ == "__main__":
test()