npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@storm-trade/chart-core

v0.1.0

Published

Framework-agnostic TradingView chart wrapper, datafeed adapter and order/price-line hooks.

Readme

@storm-trade/chart-core

Framework-agnostic primitives for embedding TradingView Charting Library in Tsunami Exchange products. The package owns the chart engine concerns (widget lifecycle, datafeed plumbing, line/marker rendering, timezone handling) and stays deliberately ignorant of:

  • application stores (zustand, redux, …)
  • domain types (OrderV2, Position, …)
  • network transport (msgpack websocket, REST, …)
  • create-order UX

All app glue is supplied by the consumer through interfaces.

Status

0.x. Implemented:

  • useTradingView — widget lifecycle, theming, persistence (with sanitizeChartState), symbol switching, header badge, options dropdown, plus-click, timezone, on-chart marks lifecycle (refreshMarks) and stale-data refresh.
  • useOrderLines — draggable chart.createOrderLine with move / live-drag (onMoving) / cancel.
  • usePriceLines — static horizontal lines via chart.createShape.
  • createDatafeed — adapter from ChartDatafeed to TradingView's IBasicDataFeed (incl. getMarks).
  • chartTimezone / customTimezones, bucketing, sanitizeChartState, chartPseudoFullscreen utilities.
  • <PriceProviderBadge /> — header badge component.

Trade layer (src/trade/*, opt-in)

A Storm-specific layer for rendering orders/positions on the chart: ChartOrderManager (SL/TP with live PnL on drag, draggable limit triggers, liquidation/entry lines), buildOrderLineModels / buildPositionLines, calculateOrderPnL, and the OrderType taxonomy. It stays framework-agnostic by injecting the host's store data, trading-service actions and number formatting through ChartTradeProvider — chart-core pulls in no store, services, i18n or math libs.

The inline create-order popover (CreateOrderPopover, plus-click driven — order-type select, SL/TP vs limit branch, leverage, live PnL, submit-by-price) is a dependency-light plain-React rebuild of upscale-ui's form; the submit, balance, leverage bounds and confirm-modal routing inject via ChartCreateOrderProvider. For precise integration it exposes on* lifecycle hooks — onOrderTypeChange, onValuesChange, validate, onValidationError, onSubmitSuccess, onSubmitError — and is fully themeable via tokens plus per-slot className / style (CreateOrderSlot). The heavy confirm modals stay host-side — they reuse the app's main OpenPositionForm / SLTP form, which can't be vendored here.

Storybook demo

A runnable example lives in stories/ — it wires useTradingView + usePriceLines + useOrderLines against a synthetic offline datafeed and the real TradingView widget.

The library is proprietary and not vendored here, so the demo copies it from a sibling tsunami-ui checkout (gitignored):

pnpm copy-tv          # or TSUNAMI_UI_DIR=/path/to/tsunami-ui pnpm copy-tv
pnpm storybook        # http://localhost:6006  (runs copy-tv first)

Peer dependencies

| Peer | Why | |---|---| | react | Hooks need a React renderer. | | TradingView Charting Library | Proprietary, supplied by the host app. We do not ship the library or its types. The consumer aliases TradingView types via tsconfig paths (see below). |

TradingView types

The TradingView Charting Library is not redistributable. Until we publish a private types-only package, chart-core defines a minimal surface in src/external/charting-library.ts. Where the surface differs from your local TV bundle, structural typing should still match because we only use documented public methods.

If you hit a type error from a missing TV symbol, add it to src/external/charting-library.ts rather than import-ing from the host app's local copy.

Design boundary

┌────────────────── consuming app ──────────────────┐
│                                                   │
│  store, services, domain types, websocket         │
│             │                  │                  │
│             ▼                  ▼                  │
│       ChartDatafeed     OrderLineModel[]          │
│             │                  │                  │
└─────────────┼──────────────────┼──────────────────┘
              ▼                  ▼
        ┌─────────────────────────────┐
        │   @storm-trade/        │
        │        chart-core           │
        │  (TV widget, lines, marks)  │
        └─────────────────────────────┘

See the root README.md for publishing workflow.