@barchart/chart-lib 2.106.1 → 2.183.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.
@@ -16,6 +16,20 @@ declare module "@barchart/chart-lib" {
16
16
  */
17
17
  export function formatPriceWithDecimals(price: number, decimals: number): string;
18
18
 
19
+ /**
20
+ * Helps if you need to know whether there's open interest for a symbol
21
+ * @param symbol A symbol name
22
+ * @returns True if the symbol has open interest
23
+ */
24
+ export function hasOpenInterest(symbol: string): boolean;
25
+
26
+ /**
27
+ *
28
+ * @param symbols An array of symbol names
29
+ * @returns {MetaData} A combination of sorts of the individual `MetaData` for each of the symbols; for example, if you had an expression involving 3 symbols the combined `MetaData` would have max decimals of all the symbols involved.
30
+ */
31
+ export function getCombinedMetaData(symbols: string[]): MetaData;
32
+
19
33
  export type FundamentalType =
20
34
  | "AccountsPayable"
21
35
  | "AccruedExpenses"
@@ -255,7 +269,7 @@ declare module "@barchart/chart-lib" {
255
269
  | "TR"
256
270
  | "IMPVOL"
257
271
  | "CTM"
258
- | "GPMI"
272
+ | "CPMI"
259
273
  | "CTLTM"
260
274
  | "CTLTMF"
261
275
  | "DEMA"
@@ -295,7 +309,7 @@ declare module "@barchart/chart-lib" {
295
309
  | "LINRLOW"
296
310
  | "CSHO"
297
311
  | "CSHB"
298
- | "GTPI"
312
+ | "CTPI"
299
313
  | "TCHRE"
300
314
  | "PCTCHG"
301
315
  | "ATRMA"
@@ -305,6 +319,7 @@ declare module "@barchart/chart-lib" {
305
319
  | "VSTOPLOW"
306
320
  | "SUPTR"
307
321
  | "BARCOLIX"
322
+ | "BARKIND"
308
323
  | "CONVLN"
309
324
  | "BASELN"
310
325
  | "LEADSP1"
@@ -323,7 +338,15 @@ declare module "@barchart/chart-lib" {
323
338
  | "BOLLSQ"
324
339
  | "TTMSQZON"
325
340
  | "TTMSQZOFF"
326
- | "TTMSQZOSC";
341
+ | "TTMSQZOSC"
342
+ | "CRS"
343
+ | "CRSAVG"
344
+ | "JPIB"
345
+ | "JPIS"
346
+ | "DRS"
347
+ | "MRS"
348
+ | "PMO"
349
+ | "PMOS";
327
350
 
328
351
  export type GeneralFieldId =
329
352
  | "DateTime"
@@ -434,7 +457,7 @@ declare module "@barchart/chart-lib" {
434
457
  | "PIVPTS"
435
458
  | "IMPVOL"
436
459
  | "CTM"
437
- | "GPMI"
460
+ | "CPMI"
438
461
  | "DEMA"
439
462
  | "TEMA"
440
463
  | "TSI"
@@ -450,7 +473,7 @@ declare module "@barchart/chart-lib" {
450
473
  | "LINRCHN"
451
474
  | "CSHO"
452
475
  | "CSHB"
453
- | "GTPI"
476
+ | "CTPI"
454
477
  | "TCHRE"
455
478
  | "PCTCHG"
456
479
  | "OPINT"
@@ -465,7 +488,13 @@ declare module "@barchart/chart-lib" {
465
488
  | "DOSC"
466
489
  | "MARIB"
467
490
  | "HASMO"
468
- | "TTMSQZ";
491
+ | "TTMSQZ"
492
+ | "CRS"
493
+ | "JPI"
494
+ | "CTTP"
495
+ | "DRS"
496
+ | "MRS"
497
+ | "PMO";
469
498
 
470
499
  type PlotType =
471
500
  | "Symbol"
@@ -678,6 +707,10 @@ declare module "@barchart/chart-lib" {
678
707
  annotationTraits?: AnnotationTraitsModel;
679
708
  /** Obsolete, please ignore. */
680
709
  curveTraits?: any[];
710
+ /** Will be `true` when all annotations are not supposed to move; their other properties, like line width, fill color etc. can still be changed.
711
+ * @default false
712
+ */
713
+ allAnnotationsLocked: boolean;
681
714
  };
682
715
 
683
716
  export type AnnotationModel = {
@@ -749,8 +782,11 @@ declare module "@barchart/chart-lib" {
749
782
  CH_CHTNEEDSCONTEXTMENU: string;
750
783
  CH_ANNSELECTIONCHANGED: string;
751
784
  CH_ANNPOINTPICKED: string;
785
+ CH_ANNMODIFIEDBYTOOL: string;
752
786
  CH_PANEHEIGHTSCHANGED: string;
753
787
  CH_PANESREORDERED: string;
788
+ CH_AXISSCALECHANGED: string;
789
+ CH_CHTLAYOUTCHANGED: string;
754
790
  CH_NODATAFORMAINSYMBOL: string;
755
791
  CH_CARDPLOTCLICKED: string;
756
792
  CH_CARDPLOTREMOVED: string;
@@ -767,6 +803,7 @@ declare module "@barchart/chart-lib" {
767
803
  TS_MANYCHANGED: string;
768
804
  TS_DATAPOINTADDED: string;
769
805
  TS_DATAPOINTCHANGED: string;
806
+ TS_TIMELINECORRECTION: string;
770
807
  TS_EVENTSCHANGED: string;
771
808
  MD_ALL: string;
772
809
  MD_CHANGED: string;
@@ -886,8 +923,20 @@ declare module "@barchart/chart-lib" {
886
923
 
887
924
  type HostingModel = "Page" | "Application";
888
925
 
926
+ type Environment = "Browser" | "NodeJs";
927
+
928
+ /**
929
+ * How should volume bars be colored:
930
+ * - `OpenToClose` same as main plot with `CurveAttribute` set to `OpenVsClose`
931
+ * - `CloseToClose` same as main plot with `CurveAttribute` set to `ChangeBased`
932
+ *
933
+ * By default, this is unset and the volume coloring will be identical to the main plot's bar coloring. This value will only be used when the main plot does _not_ have any bar coloring set (for example, when the main plot is a line or an area plot).
934
+ */
935
+ export type DefaultVolumeBarColoring = "OpenToClose" | "CloseToClose";
936
+
889
937
  /** The configuration is extensively documented at our documentation site. */
890
938
  interface Config {
939
+ environment?: Environment;
891
940
  validateInput?: boolean;
892
941
  throttleMillis?: number;
893
942
  isAlt64?: boolean;
@@ -910,7 +959,10 @@ declare module "@barchart/chart-lib" {
910
959
  useAllFieldsForComparison?: boolean;
911
960
  credentials?: ICredentials;
912
961
  apiKey?: string;
962
+ defaultVolumeBarColoring?: DefaultVolumeBarColoring;
963
+ colorfulAnnotations?: boolean;
913
964
  fetch?(kind: UrlKind, relativeUrl: string): Promise<string>;
965
+ getCustomEventPopup(view: any): CustomEventPopup | null;
914
966
  }
915
967
 
916
968
  /** How should the chart be initialized on startup (if at all). Please note that this is suited for cases where the `template` is already made such that it matches the type of the main plot. This is not an issue: if the template doesn't match (main plot is set to a different kind of plot) the main plot will be replaced by the desired plot with all the values set to their defaults. */
@@ -985,6 +1037,11 @@ declare module "@barchart/chart-lib" {
985
1037
  data: string;
986
1038
  };
987
1039
 
1040
+ /** Additional attributes sometimes needed for drawing.
1041
+ * - `ChangeBased`: when coloring bars, we need to know if the price movement was up or down; use the `Change` field to decide. Also known as 'Close-to-Close'.
1042
+ * - `OpenVsClose`: like preceding phrase, but use `Open` and `Close` field values of the bar to decide. Also known as 'Open-to-Close'.
1043
+ * The two attibutes are mutually exclusive, but we _may_ add new attributes which will be independent.
1044
+ */
988
1045
  type CurveAttribute = "ChangeBased" | "OpenVsClose";
989
1046
 
990
1047
  type CurveZone = {
@@ -998,11 +1055,6 @@ declare module "@barchart/chart-lib" {
998
1055
 
999
1056
  /** Curve is the second most important concept of the chart. It's a smallest drawable unit of time-series data. Most plots consist of several curves, each using a portion of the time-series fields associated with the plot. */
1000
1057
  export interface Curve {
1001
- /** Additional attributes sometimes needed for drawing.
1002
- * - `ChangeBased`: when deciding whether the price movement was up or down, use the `Change` field to decide.
1003
- * - `OpenVsClose`: like preceding phrase, but use `Open` and `Close` field values of the two consequtive bars to decide whether the trend is up or down.
1004
- * The preceding two attibutes are mutually exclusive, but this is not a rule, just an accident.
1005
- */
1006
1058
  attributes?: CurveAttribute[];
1007
1059
  /** The way the curve is drawn. */
1008
1060
  style?: CurveStyle;
@@ -1105,13 +1157,16 @@ declare module "@barchart/chart-lib" {
1105
1157
  dashStyle?: DashStyle;
1106
1158
  }
1107
1159
 
1160
+ export interface ICrosshairContext {
1161
+ crosshair: Orientation;
1162
+ horizontal?: CrosshairProperties;
1163
+ vertical?: CrosshairProperties;
1164
+ haloTracking?: boolean;
1165
+ }
1166
+
1108
1167
  export interface CrosshairAccessor {
1109
1168
  id: string;
1110
- context: {
1111
- crosshair: Orientation;
1112
- horizontal?: CrosshairProperties;
1113
- vertical?: CrosshairProperties;
1114
- };
1169
+ context: ICrosshairContext | { id: "Get" };
1115
1170
  }
1116
1171
 
1117
1172
  export type Orientation = "vertical" | "horizontal" | "both" | "none";
@@ -1154,6 +1209,7 @@ declare module "@barchart/chart-lib" {
1154
1209
  export interface OtherAccessor {
1155
1210
  id: string;
1156
1211
  context: {
1212
+ id?: "Get" | "Update";
1157
1213
  /**
1158
1214
  * Deprecated. Use comparisonMode instead
1159
1215
  */
@@ -1166,6 +1222,7 @@ declare module "@barchart/chart-lib" {
1166
1222
  showNavigator?: boolean;
1167
1223
  plotHover?: boolean;
1168
1224
  showGoToLatest?: boolean;
1225
+ allAnnotationsLocked?: boolean;
1169
1226
  };
1170
1227
  }
1171
1228
 
@@ -1207,6 +1264,7 @@ declare module "@barchart/chart-lib" {
1207
1264
  id: string;
1208
1265
  context: {
1209
1266
  plots?: ICompareItem[];
1267
+ alignOnExpirations?: boolean;
1210
1268
  };
1211
1269
  }
1212
1270
 
@@ -1224,6 +1282,7 @@ declare module "@barchart/chart-lib" {
1224
1282
  id: "Delete" | "Update" | "Duplicate" | "List";
1225
1283
  uid?: string;
1226
1284
  visible?: boolean;
1285
+ locked?: boolean;
1227
1286
  traits?: AnnotationTraits;
1228
1287
  extras?: {
1229
1288
  [k: string]: any;
@@ -1380,14 +1439,18 @@ declare module "@barchart/chart-lib" {
1380
1439
 
1381
1440
  export type AnnotationId =
1382
1441
  | "Line"
1442
+ | "Ray"
1443
+ | "GannLine"
1383
1444
  | "VerticalLine"
1384
1445
  | "HorizontalLine"
1385
1446
  | "FiftyPercentLine"
1386
1447
  | "LongPosition"
1387
1448
  | "ShortPosition"
1388
1449
  | "FibonacciRetracement"
1450
+ | "TrendBasedFibExtension"
1389
1451
  | "FibonacciFan"
1390
1452
  | "FibonacciArcs"
1453
+ | "FibonacciChannel"
1391
1454
  | "GannFan"
1392
1455
  | "SpeedResistanceFan"
1393
1456
  | "SpeedResistanceArcs"
@@ -1399,23 +1462,35 @@ declare module "@barchart/chart-lib" {
1399
1462
  | "SymbolArrowDown"
1400
1463
  | "SymbolArrowRight"
1401
1464
  | "SymbolArrowLeft"
1465
+ | "SymbolArrowHorizontal"
1466
+ | "SymbolArrowVertical"
1402
1467
  | "SymbolArcDown"
1403
1468
  | "SymbolArcUp"
1404
1469
  | "SymbolThumbsUp"
1405
1470
  | "SymbolThumbsDown"
1471
+ | "SymbolZero"
1406
1472
  | "SymbolOne"
1407
1473
  | "SymbolTwo"
1408
1474
  | "SymbolThree"
1409
1475
  | "SymbolFour"
1410
1476
  | "SymbolFive"
1477
+ | "SymbolSix"
1478
+ | "SymbolSeven"
1479
+ | "SymbolEight"
1480
+ | "SymbolNine"
1411
1481
  | "SymbolQuestion"
1412
1482
  | "SymbolFishHook"
1413
1483
  | "FibonacciTimeZones"
1414
1484
  | "Text"
1415
- | "ComputedText";
1485
+ | "ComputedText"
1486
+ | "DateRange"
1487
+ | "PriceRange"
1488
+ | "DatePriceRange"
1489
+ | "GannBox"
1490
+ | "GannSquare";
1416
1491
 
1417
1492
  export interface AnnotationPoint {
1418
- /** Price (y) coordianate. */
1493
+ /** Price (y) coordinate. */
1419
1494
  price: number;
1420
1495
  /** Time (x) coordinate. Number because it is a JavaScript Date, milliseconds since Unix epoch. */
1421
1496
  time: number;
@@ -1429,10 +1504,12 @@ declare module "@barchart/chart-lib" {
1429
1504
  points: AnnotationPoint[];
1430
1505
  traits: AnnotationTraits;
1431
1506
  visible: boolean;
1507
+ locked: boolean;
1432
1508
  }
1433
1509
 
1434
1510
  export interface AnnotationTraits {
1435
1511
  line?: LineTrait;
1512
+ line2?: LineTrait;
1436
1513
  fill?: FillTrait;
1437
1514
 
1438
1515
  fill2?: FillTrait;
@@ -1452,6 +1529,15 @@ declare module "@barchart/chart-lib" {
1452
1529
  showPercentDiff?: boolean;
1453
1530
 
1454
1531
  showTrendline?: boolean;
1532
+ drawBorder?: boolean;
1533
+ showLeftLabels?: boolean;
1534
+ showRightLabels?: boolean;
1535
+ showTopLabels?: boolean;
1536
+ showBottomLabels?: boolean;
1537
+ showAngles?: boolean;
1538
+ reverse?: boolean;
1539
+ showRangesRatio?: boolean;
1540
+
1455
1541
  factors?: Array<{ shown: boolean; value: number }>;
1456
1542
  }
1457
1543
 
@@ -1462,6 +1548,8 @@ declare module "@barchart/chart-lib" {
1462
1548
  traits: AnnotationTraits;
1463
1549
  extras: any;
1464
1550
  points: AnnotationPoint[];
1551
+ locked: boolean;
1552
+ visible: boolean;
1465
1553
  chart: ChartAccessor;
1466
1554
  }
1467
1555
 
@@ -1469,6 +1557,55 @@ declare module "@barchart/chart-lib" {
1469
1557
 
1470
1558
  export type RenderTo = string | HTMLElement;
1471
1559
 
1560
+ /**
1561
+ * Base class for the custom event popups. If you need to show custom events on a chart, you will likely
1562
+ * want to derive from this class and then override @func showValue and @func hideValue methods
1563
+ */
1564
+ export class CustomEventPopup {
1565
+ /** For internal use only */
1566
+ view: any;
1567
+ /** The date of the event */
1568
+ date: Date;
1569
+ /** The value of the event; opaque, chart does not interpret this in any way */
1570
+ value: any;
1571
+ /** Whether the popup is currently shown on the screen */
1572
+ visible: boolean;
1573
+ /** The popup HTML elements hosting the content */
1574
+ popupElement: HTMLElement;
1575
+ constructor(view: any);
1576
+ /** Initial DOM setup; override if you need any additional initialization */
1577
+ initialize();
1578
+ /** Called when a value needs to be "shown"; basically means you should populate the DOM with the
1579
+ * content, won't be called if the @member value doesn't change
1580
+ */
1581
+ showValue();
1582
+ /** Called when hiding the popup, in case you need to do anything (most often you don't) */
1583
+ hideValue();
1584
+ }
1585
+
1586
+ /**
1587
+ * Creates a DOM element and appends it into the @see element
1588
+ * @param element DOM element to append the newly created element into
1589
+ * @param nodeName Name of the DOM element to create
1590
+ * @returns Newly created DOM element
1591
+ */
1592
+ export function appendDOMElement<N extends keyof HTMLElementTagNameMap>(
1593
+ element: HTMLElement,
1594
+ nodeName: N
1595
+ ): HTMLElement;
1596
+ /**
1597
+ * Apply styles to a given DOM element
1598
+ * @param element Element to style
1599
+ * @param styles Key-value paris of styles to apply
1600
+ */
1601
+ export function styleDOMElement(element: HTMLElement, styles: object): void;
1602
+ /**
1603
+ * Apply attributes to a given DOM element
1604
+ * @param element DOM element whose attributes are to be set
1605
+ * @param attributes Key-value pairs of attributes and values to apply
1606
+ */
1607
+ export function setAttributesDOMElement(element: HTMLElement, attributes: object): void;
1608
+
1472
1609
  /** Chart accessor is the main API entry point, it essentially _is_ the chart. */
1473
1610
  export class ChartAccessor {
1474
1611
  /** The only parameter for construction is `headless` which if set to `true` will create a chart without any kind of visual representation. This form of a chart is useful for template editors which don't render any content. */
@@ -1503,6 +1640,16 @@ declare module "@barchart/chart-lib" {
1503
1640
  print(options: { title: TitleOptions }): void;
1504
1641
  /** Reserved for internal use. */
1505
1642
  fromModel(model: ChartModel): void;
1643
+ /** Returns `true` if @see undo method could be called in order to undo the last change to an annotation */
1644
+ canUndo: boolean;
1645
+ /** Returns `true` if @see redo method could be called in order to redo the last change to an annotation */
1646
+ canRedo: boolean;
1647
+ /** Reverts the last change made to any annotation */
1648
+ undo(): void;
1649
+ /** Does again the last change undone to an annotation */
1650
+ redo(): void;
1651
+ /** Starts (or resets) the interactive zoom */
1652
+ zoom(zoomIn: boolean);
1506
1653
  }
1507
1654
 
1508
1655
  export enum SeriesKind {
@@ -1799,6 +1946,9 @@ declare module "@barchart/chart-lib" {
1799
1946
  /** So you don't have to store the instance of the data feed - just call this method. The data feed is your root entry point to all APIs. */
1800
1947
  function getFeed<T extends BaseDataFeed>(): T | null;
1801
1948
 
1949
+ /** Shuts down the data feed, severing any and all connections to server(s). For performance reasons, should almost never be called. */
1950
+ function shutdownFeed(): void;
1951
+
1802
1952
  export interface IChartOutline {
1803
1953
  isTemplate: boolean;
1804
1954
  isDefinition: boolean;
@@ -1948,10 +2098,12 @@ declare module "@barchart/chart-lib" {
1948
2098
  | "HollowCandles"
1949
2099
  | "HeikinAshi"
1950
2100
  | "ElderImpulseSystem"
1951
- | "Renko";
1952
- /*| "LineBreak"
2101
+ | "Renko"
2102
+ | "Range"
2103
+ | "LineBreak"
1953
2104
  | "Kagi"
1954
- | "PointAndFigure";*/
2105
+ | "PointAndFigure"
2106
+ | "Baseline";
1955
2107
 
1956
2108
  interface Taxonomies {
1957
2109
  studies: Study[];
@@ -2209,6 +2361,7 @@ declare module "@barchart/chart-lib" {
2209
2361
  export {
2210
2362
  initFeed,
2211
2363
  getFeed,
2364
+ shutdownFeed,
2212
2365
  getChartOutline,
2213
2366
  BarchartSiteDataFeed,
2214
2367
  MarketDataFeed,