Spaces:
Sleeping
Sleeping
Update core_engine.py
Browse files- core_engine.py +17 -12
core_engine.py
CHANGED
|
@@ -1,18 +1,23 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
|
| 4 |
-
def
|
| 5 |
"""
|
| 6 |
-
|
|
|
|
| 7 |
"""
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
|
| 13 |
return {
|
| 14 |
-
"
|
| 15 |
-
"
|
| 16 |
-
"
|
| 17 |
-
"
|
|
|
|
|
|
|
| 18 |
}
|
|
|
|
| 1 |
+
# core_engine.py
|
| 2 |
+
# CodexFlow Core Execution Engine
|
| 3 |
|
| 4 |
+
def run_engine(payload: dict) -> dict:
|
| 5 |
"""
|
| 6 |
+
Deterministic execution core for CodexFlow_TM.
|
| 7 |
+
This is the single public entrypoint.
|
| 8 |
"""
|
| 9 |
+
|
| 10 |
+
commodity = payload.get("commodity", "UNKNOWN")
|
| 11 |
+
anchor = float(payload.get("physical_anchor", 0))
|
| 12 |
+
lag = int(payload.get("reporting_lag", 0))
|
| 13 |
+
|
| 14 |
+
harmonized_index = round(anchor * (1 + 0.001 * lag), 4)
|
| 15 |
|
| 16 |
return {
|
| 17 |
+
"status": "ok",
|
| 18 |
+
"engine": "CodexFlow_Core",
|
| 19 |
+
"commodity": commodity,
|
| 20 |
+
"physical_anchor": anchor,
|
| 21 |
+
"reporting_lag_days": lag,
|
| 22 |
+
"harmonized_index": harmonized_index
|
| 23 |
}
|