Spaces:
Sleeping
Sleeping
Restore full economy ingest database sync
Browse files- App/routers/economy/routes.py +22 -22
App/routers/economy/routes.py
CHANGED
|
@@ -208,28 +208,6 @@ async def ingest_economy_payload(
|
|
| 208 |
},
|
| 209 |
)
|
| 210 |
|
| 211 |
-
|
| 212 |
-
@router.get("/inflation", response_model=ResponseModel)
|
| 213 |
-
async def inflation_detail():
|
| 214 |
-
stored = await latest_stored_payload()
|
| 215 |
-
if stored and stored.get("nbs_inflation"):
|
| 216 |
-
return ResponseModel(success=True, message="Inflation detail retrieved", data=stored["nbs_inflation"])
|
| 217 |
-
docs = await EconomicDocument.filter(source="nbs").all()
|
| 218 |
-
return ResponseModel(success=True, message="Inflation detail retrieved", data=build_inflation_payload(docs))
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
@router.get("/bonds/secondary/daily", response_model=ResponseModel)
|
| 222 |
-
async def secondary_bond_daily_detail(report_date: Optional[str] = None):
|
| 223 |
-
stored = await latest_stored_payload()
|
| 224 |
-
if stored and stored.get("secondary_bond_detail") and not report_date:
|
| 225 |
-
return ResponseModel(success=True, message="Secondary bond daily detail retrieved", data=stored["secondary_bond_detail"])
|
| 226 |
-
parsed_date = date.fromisoformat(report_date) if report_date else None
|
| 227 |
-
return ResponseModel(
|
| 228 |
-
success=True,
|
| 229 |
-
message="Secondary bond daily detail retrieved",
|
| 230 |
-
data=await build_secondary_bond_payload(parsed_date),
|
| 231 |
-
)
|
| 232 |
-
|
| 233 |
saved_documents = 0
|
| 234 |
for doc in documents:
|
| 235 |
source_url = doc.get("source_url")
|
|
@@ -354,6 +332,28 @@ async def secondary_bond_daily_detail(report_date: Optional[str] = None):
|
|
| 354 |
)
|
| 355 |
|
| 356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 357 |
@router.get("/payload/latest", response_model=ResponseModel)
|
| 358 |
async def latest_ingest_payload(include_payload: bool = Query(False)):
|
| 359 |
row = await EconomyIngestPayload.all().order_by("-report_date", "-ingested_at").first()
|
|
|
|
| 208 |
},
|
| 209 |
)
|
| 210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
saved_documents = 0
|
| 212 |
for doc in documents:
|
| 213 |
source_url = doc.get("source_url")
|
|
|
|
| 332 |
)
|
| 333 |
|
| 334 |
|
| 335 |
+
@router.get("/inflation", response_model=ResponseModel)
|
| 336 |
+
async def inflation_detail():
|
| 337 |
+
stored = await latest_stored_payload()
|
| 338 |
+
if stored and stored.get("nbs_inflation"):
|
| 339 |
+
return ResponseModel(success=True, message="Inflation detail retrieved", data=stored["nbs_inflation"])
|
| 340 |
+
docs = await EconomicDocument.filter(source="nbs").all()
|
| 341 |
+
return ResponseModel(success=True, message="Inflation detail retrieved", data=build_inflation_payload(docs))
|
| 342 |
+
|
| 343 |
+
|
| 344 |
+
@router.get("/bonds/secondary/daily", response_model=ResponseModel)
|
| 345 |
+
async def secondary_bond_daily_detail(report_date: Optional[str] = None):
|
| 346 |
+
stored = await latest_stored_payload()
|
| 347 |
+
if stored and stored.get("secondary_bond_detail") and not report_date:
|
| 348 |
+
return ResponseModel(success=True, message="Secondary bond daily detail retrieved", data=stored["secondary_bond_detail"])
|
| 349 |
+
parsed_date = date.fromisoformat(report_date) if report_date else None
|
| 350 |
+
return ResponseModel(
|
| 351 |
+
success=True,
|
| 352 |
+
message="Secondary bond daily detail retrieved",
|
| 353 |
+
data=await build_secondary_bond_payload(parsed_date),
|
| 354 |
+
)
|
| 355 |
+
|
| 356 |
+
|
| 357 |
@router.get("/payload/latest", response_model=ResponseModel)
|
| 358 |
async def latest_ingest_payload(include_payload: bool = Query(False)):
|
| 359 |
row = await EconomyIngestPayload.all().order_by("-report_date", "-ingested_at").first()
|