acttrader-charts 1.2.0-beta.6 → 1.2.0-beta.7
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/README.md +26 -4
- package/dist/{MACD-j_q5rnM0.d.cts → MACD-wDy-dPD_.d.cts} +23 -0
- package/dist/{MACD-j_q5rnM0.d.ts → MACD-wDy-dPD_.d.ts} +23 -0
- package/dist/index.cjs +36 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +36 -11
- package/dist/index.js.map +1 -1
- package/dist/indicators/index.d.cts +2 -2
- package/dist/indicators/index.d.ts +2 -2
- package/dist/webview/chart.html +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -141,7 +141,26 @@ Auto-reconnects with exponential backoff (2 s → 30 s). Stream status is reflec
|
|
|
141
141
|
To push ticks directly without an adapter (e.g. from your own WebSocket handler):
|
|
142
142
|
|
|
143
143
|
```ts
|
|
144
|
-
chart.pushTick({
|
|
144
|
+
chart.pushTick({ B: 1.2055, A: 1.2057, T: Date.now() });
|
|
145
|
+
|
|
146
|
+
// Exchange/dealing feeds: include the last traded price/volume on trade ticks —
|
|
147
|
+
// consumed when the chart is configured with `tickClosePriceSource: 'ltp'`.
|
|
148
|
+
chart.pushTick({ B: 1.2055, A: 1.2057, T: Date.now(), LTP: 1.2056, LTPV: 120 });
|
|
149
|
+
|
|
150
|
+
// Dealing-feed setup — candle-source toggle + independent line checks:
|
|
151
|
+
const dealingChart = new ChartEngine({
|
|
152
|
+
container,
|
|
153
|
+
// "Show chart by" toggle: 'ltp' | 'ask' | 'bid' (candle close/high/low source)
|
|
154
|
+
tickClosePriceSource: 'ltp',
|
|
155
|
+
// Chart line checkboxes — each price line is independent:
|
|
156
|
+
showAskLine: true, // Show AskLine
|
|
157
|
+
showBidLine: true, // Show BidLine
|
|
158
|
+
showLtpPrice: true, // Show LTP Line (dashed line + axis tag)
|
|
159
|
+
});
|
|
160
|
+
// ...and at runtime:
|
|
161
|
+
dealingChart.setShowAskLine(false); // hide the ask line
|
|
162
|
+
dealingChart.setShowBidLine(true); // show the bid line
|
|
163
|
+
dealingChart.setShowLtpPrice(true); // show the LTP line
|
|
145
164
|
```
|
|
146
165
|
|
|
147
166
|
### Compare symbols
|
|
@@ -382,8 +401,11 @@ chart.on('orderLineMoved', ({ label, fromTimestamp, toTimestamp, data }) => {
|
|
|
382
401
|
| `themeOverrides` | | — | Deep-partial color overrides applied on top of the built-in dark/light themes |
|
|
383
402
|
| `uiConfig` | | `DEFAULT_UI_CONFIG` | Deep-partial size / font overrides per component |
|
|
384
403
|
| `labels` | | `DEFAULT_LABELS` | Deep-partial string overrides for i18n/translation |
|
|
385
|
-
| `tickClosePriceSource` | | `"bid"` | Which
|
|
386
|
-
| `
|
|
404
|
+
| `tickClosePriceSource` | | `"bid"` | Which price drives live tick close/high/low: `"bid"`, `"ask"`, or `"ltp"` (build candles from the last traded price — exchange/dealing feeds; ticks without a valid LTP fall back to the bid) |
|
|
405
|
+
| `showLtpPrice` | | unset | Show the LTP marker (dashed price line + axis tag). Unset: shown only in `"ltp"` mode. `true`: always shown when the feed supplies an LTP. `false`: hidden even in `"ltp"` mode (candles still build from the LTP). Toggle at runtime with `chart.setShowLtpPrice(show)` |
|
|
406
|
+
| `showBidAskLines` | | `false` | **Deprecated** — show both bid and ask as dashed lines during a live stream. Prefer the per-line checks `showAskLine` / `showBidLine`, which override it when set |
|
|
407
|
+
| `showAskLine` | | unset | Show the Ask price line (dashed line + axis tag) independently. Unset: legacy `showBidAskLines` behavior. Toggle at runtime with `chart.setShowAskLine(show)` |
|
|
408
|
+
| `showBidLine` | | unset | Show the Bid price line (dashed line + axis tag) independently. Unset: legacy `showBidAskLines` behavior. Toggle at runtime with `chart.setShowBidLine(show)` |
|
|
387
409
|
| `showActLogo` | | `false` | Show the ACT watermark logo in the bottom-left corner |
|
|
388
410
|
| `showCandleCountdown` | | `true` | Show countdown timer on the live candle (time axis) |
|
|
389
411
|
| `candleCountdownTimeframes` | | intraday only | Timeframes where the countdown appears; `'all'` or `Timeframe[]` |
|
|
@@ -721,7 +743,7 @@ chart.isAtLiveEdge(): boolean
|
|
|
721
743
|
```ts
|
|
722
744
|
chart.connectStream(adapter: IWebSocketAdapter): this
|
|
723
745
|
chart.disconnectStream(): this
|
|
724
|
-
chart.pushTick(
|
|
746
|
+
chart.pushTick(prices: { B: number; A: number; T?: string | number; LTP?: number; LTPV?: number }): this // push a tick directly without an adapter; LTP/LTPV feed 'ltp' mode
|
|
725
747
|
```
|
|
726
748
|
|
|
727
749
|
### State Persistence
|
|
@@ -848,6 +848,14 @@ interface ChartConfig {
|
|
|
848
848
|
* to the bid.
|
|
849
849
|
*/
|
|
850
850
|
tickClosePriceSource?: 'bid' | 'ask' | 'ltp';
|
|
851
|
+
/**
|
|
852
|
+
* Show the last-traded-price (LTP) marker — dashed price line + axis tag.
|
|
853
|
+
* Defaults to following `tickClosePriceSource`: the marker is shown only in
|
|
854
|
+
* `'ltp'` mode. Set `true` to always show it when the feed supplies an LTP
|
|
855
|
+
* (even on a bid/ask-driven chart), or `false` to hide it even in `'ltp'`
|
|
856
|
+
* mode (candles still build from the LTP).
|
|
857
|
+
*/
|
|
858
|
+
showLtpPrice?: boolean;
|
|
851
859
|
/**
|
|
852
860
|
* When the combined count of open positions and pending orders exceeds this
|
|
853
861
|
* number, the position render style auto-defaults to `'dot'` (compact).
|
|
@@ -879,8 +887,23 @@ interface ChartConfig {
|
|
|
879
887
|
* When `false` (default), only the `tickClosePriceSource` side is shown.
|
|
880
888
|
* Only relevant when a live tick stream is active.
|
|
881
889
|
* Default: `false`.
|
|
890
|
+
* @deprecated Prefer the per-line checks `showAskLine` / `showBidLine`,
|
|
891
|
+
* which override this flag when set.
|
|
882
892
|
*/
|
|
883
893
|
showBidAskLines?: boolean;
|
|
894
|
+
/**
|
|
895
|
+
* Show the Ask price line (dashed line + axis tag) independently of the
|
|
896
|
+
* Bid line. Unset falls back to the legacy `showBidAskLines` behavior
|
|
897
|
+
* (both sides when `true`, only the `tickClosePriceSource` side when
|
|
898
|
+
* `false`). Toggle at runtime with `setShowAskLine()`.
|
|
899
|
+
*/
|
|
900
|
+
showAskLine?: boolean;
|
|
901
|
+
/**
|
|
902
|
+
* Show the Bid price line (dashed line + axis tag) independently of the
|
|
903
|
+
* Ask line. Unset falls back to the legacy `showBidAskLines` behavior.
|
|
904
|
+
* Toggle at runtime with `setShowBidLine()`.
|
|
905
|
+
*/
|
|
906
|
+
showBidLine?: boolean;
|
|
884
907
|
/**
|
|
885
908
|
* Show the ACT logo watermark in the bottom-left corner of the price pane.
|
|
886
909
|
* Default: `false`.
|
|
@@ -848,6 +848,14 @@ interface ChartConfig {
|
|
|
848
848
|
* to the bid.
|
|
849
849
|
*/
|
|
850
850
|
tickClosePriceSource?: 'bid' | 'ask' | 'ltp';
|
|
851
|
+
/**
|
|
852
|
+
* Show the last-traded-price (LTP) marker — dashed price line + axis tag.
|
|
853
|
+
* Defaults to following `tickClosePriceSource`: the marker is shown only in
|
|
854
|
+
* `'ltp'` mode. Set `true` to always show it when the feed supplies an LTP
|
|
855
|
+
* (even on a bid/ask-driven chart), or `false` to hide it even in `'ltp'`
|
|
856
|
+
* mode (candles still build from the LTP).
|
|
857
|
+
*/
|
|
858
|
+
showLtpPrice?: boolean;
|
|
851
859
|
/**
|
|
852
860
|
* When the combined count of open positions and pending orders exceeds this
|
|
853
861
|
* number, the position render style auto-defaults to `'dot'` (compact).
|
|
@@ -879,8 +887,23 @@ interface ChartConfig {
|
|
|
879
887
|
* When `false` (default), only the `tickClosePriceSource` side is shown.
|
|
880
888
|
* Only relevant when a live tick stream is active.
|
|
881
889
|
* Default: `false`.
|
|
890
|
+
* @deprecated Prefer the per-line checks `showAskLine` / `showBidLine`,
|
|
891
|
+
* which override this flag when set.
|
|
882
892
|
*/
|
|
883
893
|
showBidAskLines?: boolean;
|
|
894
|
+
/**
|
|
895
|
+
* Show the Ask price line (dashed line + axis tag) independently of the
|
|
896
|
+
* Bid line. Unset falls back to the legacy `showBidAskLines` behavior
|
|
897
|
+
* (both sides when `true`, only the `tickClosePriceSource` side when
|
|
898
|
+
* `false`). Toggle at runtime with `setShowAskLine()`.
|
|
899
|
+
*/
|
|
900
|
+
showAskLine?: boolean;
|
|
901
|
+
/**
|
|
902
|
+
* Show the Bid price line (dashed line + axis tag) independently of the
|
|
903
|
+
* Ask line. Unset falls back to the legacy `showBidAskLines` behavior.
|
|
904
|
+
* Toggle at runtime with `setShowBidLine()`.
|
|
905
|
+
*/
|
|
906
|
+
showBidLine?: boolean;
|
|
884
907
|
/**
|
|
885
908
|
* Show the ACT logo watermark in the bottom-left corner of the price pane.
|
|
886
909
|
* Default: `false`.
|
package/dist/index.cjs
CHANGED
|
@@ -23460,6 +23460,7 @@ var _ChartEngine = class _ChartEngine {
|
|
|
23460
23460
|
this._targetViewport = { ...this.viewport };
|
|
23461
23461
|
this.maxSubPanes = config.maxSubPanes ?? 3;
|
|
23462
23462
|
this.tickClosePriceSource = config.tickClosePriceSource ?? "bid";
|
|
23463
|
+
this.showLtpPrice = config.showLtpPrice;
|
|
23463
23464
|
this.tradesThresholdForHorizontalLine = config.tradesThresholdForHorizontalLine ?? 2;
|
|
23464
23465
|
if (config.positionRenderStyle === "line" || config.positionRenderStyle === "dot") {
|
|
23465
23466
|
this.positionRenderStyleOverride = config.positionRenderStyle;
|
|
@@ -23479,6 +23480,8 @@ var _ChartEngine = class _ChartEngine {
|
|
|
23479
23480
|
}
|
|
23480
23481
|
this.recomputeRenderStyle();
|
|
23481
23482
|
this.showBidAskLines = config.showBidAskLines ?? false;
|
|
23483
|
+
this.showAskLine = config.showAskLine;
|
|
23484
|
+
this.showBidLine = config.showBidLine;
|
|
23482
23485
|
this.showActLogo = config.showActLogo ?? false;
|
|
23483
23486
|
this.hideLevelConfirmCancel = config.hideLevelConfirmCancel ?? false;
|
|
23484
23487
|
this.deselectActiveOnOutsideClick = config.deselectActiveOnOutsideClick ?? false;
|
|
@@ -25593,6 +25596,29 @@ var _ChartEngine = class _ChartEngine {
|
|
|
25593
25596
|
this.streamAdapter = null;
|
|
25594
25597
|
return this;
|
|
25595
25598
|
}
|
|
25599
|
+
/** Show/hide the LTP (last traded price) marker — dashed line + axis tag.
|
|
25600
|
+
* `true` always shows it when the feed supplies an LTP, `false` hides it
|
|
25601
|
+
* even in `'ltp'` mode; pass `undefined` to restore the default
|
|
25602
|
+
* (shown only when `tickClosePriceSource` is `'ltp'`). */
|
|
25603
|
+
setShowLtpPrice(show) {
|
|
25604
|
+
this.showLtpPrice = show;
|
|
25605
|
+
this.scheduleRender();
|
|
25606
|
+
return this;
|
|
25607
|
+
}
|
|
25608
|
+
/** Show/hide the Ask price line (dashed line + axis tag). Pass `undefined`
|
|
25609
|
+
* to restore the legacy `showBidAskLines` fallback. */
|
|
25610
|
+
setShowAskLine(show) {
|
|
25611
|
+
this.showAskLine = show;
|
|
25612
|
+
this.scheduleRender();
|
|
25613
|
+
return this;
|
|
25614
|
+
}
|
|
25615
|
+
/** Show/hide the Bid price line (dashed line + axis tag). Pass `undefined`
|
|
25616
|
+
* to restore the legacy `showBidAskLines` fallback. */
|
|
25617
|
+
setShowBidLine(show) {
|
|
25618
|
+
this.showBidLine = show;
|
|
25619
|
+
this.scheduleRender();
|
|
25620
|
+
return this;
|
|
25621
|
+
}
|
|
25596
25622
|
/** Push a live bid/ask tick directly — no adapter needed.
|
|
25597
25623
|
* Pass `T` from your feed as the server timestamp (ISO string or Unix ms)
|
|
25598
25624
|
* to avoid system clock skew causing premature candle formation.
|
|
@@ -27706,20 +27732,19 @@ var _ChartEngine = class _ChartEngine {
|
|
|
27706
27732
|
let primaryPriceBoxW = 0;
|
|
27707
27733
|
if (this.liveBidAsk) {
|
|
27708
27734
|
const { bid, ask } = this.liveBidAsk;
|
|
27709
|
-
const
|
|
27735
|
+
const isLtpMode = this.tickClosePriceSource === "ltp";
|
|
27736
|
+
const ltpVisible = this.showLtpPrice ?? isLtpMode;
|
|
27737
|
+
const ltpPrice = ltpVisible ? this.liveLtp ?? (isLtpMode ? bid : null) : null;
|
|
27710
27738
|
const ltpColor = lastBar.close >= lastBar.open ? theme.candle.up : theme.candle.down;
|
|
27711
|
-
|
|
27712
|
-
|
|
27713
|
-
|
|
27714
|
-
|
|
27739
|
+
const askVisible = this.showAskLine ?? (this.showBidAskLines || this.tickClosePriceSource === "ask");
|
|
27740
|
+
const bidVisible = this.showBidLine ?? (this.showBidAskLines || this.tickClosePriceSource === "bid" || isLtpMode && ltpPrice == null);
|
|
27741
|
+
const bidTag = bidVisible ? drawPriceLine(bid, theme.candle.down, "") : null;
|
|
27742
|
+
const askTag = askVisible ? drawPriceLine(ask, theme.candle.up, "") : null;
|
|
27743
|
+
const ltpTag = ltpPrice != null ? drawPriceLine(ltpPrice, ltpColor, "") : null;
|
|
27744
|
+
const primary = isLtpMode ? ltpTag ?? bidTag ?? askTag : this.tickClosePriceSource === "ask" ? askTag ?? ltpTag ?? bidTag : bidTag ?? ltpTag ?? askTag;
|
|
27745
|
+
if (primary) {
|
|
27715
27746
|
primaryPriceY = primary.y;
|
|
27716
27747
|
primaryPriceBoxW = primary.boxW;
|
|
27717
|
-
} else {
|
|
27718
|
-
const price = ltpPrice ?? (this.tickClosePriceSource === "ask" ? ask : bid);
|
|
27719
|
-
const color = ltpPrice != null ? ltpColor : this.tickClosePriceSource === "ask" ? theme.candle.up : theme.candle.down;
|
|
27720
|
-
const tag = drawPriceLine(price, color, "");
|
|
27721
|
-
primaryPriceY = tag.y;
|
|
27722
|
-
primaryPriceBoxW = tag.boxW;
|
|
27723
27748
|
}
|
|
27724
27749
|
} else {
|
|
27725
27750
|
const isUp = lastBar.close >= lastBar.open;
|