Skip to main content

DTO pakages for hj3415

Project description

Contracts-hj3415

1) 3가지 Envelope DTO (정확한 타입명 / 파일 경로)

A. NfsEnvelopeDTO

  • 파일: contracts_hj3415/common/envelope.py

  • 타입명: class NfsEnvelopeDTO(TypedDict)

필드

  • topic: Literal["nfs"]

  • key: CodeKey  (contracts_hj3415/common/types.py에서 CodeKey = str)

  • asof: datetime

  • payload: NfsPayloadDTO  (contracts_hj3415/nfs/payloads.py)

  • meta: EnvelopeMeta  (contracts_hj3415/common/types.py)

팩토리

  • make_nfs_envelope(...) -> NfsEnvelopeDTO (contracts_hj3415/common/envelope.py)

B. UniverseEnvelopeDTO

  • 파일: contracts_hj3415/common/envelope.py

  • 타입명: class UniverseEnvelopeDTO(TypedDict)

필드

  • topic: Literal["universe"]

  • key: Universe (contracts_hj3415/universe/types.py의 Universe = Literal["KRX300"])

  • asof: datetime

  • payload: UniversePayloadDTO (contracts_hj3415/universe/payloads.py)

  • meta: EnvelopeMeta

팩토리

  • make_universe_envelope(...) -> UniverseEnvelopeDTO (contracts_hj3415/common/envelope.py)

C. AnalysisEnvelopeDTO

  • 파일: contracts_hj3415/common/envelope.py

  • 타입명: class AnalysisEnvelopeDTO(TypedDict)

필드

  • topic: Literal["analysis"]

  • key: CodeKey (str)

  • asof: datetime

  • payload: AnalysisPayloadDTO (contracts_hj3415/analysis/payloads.py)

  • meta: EnvelopeMeta

팩토리

  • make_analysis_envelope(...) -> AnalysisEnvelopeDTO (contracts_hj3415/common/envelope.py)

2) 공통 타입(정확한 타입명 / 파일 경로)

common/types.py

  • 파일: contracts_hj3415/common/types.py

타입들

  • Topic = Literal["nfs", "universe", "analysis"]

  • CodeKey = str

  • Num = float | int | None

  • Source = Literal["", "scraper2", "krx", "analyser2"]

  • class EnvelopeMeta(TypedDict, total=False):

    • source: Source

    • trace_id: str

    • note: str

    • tags: list[str]


3) payload 유니온(정확한 타입명 / 파일 경로)

A. NFS payload

  • 파일: contracts_hj3415/nfs/payloads.py

  • 타입명: NfsPayloadDTO

NfsPayloadDTO = C101Payload | C103Payload | C104Payload | C106Payload | C108Payload

각 payload 정의 파일:

  • contracts_hj3415/nfs/c101.py → C101Payload (필드: endpoint: Literal["c101"], blocks: C101Blocks)

  • contracts_hj3415/nfs/c103.py → C103Payload (필드: endpoint: Literal["c103"], blocks, labels)

  • contracts_hj3415/nfs/c104.py → C104Payload

  • contracts_hj3415/nfs/c106.py → C106Payload

  • contracts_hj3415/nfs/c108.py → C108Payload

공통 키/엔드포인트 타입:

  • 파일: contracts_hj3415/nfs/types.py

    • Endpoint = Literal["c101","c103","c104","c106","c108"]

    • MetricKey = str

    • PeriodKey = str

    • BlockKey = ... (각 C101~C108 블록 리터럴 유니온)


B. Universe payload

  • 파일: contracts_hj3415/universe/payloads.py

  • 타입명: UniversePayloadDTO = KRX300Payload

  • KRX300Payload 정의: contracts_hj3415/universe/krx300.py

    • class UniverseItem(TypedDict, total=False): code/name/market/meta

    • class KRX300Payload(TypedDict): source, universe, blocks: list[UniverseItem]

  • Universe 타입: contracts_hj3415/universe/types.py (Universe = Literal["KRX300"])


C. Analysis payload

  • 파일: contracts_hj3415/analysis/payloads.py

  • 타입명: AnalysisPayloadDTO = FeaturesPayload

  • FeaturesPayload 정의: contracts_hj3415/analysis/features.py

    • service: Literal["features"]

    • endpoint: Endpoint (nfs Endpoint 사용)

    • blocks: dict[MetricKey, LatestAndTtm]

  • AnalysisService 타입: contracts_hj3415/analysis/types.py

    • AnalysisService = Literal["features","red"] (현재 payload는 features만 연결돼 있음)

4) 앞으로 “모든 프로젝트 코딩 시” 적용 기준

너희 모노레포에서 “프로젝트 간 통신”은 앞으로 무조건 아래처럼만:

  • scraper2 → db2 : NfsEnvelopeDTO

  • krx → db2 : UniverseEnvelopeDTO

  • analyser2 → db2 : AnalysisEnvelopeDTO

  • 그 외 어떤 프로젝트 간 이동도 이 3종 envelope 중 하나로만 주고받기

그리고 생성은 원칙적으로:

  • contracts_hj3415/common/envelope.py의

    • make_nfs_envelope

    • make_universe_envelope

    • make_analysis_envelope

      를 사용

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

contracts_hj3415-0.5.3.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contracts_hj3415-0.5.3-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file contracts_hj3415-0.5.3.tar.gz.

File metadata

  • Download URL: contracts_hj3415-0.5.3.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for contracts_hj3415-0.5.3.tar.gz
Algorithm Hash digest
SHA256 3845da8041ee82146d7e33578cc468660f7133f253a7419d857feca30d0efbc2
MD5 55c88c0c8cde13c4d33ab01e2a80175c
BLAKE2b-256 7a5c549866648eb4f1b4489998ba0525f63f1a6770ce0b1395ca22af020496d5

See more details on using hashes here.

File details

Details for the file contracts_hj3415-0.5.3-py3-none-any.whl.

File metadata

File hashes

Hashes for contracts_hj3415-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 eaf8ea190553a25865d9dfb7f77c90004a02797523eeb6a05d5124afb64d740f
MD5 fbd2e4955ce9d3c311b3b9e0fc079a85
BLAKE2b-256 16124d8b739835b42ac54739e5f0f2dde1f1dedcbff5dab84e197dff578507c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page