Add simulator replica, persistence, planet scan, README; split empire state out of the repo
- tools/simulate.py + puga/simulate.py: replica of PRUNplanner's simulator (flows and efficiency verified against screenshots), reports real new capex (planned minus built) - tools/scan.py: staffing variants, freight, HQ/experts, --planet mode, demolish-later, --min-n as a pure market-size filter, --json output - tools/history.py, tools/persistence.py: margin history and short-horizon payback checks - tools/plan_push.py: guarded delete; tools/state.py: syncs to empire/ - README with features and setup; CLAUDE.md made generic - Own-empire material (profile, state, plans, notes) moved to gitignored empire/; generic examples in plans/examples and state/company.example.yaml Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,3 +51,14 @@ def walk(mat: str, cx: str, qty: float, side: str, refresh=False) -> dict:
|
||||
break
|
||||
filled = qty - left
|
||||
return dict(avg=total / filled if filled else None, filled=filled, worst=worst, total=total, short=left > 0)
|
||||
|
||||
|
||||
def uni30(snap: dict, tk: str) -> float | None:
|
||||
"""PRUNplanner's 'Universe 30D' price basis: volume-weighted 30d VWAP across all exchanges (verified against its BHP price)."""
|
||||
num = den = 0.0
|
||||
for cx in CXS:
|
||||
q = snap.get((tk, cx))
|
||||
if q and q.vwap30 and q.traded30:
|
||||
num += q.vwap30 * q.traded30
|
||||
den += q.traded30
|
||||
return num / den if den else None
|
||||
|
||||
Reference in New Issue
Block a user