Skip to main content

🧭 기본 구조

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

Metadata

Release files for krx300-hj3415 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for krx300-hj3415 1.0.4
File Size Uploaded
krx300_hj3415-1.0.4.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for krx300-hj3415 1.0.4
File Interpreter ABI Platform
krx300_hj3415-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / krx300_hj3415-1.0.4.tar.gz

Download URL krx300_hj3415-1.0.4.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
70da74211fdafa723e5d5e4703230724f20068612e6475c5f43c4ae8bea98149
BLAKE2b-256 checksum
How to use checksums
07c4672b620ee9e7f310e5eb16a2bc9a589406be01e5d3624c9690451baba100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.5

Release files / krx300_hj3415-1.0.4-py3-none-any.whl

Download URL krx300_hj3415-1.0.4-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9215ed1071ee30e1de7d6201b6f6e88863bef9da893e67d63f0a8945bd3d7e7d
BLAKE2b-256 checksum
How to use checksums
392e9f1ac2ac5d5f777523dafefa3732e68bd574eaeedb43ea7ad7acfb5609cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.5

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page