@tradecanvas/commons 1.46.0 → 1.47.0

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.
@@ -15,7 +15,7 @@ export declare const VN30F_SESSIONS: TradingSession[];
15
15
  * from the reference; zone Asia/Ho_Chi_Minh; the price board's colours
16
16
  * (`VN_COLORS`); the ATO, two continuous sessions and ATC (`HOSE_SESSIONS`).
17
17
  * With `chart.setMarket`: `setPriceLimits(reference)` for the day's ceiling
18
- * and floor, `setTimezone('exchange')` for the axis in Vietnam's time.
18
+ * and floor, `setTimeZone('exchange')` for the axis in Vietnam's time.
19
19
  */
20
20
  export declare const MARKET_HOSE: MarketConfig;
21
21
  /** HOSE ETFs and covered warrants: 10 dong at every price. */
@@ -154,10 +154,10 @@ export interface ChartOptions {
154
154
  */
155
155
  freePan?: boolean;
156
156
  /**
157
- * Timezone for the time axis, crosshair, tooltip, day breaks and range
157
+ * Time zone for the time axis, crosshair, tooltip, day breaks and range
158
158
  * presets: an IANA zone (`'America/New_York'`, daylight saving included), a
159
159
  * fixed offset in minutes east of UTC, `'exchange'` for the symbol's zone
160
- * or else its market's (`setTimezone`), or null (default) for the browser's.
160
+ * or else its market's (`setTimeZone`), or null (default) for the browser's.
161
161
  */
162
162
  timeZone?: string | number | null;
163
163
  /**
@@ -92,9 +92,9 @@ export interface DataAdapter {
92
92
  /** Optional: symbols matching `query`, best first — for a symbol search box. */
93
93
  searchSymbols?(query: string, options?: SymbolSearchOptions): Promise<SymbolInfo[]>;
94
94
  /**
95
- * Optional: what the feed knows about `symbol` (name, price step, exchange
96
- * timezone and hours), or null when it doesn't know it. A connected chart
97
- * asks for it and applies it.
95
+ * Optional: what the feed knows about `symbol` (name, price step, the
96
+ * exchange's `timeZone` and hours), or null when it doesn't know it. A
97
+ * connected chart asks for it and applies it.
98
98
  */
99
99
  resolveSymbol?(symbol: string): Promise<SymbolInfo | null>;
100
100
  /**
@@ -1,4 +1,4 @@
1
- /** A regular trading window, wall-clock times in the symbol's `timezone`. */
1
+ /** A regular trading window, wall-clock times in the symbol's `timeZone`. */
2
2
  export interface SymbolSession {
3
3
  /** Opening time, `'09:30'`. */
4
4
  start: string;
@@ -26,8 +26,14 @@ export interface SymbolInfo {
26
26
  /** Smallest price step. */
27
27
  minTick?: number;
28
28
  /** IANA zone the exchange keeps its hours in, e.g. `'America/New_York'`. */
29
+ timeZone?: string;
30
+ /**
31
+ * @deprecated Use `timeZone`, spelled as the chart's `timeZone` option is.
32
+ * Still read when `timeZone` is left out (`timeZone` comes first when both
33
+ * are given); the chart's `getSymbolInfo()` gives both.
34
+ */
29
35
  timezone?: string;
30
- /** Regular trading hours in `timezone`; none means around the clock. */
36
+ /** Regular trading hours in `timeZone`; none means around the clock. */
31
37
  sessions?: SymbolSession[];
32
38
  /** Currency prices are quoted in. */
33
39
  currency?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"symbol.d.ts","sourceRoot":"","sources":["../../src/types/symbol.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,QAAQ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 import { SymbolInfo } from '../types/symbol.js';
8
8
  export declare function rankSymbols(symbols: readonly SymbolInfo[], query: string, limit?: number, boost?: (info: SymbolInfo) => number): SymbolInfo[];
9
9
  /** Decimals in a price step: `'0.01000000'` → 2, `'1'` → 0, `1e-8` → 8. */
10
10
  export declare function stepDecimals(step: number | string): number;
11
+ /** The zone a symbol keeps its hours in: its `timeZone`, else the older `timezone`. */
12
+ export declare function symbolTimeZone(info: Pick<SymbolInfo, 'timeZone' | 'timezone'> | null | undefined): string | undefined;
11
13
  /** `'09:30'` → 570 (`'24:00'`, a day's end, → 1440), or null for anything that isn't a time of day. */
12
14
  export declare function sessionMinute(time: string): number | null;
13
15
  //# sourceMappingURL=symbols.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../../src/utils/symbols.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAWrD;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,KAAK,EAAE,MAAM,EACb,KAAK,SAAK,EACV,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,MAAM,GACnC,UAAU,EAAE,CAad;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAQ1D;AAED,uGAAuG;AACvG,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOzD"}
1
+ {"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../../src/utils/symbols.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAWrD;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,KAAK,EAAE,MAAM,EACb,KAAK,SAAK,EACV,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,MAAM,GACnC,UAAU,EAAE,CAad;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAQ1D;AAED,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAErH;AAED,uGAAuG;AACvG,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOzD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradecanvas/commons",
3
- "version": "1.46.0",
3
+ "version": "1.47.0",
4
4
  "type": "module",
5
5
  "description": "Shared types and utilities for @tradecanvas/chart",
6
6
  "license": "MIT",