You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dbcca85
Browse filesBrowse the repository at this point in the historyBrowse files
Kernel+Source: a current execution converts at its cursor's rate, threaded; it neither writes nor restores the host's clock (R5 lane B-ADAPTER, item 5)
R5 lane F3's finding 2. consume_matched_request presented the execution
cursor as the engine's bar clock (current_bar_.timestamp) so that the
terms, the inspection, the admission, the preview and the settlement all
converted at the cursor's instant; F3 made execute_current save the frame's
clock and restore it after the call. E21's ruling for a host command is to
thread the rate, never the clock -- which F3 could not do without
engine_execution.cpp ("fourteen clock-based FX reads and
build_close_trade_with_costs' four").
Kernel (on INT23's engine_execution.cpp / engine_settlement_stage.hpp):
- consume_matched_request takes the execution's rate once --
account_currency_fx_at(cursor effective time), the instant it presented
-- and threads it: the terms facts' active_fx (already that instant),
the sized basis (marked_equity_at), the candidate inspection
(inspect_native_reversal_at, inspect_native_settlement_selected_at,
inspect_native_settlement_scoped_at), the preview and settlement
context (PhysicalExecutionContext::account_fx), the account observation
and the risk note (risk_note_fill / risk_roll_day take the rate). It
writes the clock only when matching a driver point, whose own instant it
is; a current execution presents nothing.
- The one-lot and staged settlements take their quote rate from the
context (settle_with_membership, settle_native_reversal_at_v1,
OneLot::preview_keeping), a projection converts at its stage's rate
(OneLot::project, project_native_settlement_stage: notional, marked
equity and the rows it builds), and project_native_settlement_at
projects at an explicit rate. A context that names no rate converts at
the presented clock's, exactly as before.
- execute_current's save and restore is deleted.
- open_profit_at(price, fx) beside open_profit.
ADR-0001 rule 2. (a) Mechanism: an execution converting at its own
instant's rate, handed to what it runs through its facts and context, is
the same for every host and venue; the host's presented clock stays its
own; nothing branches on a platform. (b) Knob: none -- no spec field; the
rate is the one the run already chose (the cursor's instant), carried as
data. For a host, one thing changes and it is the point: inside a current
execution its own hooks now see its frame's clock, not the cursor's, and
the execution's rate is in their facts (NativeExecutionTermsFacts::
active_fx, ClosedLotExcursionFacts::account_fx).
Source: the Pine callbacks that run inside an execution read the facts'
rate: the at-fill default percentage's equity and the affordability
fallback in resolve_terms, and a typed percentage's money
(percent_commission_live_equity(mark, fx); a typed reversal's flatten
projected at the rate, project_native_settlement_at, which retires the
now-unused PineStrategyHost::adapter_project_flatten). Its excursion owner
already converts at facts.account_fx (item 3).
Witness tests/test_native_current_execution_rate.cpp (new row,
source-free): F3's bar-open geometry (the command executes at the decision
floor, a bar later, across a 1.0 -> 2.5 step): inside the execution's own
terms hook the clock is the frame's (+2 min) and the facts' rate 2.5 at
+3 min; the new unit's fee is 0.11 x 2.5 = 0.275 and after the call the
clock, rate and marked equity are the frame's; a current close books
369.375 P&L, 5.625 commission and a 373.5 run-up, all at 2.5; and the
kernel sources: execute_current names no clock, consume_matched_request
writes it once and only under !current, the candidate inspection and the
sized basis read no clock, the settle and preview entries take the
context's rate. Fail-before (inside a git archive of db98990):
inside the terms hook: clock +3 min, facts rate 2.50 at +3 min
FAIL ...:194 host.hook_clock == kT0 + 2 * kMinute
execute_current names the bar clock
consume_matched_request writes the clock 1 time(s), unguarded
NativeExecutionConsumer::resolve_sized_units( reads a clock
(settle_with_membership, settle_native_reversal_at_v1, preview_keeping x2)
does not take the context's rate
R5 B-ADAPTER current execution rate: 47 checks, 8 failures
The economics rows (0.275; 369.375 / 5.625 / 373.5) pass before and after:
the threaded rate is the presented one. After: 47 checks, 0 failures; local
ctest 661/661 before the row was added (every FX, margin-clock, settlement
carry, C-host and adapter suite, including F3's item-5 and E21's rows);
check_native_cpp_versions, check_broker_state_hash_coverage,
check_native_c_api_surface, check_c_abi_runtime exit 0.
Not changed (recorded for B-DOCS): NativeStrategyHost::
inspect_current_execution, the host-facing preview of a current execution,
still converts at the presented clock -- in a bar-open frame across a step
it previews at the frame's rate what executes at the cursor's.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 1bdd55f87c2bd41fc3e091f2bb1e3561b512f1fc)
0 commit comments