Trading UI Patterns
X, TradingView, and Trading212 each solved a different part of the
"financial app that doesn't feel like a spreadsheet" problem, and the three
solutions are not interchangeable: X's density-and-restraint social feed,
TradingView's tabular-figures terminal chrome, and Trading212's
input-gated simplicity are distinct disciplines with their own failure
modes. Building "in the style of" one of them from memory alone tends to
nail the obvious surface (colors, rounded corners) and miss the structural
details that actually make a component read as that product's — a
watchlist row with no tabular digits, an order ticket whose confirm button
is tappable before the input is valid, a like icon that's already filled
red before anyone has tapped it.
The one failure mode a naive rebuild won't catch on its own
Direction color (red/green for up/down) is not a fixed constant — it is a
function of which market's convention the data represents. US/UK/HK/most of
the world uses green=up/red=down; mainland China and Taiwan use the
opposite (red is auspicious, associated with rising prices). A watchlist or
holdings row built and screenshot-checked against US test data, then pointed
at a CN symbol feed without re-deriving the color mapping, renders every
single quote backwards — and nothing crashes, nothing looks obviously wrong
in a screenshot taken by someone who doesn't already know the correct CN
convention. This is the same shape of bug as a sign-convention flip in a
quant computation (see the gamma-exposure skill), just expressed as a
color instead of a number. scripts/pattern_audit.py --demo reproduces it
on a synthetic manifest.
Workflow
- Identify the pattern.
python scripts/pattern_audit.py --list prints
every known pattern id, its source product, and a one-line description.
If the component doesn't match any of these closely, read the relevant
references/<product>_patterns.md anyway for adjacent conventions, but
don't force-fit an audit against a pattern it isn't actually implementing.
- Read the pattern's reference doc before building —
references/x_patterns.md, references/tradingview_patterns.md, or
references/trading212_patterns.md. Each covers the structural elements,
the specific "what breaks the pattern's identity" anti-patterns, and any
market-dependent field for that pattern. This is where the actual design
knowledge lives — the audit script only checks structure, not the prose
conventions (tabular digits, relative timestamps, icon fill-on-activation).
- Build the component against the target's real syntax (SwiftUI, CSS/
Tailwind, React Native, Flutter — whatever the project uses), following
the reference doc's structural and stylistic conventions. If the user
already has a
design-tokens.json (see ui-design-system), colors/radii/
spacing should still come from their tokens — this skill governs
structure and convention, not where the literal values come from.
- Write a component manifest describing what you built — see
references/methodology.md for the exact shape. This is a deliberately
small JSON (pattern, optional market, and a fields dict of what's
actually present), not a screenshot or the source code itself.
- Audit it:
python scripts/pattern_audit.py --manifest component.json.
FAIL findings (missing_required_field, forbidden_condition_present,
market_convention_mismatch, or a rule_violation at fail severity) mean
the component doesn't yet read as the claimed pattern or is wrong for its
declared market — fix before shipping. WARN findings
(missing_recommended_field, warn-severity rule_violation) are
judgment calls: the component is structurally sound but thinner than the
reference; note them rather than silently drop them.
- Building for more than one market? Always set
market in the
manifest and re-run the audit per market the component actually serves —
a watchlist row correct for US is not automatically correct for CN,
and the audit will not catch a market-aware field it wasn't told the
target market for.
python scripts/pattern_audit.py --demo to see the market-convention bug
and its fix side by side with no files needed.
Guardrails
- Never assume a market's direction-color convention without checking —
default to asking or reading
references/tradingview_patterns.md's
convention table rather than guessing from another market's build.
- A PASS/WARN verdict describes structural completeness against the
checklist, not visual quality — the audit cannot see whether the spacing
actually feels right, only whether the required pieces exist. Taste
judgment still belongs to the conversation, not the script.
- Don't force a component into a pattern id it doesn't really implement just
to get a report — an honest "this doesn't match any cataloged pattern
closely" is more useful than a misleading audit against the wrong checklist.
- Adding a new pattern is a
references/patterns.json edit plus a
references/<product>_patterns.md prose addition — never hardcode a new
pattern's logic directly into pattern_audit.py; see
references/methodology.md.
Bundled resources
scripts/pattern_audit.py — audit_manifest() runs the deterministic
checklist (required/recommended/forbidden fields, numeric/equality rules,
market-aware convention checks) against references/patterns.json.
--list prints the catalog, --manifest FILE audits a component,
--json FILE writes a machine-readable report, --demo reproduces the
market-convention bug and its fix with no files needed.
references/patterns.json — the pattern catalog itself: required/
recommended/forbidden fields, rules, and market-aware fields per pattern.
Edit this to extend the catalog; see references/methodology.md.
references/x_patterns.md — X's timeline post and action bar conventions.
references/tradingview_patterns.md — TradingView's watchlist row and
technical rating gauge conventions, including the full direction-color
market table.
references/trading212_patterns.md — Trading212's order ticket and
holdings row conventions.
references/methodology.md — the manifest shape, the division of labor
between taste and machine checks, and how to extend the pattern catalog.
1---2name: trading-ui-patterns3description: Build or review a trading/investing-app component against the specific conventions of X (timeline post, action bar), TradingView (watchlist row, technical rating gauge), or Trading212 (order ticket, holdings row). Trigger for "make this look like TradingView/X/Trading212", "watchlist row like TradingView", "order ticket like Trading212", "technical rating gauge", "做一个像 TradingView 一样的自选股列表", "参考 X 的帖子卡片样式", or when reviewing a finished component against one of these reference patterns before shipping it. Also trigger when a watchlist/quote/holdings component needs to render more than one market's data (e.g. both US and CN symbols) — this is where the direction-color convention silently breaks. Do NOT trigger to invent a generic app aesthetic from a blank slate (use `ui-ux-pro-max` for open-ended style exploration) or to freeze the user's own palette/spacing choices into reusable tokens (that's `ui-design-system`) — this skill is specifically about matching one of these three products' own component convention4---56# Trading UI Patterns78X, TradingView, and Trading212 each solved a different part of the9"financial app that doesn't feel like a spreadsheet" problem, and the three10solutions are not interchangeable: X's density-and-restraint social feed,11TradingView's tabular-figures terminal chrome, and Trading212's12input-gated simplicity are distinct disciplines with their own failure13modes. Building "in the style of" one of them from memory alone tends to14nail the obvious surface (colors, rounded corners) and miss the structural15details that actually make a component read as that product's — a16watchlist row with no tabular digits, an order ticket whose confirm button17is tappable before the input is valid, a like icon that's already filled18red before anyone has tapped it.1920## The one failure mode a naive rebuild won't catch on its own2122Direction color (red/green for up/down) is not a fixed constant — it is a23function of which market's convention the data represents. US/UK/HK/most of24the world uses green=up/red=down; mainland China and Taiwan use the25opposite (red is auspicious, associated with rising prices). A watchlist or26holdings row built and screenshot-checked against US test data, then pointed27at a CN symbol feed without re-deriving the color mapping, renders every28single quote backwards — and nothing crashes, nothing looks obviously wrong29in a screenshot taken by someone who doesn't already know the correct CN30convention. This is the same shape of bug as a sign-convention flip in a31quant computation (see the `gamma-exposure` skill), just expressed as a32color instead of a number. `scripts/pattern_audit.py --demo` reproduces it33on a synthetic manifest.3435## Workflow36371. **Identify the pattern.** `python scripts/pattern_audit.py --list` prints38 every known pattern id, its source product, and a one-line description.39 If the component doesn't match any of these closely, read the relevant40 `references/<product>_patterns.md` anyway for adjacent conventions, but41 don't force-fit an audit against a pattern it isn't actually implementing.422. **Read the pattern's reference doc before building** —43 `references/x_patterns.md`, `references/tradingview_patterns.md`, or44 `references/trading212_patterns.md`. Each covers the structural elements,45 the specific "what breaks the pattern's identity" anti-patterns, and any46 market-dependent field for that pattern. This is where the actual design47 knowledge lives — the audit script only checks structure, not the prose48 conventions (tabular digits, relative timestamps, icon fill-on-activation).493. **Build the component** against the target's real syntax (SwiftUI, CSS/50 Tailwind, React Native, Flutter — whatever the project uses), following51 the reference doc's structural and stylistic conventions. If the user52 already has a `design-tokens.json` (see `ui-design-system`), colors/radii/53 spacing should still come from their tokens — this skill governs54 structure and convention, not where the literal values come from.554. **Write a component manifest** describing what you built — see56 `references/methodology.md` for the exact shape. This is a deliberately57 small JSON (`pattern`, optional `market`, and a `fields` dict of what's58 actually present), not a screenshot or the source code itself.595. **Audit it**: `python scripts/pattern_audit.py --manifest component.json`.60 FAIL findings (`missing_required_field`, `forbidden_condition_present`,61 `market_convention_mismatch`, or a `rule_violation` at fail severity) mean62 the component doesn't yet read as the claimed pattern or is wrong for its63 declared market — fix before shipping. WARN findings64 (`missing_recommended_field`, warn-severity `rule_violation`) are65 judgment calls: the component is structurally sound but thinner than the66 reference; note them rather than silently drop them.676. **Building for more than one market?** Always set `market` in the68 manifest and re-run the audit per market the component actually serves —69 a watchlist row correct for `US` is not automatically correct for `CN`,70 and the audit will not catch a market-aware field it wasn't told the71 target market for.727. `python scripts/pattern_audit.py --demo` to see the market-convention bug73 and its fix side by side with no files needed.7475## Guardrails7677- Never assume a market's direction-color convention without checking —78 default to asking or reading `references/tradingview_patterns.md`'s79 convention table rather than guessing from another market's build.80- A PASS/WARN verdict describes structural completeness against the81 checklist, not visual quality — the audit cannot see whether the spacing82 actually feels right, only whether the required pieces exist. Taste83 judgment still belongs to the conversation, not the script.84- Don't force a component into a pattern id it doesn't really implement just85 to get a report — an honest "this doesn't match any cataloged pattern86 closely" is more useful than a misleading audit against the wrong checklist.87- Adding a new pattern is a `references/patterns.json` edit plus a88 `references/<product>_patterns.md` prose addition — never hardcode a new89 pattern's logic directly into `pattern_audit.py`; see90 `references/methodology.md`.9192## Bundled resources9394- `scripts/pattern_audit.py` — `audit_manifest()` runs the deterministic95 checklist (required/recommended/forbidden fields, numeric/equality rules,96 market-aware convention checks) against `references/patterns.json`.97 `--list` prints the catalog, `--manifest FILE` audits a component,98 `--json FILE` writes a machine-readable report, `--demo` reproduces the99 market-convention bug and its fix with no files needed.100- `references/patterns.json` — the pattern catalog itself: required/101 recommended/forbidden fields, rules, and market-aware fields per pattern.102 Edit this to extend the catalog; see `references/methodology.md`.103- `references/x_patterns.md` — X's timeline post and action bar conventions.104- `references/tradingview_patterns.md` — TradingView's watchlist row and105 technical rating gauge conventions, including the full direction-color106 market table.107- `references/trading212_patterns.md` — Trading212's order ticket and108 holdings row conventions.109- `references/methodology.md` — the manifest shape, the division of labor110 between taste and machine checks, and how to extend the pattern catalog.