rune-ext-trading

Implements fintech trading patterns including Decimal money arithmetic, WebSocket reconnects, and streaming indicators.

1|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/dangvu008/VietTruyen --skill rune-ext-trading-dangvu008
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rune-ext-trading
Source: https://github.com/dangvu008/VietTruyen/tree/main/.agents/skills/rune-ext-trading
Command: npx skills add https://github.com/dangvu008/VietTruyen --skill rune-ext-trading-dangvu008

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires decimal.js, lightweight-charts, ws, @tanstack/react-query, date-fns-tz.

What problem does it solve? Trading and fintech applications fail in predictable ways: JavaScript float arithmetic silently corrupts PnL calculations, WebSocket connections drop without reconnecting, charts leak memory on symbol changes, and strategy parameters get changed randomly without tracking what was tested. This Skill enforces safe patterns across the entire trading stack so these failures are caught before they reach production. ## Core Features & Use Cases - Safe Money Handling: Enforces Decimal.js/BigInt arithmetic at parse boundaries with banker's rounding, audit trails, and Grep-based audits that flag raw float operations on price, amount, or balance fields. - Real-Time Data & Charts: Provides WebSocket lifecycle management with exponential backoff reconnect, event normalization, TanStack Query cache invalidation, and TradingView Lightweight Charts candlestick rendering with reduced-motion support. - Streaming Indicators & Strategy Experiments: Computes SMA, EMA, RSI, MACD, Bollinger Bands, and VWAP incrementally per tick, and runs a scientific experiment loop (hypothesize, backtest, analyze, record) with quant metrics like Sharpe ratio, max drawdown, Kelly criterion, and Monte Carlo simulation. - Use Case: When building a crypto trading dashboard, the Skill detects decimal.js or ws in package.json, then guides implementation of a reconnecting WebSocket feed, a candlestick chart with indicator overlays, and a backtested entry/exit strategy with results recorded to .rune/experiments/. ## Quick Start Ask the AI to build a real-time candlestick chart with a reconnecting WebSocket feed and Decimal-safe price handling for your trading dashboard.

Frequently Asked Questions about rune-ext-trading

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I avoid floating point errors when calculating prices in JavaScript?

Use Decimal.js for all money arithmetic instead of raw number operations. Wrap values at the parse boundary with new Decimal(value), perform all calculations through Decimal methods, and only convert to number at display time with ROUND_HALF_EVEN rounding.

How to implement WebSocket auto-reconnect with exponential backoff?

Attach an onclose handler that schedules reconnection with doubling delays: 1s, 2s, 4s, capped at 30 seconds. Reset the attempt counter on successful onopen, and test disconnect/reconnect sequences with a mock server in CI.

Does Lightweight Charts support real-time candlestick updates?

Yes, call series.update({ time, open, high, low, close, volume }) on each incoming tick. Batch rapid updates with requestAnimationFrame to avoid layout thrashing, and call chart.removeSeries in cleanup when the symbol changes to prevent memory leaks.

How do I backtest a trading strategy change without breaking production logic?

Create a named variant with the changed parameters, never modify production logic directly. Run the backtest against defined success criteria, compare against the control variant, and record the result as accepted, rejected, or inconclusive in an experiment log.

Why do streaming indicators drift from batch calculations over time?

Drift occurs when indicators compute on float prices, accumulating rounding error over thousands of ticks. Feed Decimal-converted values via toNumber() only at the indicator boundary and verify streaming output against a reference batch computation in unit tests.

Is it safe to store trading auth tokens in localStorage?

No, localStorage exposes tokens and balance data to XSS attacks. Use httpOnly cookies or in-memory stores instead, and audit the codebase with a Grep search for localStorage usage across TypeScript files.