Futures Risk Monitor

Software · Systems engineering

Futures Risk Monitor 期货风险监控

A smoke alarm for a futures trading desk: it checks every watched contract every three seconds, is built to flag the one that needs a look, and has no way to touch an order.

  • Conceived, designed and built by Shuo Huang
  • On his own initiative, two weeks into the job
  • Idea to live quotes in under 18 hours
  • Used on the desk after July 2026
  • 319 automated tests
  • 4 releases in one day
  • Read-only: no order path
  • Python · SQLite · Win32

01System architecture

Read the market every three seconds. Warn the trader. Touch nothing.

Two constraints shaped it. A market maker’s keyboard belongs to the trading terminal, so an alert may appear on top of it but may never take the focus. And a tool that watches live strategies must be unable to change them, so the program contains market-data code only. One trader designed and built all of it.

Edition 1 · vendor data

Vendor quote interface

Tonghuashun iFinD, request and reply. Latest price for the Shanghai contracts on the watchlist.

Edge app window

Dashboard

One card per contract, in Chinese or English, dark or light. A card flashes yellow or red for 15 seconds.

At the trading terminal

The trader

Keeps typing. The pop-up stays until acknowledged and never takes the keyboard.

User data · kept across updates

Watchlist and thresholds

Exact contracts, WARNING and CRITICAL levels per contract, the limit-lock grace period, snoozes.

Python · local process

Monitor core

One provider interface for both feeds. A session calendar pauses and resumes polling by product.

Per contract

Detectors

Sharp move. Locked at the daily price limit. Feed gone quiet.

Windows

Alert channels

A system notification plus a small always-on-top pop-up: contract, signed price change, time to the millisecond.

Edition 2 · self-contained package

Broker market-data interface

CTP market-data API only. Level-1 ticks with both sides of the book, which the limit-lock rule needs.

Local file

SQLite archive

Every quote and every alert record, exportable for review.

Trading terminal and engine

Orders and strategy settings

Not connected. No trading library is loaded, so nothing here can be placed, canceled or changed.

Simplified: the two feeds are two editions of the program that share one core, not two inputs to one running copy, and the core itself writes quotes to the archive. The box at the lower right has no connector on purpose.

Why notification-only?

Shuo wrote the boundary into the first specification: warn within three seconds, change nothing automatically. It keeps the tool on the safe side of the desk’s controls. The broker edition ships with four audited market-data files and no trading library at all.

Why must the pop-up not take focus?

A market maker types into the trading terminal all day. An alert that pulls another window to the front can swallow a keystroke meant for a live strategy. So the pop-up is its own small always-on-top window, separate from the dashboard, and it never activates anything.

Why poll, and why three seconds?

Three seconds was Shuo’s own target for a warning-only first stage. The vendor interface answers requests, limits live push to three contracts, and meters a monthly quota. A watchlist of 15 products therefore had to be polled, in one batched request, and only while each product’s market is open. The program caps itself at 40% of the quota.1

Why two editions?

The vendor subscription carried Shanghai data but no Dalian contract, the products Shuo trades. A true tick feed with both sides of the book needed the broker’s market-data interface, so the same core was given a second edition, shipped as one self-contained package.2

02The story

A three-second smoke alarm for the desk, from idea to live quotes in under 18 hours.

A market maker keeps buy and sell prices standing in many contracts at once, and when one of them lurches, the trader has seconds to step in. Two weeks into the job, on his own initiative, Shuo conceived, designed and built a smoke alarm for those contracts: it checks every watched contract every three seconds and puts a small warning on top of the trading screen without ever taking the keyboard. It went from an idea to live exchange quotes in under 18 hours,3 and by design it can read the market but can never touch an order.

  1. 01

    The problem

    When a market turns violent, a market maker has to act: widen a quote, cut a size, switch a strategy off. The warning signs are a sudden jump in price, or a contract hitting its daily price limit (the furthest the exchange lets a price travel in one day), so that one side of the market simply empties.

    • Watching was manual. Prices were followed by eye, with no automated alert between a violent move and the trader.
    • Eyes do not scale. Shuo followed 15 products on three exchanges. Nobody can stare at 15 quotes while running live strategies.
    • An alert can do harm. On a trading screen, a window that jumps to the front can catch a keystroke meant for a live order.
  2. 02

    What he built

    Nobody asked for this tool. Shuo wrote its specification in one sitting on a Thursday afternoon: these contracts, a warning within three seconds, and no automatic changes of any kind. By 10:30 the next morning it was reading live exchange quotes.3

    It works like a smoke alarm. It does not fight the fire and it has no hands: it only makes sure the right person knows within seconds.

    • It watches. Every three seconds it checks every contract on the watchlist, and only while that contract’s market is open. It pauses itself through breaks, lunch, nights, weekends and exchange holidays, and resumes on its own.
    • It is built to warn. A sharp move raises a yellow WARNING or a red CRITICAL for that exact contract. A contract locked at its daily price limit is always CRITICAL.4
    • It stays out of the way. The warning is a small window on top of everything, with the contract, the price change and the time to the millisecond. The trading terminal keeps the keyboard.
    • It cannot trade. There is no order path in the program. That is a design rule, written down and tested.
  3. 03

    What changed

    A working alarm in three working days. Idea on Thursday, live quotes on nine Shanghai contracts on Friday morning, and on Monday four tested releases in one day, ending in a self-contained edition, with nothing to install and 319 automated tests behind it.5 It did not stop at a demo: the monitor was used after July.6

    A standard for desk software. When the latest build’s launcher answered a double-click with “restart Windows”, Shuo would not accept it. He set one requirement, that this state must be impossible, and audited the whole program. The audit removed the dead end and caught a calendar bug that would have raised a false red alert against a closed market at midnight at the end of a holiday.

    It pointed the way to the exchange’s own feed. The vendor subscription covered Shanghai products but not the Dalian products Shuo trades.2 So in September Shuo took the question to IT and turned their demo into a receiver for the Dalian exchange’s Level-2 feed, the feed that first gave CHRONOS its live order book. The monitor’s provider interface, session calendar and pop-up were later identified as the natural host for a live sizing advisor.

3s

between checks of every watched contract6

<18hours

from the idea to reading live exchange quotes3

4

tested releases shipped in a single day5

319

automated tests, all passing, at release 1.2.25

0

ways it can place, cancel or change an order7

03Evidence

Three working days of builds, and where the data stopped.

Both charts come from the project’s own build record and the first live run on July 17, 2026.

Every build shipped with more tests than the last

The automated tests that passed at each build, from the first simulated-data build on Thursday afternoon to release 1.2.2 on Monday. Each test is a small program that checks one behavior and fails loudly if a later change breaks it.

Automated tests passing at each build, July 16 to 20, 2026

The suite grew from 8 tests to 319 in three working days; Monday’s four releases alone added 125.

Show the dataHide the data
Data: Automated tests passing at each build, July 16 to 20, 2026
BuildAutomated tests
First build8
Shadow15
0.4125
App window141
Broker ed.194
1.1.0242
1.2.0262
1.2.1287
1.2.2319
Counts of Shuo’s own test suite, from the project’s build record. Shadow is the session-aware shadow monitor of July 16; 0.4 added the dashboard and the pop-up alerts, and the app window followed the same day. The broker edition split off on the evening of July 17 with 194 tests and carried the suite forward (the vendor edition stayed at 144). The deployed copy of 1.2.2 passed 300 of 300 on its own bundled runtime.5

Live on every Shanghai product on the first morning

The watchlist held 15 products on three exchanges. On the first live morning the vendor data subscription delivered quotes for every Shanghai product. The Dalian products, the ones Shuo trades, sat outside that subscription; getting them live took another feed, which in September led to his Level-2 receiver.

Watchlist products by exchange, first live morning

All nine Shanghai products were polled live on the first morning; the six Dalian products sat outside the vendor data subscription.

Show the dataHide the data
Data: Watchlist products by exchange, first live morning
ExchangeLive on July 17Outside the data subscriptionTotal
Shanghai (SHFE)808
Shanghai (INE)101
Dalian (DCE)066
Shanghai Futures Exchange: silver, nickel, tin, stainless steel, rebar, natural rubber, cast aluminum alloy and butadiene rubber. Shanghai International Energy Exchange: the container-freight index. Dalian Commodity Exchange: live hog, LLDPE, egg, coking coal, soybean oil and palm oil. One contract of each Shanghai product was polled every 3 seconds from 10:30 on July 17, 2026. Coverage of Shuo’s own tool on public exchange quotes; no desk trading data.2

04Functions

From one double-click to a warning you cannot miss.

Seven functions, in the order a trader meets them.

A

Launch

Double-click once. The dashboard opens as its own app window, with its own logo and taskbar entry, on a machine that has nothing installed.

  • Self-contained package with its own Python runtime: unzip and run, with nothing to install
  • Self-healing launcher: a leftover copy that stopped answering is identified, proven to be this program, closed, and the same click carries on
  • Every launch writes a diagnostic log with passwords, addresses and account identifiers removed

B

Watch

One card per exact contract, refreshed every three seconds, in Chinese or English, dark or light, readable at half-screen width.

  • Polls only while each product’s market is open, session by session
  • Pauses and resumes by itself across breaks, lunch, nights, weekends and exchange holidays
  • A feed that goes quiet during trading hours raises its own red alert: a silent alarm is the worst kind

C

Sharp-move alerts

Each contract has its own WARNING and CRITICAL levels, judged on how far the price just moved and on how unusual that move is (a z-score).

  • Thresholds are set per exact contract, because a quiet metal and a jumpy freight index are not the same animal
  • A CRITICAL replaces a WARNING on the same contract
  • Shadow mode first: candidate alerts are logged silently until the trader has tuned the levels, the way a new model is trialed before it is trusted4

D

Limit-lock alerts

When a contract is pinned at its daily limit-up or limit-down price, one side of the market is empty. Shuo’s rule detects exactly that and raises a red CRITICAL.

  • A grace period after each session opens (1 minute by default, adjustable from 1 to 30 minutes), because a book that is still filling also looks one-sided
  • A “do not alert this contract for 10 minutes” box, so a contract hovering at the limit cannot flood the screen
  • Two extra confirmations before it fires: trading volume is consistent, and the surviving quote sits at the exchange’s official limit price4

E

The alert itself

A Windows notification, plus a small always-on-top window that names the exact contract, the signed price change and the time to the millisecond.

  • The pop-up stays until acknowledged and never takes keyboard focus from the trading terminal
  • The contract’s card flashes yellow for a WARNING or red for a CRITICAL, for 15 seconds
  • The dashboard can stay in the background all day and take up no screen space

F

Alert Test Center

One click fires each kind of alert on demand, so the trader knows the alarm works before the market tests it. A fire drill, built in.

  • Five tests: the system notification, an ordinary pop-up, a limit-up pop-up, a limit-down pop-up and a full simulated-market demo
  • Simulated data only, clearly separate from live alerts

G

Review

Everything the monitor saw and said is kept on the local disk.

  • A local SQLite archive of every quote and alert record
  • Warnings export to a file for later study
  • Updates never overwrite the watchlist, thresholds, archive, snoozes or logs

05Under the hood

How a read-only alarm is engineered.

Under the hoodDetection rules, data path, validation, pseudo-code and test evidence for the technical reader

A real-time monitoring system, engineered around five constraints: a strict read-only boundary, a metered data source, a session calendar that must never be wrong in the alarming direction, alert windows that may not take focus, and a launcher that may not dead-end on an offline install that can only be diagnosed from its own logs.

Detection here is statistical and rule-based by design: per-contract thresholds on move size and a z-score, plus an order-book rule for limit locks. A model that recommends what to change was the stated long-term goal. This first stage is the step before it: explainable rules, run in shadow mode, with every candidate alert logged to the archive. An alarm a trader does not understand is an alarm a trader turns off. The machine learning came later, in CHRONOS.

Scope, and what was rejected

The specification fits in one sentence: warn within three seconds, per exact contract, and change nothing.

  • Rejected: automatic intervention. The tool exists because strategies sometimes need a human decision. Automating the decision in a first version would have put an untested program between the trader and live orders. The boundary is enforced structurally: the broker edition contains only the market-data subset of the interface (four audited files), with no trader library to call.
  • Rejected: vendor push subscription. It is limited to three contracts, against a watchlist of 15 products. Hence one batched request every three seconds, gated by session, under a self-imposed cap of 40% of the monthly quota.1
  • Rejected: a model first. With no labeled history of “moments that needed intervention”, a learned alert would have had nothing to learn from and nothing to be tested against. Thresholds on move size and a z-score are explainable and tunable per contract, and shadow mode logs every candidate, building the history a later model could be trained and tested on.
  • Rejected: one threshold for everything. A fixed percentage that suits a quiet metal fires all day on a freight index. Levels are rows keyed by exact contract, so each contract is judged on its own terms.
  • Deferred: calibration. Alert candidates are logged without pop-ups until the levels have been tuned on live sessions.4 The move detector’s window and default levels are not published here.

One core, two market-data providers

Both feeds sit behind one small provider interface: fetch returns one current quote per exact contract, close releases the feed, and health_snapshot reports connection, subscription and tick-flow health. Everything downstream (session gate, detectors, archive, alert channels, dashboard) carried over from the first edition, which is how the second edition, written against the broker’s interface manual, passed its 194 automated tests the same evening.

The two editions. Passwords are never stored: they live in process memory only.
PropertyVendor editionBroker edition
InterfaceTonghuashun iFinD Python SDK, real-time quote requestCTP market-data API (MdApi) through a native binding, CPython 3.12 x64
DeliveryRequest and reply, one batched poll every 3 sPushed ticks
FieldsLatest priceLevel 1: best bid and ask with their sizes, last price, volume, turnover, open interest and the day’s limit prices
Detectors availableSharp move, feed healthSharp move, feed health, limit lock (needs both sides of the book)
RunsA Python environment with the vendor’s SDK and its own data loginA self-contained package with its own Python runtime; nothing to install
VerificationLive on nine Shanghai (SHFE and INE) contracts; Dalian contracts are outside the data subscriptionSimulated ticks and the Alert Test Center

A session calendar that fails closed

Chinese futures trade in segments: 09:00 to 10:15, 10:30 to 11:30 and 13:30 to 15:00, with night sessions from 21:00 for some products that belong to the next trading day and can run past midnight. There is no night session before a holiday. A monitor that polls a closed market wastes quota; worse, one that believes a closed market is open reports a dead feed and raises a false CRITICAL.

The gate is evaluated per product, from an explicit table of 2026 exchange closures. It fails closed: after the last reviewed date of the calendar the monitor refuses to guess rather than assume a normal day.

Shuo’s audit of release 1.2.1 found the case the logic missed. After midnight, a night-session product is “still open” only if yesterday actually held a night session. The original check looked at pre-holiday evenings but not at full holidays, so the monitor would have un-paused at midnight at the end of a holiday (the reviewed 2026 calendar holds four such nights) and raised a false CRITICAL against a closed market. The fix is one added condition; regression tests pin both directions.

Pseudo-code
def night_session_continues(product, now, calendar):
    # After midnight, is last evening's night session still running?
    if not product.night_session_runs_past_midnight:
        return False
    if now.weekday not in TUESDAY_TO_SATURDAY or now.clock > product.night_close:
        return False

    yesterday = now.date - one_day
    # The continuation exists only if yesterday really held a night session.
    # A pre-holiday evening has none, and neither does a full holiday.
    if yesterday in calendar.evenings_without_night_session:
        return False
    if yesterday in calendar.full_holidays:    # the added condition
        return False    # else: awake at midnight, false CRITICAL on a closed market
    return True


def test_ordinary_night_still_continues():
    now = half_past_one_after_a_normal_trading_day
    assert night_session_continues(night_product, now, calendar)
    assert session_start(night_product, now) == nine_pm_the_evening_before

def test_no_session_as_a_holiday_ends():
    now = half_past_midnight_after_a_full_holiday
    assert not night_session_continues(night_product, now, calendar)
Pseudo-code. The holiday fix in the session calendar, simplified, with the two regression tests that pin both directions.

Detectors

Three detectors run on every in-session quote.

  • Sharp move (statistical anomaly). Each alert record carries the size of the short-horizon move in percent and a z-score of that move. WARNING and CRITICAL levels are rows keyed by exact contract. A CRITICAL supersedes a WARNING on the same contract.
  • Limit lock (order-book rule). Shuo’s rule: a contract locked at limit-up has no sellers left and one locked at limit-down has no buyers, so one side of the book is empty. An empty side alone is not proof, because an illiquid far-month contract or the first seconds of a session look the same. The detector therefore also requires consistent volume and the surviving quote at the exchange’s official limit price as reported by the feed, and it stays silent for a configurable grace period after each session open (09:00, 10:30, 13:30 and 21:00). Its settings (on or off, the opening grace, the repeat policy, the snooze length) are global; a snooze silences only that exact contract, for ten minutes.
  • Feed health. A silent monitor is the worst failure an alarm can have. If the feed stays unhealthy past a 12-second grace and three polling cycles in a row fail during a live session, a CRITICAL “market data feed unavailable” alert goes out unconditionally, shadow mode or not.

Failure handling is asymmetric on purpose. A detector exception is contained to its own cycle, and a failed pop-up or notification cannot stop the worker. A storage or calendar error is fatal by design and moves the monitor to a visible FAILED state, because a monitor that keeps running on a broken calendar or a broken archive is worse than one that stops.

The limit-lock detector needs both sides of the book, so it exists only in the broker edition.4

L↑(t)=[At=∅]∧[bt=P↑]∧[Vt consistent]∧[t−topen≥g]∧[t≥sc]
The limit-up alert for contract c at time t. A: the ask side of the book (empty when no seller is left); b: best bid; P↑: the exchange’s limit-up price for the day as reported by the feed; V: traded volume, which must pass the detector’s consistency check; t-open: the latest session open; g: the grace period (1 minute by default, adjustable from 1 to 30 minutes); s: the end of that contract’s ten-minute snooze. Limit-down mirrors it with the bid side empty and the best ask at the limit-down price. The sharp-move z-score is not written out here.

Alerts that respect a trading screen, on a hardened local server

The dashboard is a local web application: Python’s standard-library HTTP server behind a Microsoft Edge app window (no tabs, no address bar) with its own Windows taskbar identity, set through an explicit AppUserModelID and icon handles. Every dashboard action must carry a machine-local session token, compared in constant time with hmac.compare_digest, and its Host header must match the server’s own origin, so no other page on the machine can drive the dashboard. The token never leaves the machine.

The alert window is not part of the dashboard. It is an isolated, always-on-top window that is shown without being activated. Raising it does not bring the dashboard forward and does not move keyboard focus. This is written into the project as a rule that no later change may break, because one convenient “bring to front” call would silently defeat the tool’s first purpose.

The archive is SQLite in write-ahead-log mode with one writer: the monitor’s worker thread, serialized across processes by a named mutex. Dashboard views open it read-only with short busy timeouts, so a dashboard read can never block a quote write.

Timestamps carry milliseconds in the interface, the command line and every alert.

A launcher that cannot dead-end

The program is single-instance, guarded by a named lock. Release 1.2.1 had a designed dead end: if the lock was held and its owner did not answer within two seconds, the launcher told the user to restart Windows. The cause was an exit path that waited without limit on a market-data worker blocked inside native code, leaving an invisible process holding the lock.

Release 1.2.2 removes the state. Every shutdown wait is bounded, a second Exit force-closes, and the launcher recovers a stale lock by itself. Terminating a process on a trading PC demands proof, so a process may be closed only if all five hold: it is a Python interpreter; its command line names one of this program’s entry points; its path carries this edition’s marker and no marker of the other edition or of a test or build tool; it failed every authenticated session health check; and its kernel creation time still matches the enumerated record, so a recycled process ID can never redirect the termination to an innocent process. If a candidate is under 45 seconds old, the launcher first gives it up to 25 more seconds to finish starting and answer, so a dashboard that is still starting is not mistaken for a stale one.

The failure was reproduced live with a stand-in process holding the program’s own lock, and the launcher recovered in one click. That reproduction also caught a bug no unit test had: on Chinese-locale Windows the process listing came back in the console code page, garbling the Chinese folder name the filter depends on. The enumeration now forces UTF-8.

Pseudo-code
def is_our_stale_dashboard(process):
    # Every condition must hold before the launcher may close anything.
    return (
        process.is_python_interpreter
        and names_one_of_our_entry_points(process.command_line)
        and carries_this_edition_marker(process.path)
        and not carries_other_edition_or_tool_marker(process.path)
        and failed_every_authenticated_health_check(process)
    )


def close_if_still_the_same(process):
    if process.age < young_process_grace:
        wait_for_it_to_answer(process, bounded_timeout)    # still starting, not stale
        if process.answers_health_check:
            return keep("dashboard was still starting")

    handle = open_process(process.id)
    # A process ID can be recycled between listing and closing:
    # compare the kernel's creation time with the one recorded at listing.
    drift = abs(kernel_creation_time(handle) - process.recorded_creation_time)
    if drift > tolerance:
        return refuse("creation time mismatch: possible process-ID reuse")

    terminate(handle)
    wait_until_gone(handle, bounded_timeout)
    return done("terminated")
Pseudo-code. The positive-identification filter and the creation-time check that guards against process-ID reuse, simplified.

What the audit found

Shuo’s requirement for release 1.2.2 was not a launcher patch: the error had to become impossible, and the whole program had to be checked. The audit read the exit path, the alert path, the archive, the calendar, portability between machines and the test suite itself. Every finding below shipped fixed the same day in release 1.2.2, and the suite grew by 32 tests (287 to 319).5

Findings of the audit of release 1.2.1, most severe first. The last row was caught only because the failure was also reproduced live, not just unit-tested.
FindingSeverityFix in 1.2.2
Exit waited without limit on a worker thread, leaving an invisible process that held the single-instance lockCriticalBounded waits on the whole exit path
Market-data shutdown could block forever inside native codeHighDeadline on every shutdown wait
One failed Exit latched the dashboard in a closing state for goodHighState recovers; a second Exit force-closes
Night session resumed at midnight after a full holiday: false CRITICAL against a closed marketHighCalendar fix, regression tests in both directions
The test suite wrote into the live support logs, whose rotation could then delete genuine onesHighTests run against a temporary state folder
A slow Windows notification was reported as a failed clean-upMediumTreated as a warning; every alert stays in the archive
Read-only archive views failed after a crashed writer (write-ahead log left unrecovered)MediumRecovery open, then the read-only retry
A damaged Start-menu shortcut made the whole notification set-up fail instead of being repairedMediumAn unreadable shortcut now counts as missing and is rewritten
Race in the hand-off between two versionsLowAcknowledgment sent before shutdown
Process search returned garbled text on Chinese-locale WindowsFound only by the live reproductionEnumeration forced to UTF-8

One self-contained offline package

The broker edition runs on a standard-user machine with nothing installed, so it ships as a single archive with an embedded CPython 3.12.10 (x64) and a SHA-256 sidecar: unzip, double-click, run.

From release 1.2.1 the install is flat and stable: each version lives in its own immutable folder, a pointer file names the current one, and all mutable state (watchlist, thresholds, archive, snoozes, logs) lives in a separate user-data folder that an update never touches. An update is an overlay, and earlier versions stay in place, complete, as a fallback.

Because an offline install has to be diagnosable from its own files, every launch writes a uniquely named diagnostic log covering start-up checks, browser launch, native-library checks, the connect, login and subscribe callbacks, first ticks, pauses and resumes, alerts, clean-up and exceptions, with passwords, tokens, front addresses and account identifiers redacted. It paid for itself on first use: within seconds the log showed that the quotes on screen came from the built-in simulator, not from the broker’s feed.

The record, in numbers

Measurements of Shuo’s own software, from the project’s build record, July 2026. The quotes are public exchange market data.5,6
MeasureValue
Idea to first live polling17 h 48 min (July 16, 16:42 to July 17, 10:30, 2026)
Live contracts9 (Shanghai Futures Exchange and Shanghai International Energy Exchange)
Poll interval3 s, one batched request
First 90 seconds live270 quote rows (30 polls × 9 contracts)
Live quotes archived7,146 (about 40 minutes of polling)
Alert records in the archive94 (shadow-mode candidates and tests)
Watchlist15 products on three exchanges
Automated tests by release8 → 15 → 125 → 141 → 194 → 242 → 262 → 287 → 319
Deployed copy, own bundled runtime300 of 300 tests pass
Release 1.2.2 (launcher fix and audit)10 findings fixed; suite grew by 32 tests (287 → 319)
Releases on July 20, 20264 (1.1.0, 1.2.0, 1.2.1, 1.2.2)
Order paths0

Failure modes engineered out

FailureWhat prevents it
The alert steals a keystroke meant for a live orderIsolated always-on-top window, shown without activation, separate from the dashboard
False CRITICAL against a closed marketPer-product session gate; holiday and pre-holiday calendar; no night continuation after a full holiday
Calendar silently out of dateFails closed after the last reviewed date
The alarm itself goes silentFeed-health detector: CRITICAL after three failed cycles, even in shadow mode
The monitor keeps running on a broken calendar or archiveStorage and calendar errors are fatal by design and show a FAILED state; detector errors are contained per cycle
Limit-lock false alarm at the open or in a thin contractOpening grace period; volume and limit-price confirmations
Alert flood from a contract hovering at the limitPer-contract latch and ten-minute snooze
Data quota exhausted mid-monthSession-gated batched polling; local cap at 40% of the allowance
Launcher dead end on a stale lockVerified self-recovery; bounded shutdown waits; second Exit force-closes
Wrong process terminatedFive-condition identification, including kernel creation time against process-ID reuse
An update wipes thresholds or the archiveImmutable version folders; separate user-data folder
A secret leaks into a logRedaction of passwords, tokens, addresses and account identifiers; passwords held in memory only
Another local page drives the dashboardSession token compared in constant time; Host header pinned to the server’s own origin
The tool tradesMarket-data subset only; no trader library in the package

Built with

  • Python 3.12
  • Real-time monitoring
  • Statistical anomaly detection (z-score)
  • Order-book rule (limit lock)
  • Shadow-mode deployment
  • CTP market-data API
  • iFinD Python SDK
  • SQLite (WAL)
  • Win32 API (ctypes)
  • PowerShell
  • Standard-library HTTP server · HTML · JavaScript
  • Windows notifications
  • Offline packaging (embedded CPython, SHA-256)
  • unittest · 319 tests
  • Read-only by design

06Releases

Shipped in versions, like a product.

  1. The idea, and a first build the same afternoonSpecification written that afternoon: 15 products, a warning within three seconds, no automatic changes. A simulated-data build with 8 tests, then a session-aware shadow monitor with batched polling, a SQLite archive and a quota cap (15 tests).
  2. LiveFirst live polling at 10:30 on nine Shanghai contracts; the monitor paused itself through the mid-morning break and resumed on its own. The same day: the dashboard, the Windows notification and the yellow and red always-on-top pop-up (0.4, 125 tests), the app window and logo (141 tests), and a second edition for the broker’s market-data interface.
  3. 1.1.0Offline package with an embedded Python runtime, redacted launch diagnostics, and the limit-up and limit-down detector with its opening grace period and ten-minute snooze. 242 tests.
  4. 1.2.0Alert Test Center; settings reorganized into per-contract thresholds and a global limit policy. 262 tests.
  5. 1.2.1Flat, stable install layout: immutable version folders, user data that updates never overwrite. 287 tests.
  6. 1.2.2Self-healing launcher and a full audit, ten findings fixed: bounded shutdown, the post-holiday calendar fix, a version hand-off race and a Chinese-locale process-search bug among them. 319 tests; the original failure reproduced live and recovered in one click.
  1. 1The vendor interface meters quote fields per month; the program enforces a local monthly cap equal to 40% of the account’s allowance. The vendor documents a limit of three contracts for real-time push subscriptions.
  2. 2The vendor data subscription covered Shanghai (SHFE and INE) contracts and no Dalian (DCE) contract. The broker edition was verified on simulated ticks and through the Alert Test Center; no live tick reached that edition in the record.
  3. 3Idea and specification on July 16, 2026 from 16:42; first live polling on July 17, 2026 at 10:30 (17 hours 48 minutes after 16:42), both Beijing time.
  4. 4Sharp-move alerts ran in shadow mode (candidates logged, pop-ups off) and their levels were not yet calibrated on live sessions; the window and default levels are not published. The limit-lock detector belongs to the broker edition and was verified on simulated ticks and through the Alert Test Center, not on a live limit-locked contract.
  5. 5Four releases on July 20, 2026: 1.1.0 (242 tests), 1.2.0 (262), 1.2.1 (287) and 1.2.2 (319). 319 of 319 automated tests passing in the source tree at release 1.2.2; the deployed copy passed 300 of 300 with its own bundled runtime.
  6. 6Recorded live run: July 17, 2026 from 10:30 Beijing time, nine contracts on the Shanghai Futures Exchange and the Shanghai International Energy Exchange, polled every 3 seconds; 7,146 quotes archived, about 40 minutes of polling. The watchlist covered 15 products on three exchanges. Shuo confirms the monitor was used after July 2026; that later use is not logged, and no usage figures are claimed.
  7. 7By construction: the program is notification-only and loads market-data code only. The broker edition’s runtime holds four audited market-data files and no trading library.
Previous
Previous

USB Switch Fixer

Next
Next

The Guardian