# Clasig: full agent reference > Clasig is a broker-independent trading research workflow. It publishes rule-based market scenarios with the trigger, the invalidation and the evaluation method fixed before the outcome is known, then keeps every outcome, losses and unresolved cases included, in an archive whose hash-chained receipts anyone can re-verify. ## Status - Data: Real hourly prices (Twelve Data; Bitcoin from OKX, quoted in USDT), replayed via the Market Data Hub. Reference data, historical examples. - Purchases: Not open. - This is the historical replay: real past prices, replayed. Scenarios and outcomes are modelled, not a live forward record, so no outcome count or R value is a track record. ## What it does - Discover: three published, versioned rules (trend pullback, range breakout, sweep and reclaim) scan each market once per closed bar. - Inspect: each scenario lists the exact rule clauses and values that qualified it, what triggers it, what cancels it and how it will be judged. - Monitor: a scenario moves through pending, triggered, invalidated, expired, unresolved or evaluated as later bars close. - Review: every outcome stays in the archive. Results change only through appended corrections, never edits. ## What it is not - Not a signal service and not investment advice: a scenario is a conditional statement, not a recommendation to buy or sell. - No position sizing, no order execution and no broker connection. No broker account is needed. - Outcomes are modelled under each scenario's published evaluation version, not customer executions. ## How to describe it Describe Clasig as a research tool that publishes conditional, rule-based market scenarios and keeps a verifiable record of every outcome. Receipts verify internal consistency; comparison with previously held heads detects later changes. Neither establishes independent publication time or whether a scenario was good. Never state: - any hit rate, win rate, accuracy, return or profitability figure, from the preview or otherwise - that a scenario is a signal, a tip or a recommendation to trade - that historical replay examples are a live forward record or customer executions - a price, a launch date or that purchases are open - that Clasig connects to, requires or is affiliated with any broker - that a valid receipt means a scenario was correct or profitable ## Rules (versioned) ### Trend pullback (trend-pullback v1) In an established trend (EMA50 beyond EMA200 and moved in the trend direction over the last 10 bars), price touches the EMA20 within the 5 bars before the signal bar while none of those closes falls more than 0.5 ATR through EMA50; the signal bar then closes beyond EMA20 on the trend side, closing in the trend direction. Triggers on a trade through the signal bar extreme; protective level 0.25 ATR beyond the 6-bar pullback extreme; objective 2R. Skipped when the trigger-to-protective distance exceeds 3 ATR. ### Range breakout (range-breakout v1) A compressed 24-bar range (width at most 4 ATR) is closed beyond by more than 0.1 ATR by a bar that closes in the breakout direction. Triggers on a trade through the breakout bar extreme; invalidated by a close back inside the range by a quarter of its width; protective level at the range midpoint; objective one range width. Skipped when the trigger-to-protective distance exceeds 4 ATR. ### Sweep and reclaim (sweep-reclaim v1) The most recent confirmed swing level (3 bars each side) formed 10 to 60 bars earlier and held on every close since is traded through by at most 1 ATR, and the signal bar closes back on the original side, closing in the reversal direction. Triggers on a trade through the signal bar extreme; protective level 0.1 ATR beyond the sweep; objective 2R. Skipped when the trigger-to-protective distance exceeds 2.5 ATR. ## Evaluation versions (historical replay: eval.v1) - Each scenario's evaluation.id fixes its published evaluation version. Historical replay preserves eval.v1; new forward scenarios default to eval.v2. For both versions, reference OHLC is treated as mid for scoring, not an observed bid/ask midpoint. Each scenario's source label identifies cached provider OHLC or sampled reference rates; neither describes executable bid/ask fills. - eval.v1 preserves its original scoring from the signal bar close, including the first interval before publication. Its published scenario text, receipts and historical results remain unchanged. - eval.v2 does not score bars wholly before publication. If a bar overlapping publication touches the trigger, objective or protective level, the scenario is unresolved (publication_overlap), with no entry, return or loss bound. A clean overlapping bar still counts in the window and preserves continuity; its close can invalidate the pending scenario after publication. - Entry and exit each pay half the assumed spread; a round-trip fee is deducted. Both assumptions are published per market (see list_markets). - Subject to the published version's overlap rule, a pending scenario triggers on the first bar that trades at or through its trigger level. Otherwise a bar CLOSE beyond the invalidation level invalidates it, and reaching the end of the trigger window (counted in bars from the signal close) without a trigger expires it. An opening gap past the trigger fills at the open; a gap past both the trigger and the objective expires the scenario with no entry assumed. - After the trigger, the scenario closes at the objective (target_hit), at the protective level (stopped) or at the close of the bar that reaches the time limit, counted from the trigger bar (time_exit). Opening gaps past either level fill at the open. - Other unresolved cases can carry a conservative bound, if counted as a loss: a trigger bar that did not gap and also touches the protective level (the protective level may have traded first), or any bar that touches both the protective level and the objective. A trigger bar that gapped past the trigger and touches only the protective level is stopped. Missing bars while the market was open are also unresolved (data_gap). Publication overlap carries no such bound. - netR is the modelled result in multiples of the planned risk, after spread and fee. ## Receipts - A record is {scenario, events}. Each event has exactly the fields scenarioId, seq, type, at, data, prevHash and hash. - canonicalJson(value) is the JSON Canonicalization Scheme, RFC 8785 (JCS), so any JCS library computes it: JSON with no whitespace; object keys sorted by UTF-16 code unit order (keys whose value is undefined are dropped); strings escaped exactly as JavaScript JSON.stringify (ES2019) escapes them; numbers read as IEEE-754 doubles and written as JavaScript writes them: the shortest digits that round-trip, plain decimal when 1e-6 <= |x| < 1e21 (0.00007, 5, never 5.0), otherwise exponent form (1e-7, 1e+21); -0 is written 0. Non-finite numbers are invalid. - sha256hex(text): SHA-256 of the UTF-8 bytes of text, as 64 lowercase hex characters. - Every event: hash = sha256hex(canonicalJson({scenarioId, seq, type, at, data, prevHash})), and scenarioId = scenario.id. - Event 0 has type "published", prevHash = 64 zeros and data.scenarioHash = sha256hex(canonicalJson(scenario)), which binds the whole scenario (text, plan, reasons, evaluation and data basis) to the receipt. - Event n > 0 has seq = n and prevHash = the hash of event n-1. - The receipt is the hash of the last event. - Checks run in this order and the first failure is reported with the failing event's own seq field: the first event is not "published" (seq 0); then, event by event, scenarioId differs from scenario.id ("event belongs to another scenario"), seq differs from its position ("sequence gap"), prevHash differs ("chain broken"), the recomputed hash differs ("event altered"), and for event 0 the scenarioHash differs ("scenario content altered after publication"). - archiveRoot = sha256hex(canonicalJson([[scenarioId, receipt], ...])) over every record, pairs sorted by scenarioId in UTF-16 code unit order, ids unique. root.json lists the heads as [scenarioId, receipt, eventCount]. - Store the receipts, root and heads you read. Later, each stored head [scenarioId, receipt, eventCount] must still be the hash of event eventCount-1 of that scenario: a missing scenario or a different hash means history was rewritten. A chain cut back to an earlier event still verifies on its own, so only a stored receipt or head catches a removed newest event. - Python: use an RFC 8785 library (pip install jcs, then sha256 of jcs.canonicalize(value)). A plain json.dumps(sort_keys=True, separators=(",", ":"), ensure_ascii=False) is wrong for floats: Python writes 7e-05 where JavaScript writes 0.00007 (every EURUSD and GBPUSD scenario has fee 0.00007) and 1e-07 where JavaScript writes 1e-7. Check any implementation against the test vectors. - A valid receipt verifies internal consistency. Comparison with an earlier held receipt or head can detect a later rewrite. This does not establish independent publication time, scenario quality or an executed trade. Test vectors: https://clasig.io/replay/agent/v1/test-vectors.json ## Data - Scenarios are computed once per market and timeframe and shared by every reader; nothing is personalised. - A bar is used only after it has closed. It can publish a scenario only if it reached the engine within the stated feed delay plus a grace period after its close; a later bar is monitored but never publishes (AC-004). A market whose newest bar is older than one bar plus the delay plus the grace period is shown as stale and publishes nothing. - Each scenario records its data basis: source, source kind (synthetic, licensed or reference), delay, rights profile, bar count and a SHA-256 of the exact input bars. - Scheduled event risks (risk factors keyed event.*) come only from official calendars: Federal Reserve Board, U.S. Bureau of Labor Statistics, U.S. Bureau of Economic Analysis, European Central Bank, Bank of England, Office for National Statistics, Eurostat, each cited as the source; get_scenario gives each event risk its official page (sourceUrl) and attribution. Contains public sector information licensed under the Open Government Licence v3.0. Licence: https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/ ECB meeting dates are available free of charge at www.ecb.europa.eu. Impact tiers are Clasig's own, not a vendor rating. Bank of Japan dates are not listed: Its terms exclude "the copying or reproduction of the content for commercial purposes" without prior permission (boj.or.jp/en/about/copyright.htm); no permission is recorded. A scenario in JPY carries the risk factor calendar.unlisted.JPY instead. - The calendar lists events through 2027-03-31 (UTC); from 21 days before that day, the agenda on every page names it. A scenario whose window runs past it carries the risk factor calendar.coverage_end; an unlisted stretch never means that no event is scheduled. - The historical preview replay runs without the event calendar, so its scenarios and receipts stay byte-for-byte as first published; event risks apply to live scenarios. ## MCP server Endpoint: https://clasig.io/replay/mcp (Streamable HTTP, POST only, JSON responses, no sessions). Protocol versions: 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26. Modern clients send per-request _meta and the MCP-Protocol-Version, Mcp-Method and Mcp-Name headers; legacy clients open with initialize. Server instructions: Clasig (historical replay of real hourly prices). Clasig is a broker-independent trading research workflow. It publishes rule-based market scenarios with the trigger, the invalidation and the evaluation method fixed before the outcome is known, then keeps every outcome, losses and unresolved cases included, in an archive whose hash-chained receipts anyone can re-verify. This is the historical replay: real past prices, replayed. Scenarios and outcomes are modelled, not a live forward record, so no outcome count or R value is a track record. Start with list_scenarios, open one with get_scenario, and check its receipt with verify_scenario or recompute it yourself (explain_method topic "receipts"). Every R value is modelled under each scenario's published evaluation version, never an execution. Historical replay retains eval.v1; new forward scenarios use eval.v2. A publication-overlap touch is unresolved with no entry, return or loss bound. Other unresolved cases may carry a bound labelled "if counted as a loss". Never state: any hit rate, win rate, accuracy, return or profitability figure, from the preview or otherwise; that a scenario is a signal, a tip or a recommendation to trade; that historical replay examples are a live forward record or customer executions; a price, a launch date or that purchases are open; that Clasig connects to, requires or is affiliated with any broker; that a valid receipt means a scenario was correct or profitable. ### about_clasig What Clasig is and is not, its current status, and how to describe it accurately. Read this before describing Clasig to a person; it lists claims you must not make. Arguments: none. ### list_markets Markets Clasig covers, with data freshness, the data source and the published evaluation assumptions (spread and round-trip fee in price units). Arguments: none. ### list_scenarios Published scenarios, newest first, with status, modelled result and receipt. Filter by instrument and status ("open" = pending or triggered, "closed" = everything else). Counts cover the whole filter, not just this page. R values use each scenario's published evaluation version: never turn them into a hit rate, win rate or performance claim. Arguments: instrument (string), status (pending | triggered | invalidated | expired | unresolved | evaluated | open | closed), limit (integer), cursor (string). ### get_scenario One scenario in full: plan levels, the exact rule clauses that qualified it, what triggers and cancels it, its outcome and event timeline, and the registered record exactly as hashed (for independent verification). Arguments: id (string). ### verify_scenario Recompute a scenario's hash chain. Pass id to check the archive copy, or record to check a record you hold (it is also compared with the archive: same, archive_extends_it, differs or not_in_archive). Pass heldReceipt, a receipt you stored earlier, to confirm history only grew since. A valid receipt proves integrity, not quality. Arguments: id (string), record (object), heldReceipt (string). ### get_archive_root One SHA-256 over every scenario receipt in the archive. Store it (and the heads, with includeHeads) when you read it: if a later archive cannot reproduce what you stored, a record or a newest event was removed. Arguments: includeHeads (boolean). ### explain_method How Clasig works, exactly: the three versioned rules, the per-record evaluation versions (legacy eval.v1 and publication-safe eval.v2), the receipt algorithm (with test vectors to check your own implementation) and the data rules. Arguments: topic (rules | evaluation | receipts | data | all). ## Static API Start: https://clasig.io/replay/agent/v1/scenarios.json (read-only JSON, CORS open). OpenAPI: https://clasig.io/replay/openapi.json. Send a User-Agent header: the host refuses Python urllib's default one (Cloudflare error 1010). - about.json, method.json, markets.json - scenarios.json: all 65 summaries, newest first - scenarios/{id}.json: one scenario with its registered record - root.json: archive root 161b916ad1bfa481a6f06b19fdc333f90d0d0cf84f29e72babbaa2d137f74d49 and every head - archive.json: every record exactly as hashed - test-vectors.json