@barchart/chart-lib 2.260.1 → 2.260.2

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.
@@ -537,33 +537,32 @@ declare module "@barchart/chart-lib" {
537
537
  | "IncomeStatement"
538
538
  | "Seasonal";
539
539
 
540
- export type AggregationUnit = "Tick" | "Intraday" | "Day" | "Week" | "Month" | "Quarter" | "Year";
541
- export type AggregationSpec =
542
- | "None"
543
- | "Nearest"
544
- | "Continue"
545
- | "FormT"
546
- | "PerCount"
547
- | "PerVolume"
548
- | "PerRange"
549
- | "PerSeconds";
550
-
551
- export type Aggregation = {
540
+ export enum AggregationUnit {
541
+ Tick,
542
+ Intraday,
543
+ Day,
544
+ Week,
545
+ Month,
546
+ Quarter,
547
+ Year,
548
+ }
549
+
550
+ export enum AggregationSpec {
551
+ None,
552
+ Nearest,
553
+ Continue,
554
+ FormT,
555
+ PerCount,
556
+ PerVolume,
557
+ PerRange,
558
+ PerSeconds,
559
+ }
560
+
561
+ interface AggregationCommon {
552
562
  /** Number of days/weeks etc. the data is aggregated over
553
563
  * @default 1
554
564
  */
555
565
  size?: number;
556
- /** The unit (or time period) of aggregation
557
- * @default "Day"
558
- */
559
- unit?: AggregationUnit;
560
- /** Additional info about the aggregation
561
- * @default "None"
562
- */
563
- spec?: AggregationSpec;
564
- /** If the volume is per contract or total (futures only)
565
- * @default false
566
- */
567
566
  isContractVolume?: boolean;
568
567
  /** Turn off (false) or on (true) dividends adjustment for stock data.
569
568
  * @default false
@@ -581,7 +580,42 @@ declare module "@barchart/chart-lib" {
581
580
  * @default "combined"
582
581
  */
583
582
  contractRoll?: "expiration" | "combined";
584
- };
583
+ }
584
+
585
+ export interface AggregationModel extends AggregationCommon {
586
+ /** The unit (or time period) of aggregation
587
+ * @default "Day"
588
+ */
589
+ unit?: keyof typeof AggregationUnit;
590
+ /** Additional info about the aggregation
591
+ * @default "None"
592
+ */
593
+ spec?: keyof typeof AggregationSpec;
594
+ /** If the volume is per contract or total (futures only)
595
+ * @default false
596
+ */
597
+ }
598
+
599
+ export class Aggregation implements AggregationCommon {
600
+ constructor(
601
+ unit: AggregationUnit,
602
+ size: number,
603
+ spec: AggregationSpec,
604
+ isContractVolume: boolean,
605
+ dividendsAdjust: boolean,
606
+ backAdjust: boolean,
607
+ daysToExpiration: number,
608
+ contractRoll: string
609
+ );
610
+ unit: AggregationUnit;
611
+ spec: AggregationSpec;
612
+ size: number;
613
+ isContractVolume: boolean;
614
+ dividendsAdjust: boolean;
615
+ backAdjust: boolean;
616
+ daysToExpiration: number;
617
+ contractRoll: "expiration" | "combined";
618
+ }
585
619
 
586
620
  /** A range of values, values are typically inclusive. */
587
621
  interface Range {
@@ -785,7 +819,7 @@ declare module "@barchart/chart-lib" {
785
819
 
786
820
  export type DataModel = {
787
821
  /** The way the data is aggregated across time. */
788
- aggregation: Aggregation;
822
+ aggregation: AggregationModel;
789
823
  /** Maximum number of data points to load in a first chunk (sent as-is to historical server); there is no default in the model, internally defaults to 640. */
790
824
  maxDataPoints?: number;
791
825
  /** If set, the range of time the historical data will be limited to (if supported by the historical server). */
@@ -1078,6 +1112,31 @@ declare module "@barchart/chart-lib" {
1078
1112
  studyProvider?: StudyProvider;
1079
1113
  };
1080
1114
 
1115
+ export function makeStudy(studyId: string, options: StudyOptions, innerSeries: TimeSeries): StudySeries;
1116
+ export function getStudyOptions(
1117
+ model: StudyPlotModel & { target: string },
1118
+ agg: Aggregation,
1119
+ curves?: Curve[]
1120
+ ): StudyOptions;
1121
+
1122
+ export enum ExpressionMissingBar {
1123
+ UsePrevious,
1124
+ UseNext,
1125
+ UseNone,
1126
+ }
1127
+
1128
+ export enum ExpressionRecompute {
1129
+ Minimum,
1130
+ Everything,
1131
+ Manual,
1132
+ }
1133
+
1134
+ export enum ExpressionNoDataApproach {
1135
+ NoAction,
1136
+ IgnoreTimelineOnly,
1137
+ ModelTransformRequired,
1138
+ }
1139
+
1081
1140
  /** The configuration is extensively documented at our documentation site. */
1082
1141
  interface Config {
1083
1142
  environment?: Environment;
@@ -1319,7 +1378,7 @@ declare module "@barchart/chart-lib" {
1319
1378
 
1320
1379
  export interface AggregationAccessor {
1321
1380
  id: string;
1322
- context: Aggregation;
1381
+ context: AggregationModel;
1323
1382
  }
1324
1383
 
1325
1384
  export interface PeriodAccessor {
@@ -1760,13 +1819,13 @@ declare module "@barchart/chart-lib" {
1760
1819
  popupElement: HTMLElement;
1761
1820
  constructor(view: any);
1762
1821
  /** Initial DOM setup; override if you need any additional initialization */
1763
- initialize();
1822
+ initialize(): void;
1764
1823
  /** Called when a value needs to be "shown"; basically means you should populate the DOM with the
1765
1824
  * content, won't be called if the @member value doesn't change
1766
1825
  */
1767
- showValue();
1826
+ showValue(): void;
1768
1827
  /** Called when hiding the popup, in case you need to do anything (most often you don't) */
1769
- hideValue();
1828
+ hideValue(): void;
1770
1829
  }
1771
1830
 
1772
1831
  /**
@@ -1844,13 +1903,13 @@ declare module "@barchart/chart-lib" {
1844
1903
  /** Does again the last change undone to an annotation */
1845
1904
  redo(): void;
1846
1905
  /** Pause the undo/redo mechanism */
1847
- pauseUndoRedo();
1906
+ pauseUndoRedo(): void;
1848
1907
  /** Resume the undo/redo mechanism
1849
1908
  * @param acceptLastChange Apply the last change while the undo/redo was paused
1850
1909
  * */
1851
- resumeUndoRedo(acceptLastChange: boolean);
1910
+ resumeUndoRedo(acceptLastChange: boolean): void;
1852
1911
  /** Starts (or resets) the interactive zoom */
1853
- zoom(zoomIn: boolean);
1912
+ zoom(zoomIn: boolean): void;
1854
1913
  /** Resets the chart to default template and re-applies current main plot */
1855
1914
  reset(preserveTheme: boolean): void;
1856
1915
  /** Reserved for internal use. */
@@ -2094,6 +2153,7 @@ declare module "@barchart/chart-lib" {
2094
2153
  * @returns A string representation of the price.
2095
2154
  */
2096
2155
  format(price: number, field: Field, options: any): string;
2156
+ shutdown(): void;
2097
2157
  }
2098
2158
 
2099
2159
  export interface IMetaDataSource {
@@ -2233,12 +2293,14 @@ declare module "@barchart/chart-lib" {
2233
2293
  */
2234
2294
  function parseExpression(text: string, useCache?: boolean): ExpressionSuccess | ExpressionError;
2235
2295
 
2296
+ export type ValueProviderFunc = (symbol: string, field?: string) => number | null;
2297
+
2236
2298
  /** If you would like to evaluate an expression yourself.
2237
2299
  * @param model Same as @see model property of the @see ExpressionSuccess
2238
2300
  * @param valueProvider A function which, given a symbol name, returns a price.
2239
2301
  * @returns The computed value of the expression.
2240
2302
  */
2241
- function evaluateExpression(model: ExpressionInternalModel, valueProvider: (string) => number): number;
2303
+ function evaluateExpression(model: ExpressionInternalModel, valueProvider: ValueProviderFunc): number;
2242
2304
 
2243
2305
  interface StudyMetaRange {
2244
2306
  min: number;