Equities and reconciliation

Equities and reconciliation

The backtest corporate-action stack is implemented: splits/reverse splits, cash and total-return dividends, renames, cash/stock/mixed mergers and delisting. Since GLE-328 (GLE-228 Decision 5a) the engine is a consumer of the price view: marketfeed serves an eq:V:T:adj=split or adj=splitdiv symbol adjusted, anchored at the run end, with the raw prices and the cumulative_price_ratio on every bar, and the engine builds no price schedule for a backtest. The bar loop keeps two frames of each served bar. The strategy receives the bar as served, so its indicators run in the adjusted view. The fill simulator, the corporate-action firing passes and the report recorder receive its raw projection: the raw prices promoted to OHLC, a settle divided by the ratio, the path constituents projected the same way and the adjustment fields cleared. Fills are therefore at historical prices. An order placed in the adjusted view has its limit, stop and trailing levels divided by the symbol’s latest served ratio (attached orders by their own symbol’s); a fill is multiplied back by the ratio of the bar it filled in, where the instant belongs to the bar that closes at it, which covers a next-open fill, a path fill and a market-on-close fill delivered with the next bar’s events. A bar without the raw view passes through both frames unchanged, so a raw equity or futures run is byte-identical to before.

Corporate-action accounting runs for every eq symbol, raw or adjusted. The records are fetched on the run symbol as given (marketfeed serves the same ledger for every price view, stamped with the base symbol) and re-keyed with the run symbol’s qualifier suffix, so a rename or merger relocates a position onto eq:V:NEW:adj=split when the run named eq:V:OLD:adj=split; one event builder, equity.RawEventManifest, folds them into the manifest the firing passes read, and the run security master is built over the pooled records. A split rewrites the held quantity and a dividend is credited whatever the view; under adj=splitdiv the feed has already folded the dividend into the prices, and the CORPORATE_ACTIONS stream is accounting only. The manifest’s source checksum is over the re-keyed records, so a qualified run (adj=raw, adj=split) carries its own per-view checksum. --auto-lineage follows each equity series’ forward rename chain, and a discovered successor inherits the head’s qualifier suffix, interval and session. Stable identity anchors preserve position accounting across ticker changes and reuse; whole-unit changes require an integral result or cash-in-lieu treatment. A declared eq: reference series is served as is and takes no accounting.

The gates are keyed on the symbol’s class, not on a configured registry: an adjusted equity reads its bars and its corporate actions on the protobuf wire only, so it forces pb in auto negotiation (and the DBN demotion has an adjusted-equity clause for a benchmark sleeve), while a raw equity prefers pb with a fallback to a best-effort run without its records. The bars a feed serves must agree with the class: an adjusted symbol whose bars lack is_adjusted, or a raw symbol whose bars carry it, is refused before the first bar, naming the offending close; so the file-csv adapter, which serves raw bars only (its optional ledger answers a qualified request with the base symbol’s rows), cannot run an adj=split symbol. Every BARS request of an adjusted symbol carries adjust_anchor = the run end, and the series cache keys on it. The config keys adjustment-mode and dividend-treatment are refused for one release with a message naming eq:<VENUE>:<TICKER>:adj=split or adj=splitdiv; there is no reinvested treatment left to configure.

The raw view refusals. The raw view must be usable wherever it is promoted (GLE-546, owner ruling of 30 October 2026). Every adjusted bar is checked at its turn, after its cumulative_price_ratio (a ratio that is not finite and positive is refused first, with its own text): in the backtest bar loop and the live loop, where the raw projection is built, on each path constituent of the bar, and on every warm-up bar, adjuster or not, since the strategy’s raw accessors read it (a continuous series’ warm-up bar belongs to its frame and is not checked). The raw fields are proto3 doubles, so an unset one reads as 0; with a finite, positive ratio a raw 0 can only give a served 0, so a raw field of 0 beside a served price that is not 0 is unset. A raw 0 beside a served 0 is a price of 0 and projects as before, as it would on a plain bar. The fields are checked in the order open, high, low, close, and the first unusable one refuses the run with an *engine.RawViewRefusal (Reason, Symbol, ClosesAt, Field, Raw, Adjusted), returned unwrapped so errors.As reaches it:

ReasonRefused when
raw_view_unseta raw field is 0 (or -0) beside a served price that is not 0
raw_view_not_finitea raw field is NaN or an infinity, whatever the served price
engine: raw_view_unset: series eq:XNAS:AAPL:adj=split: the bar closing 2026-03-17T00:00:00Z is adjusted but its raw_close is 0 (unset) beside close 402, so its raw view cannot be promoted to the prices the simulator fills on; a feed defect: report it to the feed

Such a bar is a feed defect: report it to the feed. marketfeed does not serve one: its adapter copies the stored raw prices into raw_* before it multiplies the served prices by the factor. Not checked: a negative raw price, the volume, a session’s settle, and a bar whose eight prices are all 0. The trade director’s history keeps its own rule for a bar without a raw close, a missing observation (GLE-532 I12), as a second line of defence.

Strategies can opt into raw/adjusted prices and CorporateActionObserver notices. The AdjustmentFactorSource adapter contract exists, but the engine consumes no factor feed (GLE-228 Decision 8): the view is the feed’s and the accounting is event-driven. What an action does to the working orders on its instrument depends on the order lifetime: the legacy profile rewrites them, and a backtest under lifetime v2 cancels, keeps or translates them as IBKR does (Corporate actions and working orders (lifetime v2)).

The IBKR venue is exercised through the deterministic emulator in cmd/tools/ibkr-emulator. Its HTTP endpoints implement account selection, positions, account state, order submission/cancellation, open orders and fills, plus admin clock/fixture control. Its cancel endpoint answers IBKR’s documented bodies, on IBKR’s singular path and on the plural one it served before (Tickets and cancels at the IBKR venue), and its replyWarnings fixture raises IBKR’s order reply messages for tickets at or above a quantity or value threshold, one reply or a chain, so the adapter’s reply policy runs against it (Order reply messages). It serves a contract’s rules, takes and refuses tickets as a paper account does, and holds a future’s stop outside its regular hours unless the ticket says outsideRTH (The venue seam and the current live path). internal/ibkrclient and emulator handler tests are the maintained endpoint contract.

The ledger persists canonical order identity before submission, under a persisted deployment namespace since GLE-373: every reference is <label>-<nonce>-<n>, the order line carries the complete frame, every execution report is validated against the order it names and quarantined when it fails, and adopted state carries the owner (The order ledger). Startup first folds the venue’s executions into the ledger, each applied once to the order that owns it and foreign ones quarantined, with the splits that took effect while the engine was down; it then matches the ledger to venue orders, refuses unexplained orders under the supported exit orphan policy, compares the owned position with the broker’s snapshot (a difference refuses the start, carrying a discrepancy record), and sends adopted state before warmup (The execution fold). Continuous reconciliation polls in-flight and open orders and resolves a filled order through the same fold, keyed on the venue’s execution id, partial executions included. Each GTC order’s line also records its venue deadline, gtc_deadline, from which the loop reports the venue’s quarter-end cancellation as GTC_EXPIRED (see The venue seam and the current live path); AdoptedOrder carries no deadline.

Live mode currently requires the emulator or the desk, and bar resolution. It runs every corporate action the backtest runs (GLE-1385 8d): splits, reverse splits and stock dividends, cash and total-return dividends, renames, cash mergers, delistings, and stock and mixed mergers, several on one symbol and ex-date included. The broker applies each action to its own books. The engine fires it where the backtest fires it, at the top of the first bar dated on or after its ex-date, in the backtest’s order: renames, the bar symbol’s splits and dividends, cash mergers and delistings, stock mergers, mixed mergers. For each it sends the backtest’s two notices and, between them, records the action in the ledger, keyed by symbol, ex-date, kind and ordinal, so the ledger’s expected positions move as the broker’s do, and opens a settling window on each symbol whose position the action moves (engine/livecorp.go). The ledger’s record keeps a restarted run from firing the action again. Two runs are refused:

  • a run under --lifetime v2 with an action at or after its start. v2 cancels working orders around an action, which the live loop does not model yet (GLE-456, the owner’s ruling of 10 Nov 2026); run it under --lifetime v1, live mode’s default;
  • a run with a rename or merger that moves a position to a symbol the run does not trade, since the venue reports positions in its traded symbols only.

An action whose ex-date precedes the run start, or that the run’s first bar already reaches, took effect before the run: the broker applied it before the first bar. If it also follows everything the ledger records for its symbol, and the ledger holds a position there, it took effect while the engine was down. The startup records it in the ledger, in time order with the offline executions, and the owned position is folded through it, so the strategy adopts the book after the action and is not told of it again. Over a flat book a first-bar action is left for the live pass, which announces it at the first bar, as the backtest does. The IBKR emulator applies the actions seeded in each symbol’s corporateActions (kind split, the default, dividend, rename, cash_merger, delisting, stock_merger or mixed_merger) with the simulator calls the backtest makes, and takes one its series’ first bar reaches as applied before the series starts, on the book /admin/seed then seeds. Live mode is the one place the engine still adjusts prices (GLE-228 Decision 7, kept by GLE-328): the feed’s served view re-anchors as its ledger grows, so a live run on an adjusted symbol builds its own forward-adjust schedule (equity.Build, anchored at the run start, mode split_adjusted for adj=split and split_dividend_adjusted for adj=splitdiv) and applies it to the raw projection of each served bar, warm-up included. The live and backtest paths agree bar for bar on a split and on a total-return dividend: the feed’s end-anchored view and the engine’s most-recent-segment schedule both put every bar in the basis after the action. Real-time non-emulated feeds, tick/path fills, bracket children, IOC/FOK, unspecified TIF and --limit-fill through are outside the admitted live surface; a member on its desk’s SIM clock carries tick and path fills and through, which the desk applies (GLE-1603, deskFillsSupported). Synthetic reconciliation fills, orphan claim/ignore, average-price/P&L tolerance policies and automatic alignment remain unfinished. See liveRunSupported, liveCASupported, engine/livecorp.go, engine/recon, and engine/liverun_*_test.go.

Corporate actions and working orders (lifetime v2)

Interactive Brokers does not carry a working order across a split or a merger: it cancels it. Since increment I14 unit 1 of the order-lifetime programme (GLE-455, 2026-10-08; engine/sim/corpterm.go and engine/corpterm.go) a backtest under lifetime v2, the default since I22, does the same. For each corporate action the engine fires, the working orders on the instrument it affects are cancelled with a reason of their own, CANCEL_REASON_CORPORATE_ACTION, kept, or kept and translated to a new ticker; the cancels reach the strategy before the action takes effect and before the ex-date bar is matched, and the engine’s race guard follows the books. The policy is automatic under v2 and has no flag: v2 is the venue-faithful profile, and --lifetime v1 is the way back to the old behaviour.

v1 is unchanged, byte for byte. The legacy profile keeps its historical transformations (engine/sim/corpaction.go): a split rewrites every working order on the symbol (the quantity floored by the ratio, the levels scaled), a stock or mixed merger re-keys and scales the target’s orders onto the acquirer, a cash merger or a delisting closes the position to cash and leaves the symbol’s orders resting until the end of the data (no bar of a delisted symbol arrives, so only the shutdown sweep ends them), and spinoffs and suspensions are ignored. A v1 run builds no corporate-action driver, every hook is a no-op and no order is cancelled with the new reason, so the KBD masters and every golden are unchanged.

The policy. sim.CorporateActionOrderPolicy reads the action’s type alone, except for a cash dividend:

ActionWorking orders on the affected instrumentWhy (IBKR’s rule, or the reason it does not apply)
CA_SPLIT, CA_REVERSE_SPLITcancel“a stock split (forward or reverse)”
CA_STOCK_DIVIDENDcancel“distribution of shares”
CA_MERGER_STOCK, CA_MERGER_MIXEDcancel on the target; the acquirer’s orders are kept“exchange for shares”; the target delists
CA_MERGER_CASHcancelthe target is exchanged for cash and delists: a terminal instrument has no market
CA_DELISTINGcancela terminal instrument has no market
CA_SPINOFFcancel on the parentthe spun-off shares go to the parent’s holders: “distribution of shares”
CA_RENAMEkeep and translate: the orders move to the new ticker, levels and quantities unchangednot among IBKR’s conditions; the same instrument under a new ticker (an assumption, below)
CA_CASH_DIVIDENDcancel when the dividend is above 3% of the prior close, keep otherwiseorders resting more than a day “will not be reduced for ordinary dividends”, but a special dividend “where the rate exceeds 3% of the prior day’s closing price” cancels them
CA_SUSPENSIONkeepnot among IBKR’s conditions (an assumption, below); no bar arrives, so nothing fills
CA_NEW_LISTING, unspecified, any other valuekeepnothing to cancel

The dividend rule is the float64 comparison CashAmount > CorporateActionDividendLimit * priorClose * (1 + 1e-9), with sim.CorporateActionDividendLimit 0.03: the limit times the close, not the dividend divided by the close, with a relative tolerance of one part in 10^9 for float64 rounding. A dividend of exactly 3% in decimal keeps: 3.00 on 100, 0.30 on 10, 0.27 on 9 (the quotient 0.27 / 9 rounds to 0.030000000000000002 and would cancel), and 0.90 on 30, 0.33 on 11 and 0.45 on 15 (the product 0.03 * 30 rounds to 0.8999999999999999, below 0.90, so the product without the tolerance would cancel; the frozen spec’s literal float64 rule did, and the mutation sweep found it, GLE-455). 3.0001% and 3.01% of a close cancel. The tolerance is far above float64 rounding (about 1e-16) and far below a real step: a cent above 3% of a close is more than one part in 10^9 above it for any close under about 333 million. Both inputs must be finite and above zero, so a NaN, infinite, zero or negative amount or close keeps, and so does a dividend on a symbol with no prior close. The prior close is the simulator’s last raw close of the symbol when the action fires (Simulator.LastPrice): the previous day’s close on daily bars, and on intraday bars the last bar’s close before the ex-date bar, not the official settlement. It is a raw price against a raw amount, whatever the symbol’s price view, and not the position’s average price.

IBKR’s rule, as found. These are IBKR’s statements as checked on 2026-10-08, not algolang’s. IBKR’s Web API reference (searched through Context7) documents the order statuses and the cancel endpoint, and nothing on the conditions under which IBKR itself cancels a GTC order. IBKR’s Good-Til-Canceled page states them. The live page refused every fetch, and the text below is from a 2015 copy of it (Interactive Brokers LLC, “Good-Til-Canceled (GTC) Orders”):

GTC orders will generally be canceled automatically under the following conditions: If a corporate action on a security results in a stock split (forward or reverse), exchange for shares, or distribution of shares. If the company issues a special dividend where the rate exceeds 3% of the prior day’s closing price. […] Orders submitted to IB that remain in force for more than one day will not be reduced for ordinary dividends. […] Stock orders with a time in force attribute set to work beyond one trading session will be flagged as Do Not Reduce (DNR). IB will, on a best efforts basis, cancel such GTC orders as described above; however under certain circumstances IB may not be able to cancel such orders on a timely basis, including but not limited to when IB receives information on a corporate action within 48 hours of the announced effective date, and such GTC orders may continue to remain in force and may be eligible for execution.

A later wording of the dividend condition, seen only in a search summary of the current page and not verified, also cancels on “an extra/special dividend, regardless of the payment amount”. Nothing found says what IBKR does to working orders on a rename, a suspension or a delisting, or how a corporate-action cancel shows in an order’s status.

Assumptions. Where IBKR’s statements stop, the policy assumes:

  • a rename keeps its orders. A ticker change is not among IBKR’s conditions, and IBKR’s contract id is understood to survive it. This is unverified; the paper-account probe of GLE-456 (the rest of I14 unit 2) includes a ticker change that also changes the CUSIP, which IBKR may treat as a new contract;
  • a suspension does not cancel. It is not among the conditions either; its orders stay working and cannot fill while no bar arrives;
  • a special dividend at or under 3% of the prior close is kept. IBKR’s later wording cancels on any special dividend, but the feed carries no special-dividend flag, so the simulator applies the amount test alone; marketfeed has been asked for the flag;
  • the simulator always cancels. IBKR cancels on a best-efforts basis and may leave an order working when it learns of the action late; an order that survives is the live path’s concern (unit 2).

At the ex-date. The engine fires a corporate action at the top of the first bar whose date is on or after the action’s ex-date (its effective date when it has none), before the simulator matches that bar (GLE-1086). A bar’s date is the trade date in its session block when that is a well-formed YYYY-MM-DD date, and otherwise the date on the symbol’s exchange clock (the zone the adapter gives, UTC when it gives none) of the instant one nanosecond before its close (GLE-1342; it was the UTC date). So a daily bar without a session (--bar-interval 1d without --session), which closes at the exchange’s midnight, belongs to the day that midnight ends: the one closing at the midnight that starts the ex-date belongs to the day before and does not fire the action, the ex-date’s own bar does. A session bar fires on its trade date whenever it closes: a US equity’s after-hours session can close past the next midnight, and CME’s Sunday evening bars carry Monday’s trade date and fire a Monday action. The ex-date is a calendar date, compared with the bar’s date on its exchange’s clock, so a Tokyo bar of the ex-date’s morning fires it, though it closes on the UTC date before. The per-symbol pass reads the symbol’s own bar and the run-wide passes (renames, mergers and delistings, spinoffs and suspensions) the merged stream’s bar, whatever its symbol; a bar with no date fires nothing; the firing bar’s close stamps the action’s legs; and an action dated before the run start is left out, one dated at it fires. Live mode’s corporate-action passes and its start-up fold, for an action the first bar reaches, follow the same law (ExDateReachedIn, engine/sim/exdate.go), and the emulator’s seeded actions keep UTC days; the director’s history knows an ex-date strictly after the exchange’s midnight that starts it (ExDateKnownFrom). Nothing is opt-in. Under v2 the bar then runs in this order, after any timer due before it:

  1. the lifetime-v2 outcomes deferred at the previous instant (Lifecycle turns). I14 moved them ahead of the corporate actions, so a strategy learns that an order is working before it learns that the order was cancelled for an action;
  2. the firing passes: renames, the per-symbol pass (splits, reverse splits, stock dividends and cash dividends, on the symbol’s own bar), cash mergers and delistings, stock mergers, mixed mergers, and last the spinoffs and suspensions (below). For each due action:
    • the ANNOUNCED notice (OnCorporateAction with PhaseAnnounced);
    • the order policy: on a cancel every working order on the instrument is cancelled (Simulator.CancelForCorporateAction), the cancels are delivered to the strategy at once and observed by the race guard, the operator line is written, and the attempts the guard holds on the instrument are refused (below);
    • the books change, through the unchanged legacy primitive (the split’s position rewrite, the dividend’s cash, the rename’s re-key, the close to cash, the merger’s re-key);
    • the race guard’s position sync (below);
    • the EFFECTIVE notice;
  3. the bar is matched, its fills and cancels are delivered, and the strategy decides on it.

A cancelled order therefore cannot fill on the ex-date bar. When the split’s or the merger’s legacy rewrite looks for working orders on the symbol, a v2 run has none left, so it rewrites nothing; its position and cash effects are the legacy ones on both profiles. The cancel is stamped at the simulation clock, the last observed close, as a GTC expiry is: the latest instant known to precede the ex-date bar, which in a multi-symbol run can equal the ex-date bar’s own close. The lifecycle trace records it against the previous bar. Nothing is re-placed for the strategy: its next decision is the one on the ex-date bar, and an order it submits there is first evaluated on the following bar, as any order is. A strategy that wants its protection back re-places it there, as the e9equity demo does (GLE-498): it notes the cancel in OnCancel (reason CancelReasonCorporateAction), carries the stop’s level across the action on the EFFECTIVE notice (a raw level scales by PriceRatio when the action changes the share count; an adjusted level is continuous across it) and on the ex-date bar submits the stop again under its label, the label’s next attempt, for the open lot.

Children and groups. The cancel walks the simulator’s book in submission order through the common cancel path a strategy’s own cancel takes. An unfilled bracket entry is cancelled with CORPORATE_ACTION, and each of its unactivated children follows it with PARENT_CANCELLED, as when any parent is cancelled. The activated children of a filled entry are live orders of their own and are each cancelled with CORPORATE_ACTION, as is each member of a standalone OCO group: a group does not span symbols, so every live member is reached and cancelled for the action itself, and no OCO_TRIGGERED cancel is produced. Each cancel echoes the attempt and carries the top-level order’s broker id as its origin. Orders already done and orders on other symbols are untouched, and nothing else changes: no position, cash, fill, level or quantity.

Held attempts. An attempt the race guard holds on the instrument (admitted but not sent, waiting behind a pending cancellation; The engine race guard) is not at the venue, so the cancel does not reach it. Released after the action, it would go out at its pre-action levels (a sell stop at 1000 against a post-split price of 110) or onto a delisted symbol. Under a cancelling action it is refused instead, after the working orders’ cancels: an OrderUpdate with status Denied and the reason hold_corporate_action: a corporate action on <symbol> cancelled its working orders while order "<client id>" attempt <n> (<side> <symbol>) was held, stamped at the simulation clock, its children ended with it, the guard’s own denial line on stderr, and no turn granted. Holds on other symbols stay held, in their order. Under a keep the hold stands, and under a rename it moves to the new ticker with everything else the guard tracks. In a backtest the simulator confirms a cancel at once, so the ordinary cancel-and-replace holds nothing (the replacement is working, and the action cancels it); the refusal matters chiefly on a live venue, which unit 2 brings under the policy.

The race guard follows the books. The guard’s exposure oracle accumulates each symbol’s position from the fills it observes, and a corporate action moves a position without a fill: a split scales it, a stock or mixed merger moves it to the acquirer, a cash merger or a delisting closes it to cash. After the books change, the guard’s position of the affected symbol, and of the new symbol when the action names one (the acquirer, the new ticker), is set to the simulator’s. A rename first moves everything the guard tracks on the old ticker to the new one: the attempts with their cancellation state, the held orders and the position. Before this unit a v2 position cap read a stale position after a split, a gap left by I6. The quantity effect and its rounding are the legacy ones on both profiles: a 3-for-2 split of 101 shares floors to 151 and pays the half share as cash in lieu at the ex-date bar’s raw close, and the guard then holds 151. A run has one strategy instance and one simulator, so that instance owns the whole position and the effect needs no allocation; the ledgered allocation across owners is unit 2’s.

Spinoffs and suspensions. No manifest folds a CA_SPINOFF or a CA_SUSPENSION record, so the five legacy passes do not see them, and a v1 run ignores them as before. Under v2 the engine keeps the fetched records of each eq symbol and fires each once, after the other passes, at the first bar of any symbol dated on or after its ex-date (its effective date when it has no ex-date): the ANNOUNCED notice, the policy, the race guard’s sync and the EFFECTIVE notice, the notices carrying QuantityNum and QuantityDen 0 so that the SDK’s split mirror does not fire. They fire in date order, then symbol, type and new symbol, with equal keys in fetch order. A record dated before the run start took effect before it and is left out; one dated at the run start fires. A record with neither date, or naming no symbol, refuses the run:

engine: corporate action CA_SPINOFF on "<symbol>" has no ex-date or effective date and cannot be placed (GLE-200 I14)
engine: corporate action CA_SPINOFF at <date> names no symbol (GLE-200 I14)

A suspension keeps the orders. A spinoff cancels the parent’s, but its position effect is not modelled: marketfeed’s spinoff records carry no distribution ratio, so the parent’s position is unchanged and no shares of the spun-off ticker are credited. When the simulator holds the parent, long or short, whether or not anything was cancelled, the engine says so on stderr and the report’s simulator: line gains spinoffs_unmodelled=N:

algo: corporate action CA_SPINOFF on <symbol> at <date>: the simulator does not model a spinoff's position effect; the position of <qty> is unchanged and the distribution is not credited (GLE-200 I14)

A held spinoff does not fail the run; the line and the count let an unattended run show it.

Diagnostics.

  • One stderr line per action that cancelled orders, not per order, counting the orders cancelled with the reason (their PARENT_CANCELLED children are not counted):

    algo: corporate action <type> on <symbol> at <date>: cancelled <n> working order(s) of instance <label> (order lifetime v2: the venue cancels working orders across this action; reason corporate_action)

    where <type> is the proto name (CA_SPLIT, CA_MERGER_CASH) and <date> the action’s date in the wire’s time format.

  • The lifecycle trace labels each such cancel corporate_action and counts it among the unsolicited_cancels (The lifecycle trace schema).

  • The report’s simulator: line gains corporate_action_cancels=N (Summary.CorporateActionCancels), and spinoffs_unmodelled=N above, each only when it is above zero, so every other run’s line is unchanged.

  • A refused held attempt prints the guard’s denial line, algo: order "<client id>" (<symbol>) from instance <label> denied: hold_corporate_action: ....

The reason on each wire. CANCEL_REASON_CORPORATE_ACTION is 9 in the proto’s CancelReason (Protocol reference), and the SDK’s CancelReasonCorporateAction. stdio-csv-v2 writes it cancelled REASON corporate_action (The v2 line catalogue), the stdio-csv-v1 cancel line has the same token, though only a lifetime-v2 run produces the reason and such a run does not speak v1, and the lifecycle trace labels it corporate_action too. A strategy hears it as an OnCancel whose Reason is CancelReasonCorporateAction, after the action’s ANNOUNCED notice and before its EFFECTIVE one, and its working view retires the attempt as for any cancel (The working view under lifetime v2). A reader built before the value receives it as the number 9.

Known limits.

  • The cancel is bar-granular: the action fires at the first bar dated on or after its ex-date (I13b, GLE-468, moved the Day and GTC cancellations to their calendar instants; the corporate-action cancel stays at the bar). On daily bars the strategy’s first chance to re-place a cancelled order is its decision on the ex-date bar, so that bar runs without it, where a live trader could re-place before the open.
  • An emulated-live run under v2 is not covered. The live corporate-action pass handles splits alone, the emulator still rewrites the working orders at a split, and the SDK’s interim rewrite (below) still follows it; unit 2 brings the live path under the policy.
  • The SDK’s v2 working view still rewrites an attempt on a split’s or a merger’s EFFECTIVE notice (Context.applyCorporateAction, applyMerge). In a v2 backtest it finds nothing, because the cancels have already retired the attempts; unit 2 removes it.
  • The guard’s sync reads the simulator’s whole position report after every action, a cash dividend included: one report per action, on v2 only. An early return for the types that move no position today was rejected, since the sync after every action is what closes the stale-position gap, and a type that starts moving one (a spinoff with a distribution ratio) would reopen it. A per-symbol position lookup on the simulator, which removes the scan without that risk, is recorded for unit 2.

I14 unit 2 is in two parts. Unit 2a (GLE-479), contract expiry in the simulator, landed 2026-10-09: under v2 the simulator learns each dated contract’s expiration from the adapter, cancels its working orders there with CANCEL_REASON_CONTRACT_EXPIRED (10), settles its position by one fill at the last served settlement, else the last close, denies later submissions, refuses held attempts, and records and reports the expiry (Contract expiry (lifetime v2)). Its follow-up GLE-481, landed 2026-10-10, settles that position at the exchange’s final settlement read from the statistics stream, ahead of the last served settlement and the last close, since the served bars carry none on the last bar. The rest of unit 2 (GLE-456) adds:

  • ledgered position events for every corporate-action kind and for contract expiry, extending the ledger’s corporate-action line (today splits only), with a per-owner allocation and its rounding: each owner’s quantity effect is the whole-unit floor toward zero of its own ledgered position times the ratio, the residue recorded as cash in lieu and the post-event quantity on the line. With several owners on one account the account’s floor of the sum can exceed the sum of the owners’ floors, and GLE-456 either assigns that remainder by largest remainder or quarantines it, an owner decision;
  • the execution fold’s replay (The execution fold): FoldInput.Splits generalised to position events, each applied at its ex-date before every execution at or after it, the recorded post-event quantity applied rather than recomputed, so a later change of rounding cannot move history;
  • IBKR’s corporate-action cancels on the live path: an unsolicited cancel observed on an instrument at or after an action’s effective date classified as CORPORATE_ACTION, an order IBKR fails to cancel (best efforts) handled, the live pass extended beyond splits, and the emulator’s split injection made to cancel under v2;
  • the live side of contract expiry: how IBKR treats resting orders near the last trading time (K11) and how an expiry appears on its trades endpoint, both still open (its Web API reference, searched through Context7 on 2026-10-09, says nothing on either);
  • the removal of the SDK’s interim v2 rewrite, which no live venue performs;
  • the per-symbol position lookup for the guard’s sync;
  • a spinoff’s position effect and the spun-off listing, once marketfeed’s records carry a distribution ratio.

Tests. engine/sim/aa_ca14_tournament_spec_test.go (8 tests) pins the policy table for every type and phase, the dividend rule’s boundaries and non-finite inputs, the policy’s names, and CancelForCorporateAction’s walk, children, OCO groups, stamp, count and no later fill, with the legacy rewrite unchanged. engine/aa_ca14_tournament_spec_test.go (16) drives runBarLoop: the same split cancelling on v2 and rewriting on v1, no zombie after a terminal action on v2 and the legacy zombies on v1, the dividend limit against the prior close, the rename, the guard’s position and the rounding, spinoffs and suspensions, the deferred outcomes ahead of the action, the share-event queue, held attempts and a cancel-and-replace across a split, and delivery errors. internal/wire/aa_ca14_tournament_spec_test.go pins the token on both CSV grammars. The review panel’s gap tests, in engine/corpterm_review_test.go and engine/sim/corpterm_review_test.go, pin the dividend rule as a float64 product with a rounding tolerance (and engine/sim/corpterm_mutation_review_test.go checks it against the decimal rule over every close in cents to 2000.00), a terminal target’s guard position, a held bracket refused with its children, notice failures in the share-event queue, the dividend booked once, and equal-key share events in fetch order.