Skip to content

Commit 4ad7b4b

Browse files
luisleo526claude
andcommitted
Add the Pine execution adapter and native-hook scheduler on a fixture host without switching the generated route (R4-D L2)
Complete the L1f source projection, fill-bar margin slice, and variable ShortSeed lowering on the fixture-only native route. Add exact full fixture coverage for stop snapshots and fixed/percent ShortSeed books; retain all added adapter state in the source hash. Contract: §0, §2 P2/P4-P9/P13/P15, §3.2-§3.5, P-DA1-P-DA5; amendments A15-A20. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016iF71UAEuQ7F6eqWgecAHm
1 parent fcd7a3b commit 4ad7b4b

6 files changed

Lines changed: 397 additions & 42 deletions

File tree

‎include/pineforge/source/pine_adapter.hpp‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ struct ShortSeedPlan {
145145
native_order::RequestHandle materialize_long{};
146146
native_order::RequestHandle final_short{};
147147
bool active = false;
148+
// Generic matching must execute the artifact before the final source
149+
// short. For variable-size source books their acceptance handles are
150+
// consequently opposite to their source report incarnations; retain the
151+
// pending source-report projection until the remnant is closed.
152+
bool report_swap_pending = false;
148153
};
149154

150155
struct SourceDayLedger {
@@ -326,6 +331,15 @@ class PineExecutionAdapter {
326331
bool opening = false;
327332
};
328333

334+
// A source command can remain observable through the enclosing source
335+
// evaluation after generic admission has already produced its terminal
336+
// receipt. This is a source projection row, never a second executable
337+
// request; it expires at the following broker open.
338+
struct SourceShadowPending {
339+
PlacementSnapshot snapshot;
340+
std::string label;
341+
};
342+
329343
struct PendingRelativeExit {
330344
SourceId exit_id;
331345
SourceId from_entry;
@@ -363,6 +377,8 @@ class PineExecutionAdapter {
363377
void apply_fx_opening_margin_slice(const native_order::ExecutionAppliedEvent&,
364378
const NativeDecisionContext&);
365379
void submit_fx_margin_slice(const Bar&, const NativeDecisionContext&, double rate);
380+
void schedule_preopen_margin_slice(const Bar&, const NativeDecisionContext&);
381+
void maybe_activate_short_seed_plan();
366382
void consume_cohort_units(const SourceId&, const native_order::ExecutionAppliedEvent&);
367383
bool origin_is_pending(const native_order::RequestHandle&) const noexcept;
368384
void cancel_bracket_origin(const native_order::RequestHandle&);
@@ -396,6 +412,7 @@ class PineExecutionAdapter {
396412
std::vector<PendingBracketLeg> pending_bracket_legs_;
397413
std::vector<PendingEntry> pending_entries_;
398414
std::vector<PendingSameBarCommand> pending_same_bar_commands_;
415+
std::vector<SourceShadowPending> source_shadow_pending_;
399416
double pending_same_bar_close_qty_ = 0.0;
400417
std::vector<PendingRelativeExit> pending_relative_exits_;
401418
std::vector<PendingCoofRequest> pending_coof_requests_;
@@ -428,6 +445,7 @@ class PineExecutionAdapter {
428445
PineRiskState risk_{};
429446
ShortSeedPlan short_seed_{};
430447
native_order::RequestHandle short_seed_candidate_long_{};
448+
native_order::RequestHandle short_seed_candidate_materialize_{};
431449
native_order::RequestHandle short_seed_candidate_final_short_{};
432450
int last_bar_dual_entry_path_ = 0;
433451
PendingIntentView pending_view_{};

‎include/pineforge/source/pine_native_host.hpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class PineNativeHost : public NativeStrategyHost {
174174
const std::vector<FixturePendingOrder>& source_pending_view() const {
175175
source_pending_view_cache_.clear();
176176
source_pending_view_cache_.reserve(adapter_.pending_same_bar_commands_.size()
177-
+ adapter_.live_handles_.size());
177+
+ adapter_.source_shadow_pending_.size() + adapter_.live_handles_.size());
178178
const auto append = [&](const PlacementSnapshot& snapshot, const std::string& label) {
179179
FixturePendingOrderType type = FixturePendingOrderType::MARKET;
180180
switch (snapshot.family) {
@@ -200,6 +200,9 @@ class PineNativeHost : public NativeStrategyHost {
200200
for (const auto& command : adapter_.pending_same_bar_commands_) {
201201
append(command.snapshot, command.request.label);
202202
}
203+
for (const auto& shadow : adapter_.source_shadow_pending_) {
204+
append(shadow.snapshot, shadow.label);
205+
}
203206
for (const auto& handle : adapter_.live_handles_) {
204207
const auto found = adapter_.placement_.find(handle.incarnation);
205208
if (found != adapter_.placement_.end()) append(found->second, found->second.source_id);
@@ -218,6 +221,7 @@ class PineNativeHost : public NativeStrategyHost {
218221
void scheduler_prepare_chart_day_partition(const std::vector<Bar>& bars);
219222
void scheduler_record_range_end(const Bar&);
220223
void scheduler_publish_source_bar(const Bar&, bool first_tick, bool advance_source_index = true);
224+
void project_short_seed_report_rows(const native_order::ExecutionAppliedEvent&);
221225
bool scheduler_coof_enabled() const noexcept { return config_.calc_on_order_fills; }
222226
static PineStrategyConfig apply_overrides(PineStrategyConfig, const StrategyOverrides&);
223227

0 commit comments

Comments
 (0)