hyperprop-charting-library 0.1.145 → 0.1.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/API.md CHANGED
@@ -625,6 +625,7 @@ link.click();
625
625
 
626
626
  - `startReplay(options?: ReplayStartOptions): void` / `stopReplay(): void`
627
627
  - `replayStep(bars?: number): void` — negative rewinds.
628
+ - `replaySeek(index: number): void` — absolute jump, clamped to the series.
628
629
  - `replayPlay(speed?: number): void` / `replayPause(): void` / `setReplaySpeed(speed: number): void`
629
630
  - `getReplayState(): ReplayState` / `onReplayStateChange(handler)`
630
631
 
@@ -644,6 +645,70 @@ link.click();
644
645
 
645
646
  ---
646
647
 
648
+ ## Futures desk indicators
649
+
650
+ Three built-ins aimed at intraday futures work. All three are overlays on the
651
+ main pane, and the last two need a session spec (`setSession`) — without one
652
+ they have no notion of a trading day and render nothing.
653
+
654
+ ### `volume-profile`
655
+
656
+ Volume distribution across price, with point of control and value area.
657
+
658
+ ```ts
659
+ chart.addIndicator("volume-profile", { scope: "visible", rows: 40, widthPercent: 28 });
660
+ chart.addIndicator("volume-profile", { scope: "session" }); // one per trading day
661
+ ```
662
+
663
+ `scope: "visible"` profiles whatever is on screen and follows pan/zoom, drawn
664
+ against the price axis; `scope: "session"` draws a separate profile inside each
665
+ trading day's bars, skipping any session too narrow to read. Rows are split
666
+ into buy and sell volume by each bar's own direction, shaded brighter inside
667
+ the value area. Inputs: `rows`, `widthPercent`, `placement`
668
+ (`"right" | "left"`, visible scope only), `valueAreaPercent`, `upColor`,
669
+ `downColor`, `valueAreaOpacity`, `outsideOpacity`, `showPoc`, `pocColor`,
670
+ `showValueArea`, `valueAreaColor`, `showLabels`.
671
+
672
+ OHLCV bars carry no intrabar detail, so each bar's volume is spread evenly over
673
+ the rows its high–low range touches — the same approximation TradingView makes
674
+ when building a profile from candles rather than ticks.
675
+
676
+ ### `session-levels`
677
+
678
+ The reference prices marked up before the open: prior-day high/low/close
679
+ (PDH/PDL/PDC), overnight high/low (ONH/ONL), the opening range (ORH/ORL) and
680
+ optionally the initial balance (IBH/IBL, first hour).
681
+
682
+ ```ts
683
+ chart.setSession({ spec: "cme-futures" });
684
+ chart.addIndicator("session-levels", { openingRangeMinutes: 30, showInitialBalance: true });
685
+ ```
686
+
687
+ Cash-session bounds are inputs (`rthStart` / `rthEnd`, default 09:30–16:00)
688
+ rather than being read from the chart's session spec: a CME futures session
689
+ runs 18:00–17:00, but the levels traders mark are relative to the 09:30 equity
690
+ open inside it. Everything in the current session outside those hours counts as
691
+ overnight.
692
+
693
+ ### `anchored-vwap`
694
+
695
+ VWAP measured from a bar you choose rather than the session open.
696
+
697
+ ```ts
698
+ chart.addIndicator("anchored-vwap", {
699
+ anchorTime: "2026-07-14T13:30:00Z", // epoch ms or ISO
700
+ showBands: true,
701
+ bandMultiplier: 2
702
+ });
703
+ ```
704
+
705
+ Without an `anchorTime` it anchors to the most recent session start, which is
706
+ just the session VWAP. Add one instance per anchor; hosts typically expose this
707
+ as a "start here" action on the bar under the cursor. Volume-less feeds fall
708
+ back to an unweighted running average rather than flatlining.
709
+
710
+ ---
711
+
647
712
  ## Time zones and trading sessions
648
713
 
649
714
  Timestamps are rendered in whatever zone you choose, and the chart can be told
@@ -724,6 +789,7 @@ chart.startReplay({ fromTimeMs: Date.parse("2026-07-14T13:30:00Z"), speed: 4 });
724
789
  chart.replayPlay(); // 4 bars per second
725
790
  chart.replayStep(1); // or step by hand
726
791
  chart.replayStep(-1); // rewind
792
+ chart.replaySeek(1200); // jump straight to a bar (scrubbers, "replay from here")
727
793
  chart.onReplayStateChange((s) => {
728
794
  label.textContent = `${s.index + 1}/${s.total}${s.atEnd ? " (end)" : ""}`;
729
795
  });
@@ -734,6 +800,16 @@ Live bars arriving during replay are buffered rather than shown, and are all
734
800
  present when replay stops. Without `fromIndex`/`fromTimeMs` replay starts 70%
735
801
  of the way through the series.
736
802
 
803
+ While replay is active the chart also takes the arrow keys and Space: arrows
804
+ step the tape (Shift steps 10) instead of panning, and Space toggles playback.
805
+ Both revert to normal as soon as replay stops, and `keyboard.replay: false`
806
+ turns them off. Stepping one bar at a time is the wrong tool for covering
807
+ distance, so pair them with `replaySeek` for a scrubber:
808
+
809
+ ```ts
810
+ scrubber.oninput = () => chart.replaySeek(Number(scrubber.value));
811
+ ```
812
+
737
813
  ---
738
814
 
739
815
  ## Price alerts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.145",
3
+ "version": "0.1.147",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",
@@ -22,7 +22,7 @@
22
22
  "build": "tsup src/index.ts --format esm,cjs --dts --clean && cp \"./dist/index.js\" \"./dist/hyperprop-charting-library.js\" && cp \"./dist/index.cjs\" \"./dist/hyperprop-charting-library.cjs\" && cp \"./dist/index.d.ts\" \"./dist/hyperprop-charting-library.d.ts\"",
23
23
  "dev": "tsup src/index.ts --format esm,cjs --dts --watch --onSuccess \"cp ./dist/index.js ./dist/hyperprop-charting-library.js && cp ./dist/index.cjs ./dist/hyperprop-charting-library.cjs && cp ./dist/index.d.ts ./dist/hyperprop-charting-library.d.ts\"",
24
24
  "typecheck": "tsc -p tsconfig.json --noEmit",
25
- "test": "npx tsx src/time.test.mjs"
25
+ "test": "npx tsx src/time.test.mjs && npx tsx src/indicators.test.mjs"
26
26
  },
27
27
  "devDependencies": {
28
28
  "tsup": "^8.5.0"