openalgo-charts 2.6.3 → 2.6.4

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.
@@ -766,11 +766,14 @@ interface Imbalance {
766
766
  }
767
767
  /**
768
768
  * Diagonal imbalances compare ask at P with bid one row below, and bid at P
769
- * with ask one row above. Missing rows are never bridged or synthesized.
770
- * Supply rowSize for sparse ladders; legacy callers infer the minimum observed
771
- * gap, which cannot distinguish uniformly missing rows from a coarser grid.
772
- * Positive volume against a zero opposing volume is an imbalance; zero against
773
- * zero is not. threshold is the minimum dominant-side quantity (inclusive).
769
+ * with ask one row above. A row between the bar's high and low that never
770
+ * traded holds zero volume, so a cell beside it is compared with zero (since
771
+ * 2.6.4; through 2.6.3 such a cell was not compared). The rows beyond the
772
+ * bar's high and low are not compared at all. Supply rowSize for sparse
773
+ * ladders; legacy callers infer the minimum observed gap, which cannot
774
+ * distinguish uniformly missing rows from a coarser grid. Positive volume
775
+ * against a zero opposing volume is an imbalance; zero against zero is not.
776
+ * threshold is the minimum dominant-side quantity (inclusive).
774
777
  */
775
778
  declare function diagonalImbalances(cells: readonly FootprintCell[], ratio?: number, rowSize?: number, threshold?: number): Imbalance[];
776
779
  /** Running cumulative delta across a sequence of footprint bars. */
@@ -850,6 +853,8 @@ interface FootprintSignalOptions {
850
853
  zoneEnd: FootprintZoneEnd;
851
854
  /** Whole bars that must trade completely beyond a zone before it is active for alerts. */
852
855
  zoneActiveAfter: number;
856
+ /** Zones start only in the newest this many bars (since 2.6.4). 0, the default, takes every bar. */
857
+ zoneLookback: number;
853
858
  /**
854
859
  * The newest bar is still forming: its close is not final, so it cannot end a
855
860
  * zone by closing inside it, and its high and low are not final, so it gets no
@@ -869,6 +874,12 @@ interface FootprintZone {
869
874
  endTime: number | null;
870
875
  /** Time of the bar that made it active for alerts, or null. */
871
876
  activeTime: number | null;
877
+ /**
878
+ * Time of the first bar after it became active whose high to low range
879
+ * reached it, which is when an alert fires (since 2.6.4), or null. A bar that
880
+ * jumps across the zone reaches it too, as it would trigger a stop there.
881
+ */
882
+ touchTime: number | null;
872
883
  }
873
884
  interface FootprintAuction {
874
885
  /** Time of the bar whose extreme traded on both bid and ask. */
@@ -947,9 +958,19 @@ type FootprintStatRow = 'volume' | 'bidVolume' | 'askVolume' | 'delta' | 'minDel
947
958
  /**
948
959
  * `bidask` shades both sides by volume; `imbalance` leaves cells plain and fills
949
960
  * only diagonal imbalances, shading the candle body's rows; `delta`, `deltaPct`,
950
- * `volume` and `volumeDelta` print one value per row.
961
+ * `volume`, `volumeDelta` and `deltaShadedVolume` print one value per row.
962
+ * `deltaShadedVolume` (since 2.6.4) prints the row's volume on a cell coloured
963
+ * and shaded by its delta.
951
964
  */
952
- type FootprintDisplayMode = 'bidask' | 'imbalance' | 'delta' | 'deltaPct' | 'volume' | 'volumeDelta';
965
+ type FootprintDisplayMode = 'bidask' | 'imbalance' | 'delta' | 'deltaPct' | 'volume' | 'volumeDelta' | 'deltaShadedVolume';
966
+ /** The zones `showZones` extends: stacked imbalances, multiple nodes and absorption. */
967
+ type FootprintZoneGroup = 'stacked' | 'node' | 'absorption';
968
+ /** A zone that price came back to after it became active (since 2.6.4). */
969
+ interface FootprintZoneAlert {
970
+ zone: FootprintZone;
971
+ /** Time of the bar whose range came back to the zone. */
972
+ time: number;
973
+ }
953
974
  type FootprintCellStyle = 'heatmap' | 'profile' | 'ladder';
954
975
 
955
976
  interface FootprintOptions {
@@ -1024,8 +1045,12 @@ interface FootprintOptions {
1024
1045
  flipMinDeltaPct: number;
1025
1046
  /** Extend stacked imbalances, multiple nodes and absorption to the right as zones. Default false. */
1026
1047
  showZones: boolean;
1048
+ /** Which of them `showZones` extends and alerts on (since 2.6.4). Default all three. */
1049
+ zoneKinds: readonly FootprintZoneGroup[];
1027
1050
  zoneEnd: FootprintZoneEnd;
1028
1051
  zoneActiveAfter: number;
1052
+ /** Zones start only in the newest this many bars (since 2.6.4). 0, the default, takes every bar. */
1053
+ zoneLookback: number;
1029
1054
  /** Dash-dot line at a high or low that traded on both bid and ask. Default false. */
1030
1055
  showUnfinishedAuctions: boolean;
1031
1056
  auctionHighColor?: string;
@@ -1050,6 +1075,21 @@ interface FootprintOptions {
1050
1075
  formingLastBar: boolean;
1051
1076
  buyColor?: string;
1052
1077
  sellColor?: string;
1078
+ /** Imbalanced cells, stacked imbalance brackets and stacked zones. */
1079
+ imbalanceBuyColor?: string;
1080
+ imbalanceSellColor?: string;
1081
+ /** Cells in the `volume` display mode, which otherwise take the colour of the side that traded more. */
1082
+ volumeColor?: string;
1083
+ /** The candle beside each column, and the body rows the `imbalance` mode shades. */
1084
+ candleUpColor?: string;
1085
+ candleDownColor?: string;
1086
+ /** Ask and bid bars of the visible-range profile. */
1087
+ profileAskColor?: string;
1088
+ profileBidColor?: string;
1089
+ /** Session letters in the table and the statistics cards. */
1090
+ sessionColor?: string;
1091
+ /** Background of the statistics table. */
1092
+ tableBackground?: string;
1053
1093
  pocColor: string;
1054
1094
  radius: number;
1055
1095
  }
@@ -1096,6 +1136,12 @@ declare class Footprint implements IPrimitive {
1096
1136
  private _cols;
1097
1137
  private _rc;
1098
1138
  private _inferredStep;
1139
+ private _primed;
1140
+ /** Time of the newest bar at the last `setBars`: touches from it on are live. */
1141
+ private _liveFrom;
1142
+ private readonly _alertHandlers;
1143
+ /** Zones already reported or already touched when first seen, by kind, origin and low. */
1144
+ private readonly _alerted;
1099
1145
  constructor(opts?: Partial<FootprintOptions>);
1100
1146
  attached(host: PrimitiveHost): void;
1101
1147
  detached(): void;
@@ -1105,6 +1151,18 @@ declare class Footprint implements IPrimitive {
1105
1151
  setBars(bars: readonly FootprintBar[]): void;
1106
1152
  setOptions(patch: Partial<FootprintOptions>): void;
1107
1153
  options(): FootprintOptions;
1154
+ /**
1155
+ * Called once for each zone that `showZones` extends (so nothing is reported
1156
+ * while it is off) when a bar's range comes back to it after it became active
1157
+ * (since 2.6.4), the moment to raise an alert or play a sound. The first bars
1158
+ * a footprint is given are history and report nothing; each later `setBars`
1159
+ * is read as the live tail, so a touch in the bar that was newest at the
1160
+ * previous call, or in any bar after it, is reported. `setBars([])`, or bars
1161
+ * that start again from an older bar, begin a new history. Returns the
1162
+ * unsubscribe.
1163
+ */
1164
+ onZoneAlert(handler: (alert: FootprintZoneAlert) => void): () => void;
1165
+ private _reportTouches;
1108
1166
  stats(): readonly FootprintBarStats[];
1109
1167
  /**
1110
1168
  * Multiple nodes, big orders, absorption, flips, divergence, zones and
@@ -1153,6 +1211,19 @@ declare class Footprint implements IPrimitive {
1153
1211
  hoverAt(x: number, y: number, rc?: PrimitiveRenderContext): FootprintHover | null;
1154
1212
  }
1155
1213
 
1214
+ /**
1215
+ * Named colour sets for a footprint (since 2.6.4). Each is a plain options
1216
+ * patch, so a host spreads one under its own choices:
1217
+ * `new Footprint({ ...FOOTPRINT_THEMES.ocean, displayMode: 'bidask' })`.
1218
+ * Daylight is for a light chart; the others are for a dark one. A theme sets
1219
+ * colours only, never the chart's background.
1220
+ */
1221
+
1222
+ type FootprintThemeName = 'ocean' | 'ember' | 'forest' | 'neon' | 'monochrome' | 'daylight';
1223
+ /** The colours a theme sets, each an optional `FootprintOptions` colour. */
1224
+ type FootprintThemeColors = Readonly<Pick<FootprintOptions, 'buyColor' | 'sellColor' | 'volumeColor' | 'candleUpColor' | 'candleDownColor' | 'textColor' | 'imbalanceBuyColor' | 'imbalanceSellColor' | 'lastPriceColor' | 'pocColor' | 'nodeColor' | 'divergenceColor' | 'bigOrderColor' | 'absorptionColor' | 'auctionHighColor' | 'auctionLowColor' | 'profileAskColor' | 'profileBidColor' | 'sessionColor' | 'tableBackground'>>;
1225
+ declare const FOOTPRINT_THEMES: Readonly<Record<FootprintThemeName, FootprintThemeColors>>;
1226
+
1156
1227
  /** Fixed-length bars: `seconds` each, aligned to `anchorSec` (default epoch). */
1157
1228
  interface IntervalBucketing {
1158
1229
  mode: 'interval';
@@ -1238,4 +1309,4 @@ declare class FootprintAggregator {
1238
1309
 
1239
1310
  declare const PROFILE_TIER: "profile";
1240
1311
 
1241
- export { type ClassifiedTrade, DEFAULT_FOOTPRINT_OPTIONS, DEFAULT_FOOTPRINT_SIGNAL_OPTIONS, DEFAULT_MARKET_PROFILE_OPTIONS, DEFAULT_MARKET_PROFILE_PRIMITIVE_OPTIONS, DEFAULT_VOLUME_PROFILE_FAMILY_OPTIONS, DEFAULT_VOLUME_PROFILE_PRIMITIVE_OPTIONS, type DayType, type DevelopingValue, Footprint, FootprintAggregator, type FootprintAuction, type FootprintBar, type FootprintBarSignals, type FootprintBarStats, type FootprintBuildOptions, type FootprintCell, type FootprintCellStyle, type FootprintDisplayMode, type FootprintHover, type FootprintOptions, type FootprintSignalOptions, type FootprintSignals, type FootprintStatRow, type FootprintTextColorMode, type FootprintTick, type FootprintUpdate, type FootprintZone, type FootprintZoneEnd, type FootprintZoneKind, HorizontalProfile, type HorizontalProfileOptions, type Imbalance, MarketProfile, type MarketProfileHover, type MarketProfileLevel, type MarketProfileOptions, type MarketProfilePeriod, type MarketProfilePrimitiveOptions, type MarketProfileResult, type MarketProfileSession, type MarketProfileSessionResult, type MpBlockDisplay, type MpColorMode, type OpenType, PROFILE_TIER, type ProfileLevel, type SessionWindow, type StackedImbalance, TPO_PERIOD_COLORS, TRADING_HOURS, type TpoResult, type TradeClassification, type TradePrint, type VolumeDisplayMode, VolumeProfile, type VolumeProfileFamilyOptions, type VolumeProfileFamilyResult, type VolumeProfileLevel, type VolumeProfileOptions, type VolumeProfilePrimitiveOptions, type VolumeProfileResult, type VolumeProfileSession, type VolumeProfileSessionResult, type VolumeProfileSide, bucketPrice, compactVol, computeFootprint, computeMarketProfile, computeTpo, computeVolumeProfile, computeVolumeProfileSessions, createTradeClassifier, cumulativeDelta, diagonalImbalances, footprintSignals, inWindow, nakedLevels, priceBuckets, rowOf, rowTicksFor, stackedImbalances, tpoLetter };
1312
+ export { type ClassifiedTrade, DEFAULT_FOOTPRINT_OPTIONS, DEFAULT_FOOTPRINT_SIGNAL_OPTIONS, DEFAULT_MARKET_PROFILE_OPTIONS, DEFAULT_MARKET_PROFILE_PRIMITIVE_OPTIONS, DEFAULT_VOLUME_PROFILE_FAMILY_OPTIONS, DEFAULT_VOLUME_PROFILE_PRIMITIVE_OPTIONS, type DayType, type DevelopingValue, FOOTPRINT_THEMES, Footprint, FootprintAggregator, type FootprintAuction, type FootprintBar, type FootprintBarSignals, type FootprintBarStats, type FootprintBuildOptions, type FootprintCell, type FootprintCellStyle, type FootprintDisplayMode, type FootprintHover, type FootprintOptions, type FootprintSignalOptions, type FootprintSignals, type FootprintStatRow, type FootprintTextColorMode, type FootprintThemeColors, type FootprintThemeName, type FootprintTick, type FootprintUpdate, type FootprintZone, type FootprintZoneAlert, type FootprintZoneEnd, type FootprintZoneGroup, type FootprintZoneKind, HorizontalProfile, type HorizontalProfileOptions, type Imbalance, MarketProfile, type MarketProfileHover, type MarketProfileLevel, type MarketProfileOptions, type MarketProfilePeriod, type MarketProfilePrimitiveOptions, type MarketProfileResult, type MarketProfileSession, type MarketProfileSessionResult, type MpBlockDisplay, type MpColorMode, type OpenType, PROFILE_TIER, type ProfileLevel, type SessionWindow, type StackedImbalance, TPO_PERIOD_COLORS, TRADING_HOURS, type TpoResult, type TradeClassification, type TradePrint, type VolumeDisplayMode, VolumeProfile, type VolumeProfileFamilyOptions, type VolumeProfileFamilyResult, type VolumeProfileLevel, type VolumeProfileOptions, type VolumeProfilePrimitiveOptions, type VolumeProfileResult, type VolumeProfileSession, type VolumeProfileSessionResult, type VolumeProfileSide, bucketPrice, compactVol, computeFootprint, computeMarketProfile, computeTpo, computeVolumeProfile, computeVolumeProfileSessions, createTradeClassifier, cumulativeDelta, diagonalImbalances, footprintSignals, inWindow, nakedLevels, priceBuckets, rowOf, rowTicksFor, stackedImbalances, tpoLetter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openalgo-charts",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
4
4
  "description": "From-scratch, dependency-free canvas charting engine for OpenAlgo: professional-grade interactive rendering, advanced on-chart trading, and a one-call widget tier that adds the toolbar, drawing rail, dialogs and shortcuts.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "marketcalls",