一键导入
tradingview-bundle
TradingView bundle maintenance and debugging. Load when debugging TV bundle issues or patching obfuscated JS
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
TradingView bundle maintenance and debugging. Load when debugging TV bundle issues or patching obfuscated JS
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
External API evaluation and MCP server wrapper generation. Load when integrating a REST/GraphQL API as a workspace tool
Capability-based provider system patterns. Load when creating providers or wiring module-provider integration
Full-stack WebSocket subscription development. Load when adding WS routes, topic services, or debugging WS data flows
Systematic Python type error resolution (mypy/pyright). Load when fixing backend type check failures
Type-first Python with Pydantic, Protocol, and discriminated unions. Load when writing models or enforcing typing
Systematic type error resolution for Python (mypy/pyright) and TypeScript (vue-tsc). Use when fixing type errors, resolving type check failures, or optimizing type imports.
| name | tradingview-bundle |
| description | TradingView bundle maintenance and debugging. Load when debugging TV bundle issues or patching obfuscated JS |
| user-invocable | false |
Methodology for debugging, patching, and maintaining the forked TradingView Trading Terminal obfuscated bundles. This is a reverse-engineering discipline — no vendor support exists.
startWith(), fixing observable chains)frontend/public/trading_terminal/bundles/
├── order-view-controller.*.js # Order/Position dialog logic (PATCHED)
├── trading.*.js # Core trading operations, calculations
├── trading-account-manager.*.js # Account Manager UI components
└── ... (100+ other bundle files)
| Bundle | Key Classes | Responsibility |
|---|---|---|
| order-view-controller.js | Pt (PositionViewModel), bt (OrderViewModel), ie (BracketModel) | Dialog view models |
| trading.js | Trading utilities | Calculations (pip value, tick size) |
| trading-account-manager.js | Account panel components | Account Manager UI |
grep -n "class Pt " order-view-controller.*.jsMap cryptic parameter names by usage analysis:
| Technique | How |
|---|---|
| Method calls | e.getHost() → Trading Host adapter |
| Property access | t.id, t.qty → Position interface |
| RxJS patterns | pipe, subscribe → Observable |
| Cross-reference | Compare with types in charting_library.d.ts / broker-api.d.ts |
Output options (pick one per situation):
e, // adapter: IBrokerConnectionAdapterHostConsole logging strategy:
// ✅ GOOD: Contextual, structured, prefixed with class.method
console.log('[ie.subscribe] combineLatest emitted:', {
enabled: values.enabled,
parentPrice: values.parentPrice,
pipValue: values.pipValue,
equity: values.equity,
})
// ❌ BAD: Generic, no context
console.log('value:', values)
Where to add logs: Constructor calls, observable emissions, subscription handlers, error paths.
Common patterns:
| Symptom | Likely Cause | Diagnostic |
|---|---|---|
| Fields don't sync on input | Missing startWith() on observable | Check combineLatest — are ALL source observables emitting? |
| Dialog opens with empty fields | Data not passed through hook | Log parameters in customUI.showPositionDialog |
| Values update only on click | combineLatest blocked until manual interaction | Trace which observable hasn't emitted yet |
| Silent failures | Nullish keys in discriminated unions | Check objects passed to host.*Update() methods |
Fix application rules:
// Original: T(fromEventPattern(o))// console.log('[Pt.constructor]...| Minified | Actual | Location | Purpose |
|---|---|---|---|
Pt | PositionViewModel | order-view-controller.js | Position dialog state management |
bt | OrderViewModel | order-view-controller.js | Order dialog state management |
ie | BracketModel | order-view-controller.js | SL/TP bracket field sync logic |
gt | (varies) | order-view-controller.js | Supporting view model |
T() | shareObservable() | Various | RxJS share helper |
m.startWith | startWith() | RxJS imports | Initial value for observables |
Naming patterns:
Pt, bt, ie)_createModels, _subscribe)$ (_equity$, _quotes$, _pipValues$)// combineLatest ONLY fires after ALL observables emit at least once
combineLatest({ equity: _equity$, quotes: _quotes$, ... }).subscribe(handler)
// If _equity$ never emits → handler NEVER fires → fields never sync
Fix: Add startWith() to event-based observables:
// Before (broken): fromEventPattern(subscribeEquity)
// After (fixed): fromEventPattern(subscribeEquity).pipe(startWith(NaN))
fromEventPattern(
(handler) => subscribeRealtime(symbol, handler), // subscribe
(handler, unsubscribe) => unsubscribe?.() // unsubscribe
)
Wraps observable with share({ connector: () => new ReplaySubject(1) }) for multicasting.
Primary documentation (read the relevant case study before starting):