LordXido commited on
Commit
3224210
·
verified ·
1 Parent(s): de96274

Update core_engine.py

Browse files
Files changed (1) hide show
  1. core_engine.py +17 -12
core_engine.py CHANGED
@@ -1,18 +1,23 @@
1
- import math
2
- from typing import Dict
3
 
4
- def harmonize_price(raw_price: float, physical_indicator: float, lag_factor: float) -> Dict[str, float]:
5
  """
6
- Returns harmonized pricing with distortion and confidence.
 
7
  """
8
- # Correction reduces false inflation from synthetic trading
9
- correction = (raw_price - physical_indicator) * min(1.0, lag_factor)
10
- harmonized = raw_price - correction
11
- confidence = 1.0 - abs(correction) / max(raw_price, 1)
 
 
12
 
13
  return {
14
- "raw_price": raw_price,
15
- "harmonized_price": round(harmonized, 4),
16
- "distortion": round(correction, 4),
17
- "confidence": round(max(0.0, min(confidence, 1.0)), 4)
 
 
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
  }