Buy Board and Kanban States - cafe-auvers/quant_app GitHub Wiki

Buy Board and Kanban States

The six visible operator columns are projections of canonical card, ownership, and order state. Watchlist and Closed are hidden lifecycle stages.

stateDiagram-v2
    [*] --> WATCHLIST: passive planning
    WATCHLIST --> BUYLIST: promote
    BUYLIST --> BUY_TODAY: activate plan
    BUY_TODAY --> ENTRY_PENDING: system sees durable submitted entry
    ENTRY_PENDING --> ENTRY_PENDING: safe later-ORB cancel/replace
    ENTRY_PENDING --> OPEN_POSITION: broker-confirmed fill
    ENTRY_PENDING --> BUYLIST: reconciled cancel/no fill
    OPEN_POSITION --> PARTIAL_SELL: request partial exit
    PARTIAL_SELL --> OPEN_POSITION: partial fill reconciled
    OPEN_POSITION --> SELL_ALL: request final exit
    PARTIAL_SELL --> SELL_ALL: request final exit
    SELL_ALL --> CLOSED: broker-confirmed flat
    CLOSED --> [*]

Column ownership

  • Buylist and Buy Today accept authorized planning commands.
  • Entry Pending and Closed are system-owned; operators must not force them.
  • Open Position, Partial Sell, and Sell All reflect guarded intents plus broker evidence.
  • External/unlinked broker orders remain visible and observation-only until an explicit adoption workflow succeeds.

Drag and command behavior

The deployed canonical card state is in Supabase's private PostgreSQL schema. Mobile Buylist removal waits for authoritative confirmation instead of optimistically hiding the row; failures and revision conflicts remain visible. It is not a broker order or cancellation. See Supabase Deployment.

A drag carries the card revision and interaction fingerprint. The UI marks that card pending immediately, queues database work outside the UI thread, and then reloads canonical projections. A stale fingerprint or revision is rejected. No drag calls KIS directly.

The engine remains read-only when disabled, when this device lacks the lease, or when any action-specific readiness gate fails.

Connected web/PWA actions may update their initiating screen immediately while the canonical request is pending. That visual state is not confirmation. A failure rolls back; a success publishes browser invalidation and typed desktop pulses so every running surface refetches canonical state automatically. Runtime device-state and database-writability transitions also refresh desktop restrictions without waiting for a card revision or manual refresh.

Buy Today and Entry Pending

Buy Today is monitoring intent, not an order. After a current-session ORB closes, a fresh KIS trade strictly above both ORB high and breakout confirms the candidate. The system then submits a passive BUY limit at ORB high by default while last trade and ask remain above that limit.

Entry Pending means a durable submitted/discovered/ambiguous BUY identity exists. It does not mean filled. New passive entries have no 15-second auto-cancel/reprice deadline. A zero-fill working order may upgrade to a later, strictly higher-scoring ORB only by cancelling and authoritatively confirming the old order before submitting the linked replacement. Any fill blocks the upgrade and moves broker-confirmed quantity to Open Position.

See Current Order Logic. See also Web/PWA Operator Synchronization.

Mobile stage details

Stage headers count stocks and total target/held shares; unsized plans are identified. Cards and detail sheets show the same stage facts:

Stage Details
Today Target shares, ORB window, breakout/trigger, entry price, planned stop/risk and block/retry reason
Entry Entry plan, held/target shares and average fill
Open Held/sellable shares, average entry, active/pending stop and stop shares, estimated P&L and distance to stop
Partial Position details, requested sell and working remaining shares
Sell All Position details, working remaining shares, submit/cancel state and exit/retry reason

Prices reuse existing Monitor or PC observations. The source, KST timestamp, age and stale status are visible. Yahoo prices are indicative, not execution permission. The last valid price, estimated P&L and distance to stop remain visible when stale, with a stale label and the original observation time. The normal minute refresh replaces them when a later quote arrives, including after a failed poll. Actual KIS execution freshness gates are unchanged.

Current-session ORB and feed feedback

The mobile Buylist now displays the current-session Buy Today rejection after the PC returns an invalid plan to Buylist; prior-session history remains hidden. Web and PC 3a7c14fe (PR #141) are deployed. The approved PC executor was verified ACTIVE and reconciled at 03:20–03:21 KST on 2026-10-06. Manual arming from the PC at 03:23:46 KST was verified enabled/effective at 03:25:32 KST for this exact release and the 2026-10-05 NYSE session (revision 48).

The activated PC release 3a7c14fe uses the highest legal BUY tick at or below raw ORH for automatic limits. The raw high remains the confirmation threshold; manual prices are never silently rounded, and a collapsed passive zone still fails. ODD's actual cached 30m range (19.705/19.09) replays to a legal 19.70 limit and valid sizing, while its 1m/5m plans remain risk-invalid. The operator approved this exact release and the supervised restart; the planner now runs on the PC. The diagnostic did not re-add ODD to Buy Today or place an order.

Initial missing queue data waits for the PC calculation. A Fresh KIS block means the execution feed gate failed: disconnected/awaiting channels, missing or stale trade/quote, invalid timestamp/ask, or excessive evaluation lag. The combined fix preserves fresh observations and identifies the failed gate. It keeps the 3-second trade/quote policy and 1-second queue budget; quiet symbols may still block tomorrow. An indicative Monitor price never authorizes an order.

CURV sparse opening history (fix prepared)

The actual October 5 KIS CURV chart starts at 09:43 ET, even when a second page reaches the previous session. The 1m/5m opening windows contain no returned minute bars; the 09:30–10:00 window contains eleven, with low $2.48 and high $2.51. The application required an exact 09:30 bar for every window, so it also blocked this calculable 30m range. This proves what KIS returned, not independently whether exchange trades occurred earlier.

PR #142, exact source 0f15aa7b4d3e321d35f74409d250ee30b725cb15, accepts sparse KIS ranges only when local-time history reaches before the open and beyond the window, contains no invalid rows, and its opening-row digest still matches. Cache persistence is atomic and resampling retains the evidence. Explicit New York timestamps prevent a late local bar being guessed to be a UTC opening bar. Empty or unproven windows remain unavailable; all blocked automatic windows receive an explanation. The 5m label 09:40 is the bin containing the first actual 09:43 minute.

Actual-response replay calculates CURV's 30m range, but its saved $2.52 breakout is above the $2.51 high, so the passive entry zone remains rejected. No threshold change, forced entry or broker mutation was made. The isolated PC stage and local full suite passed (3,363 tests, 7 skipped). MySQL metadata insert/update/read checks used a temporary table, which was removed.

This new executor release is not activated; it awaits exact-release review and a supervised PC restart. The approved PC 3a7c14fe source continues running; the separate web display release is recorded below. Supabase remains canonical and PC MySQL remains the cache; this correction adds no TiDB dependency.

Mobile Buy Board risk and NAV allocation

The card and its detail sheet show the selected risk budget as a percentage of NAV. Today and Entry also show estimated planned risk and planned allocation as both percentages and dollars. Planned risk is target shares multiplied by the difference between execution price and the planned stop; planned allocation is target shares multiplied by execution price. An unsized plan stays labelled Not sized.

Filled Entry cards and Open, Partial and Sell All cards show Allocated using the broker-confirmed remaining shares multiplied by average fill price. A sell request does not reduce this amount before the shares actually leave the holding. Positions show Risk at stop using the positive entry-to-active-stop loss and remaining shares; a stop above entry implies zero estimated loss from entry. Incomplete stop coverage is labelled rather than assigned zero risk. These estimates exclude fees and slippage.

The denominator is the account-matched USD equity snapshot already published by the PC. Its actual fetch time accompanies the value. Snapshots older than 15 minutes, missing, invalid, or from another account cannot supply NAV percentages. The browser also expires a previously received NAV during a failed/offline poll; known dollar amounts remain visible. The NAV header shows the current usable denominator. Rendering makes no broker calls and adds no canonical database query for NAV.

Earlier NAV deployment: web dfd80c1d62b949826a1107f04b20df469cc3f98f (PR #143) at 04:39 KST on 2026-10-06. The running PC executor remains at approved 3a7c14fe9cc269a2590f825e88aacafac7d98a21; process identities, configuration and Live Trading were preserved. Read-only verification at 04:39:59 KST confirmed ACTIVE and Live Trading enabled/effective. 317 compatibility tests and mobile checks at 320/390/820 pixels passed. The live mobile browser confirmed SVIA's held allocation and stop risk, and EFOR's planned values. That web source has since been superseded by the re-entry update described below.

Explicit re-entry after a completed exit

A stop hit starts liquidation. A new entry cannot start while the stock remains held or its exit is pending. Once broker reconciliation confirms zero shares and the completed cycle is Closed, select the stock and confirm Buy Today again on mobile, or use Re-enter on the PC chart. The original breakout price and risk budget are retained; editing the breakout price is no longer required.

Each explicit activation starts a fresh planning cycle. Previous entry/exit identities, frozen ORB execution values, stop state and retry projections are retired, while the immutable order history remains available. The PC calculates a current-session ORB plan and creates a new broker-order identity. There is no one-entry-per-symbol-per-day lock and no automatic reactivation after another stop. Repeated same-day attempts still require a new user activation each time, current ORB qualification, fresh KIS trade/quote data, account equity/buying power, portfolio risk, execution ownership, Live Trading and broker-boundary checks. Existing attempt-rate limits and cooldowns remain in force.

Re-entry rejects nonzero held/sellable shares, nonterminal position/entry/exit state, pending stop changes, reserved capital, active owned/external orders and unresolved broker commands. These checks run again before the canonical update. Closed remains outside the ordinary drag graph; only a validated new-cycle command can reopen it.

A Closed card can retain a historical reservation ID. The new-cycle check reads the canonical reservation ledger and retires that reference only when its environment/account/symbol match, its status is Consumed/Released/Expired and both remaining reserved money and projected risk are zero. Missing, mismatched, active or inconsistent reservations still block; an active reservation for the symbol also blocks even if its card reference is missing. No reservation is released by a re-entry request.

An ambiguous historical cancel stops blocking only when its exact target order has a unique matching account/symbol identity, zero remaining quantity and a Filled/Cancelled/Expired broker observation reconciled after that cancel was requested. Missing, earlier or inconsistent evidence still blocks. An unresolved submit, replace or in-flight requested cancel always blocks. This check retains the original command and order records; it does not retry or send a cancel.

Re-entry deployment: mobile/web 04bffd4f6a2f44eddb4c0f822db2c4c9cd3664b2 (PR #144) at 05:29 KST on 2026-10-06. The update retained NAV/risk/allocation details and added explicit re-entry after a fully reconciled exit. The real Closed-card read-only preflight and served HTTPS assets passed. No real re-entry intent/order was created during verification. 148 focused checks, 12 mobile browser checks and 3,428 full-suite tests passed (7 skipped). The PC remains on approved 3a7c14fe9cc269a2590f825e88aacafac7d98a21; its processes, configuration and live-control value were preserved. After market close, the control remains armed for October 5 and must be re-armed for the October 6 session. The new PC Re-enter control and CURV executor correction are prepared together at 04bffd4f6a2f44eddb4c0f822db2c4c9cd3664b2, pending exact-release review and activation; this supersedes the earlier unactivated CURV-only 0f15aa7b packet. The PC activation workflow preserves the current web source.

Current mobile/web deployment: d0e1d014d9b528eda093916188fa9b1a3f6f47b1 (PR #145) at 06:04 KST on 2026-10-06. The display now retains numeric Yahoo estimates while stale. 192 web tests passed, including 320/390/820px views, failed-poll retention and automatic minute refresh. HTTPS assets and the canonical read-only API passed. The PC executor remains on approved 3a7c14fe; its process identities, credentials, configuration and live control were preserved. Before activating the separately pending 04bffd4f PC release, refresh its supervisor's web-source preservation binding to this current web release; the original activation helper expects the older web source and will refuse.