krx-hj3415 2.2.2__tar.gz → 2.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: krx-hj3415
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: KRX300 code scraper
5
5
  Keywords: example,demo
6
6
  Author-email: Hyungjin Kim <hj3415@gmail.com>
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
4
4
 
5
5
  [project]
6
6
  name = "krx-hj3415" # PyPI 이름 (하이픈 허용)
7
- version = "2.2.2"
7
+ version = "2.2.3"
8
8
  description = "KRX300 code scraper"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -48,7 +48,9 @@ async def refresh_krx300(*, max_days: int = 15) -> tuple[datetime, list[CodeItem
48
48
  return fetch_krx300_items(max_days=max_days)
49
49
 
50
50
 
51
- def to_universe_item_dtos(items: Iterable[Any], *, market: str = "KRX") -> list[UniverseItemDTO]:
51
+ def to_universe_item_dtos(
52
+ items: Iterable[Any], *, market: str = "KRX"
53
+ ) -> list[UniverseItemDTO]:
52
54
  out: list[UniverseItemDTO] = []
53
55
  for it in items:
54
56
  if it is None:
@@ -89,7 +91,9 @@ async def run_sync(
89
91
  asof, new_items = await refresh_krx300(max_days=max_days)
90
92
 
91
93
  # --- 2) load old ---
92
- old_payload_dto = await get_universe_latest(db, universe=cast(UniverseNames, universe.value))
94
+ old_payload_dto = await get_universe_latest(
95
+ db, universe=cast(UniverseNames, universe.value)
96
+ )
93
97
  old_items = _payload_dto_to_items(old_payload_dto)
94
98
 
95
99
  # --- 3) diff ---
@@ -99,11 +103,19 @@ async def run_sync(
99
103
 
100
104
  # --- 4) save ---
101
105
  await upsert_universe_latest(
102
- db, universe=cast(UniverseNames, universe.value), items=to_universe_item_dtos(new_items), asof=asof
106
+ db,
107
+ universe=cast(UniverseNames, universe.value),
108
+ items=to_universe_item_dtos(new_items, market="KRX"),
109
+ asof=asof,
110
+ source="samsungfund",
103
111
  )
104
112
  if snapshot:
105
113
  await insert_universe_snapshot(
106
- db, universe=cast(UniverseNames, universe.value), items=to_universe_item_dtos(new_items), asof=asof
114
+ db,
115
+ universe=cast(UniverseNames, universe.value),
116
+ items=to_universe_item_dtos(new_items, market="KRX"),
117
+ asof=asof,
118
+ source="samsungfund",
107
119
  )
108
120
 
109
121
  return d
@@ -121,4 +133,4 @@ async def apply_removed(
121
133
  if not codes:
122
134
  return {"latest_deleted": 0, "snapshots_deleted": 0}
123
135
 
124
- return await delete_codes_from_nfs(db, codes=codes, endpoint=None)
136
+ return await delete_codes_from_nfs(db, codes=codes, endpoint=None)
File without changes
File without changes