Skip to content

p0-ship-fx-stack-20260731: stack FX series loader + short 1× rollover - #142

Merged
luisleo526 merged 1 commit into
mainfrom
campaign/p0-ship-fx-stack-20260731
Jul 30, 2026
Merged

p0-ship-fx-stack-20260731: stack FX series loader + short 1× rollover#142
luisleo526 merged 1 commit into
mainfrom
campaign/p0-ship-fx-stack-20260731

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Campaign task

p0-ship-fx-stack-20260731 (task 81) — mechanical ship of lead-adjudicated ACCEPT_SHIP (update seq 392, scoreboard sb:59078b18c459).

Stacked patches only (no new experiments):

  1. task-76 series JSON loader — engine-account-currency-fx-series-json.patch sha256 3895ef93173e1a7a3e6ae02afa6b3cd4f62ea2e6681f56a0eef3267c665e54bb
  2. task-79 A1 short 1× FX rollover — fx-rollover-short-1x.patch sha256 20896f756bc24b074a565d62601a486e089219b18b8b61a8d4c1d5f3811b717b

Base: origin/main @ 3cdcd36 (patches applied clean with git apply --3way).

pr-gate verdict

  • PASS$PINEFORGE_CAMPAIGN_STATE_DIR path:
    /Users/haoliangwen/code/agent-org-harness/var/orgs/pineforge-parity/pr-gate-verdict.json
  • Baseline: /Users/haoliangwen/code/agent-org-harness/var/orgs/pineforge-parity/progress/.tiers-pre-p0-impl-account-currency-fx-wire-20260731.json sha256 407675330b44432acc949b0df1c4ae56ef3d26d69e891202d569a9c48fefb63f
  • Candidate grades: _tier-grades.json sha256 59078b18c4595a51ee8dcd9450a8508e959e39807274dc525fd7828bbfed5a00sb:59078b18c459
  • Gate arithmetic (shared-slug rows): 14 UP / 6 DOWN (net +8); corpus: 0 regressions / 251 compared

Missing-as-DOWN accounting vs pre-FX-wire e+s=400 lineage

pr-gate drops vanished rows from the DOWN count. With missing counted as DOWN (briancurry excellent→absent):

metric value
UP 14
DOWN (incl. missing) 7
e+s 400 → 402 (+2)
UP > DOWN (missing as DOWN) yes (14 > 7)

6 inherited FX-wire tier demotions (pre-existing; not introduced by A1)

Accepted as residual from task-76 FX enablement; diagnosis queued separately:

slug pre-FX after stack class
bhavik51-pivot-point-standard excellent strong FX-wire residual
chartprime-power-order-blocks-chartprime excellent strong FX-wire residual
equiest-equivest-supply-and-demand-zone excellent strong FX-wire residual
fluxchart-supply-and-demand-zones-flux-charts excellent moderate FX-wire residual
proozac98-advvolbars-proozac excellent strong FX-wire residual
willowsportz-pk-willow-pulse-ut-williams-live-movement excellent strong FX-wire residual

briancurry fail-closed caveat

briancurry-egan-s-pure-structure-s-d-strategy-backtest: excellent → missing under A1 design (leveraged fail-closed). Deferred to leveraged L/R cells (needs TV pin). Not an A1 non-target regression vs post-task-76 state (A1: 16 UP / 0 DOWN vs task-76 degraded).

FX series runtime input contract

field value
path /Users/haoliangwen/code/agent-org-harness/var/orgs/pineforge-parity/baselines/account-currency-fx/c2a1-full-history-bar-grain.json
sha256 ccf0e088fc92b839e82d65ebf9458c0aeffb58257fa3257370440a141b319a11
PIN baselines/account-currency-fx/PIN.json — engine pin bddddac7491867b4a1b610073c30b6661122967e, codegen pin 4b1af93e5594191c2f13e32bba40fbe907505c75
grain bar-step (489 transitions from 45062 samples)
transfer_gate 5680/5680 qty+rate exact

Local hard gate

tests/test_affordability_fx: 128 passed / 0 failed (G long regression green) on this branch worktree.

Evidence

  • Task-80 findings (ACCEPT_SHIP): file:///Users/haoliangwen/code/agent-org-harness/var/orgs/pineforge-parity/progress/p0-verify-task79-a1-20260731/findings.md
  • Ship worktree: var/orgs/pineforge-parity/worktrees/p0-ship-fx-stack-20260731 @ 447726a

… rollover

Ship lead-adjudicated ACCEPT_SHIP stack (update seq 392, sb:59078b18c459):
- task-76: engine account-currency FX series JSON loader (run_strategy.py)
- task-79 A1: short 1x FX rollover fix (engine fills/run + affordability tests)

Gate: pr-gate PASS 14 UP > 6 DOWN (+briancurry missing as DOWN => 14>7)
vs pre-FX-wire baseline; test_affordability_fx 128/0.
Copilot AI review requested due to automatic review settings July 30, 2026 20:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR stacks two FX-related patches: it broadens the broker-open “timestamped FX rollover” handling from carried 1× longs to also include carried 1× shorts (while keeping leveraged shapes fail-closed), and adds a Python harness loader for bar-grain FX series JSON so runtime overrides can feed the engine the intended effective-time curve.

Changes:

  • Extend broker-open timestamped account-currency FX rollover logic to support carried full-margin shorts (cell A1) and rename the internal helper accordingly.
  • Add/extend unit tests to cover carried 1× short rollover behavior (including margin-call trims and flat-epoch consumption).
  • Add a runtime override path in scripts/run_strategy.py to load bar-grain FX series JSON (mutually exclusive with daily-close FX JSON).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_affordability_fx.cpp Adds carried 1× short rollover probes and assertions; updates G6 expectations for short vs leveraged shapes.
src/engine_run.cpp Switches dispatch to the renamed carried-position FX rollover handler.
src/engine_fills.cpp Generalizes carried FX rollover from 1× long-only to full-margin (1×) long/short and adds short-side MTM/margin math.
scripts/run_strategy.py Adds JSON loader for bar-grain FX series overrides and enforces mutual exclusivity with daily-close loader.
include/pineforge/engine.hpp Updates the private engine API declaration and documentation to match the generalized rollover handler.
Comments suppressed due to low confidence (1)

scripts/run_strategy.py:858

  • In the points[] JSON shape, boolean timestamps (True/False) will also be accepted via int(True)/int(False). Reject bool explicitly so invalid producer output can't slip through as a numeric timestamp.
            raw_t = item.get("t", item.get("timestamp_ms", item.get("timestamp")))
            raw_r = item.get("rate", item.get("c2a1"))
            try:
                t_ms = int(raw_t)
                r = float(raw_r)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/run_strategy.py
raw_bytes = path.read_bytes()
payload = json.loads(raw_bytes)
points = []
if isinstance(payload, dict) and isinstance(payload.get("timestamps_ms"), list) and isinstance(payload.get("rates"), list):
Comment thread scripts/run_strategy.py
Comment on lines +835 to +841
try:
t_ms = int(ts)
r = float(rate)
except (TypeError, ValueError) as exc:
raise ValueError(
f"invalid account-currency FX series point {ts!r}: {rate!r}"
) from exc
@luisleo526
luisleo526 merged commit d9e3510 into main Jul 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants