fix(chart): lines for every closed trade, closed_alpha for cancelled - #625
Merged
Merged
Conversation
Three defects of the "Moonbot lines" trade style (#624), found on the first live day. - The style lifted `closed_alpha` to `active_alpha` for the WHOLE live order pass, so every cancelled order lit up with the trades and the "closed/cancelled visibility" slider went dead in that style. The swap is replaced by a runtime-only `ChartGraphicsCfg::bright_closed_trades`; `build_order_geometry` lifts a closed order only when it is the frozen viewer's subject or the flag is set AND the order became a trade (`RetainedOrder::traded`: Filled verdict, entry fill percentage, or a stepped Sell line — the last covers a listing-sell closed by the backstop). Cancelled orders stay under the slider. - A trade that closed this session draws from the live store, and that pass still obeyed the tab's `hide_closed_sell_line` while the archived pass beside it did not: one line until the next launch, two after. The live pass lifts the switch in the lines style too. A cancelled order gains nothing — the store steps a Sell line only while the order holds a position, and the core keys the sell side's server trace by the exit leg's id, which exists only after the entry filled. - A trade the core archived nothing for kept both arrows. The core archives a line only once its chart gave it a point, so a trade that closed within a second answers empty (AMC on OKXf: 1 s, 0 lines; every 0-line answer of that core is a 0–1 s trade). No archive is not no line: the report row states the exit price, when the exit order was placed (`SellSetDate`, new `ChartTradeRecord::sell_set_date` / `sell_set_ms`, optional at the source) and when it filled. `ReportExit::of_record` lifts that through the report axis, and both store builders (`archived`, `append_archived`) add the straight Sell line when the traces hold no own exit line; an archived own exit, with its repricing path, wins. The live chart walks every visible non-twin trade, answered or not; the trade window's neighbours (the NEIGHBOUR_CAP nearest, one selection for the ask and the store) and subject get the same. The entry keeps its arrow until the core archives its own entry line — the report dates the entry's completion, not its placement. - The archived store's per-pane cache keys on a signature of the live twins instead of the live store's revision, which moved on every order message of the core. Refs #621
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Three defects of the "Trades: Moonbot lines" style (#624), found on its first live day.
closed_alphaforactive_alphaacross the WHOLE live order pass — so every cancelled order lit up too and the "closed/cancelled visibility" slider went dead in that style. Now a runtime-onlyChartGraphicsCfg::bright_closed_trades(serde-skipped, likehide_entry_fill_arrow) tellsbuild_order_geometryto lift only a closed order that became a trade —RetainedOrder::traded():Filledverdict, entry fill percentage, or a stepped Sell line (the last covers a listing-sell closed by the backstop). Cancelled orders stay under the slider, in every style.hide_closed_sell_line(default on) while the archived pass beside it did not: one line today, two after a restart. The live pass lifts the switch in the lines style too. A cancelled order gains nothing: the store steps a Sell line only while the order holds a position, and the core keys the sell side's server trace by the exit leg's own id, which exists only after the entry filled.line_count = 0; every 0-line answer of that core is a 0–1 s trade; across all cores 260 of 1 071 trades ≤2 s have lines). No archive is not no line: the report row states the exit price, when the exit order was placed (SellSetDate— newChartTradeRecord::sell_set_date/sell_set_ms, optional at the source like the ms columns) and when it filled.ReportExit::of_recordlifts that through the report axis, and both store builders (OrderLineStore::archived/append_archived) add the straight Sell line when the traces hold no OWN exit line; an archived own exit, with its repricing path, wins. The exit never waits for the archive — it draws from the first frame; only the entry keeps its arrow until the core archives its own entry line (Moonbot lines on the chart: a trade whose buy order never moved has no entry line — the core's archive does not serve it #623: the report dates the entry's completion, not its placement).Notable decisions
session/order_lines/archived.rs), so the live chart, the trade window's subject and its neighbours all get it through the same path. The trade window's neighbours are selected once — theNEIGHBOUR_CAPnearest — for both the ask and the store.line_ends(wasarchived_line_ends): exit is always a line, entry only with an own archived Entry line; the arrows pass draws the arrow of the end that has no line.twins_signature) instead of the live store's revision, which moved on every order message of the core and would now rebuild a store of up toHISTORY_LIMITorders each time.SellSetDate < BuyDate(570 of 605k rows) is drawn as stated: the exit order is genuinely placed on a partial fill before the entry is recorded complete. A placement stamp raised past a millisecond close collapses to the close.Known limitations
order_geometry/tests.rs), the exit fallback in both builders (archived/tests.rs), store assembly and line ends (archived_lines/tests.rs).Issues
Refs #621 — fixes to part 2 (the lines style); the tracker's remainder is unchanged.
Refs #623 — the entry still keeps its arrow; this PR extends the exit line to trades with an empty archive as well.
None of the other 20 open issues is touched by this change.
How to verify
clippy: 82 findings, all pre-existing debt — the 2 inside touched files (
layout.rsmem_replace_option_with_some) sit on lines this diff does not touch (same lines onorigin/main, shifted by insertions). FireTest not run (no chart/render/input path changed beyond geometry inputs; per the developer's rule).On a chart in the lines style: a cancelled order dims with the "closed/cancelled visibility" slider while closed trades stay bright; a trade closed this session shows both lines; a 1-second trade (AMC/OKXf, 22:07:23) shows the entry arrow plus a straight exit line.