KRX 300 종목 스냅샷 동기화 도구
Project description
🧭 기본 구조
krx300 [COMMAND] [OPTIONS]
주요 명령어
| 명령어 | 설명 |
|---|---|
| sync | 최신 KRX300 구성요소(코드 목록 등)를 다운로드하고 스냅샷 파일을 갱신 |
| show | 기존 스냅샷 파일(codes_snapshot.json) 내용을 조회 또는 내보내기 |
1.sync 명령어 — 스냅샷 동기화
“KRX300 코드 목록을 새로 다운로드하고 JSON 스냅샷을 갱신합니다.”
✅ 기본 사용
krx300 sync
-
현재 디렉터리의 ./codes_snapshot.json을 자동 생성 또는 갱신합니다.
-
콘솔에 다음과 같이 표시됩니다:
✓ 동기화 완료 rows=300
source_ymd: 20251105 etag: E123456
snapshot : codes_snapshot.json
추가(+3): 001234, 002345, 004321
삭제(-1): 003456
✅ 출력 JSON 보기
krx300 sync --json
- JSON 형식으로 결과를 출력:
{
"ok": true,
"source_ymd": "20251105",
"etag": "E123456",
"rows": 300,
"added": ["001234"],
"removed": [],
"snapshot_path": "codes_snapshot.json"
}
✅ 파일로 결과 저장
krx300 sync --out-json ./result.json --out-codes ./codes.txt
-
result.json → 동기화 결과 요약(JSON)
-
codes.txt → 코드 목록만 한 줄씩 저장
005930
000660
035420
...
→ 이 파일은 scraper2-hj3415에 바로 사용할 수 있습니다:
scraper2 ingest many --file ./codes.txt --save
✅ 기타 유용한 옵션
| 옵션 | 설명 | 기본값 |
|---|---|---|
| --state, -s | 스냅샷 JSON 파일 경로 | ./codes_snapshot.json |
| --json | 콘솔 출력 대신 JSON 형식 출력 | False |
| --out-json PATH | 결과를 JSON 파일로 저장 | None |
| --out-codes PATH | 코드 목록을 텍스트 파일로 저장 | None |
| -v, -vv | 로그 상세도 증가 | - |
| --quiet | 경고 이상만 출력 | False |
2.show 명령어 — 스냅샷 내용 보기
기존에 저장된 codes_snapshot.json 내용을 출력하거나 내보냅니다.
✅ 기본 사용
krx300 show
출력 예시:
asof : 2025-11-05
source_ymd: 20251104
etag : E123456
codes(300): 005930, 000660, 035420, 051910, ...
✅ JSON으로 보기
krx300 show --json
- 스냅샷 내용을 JSON으로 표시.
✅ 파일로 내보내기
krx300 show --out-codes ./codes.txt
-
코드 목록만 추출해서 텍스트 파일로 저장.
(scraper2에서 --file로 바로 사용 가능)
전체 예시 흐름 (통합 시나리오)
# 1️⃣ KRX300 스냅샷 동기화 및 코드 목록 생성
krx300 sync --out-codes ./codes.txt
# 2️⃣ Scraper2로 코드 목록을 사용해 실제 수집 및 MongoDB 저장
scraper2 ingest many --file ./codes.txt --pages c103 c104 --save
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file krx300_hj3415-1.0.4.tar.gz.
File metadata
- Download URL: krx300_hj3415-1.0.4.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70da74211fdafa723e5d5e4703230724f20068612e6475c5f43c4ae8bea98149
|
|
| MD5 |
4bfa760309b13d2a989bd78d2527b1ba
|
|
| BLAKE2b-256 |
07c4672b620ee9e7f310e5eb16a2bc9a589406be01e5d3624c9690451baba100
|
File details
Details for the file krx300_hj3415-1.0.4-py3-none-any.whl.
File metadata
- Download URL: krx300_hj3415-1.0.4-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9215ed1071ee30e1de7d6201b6f6e88863bef9da893e67d63f0a8945bd3d7e7d
|
|
| MD5 |
894104aa8140fa1db8ad837c3f0fd45e
|
|
| BLAKE2b-256 |
392e9f1ac2ac5d5f777523dafefa3732e68bd574eaeedb43ea7ad7acfb5609cd
|