-
Notifications
You must be signed in to change notification settings - Fork 3
/
barchart.chart.d.ts
2223 lines (2049 loc) · 75.2 KB
/
barchart.chart.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare module "@barchart/chart-lib" {
import PubSub from "pubsub-js";
/**
* Assists with asynchronous calls, mainly reentrancy (if you call the function multiple times you'll get back the same `Promise` object). Propagates `this` to the `work` function and uses `this` to store temporary state @see asyncStatePropName
* @param work A function which performs the actual asynchronous operation.
* @param [asyncStatePropName = "asyncReadyWork"] A property which stores the state necessary for this helper, only change if the name conflicts with the object's properties.
*/
export function asyncReady(work: () => Promise<any>, asyncStatePropName?: string): Promise<any>;
/**
* Tiny helper for the price formatting.
* @param price The price to format
* @param decimals A number of decimals to use
* @returns {string} A price formatted using the comma (`,`) as thousands separator and the dot (`.`) as the decimal separator.
*/
export function formatPriceWithDecimals(price: number, decimals: number): string;
export type FundamentalType =
| "AccountsPayable"
| "AccruedExpenses"
| "Cash"
| "CommonShares"
| "DeferredIncomeTax"
| "DeferredLongRevenues"
| "EquityOtherInvestments"
| "IncomeTaxPayable"
| "Intangibles"
| "Inventories"
| "LongTermDebt"
| "MarketableSec"
| "OtherCurrentAssets"
| "OtherCurrentLiabilities"
| "OtherEquity"
| "OtherNonCurrentAssets"
| "OtherNonCurrentLiabilities"
| "PpeNet"
| "PrepaidExpenses"
| "Receivables"
| "RetainedEarnings"
| "ShorttermDebt"
| "TotalAssets"
| "TotalCurrentAssets"
| "TotalCurrentLiabilities"
| "TotalLiabilities"
| "TotalLiabilitiesAndEquity"
| "TotalNonCurrentAssets"
| "TotalNonCurrentLiabilities"
| "TotalShareholdersEquity"
| "BasicEpsContOp"
| "BasicEpsTotalOp"
| "CostGoods"
| "DilutedEpsContOp"
| "DilutedEpsTotalOp"
| "Ebitda"
| "GrossProfit"
| "IncomeTax"
| "InterestExpense"
| "NetIncome"
| "OperatingExpenses"
| "OperatingIncome"
| "OtherIncomeExpenses"
| "PreTaxIncome"
| "Sales";
type FundamentalFrequency = "Quarter" | "Year";
export type FundamentalFieldId =
| "AccountsPayable"
| "AccruedExpenses"
| "Cash"
| "CommonShares"
| "DeferredIncomeTax"
| "DeferredLongRevenues"
| "EquityOtherInvestments"
| "IncomeTaxPayable"
| "Intangibles"
| "Inventories"
| "LongTermDebt"
| "MarketableSec"
| "OtherCurrentAssets"
| "OtherCurrentLiabilities"
| "OtherEquity"
| "OtherNonCurrentAssets"
| "OtherNonCurrentLiabilities"
| "PpeNet"
| "PrepaidExpenses"
| "Receivables"
| "RetainedEarnings"
| "ShorttermDebt"
| "TotalAssets"
| "TotalCurrentAssets"
| "TotalCurrentLiabilities"
| "TotalLiabilities"
| "TotalLiabilitiesAndEquity"
| "TotalNonCurrentAssets"
| "TotalNonCurrentLiabilities"
| "TotalShareholdersEquity"
| "BasicEpsContOp"
| "BasicEpsTotalOp"
| "CostGoods"
| "DilutedEpsContOp"
| "DilutedEpsTotalOp"
| "Ebitda"
| "GrossProfit"
| "IncomeTax"
| "InterestExpense"
| "NetIncome"
| "OperatingExpenses"
| "OperatingIncome"
| "OtherIncomeExpenses"
| "PreTaxIncome"
| "Sales";
export type StudyFieldId =
| "MA"
| "MA1"
| "MA2"
| "MA3"
| "MA4"
| "MA5"
| "MA6"
| "MA7"
| "MA8"
| "MA9"
| "MA10"
| "MAS"
| "MAL"
| "EMA"
| "MAHI"
| "MALO"
| "MACD"
| "MACDS"
| "MACDH"
| "ENVU"
| "ENVD"
| "ENVEXPU"
| "ENVEXPD"
| "ENVSMOU"
| "ENVSMOD"
| "SMA"
| "TMA"
| "WMA"
| "VOLMA"
| "OSC"
| "VOSC"
| "RSI"
| "STORSI"
| "HH"
| "LL"
| "PercK"
| "PercD"
| "PercR"
| "WGCL"
| "BOLLBU"
| "BOLLBL"
| "BOLLBM"
| "BOLLBW"
| "BOLLBP"
| "OBVOL"
| "ATR"
| "PDI"
| "MDI"
| "ADX"
| "ADXM"
| "ADL"
| "ADWM"
| "ADWMMA"
| "CHAOSC"
| "TP"
| "KCUP"
| "KCMID"
| "KCLOW"
| "KBUP"
| "KBMID"
| "KBLOW"
| "KCEUP"
| "KCEMID"
| "KCELOW"
| "DONUP"
| "DONMID"
| "DONLOW"
| "DONW"
| "PVT"
| "ROC"
| "TRIX"
| "PVPT"
| "PVPTR"
| "PVPTS"
| "ARNUP"
| "ARNLOW"
| "ARNOSC"
| "TCHNUP"
| "TCHNLOW"
| "ALJAW"
| "ALTEETH"
| "ALLIPS"
| "PLTLN"
| "AWOS"
| "AWOSMA"
| "MFMUL"
| "CLV"
| "CHAMF"
| "CHAVOL"
| "DPO"
| "CCI"
| "EMV"
| "EMVMA"
| "ERBLPOW"
| "ERBRPOW"
| "FI"
| "MI"
| "MOM"
| "MOMMA"
| "MFI"
| "MSD"
| "NVI"
| "NVIEMA"
| "PVI"
| "PVIEMA"
| "PPO"
| "PPOS"
| "PPOH"
| "PVO"
| "PVOS"
| "PVOH"
| "HV"
| "PERF"
| "WASI"
| "WWVSARU"
| "WWVSARD"
| "PARSARS"
| "PARSARL"
| "MOVLR"
| "TRSP1"
| "TRSP2"
| "PPTPIV"
| "PPTR1"
| "PPTR2"
| "PPTR3"
| "PPTS1"
| "PPTS2"
| "PPTS3"
| "COTLCCMSP"
| "COTLCLGSP"
| "COTLCSMSP"
| "COTDAGPRO"
| "COTDAGSPD"
| "COTDAGMNM"
| "COTDAGOTH"
| "COTFTRDLI"
| "COTFTRASM"
| "COTFTRLVF"
| "COTFTROTH"
| "TR"
| "IMPVOL"
| "CTM"
| "GPMI"
| "CTLTM"
| "CTLTMF"
| "DEMA"
| "TEMA"
| "TSI"
| "TSISIG"
| "ADJATR"
| "COTR"
| "GMMA3"
| "GMMA5"
| "GMMA8"
| "GMMA10"
| "GMMA12"
| "GMMA15"
| "GMMA30"
| "GMMA35"
| "GMMA40"
| "GMMA45"
| "GMMA50"
| "GMMA60"
| "MCGD"
| "HMA"
| "COPP"
| "CPPH4"
| "CPPH3"
| "CPPH2"
| "CPPH1"
| "CPPL1"
| "CPPL2"
| "CPPL3"
| "CPPL4"
| "REATRHI"
| "REATRLO"
| "BREL"
| "LINRUP"
| "LINRMID"
| "LINRLOW"
| "CSHO"
| "CSHB"
| "GTPI"
| "TCHRE"
| "PCTCHG"
| "ATRMA"
| "STOMOMIX"
| "CHDMOMOSC"
| "VSTOPUP"
| "VSTOPLOW"
| "SUPTR"
| "BARCOLIX"
| "CONVLN"
| "BASELN"
| "LEADSP1"
| "LEADSP2"
| "LAGGSP"
| "VWAP"
| "VWAPSD1U"
| "VWAPSD1L"
| "VWAPSD2U"
| "VWAPSD2L"
| "PLVI"
| "MNVI"
| "DIFA"
| "DOSCH"
| "DOSCS"
| "BOLLSQ"
| "TTMSQZON"
| "TTMSQZOFF"
| "TTMSQZOSC";
export type GeneralFieldId =
| "DateTime"
| "Open"
| "High"
| "Low"
| "Close"
| "TradeSize"
| "Volume"
| "OpenInterest"
| "Last"
| "Symbol"
| "Change"
| "PercentChange"
| "PreviousOpen"
| "PreviousClose"
| "PreviousHigh"
| "PreviousLow"
| "WeekPreviousClose"
| "WeekPreviousHigh"
| "WeekPreviousLow"
| "MonthPreviousClose"
| "MonthPreviousHigh"
| "MonthPreviousLow";
export type CurveFieldId = FundamentalFieldId | StudyFieldId | GeneralFieldId;
export type StudyId =
| "MA"
| "MACDSIG"
| "MASIG"
| "MAEXP"
| "MAHLC"
| "MACD"
| "MACDEXP"
| "VOL"
| "MAENV"
| "MAENVEXP"
| "MAENVSMO"
| "MASMO"
| "MATRI"
| "MAWEI"
| "MAVOL"
| "OSCI"
| "OSCIVOL"
| "RSI"
| "RSIMOD"
| "RSISTO"
| "STOCHF"
| "STOCHS"
| "WPERCR"
| "HHLL"
| "WGCL"
| "BBANDS"
| "BWIDTH"
| "BPERC"
| "BSQUEEZE"
| "OBVOL"
| "ATR"
| "ADX"
| "ADXMOD"
| "ADL"
| "ADWM"
| "CHAOSC"
| "TP"
| "KELCHN"
| "KELEXP"
| "KELBND"
| "DONCHN"
| "DONWIDTH"
| "PVT"
| "ROC"
| "TRIX"
| "PPMOV"
| "ARNUPDW"
| "ARNOSC"
| "TCHN"
| "ALLG"
| "PLTLN"
| "AWEOSC"
| "CLV"
| "CHAMF"
| "CHAVOL"
| "DPO"
| "CCI"
| "EMV"
| "ERBLPOW"
| "ERBRPOW"
| "FI"
| "MI"
| "MOM"
| "MFI"
| "MSD"
| "NVI"
| "PVI"
| "PPO"
| "PVO"
| "HV"
| "PERF"
| "WASI"
| "WWVOL"
| "PARTP"
| "MOVLR"
| "TRSP"
| "COTLC"
| "COTDAG"
| "COTFTR"
| "PIVPTS"
| "IMPVOL"
| "CTM"
| "GPMI"
| "DEMA"
| "TEMA"
| "TSI"
| "ADJATR"
| "COTR"
| "GMMA"
| "MCGD"
| "HMA"
| "COPP"
| "CPP"
| "REATRHI"
| "REATRLO"
| "LINRCHN"
| "CSHO"
| "CSHB"
| "GTPI"
| "TCHRE"
| "PCTCHG"
| "OPINT"
| "STOMOMIX"
| "CHDMOMOSC"
| "VSTOP"
| "SUPTR"
| "ICHCLD"
| "VWAP"
| "VOIN"
| "DIFA"
| "DOSC"
| "MARIB"
| "HASMO"
| "TTMSQZ";
type PlotType =
| "Symbol"
| "Expression"
| "Study"
| "Forward"
| "BalanceSheet"
| "IncomeStatement"
| "Seasonal"
| "Annual";
export type AggregationUnit = "Tick" | "Intraday" | "Day" | "Week" | "Month" | "Quarter" | "Year";
export type AggregationSpec =
| "None"
| "Nearest"
| "Continue"
| "FormT"
| "PerCount"
| "PerVolume"
| "PerRange"
| "PerSeconds";
export type Aggregation = {
/** Number of days/weeks etc. the data is aggregated over
* @default 1
*/
size?: number;
/** The unit (or time period) of aggregation
* @default "Day"
*/
unit?: AggregationUnit;
/** Additional info about the aggregation
* @default "None"
*/
spec?: AggregationSpec;
/** If the volume is per contract or total (futures only)
* @default false
*/
isContractVolume?: boolean;
/** Turn off (false) or on (true) dividends adjustment for stock data.
* @default false
*/
dividendsAdjust?: boolean;
/** Whether the contracts in the series will be adjusted based on the roll-gap between the closing prices of the current contract and the previous contract on the day of the switch.
* @default false
*/
backAdjust?: boolean;
/** Number of calendar days prior to a contract expiration when the series of contracts will be switched to the next contract in the series. Range: 0 to 60.
* @default 1
*/
daysToExpiration?: number;
/** For futures, multi-contract nearest queries; this parameter can be set to one of two values (`"expiration"`, `"combined"`), and determines how the switch from one contract to the next in the series is calculated.
* @default "expiration"
*/
contractRoll?: "expiration" | "combined";
};
/** A range of values, values are typically inclusive. */
interface Range {
/** Beginning of the range, _oftern_ (but not always) ECMAScript timestamp (milliseconds), can be negative. */
from: number;
/** Ending of the range, _oftern_ (but not always) ECMAScript timestamp (milliseconds), can be negative. */
to: number;
}
export type PreviousModel = {
/** Line color
* @default #000
*/
color?: string;
/** Line dash stlye
* @default "Solid"
*/
dashStyle?: DashStyle;
/** If set to `true` will enlarge the price scale range to ensure this fits on the screen.
* @default false
*/
forceVisible?: boolean;
};
export type DisplayChart = {
/** Background color of the chart.
* @default #fff
*/
backgroundColor?: string;
/** Deprecated, please ignore. */
plotBorderColor?: string;
/** Font family used for all text rendering in the chart.
* @default "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif
*/
fontFamily?: string;
/** Visual aspects of the `Previous` value drawing (this is the last value from the previous trading session or day, depending on the data source) */
previous: PreviousModel;
/** Deprecated, please ignore. */
exportUrl?: string;
/** If set to `true`, shows a small arc (cap) on the largest and smallest value in the currently visible data range.
* @default true
*/
showMinMaxArc?: boolean;
/** If set to `true`, shows a small button to the bottom right of the main pane, which when clicked, scrolls the chart all the way to the latest (newest) bar. Can be overridden by the data feed configuration.
* @default false
*/
showGoToLatest?: boolean;
/** The default height (a relative value, @see PaneModel) of panes created by chart (for example, the panes are created for you when you add a standalone study). */
newPaneHeight?: number;
/** Will draw a focus point at the value the crosshair is pointing at, if crosshair is visible and the curve style is Line or Area. */
plotHover?: boolean;
/** If set to `true`, will display a red bold text `No Data` in the middle of the chart when there is no error but no data was loaded for a given symbol. No default, if not set internally defaults to `true`. */
showNoDataText?: boolean;
/** Reserved for internal use. */
bar?: {
width: number;
spacing: number;
};
/** Which direction is allowed for the user to zoom the chart (self explanatory), one of the `"vertical", "horizontal", "both", "none"`
* @default "both"
*/
zooming?: Orientation;
};
export type TooltipModel = {
/** Should any tooltip be visible - set to `false` if not.
* @default true
*/
visible?: boolean;
/** We support several kinds of tooltips
* - `"standard"` is a global tooltip, shows all values in all panes. Can be floating (movable by user) or auto-moving, as configured in feed settings.
* - `"bubble"` is per-pane tooltip, follows the mouse pointer/finger.
* - `"cards"` is a small header, per pane.
* - `"external"` shows nothing, but sends the notification with the raw data (so that third parties might implement their own tooltips).
* @default "standard"
*/
mode?: TooltipMode;
/** Obsolete, please ignore. */
backgroundColor?: string;
/** Obsolete, please ignore. */
borderColor?: string;
/** Set to `true` if you want the main plot to be included with the rest of the plots in the `"cards"` mode (some hosts opt to show main plot's data differently).
* @default false
*/
showMainPlot?: boolean;
};
export type PriceAxisModel = {
/** How to handle the display of the last price in the timeseries on the price scale:
* `"None"`: do not show the last price at all
* `"All"`: show all prices for all plots
* `"Main"`: only show the last price of the main plot
* @default "All"
*/
showLastValue?: "None" | "All" | "Main";
/** If set to `true` will not allow the prices shown on the price scale (defined by @see showLastValue) to visually overlap; please note that this does mean that some prices will be placed incorrectly - they will be moved out of their normal position so that they are fully visible.
* @default false
*/
preventLabelOverlap?: boolean;
/** When drawing annotations, if this is set to `true`, the annotation points (or anchors) will snap to the closest price point found on the chart.
* @default false
*/
snapAnnotationsToPrices?: boolean;
};
export type TimeAxisModel = {
/** Override of the format for the time ticks on the time scale. Uses the same format specifier(s) as the same setting in the @see CrosshairModel */
format?: string;
/** Minimum _time_ (in milliseconds) distance between the two ticks on the time scale.
* @default 0
*/
minTickInterval?: number;
/** Minimum pixel interval between the two ticks on the time scale.
* @default 0 but this means to auto-decide the best value
*/
tickPixelInterval?: number;
/** A time range between the leftmost and rightmost bar. */
visibleRange?: Range;
/** Obsolete, please ignore. */
equidistant?: boolean;
/** A margin in **bars** on the _right_ side of every pane.
* @default 0
*/
marginBars?: number;
/** Reserved for internal use. */
zoom?: number;
/** Obsolete, please ignore. */
resizeHandles?: boolean;
/** Will ensure that each tick on the axis is fully visible. In practice, this means that leftmost and/or rightmost ticks will be shifted slighty so they aren't visually cut-off. No default but internally defaults to `false`. */
forceTicksVisible?: boolean;
/** Set to `false` if you want to prohibit horizontal chart panning (this is used rarely). No default but internally defaults to `true`. */
panning?: boolean;
};
export type DisplayModel = {
/** An initial time period the data is confined to on the time scale. Corresponds to ISO 8601 duration (please see Wikipedia or other sources for details). */
period?: string;
/** A number of **bars** the data is confined to on the time scale. The historical data is always right-aligned, meaning the latest (newest, most recent in time) data is to the right of the chart, then `density` number of bars is subtracted to arrive at the timestamp of the leftmost bar. */
density?: number;
chart: DisplayChart;
/** Obsolete, please ignore. */
scrollbar?: any;
/** Defines the input method that triggers horizontal zooming (yeah, misfortunate name):
* - `"none"` No zooming allowed
* - `"wheel" Using the mouse wheel
* - `"wheel+shift" By holding a shift key and using the mouse wheel
* @default "wheel"
*/
scrollBehavior?: ScrollBehavior;
/** The tooltip is a visual representation of the data under the crosshair (regardless of the visibility of the crosshair itself) at a given point in time. */
tooltip: TooltipModel;
yAxis: DisplayAxis & PriceAxisModel;
xAxis: DisplayAxis & TimeAxisModel;
/** The default traits applied to annotations drawn. */
annotationTraits?: AnnotationTraitsModel;
/** Obsolete, please ignore. */
curveTraits?: any[];
};
export type AnnotationModel = {
/** A unique identifier of the annotation. */
id: AnnotationId;
/** Whether the annotation is visible or not.
* @default true
*/
visible?: boolean;
/** Annotation's visual properties like line color, stroke width, fill color etc. */
traits?: AnnotationTraitsModel;
/** Each annotation has one or more anchors, which are points the user can move around and arrange. For example, Line annotation has two - start and end of the line. Note that the point's coordinates are (time, price). */
points: AnnotationPoint[];
};
export type AxisModel = {
/** Describes the way the plots are presented when more than one plot shares a single axis. Useful _only_ when plots have wildly different price ranges. If `"None"`, the drawing is skewed towards the price scale of the plot with the largest value (other plots will be squished). If set to `"Percent"`, all plots will be drawn as percentages relative to the leftmost (oldest, furthest back in time) value on the screen. When set to `"Value"` the plots will be drawn as net change relative to the leftmost value.
* @default "None"
*/
comparison?: ComparisonMode;
/** A list of plots attached to the axis. Plots are the visual representation of the timeseries data and are the most imporant concept in the chart. There has to be at least one plot attached to the axis. */
plots: PlotModel[];
/** A list of annotations attached to this axis. The annotations (sometimes referred to as drawings) are lines, symbols, fibonacci arcs etc. */
annotations?: AnnotationModel[];
/** The way the data is "distributed" along the vertical space - linearly or using a logarithm base 10. You'd use log scale if you had a **lot** of variability in values.
* @default "Linear"
*/
scale?: ScaleType;
/** Reserved for internal use */
annCache?: any[];
};
export type PaneModel = {
/** All the price axes attached to the pane. At most 2 are allowed, 1 is minimum. */
axes: AxisModel[];
/** A logical (relative) height of the pane, best described using an example: if we have 3 panes with heights 4, 2 and 1, then: total relative height is 4 + 2 + 1 = 7; each pane's height is proportional to that total height so (roughly) 57%, 28% and 14%.
* @default 1
*/
height?: number;
};
export type DataModel = {
/** The way the data is aggregated across time. */
aggregation: Aggregation;
/** 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. */
maxDataPoints?: number;
/** If set, the range of time the historical data will be limited to (if supported by the historical server). */
range?: Range;
/** Reserved for internal use only. */
checkRange?: boolean;
};
export type ChartModel = {
/** All the settings related to data presented by the chart. */
data: DataModel;
/** The display contains all the look and feel related settings (colors, fonts, information density, axes parameters etc.) */
display: DisplayModel;
/** A list of panes that the chart consists of. A pane is a vertical slice of space. There has to be at least one pane in the model. */
panes: PaneModel[];
/** A monotonically increasing version of the model. Managed internally - when given an older version than the current, the chart will automatically upgrade the model. */
version: number;
};
interface ITopics {
CH_ALL: string;
CH_RECREATED: string;
CH_ANNOTATIONCHANGED: string;
CH_ANNNEEDSCONTEXTMENU: string;
CH_CHTNEEDSCONTEXTMENU: string;
CH_ANNSELECTIONCHANGED: string;
CH_ANNPOINTPICKED: string;
CH_PANEHEIGHTSCHANGED: string;
CH_PANESREORDERED: string;
CH_NODATAFORMAINSYMBOL: string;
CH_CARDPLOTCLICKED: string;
CH_CARDPLOTREMOVED: string;
CH_TOOLTIPCHANGED: string;
CH_LOGOCLICKED: string;
CH_SHUTDOWN: string;
CH_ZOOMCHANGED: string;
CH_ALL_DATA_PROJECTED: string;
CH_API_ACTIONS_RECEIVED: string;
DF_ALL: string;
DF_STREAMRECONNECTED: string;
TS_ALL: string;
TS_LOADING: string;
TS_MANYCHANGED: string;
TS_DATAPOINTADDED: string;
TS_DATAPOINTCHANGED: string;
TS_EVENTSCHANGED: string;
MD_ALL: string;
MD_CHANGED: string;
RT_ALL: string;
RT_QUOTE: string;
RT_TRADE: string;
RT_VOLUME: string;
TL_CHANGED: string;
ME_ALL: string;
ME_MOUSE_OUT_SERIES: string;
ME_MOUSE_OVER_SERIES: string;
}
export interface ITooltipChangedData {
date: string;
time?: string;
isMultiSymbol?: boolean;
isMultiContract?: boolean;
offset: {
x: number;
y: number;
};
lastBarRefresh: boolean;
chartId: string;
panes: {
id: string;
bounds: {
top: number;
left: number;
width: number;
height: number;
};
plots: {
isMain: boolean;
type: PlotType;
typeName: string;
name: string;
description?: string;
exchange?: string;
error?: string;
id: string;
events: {
date: Date;
value: string;
kind: string;
visible: boolean;
title: string;
color: string;
}[];
values: {
abbreviation: string;
shortName: string;
id: string;
name: string;
longName: string;
color: string;
value: string;
}[];
}[];
}[];
}
const Topics: ITopics;
export type FeedMode =
| "Unspecified"
| "GBE"
| "cmdtyView"
| "DemoSite"
| "InternalFeed"
| "Widget"
| "FreeWidget";
type BaseUrl = {
instruments: string;
futures: string;
timeseries: string;
timeseriesNew: string;
ondemand: string;
};
type UrlKind = keyof BaseUrl;
type TooltipMovement = "Auto" | "Draggable";
interface TickProviderOptions {
height: number;
approxLineHeight: number;
domain: [number, number];
autoTicks: number[];
}
interface PriceAxisOverrides {
tickProvider?(options: TickProviderOptions): number[];
}
interface SymbologyOverrides {
translateSymbol?(symbolName: string): string;
}
type LocaleName = "fr" | undefined;
interface TimeAxisOverrides {
getLocaleName?(): LocaleName;
}
interface Overrides {
yAxis?: PriceAxisOverrides;
xAxis?: TimeAxisOverrides;
symbology?: SymbologyOverrides;
}
interface TooltipHeadersConfig {
showMainPlot?: boolean;
includeTimestamp?: boolean;
}
type HostingModel = "Page" | "Application";
/** The configuration is extensively documented at our documentation site. */
interface Config {
validateInput?: boolean;
throttleMillis?: number;
isAlt64?: boolean;
defaultTemplate?: string | object;
cachedAnnotationsCount?: number;
showResizeHandles?: boolean;
scrollBehavior?: ScrollBehavior;
bypassSmoothing?: boolean;
showGoToLatest?: boolean;
tooltipMovement?: TooltipMovement;
tooltipHeaders?: TooltipHeadersConfig;
touchCrosshairTimeoutMillis?: number;
touchCrosshairDelayMillis?: number;
mode?: FeedMode;
hostingModel?: HostingModel;
logo?: string;
baseUrl?: BaseUrl;
overrides?: Overrides;
noDataText?: string;
useAllFieldsForComparison?: boolean;
credentials?: ICredentials;
apiKey?: string;
fetch?(kind: UrlKind, relativeUrl: string): Promise<string>;
}
/** 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. */
export type ChartConfig = {
/** Make the main a plot a symbol. */
symbol?: string;
/** Make the main a plot an expression. */
expression?: string;
/** Make the main a plot a forward. */
forward?: string;
/** Make the main a plot a seasonal. */
seasonal?: string;
/** If this is provided, it overrides the default template. It's basically as if you've called the @see load method on a chart instance. */
template?: string;
};
type LoadOptions = {
keepOldAnnotations: boolean;
keepNewAnnotations: boolean;
keepOldCompare: boolean;
keepNewCompare: boolean;
keepOldAggregation: boolean;
keepNewBarWidth: boolean;
};
type TitleOptions = {
/** The text of the title. */
text: string;
/** Horizontal alignment of the title.
* @default "center"
*/
align?: "center" | "left" | "right";
/** Vertical alignment of the title.
* @default "top"
*/
verticalAlign?: "top" | "middle" | "bottom";
/** Horizontal position of the title (pixels).
* @default 0
*/
x?: number;
/** Vertical position of the title (pixels).
* @default 0
*/
y?: number;
style?: {
/** A CSS color string of the text's color.
* @default #333
*/
color?: string;
/** Size of the title text's font, in pixels.
* @default 18
*/
fontSize?: number;
};
};
type ExportImageOptions = {
/** Override the width of the exported image (pixels). By default exports the chart's width as-is currently on the screen. */
width?: number;
/** Override the height of the exported image (pixels). By default exports the chart's height as-is currently on the screen. */
height?: number;
/** Temporarily sets the title of the exported image. */
title?: TitleOptions;
};
type ExportedImage = {
/** Width of the exported image in pixels. */
width: number;
/** Height of the exported image in pixels. */
height: number;
/** Data URL representation of the PNG image. Please see MDN for details on the data urls. */
data: string;
};
type CurveAttribute = "ChangeBased" | "OpenVsClose";
type CurveZone = {
/** A value which is the **maximum** for this zone. If there's nothing set, no maximum. Please note that the minium is implicitly taken to be the maximum of the previous zone (in order listed) of the same curve. */
value?: number;
/** This is a _number_ of colors to take from the curve's `colors` array for the use in this zone. It's basically a small slice of colors, taken in the order the zones are listed. */
colors: number;
/** Should we (using implicit values) apply a gradient to the drawing and if so, should we darken or lightne the base color? */
gradient?: "linLighten" | "linDarken";
};
/** 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. */
export interface Curve {