@oanda/labs-instruments-price-chart-widget 1.0.13 → 1.0.14

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/codegen.ts +2 -5
  3. package/dist/main/InstrumentsPriceChartWidget/InstrumentsPriceChartWidget.js +6 -2
  4. package/dist/main/InstrumentsPriceChartWidget/InstrumentsPriceChartWidget.js.map +1 -1
  5. package/dist/main/InstrumentsPriceChartWidget/Main.js +32 -16
  6. package/dist/main/InstrumentsPriceChartWidget/Main.js.map +1 -1
  7. package/dist/main/InstrumentsPriceChartWidget/components/Chart.js +4 -2
  8. package/dist/main/InstrumentsPriceChartWidget/components/Chart.js.map +1 -1
  9. package/dist/main/InstrumentsPriceChartWidget/components/TimeZoneLabel.js +29 -0
  10. package/dist/main/InstrumentsPriceChartWidget/components/TimeZoneLabel.js.map +1 -0
  11. package/dist/main/InstrumentsPriceChartWidget/components/formatters.js +50 -11
  12. package/dist/main/InstrumentsPriceChartWidget/components/formatters.js.map +1 -1
  13. package/dist/main/InstrumentsPriceChartWidget/components/getOption.js +13 -13
  14. package/dist/main/InstrumentsPriceChartWidget/components/getOption.js.map +1 -1
  15. package/dist/main/InstrumentsPriceChartWidget/components/types.js.map +1 -1
  16. package/dist/main/InstrumentsPriceChartWidget/config.js +14 -7
  17. package/dist/main/InstrumentsPriceChartWidget/config.js.map +1 -1
  18. package/dist/main/InstrumentsPriceChartWidget/render.js +10 -2
  19. package/dist/main/InstrumentsPriceChartWidget/render.js.map +1 -1
  20. package/dist/main/InstrumentsPriceChartWidget/types.js.map +1 -1
  21. package/dist/main/InstrumentsPriceChartWidget/utils.js +12 -0
  22. package/dist/main/InstrumentsPriceChartWidget/utils.js.map +1 -0
  23. package/dist/main/gql/{mock/getPriceCandles.js → priceCandles.js} +9 -8
  24. package/dist/main/gql/priceCandles.js.map +1 -0
  25. package/dist/main/gql/types/gql.js +1 -1
  26. package/dist/main/gql/types/gql.js.map +1 -1
  27. package/dist/main/gql/types/graphql.js +53 -24
  28. package/dist/main/gql/types/graphql.js.map +1 -1
  29. package/dist/main/translations/sources/en.json +2 -1
  30. package/dist/module/InstrumentsPriceChartWidget/InstrumentsPriceChartWidget.js +6 -2
  31. package/dist/module/InstrumentsPriceChartWidget/InstrumentsPriceChartWidget.js.map +1 -1
  32. package/dist/module/InstrumentsPriceChartWidget/Main.js +33 -17
  33. package/dist/module/InstrumentsPriceChartWidget/Main.js.map +1 -1
  34. package/dist/module/InstrumentsPriceChartWidget/components/Chart.js +4 -2
  35. package/dist/module/InstrumentsPriceChartWidget/components/Chart.js.map +1 -1
  36. package/dist/module/InstrumentsPriceChartWidget/components/TimeZoneLabel.js +21 -0
  37. package/dist/module/InstrumentsPriceChartWidget/components/TimeZoneLabel.js.map +1 -0
  38. package/dist/module/InstrumentsPriceChartWidget/components/formatters.js +47 -9
  39. package/dist/module/InstrumentsPriceChartWidget/components/formatters.js.map +1 -1
  40. package/dist/module/InstrumentsPriceChartWidget/components/getOption.js +14 -14
  41. package/dist/module/InstrumentsPriceChartWidget/components/getOption.js.map +1 -1
  42. package/dist/module/InstrumentsPriceChartWidget/components/types.js.map +1 -1
  43. package/dist/module/InstrumentsPriceChartWidget/config.js +14 -7
  44. package/dist/module/InstrumentsPriceChartWidget/config.js.map +1 -1
  45. package/dist/module/InstrumentsPriceChartWidget/render.js +11 -3
  46. package/dist/module/InstrumentsPriceChartWidget/render.js.map +1 -1
  47. package/dist/module/InstrumentsPriceChartWidget/types.js.map +1 -1
  48. package/dist/module/InstrumentsPriceChartWidget/utils.js +4 -0
  49. package/dist/module/InstrumentsPriceChartWidget/utils.js.map +1 -0
  50. package/dist/module/gql/{mock/getPriceCandles.js → priceCandles.js} +9 -8
  51. package/dist/module/gql/priceCandles.js.map +1 -0
  52. package/dist/module/gql/types/gql.js +1 -1
  53. package/dist/module/gql/types/gql.js.map +1 -1
  54. package/dist/module/gql/types/graphql.js +52 -23
  55. package/dist/module/gql/types/graphql.js.map +1 -1
  56. package/dist/module/translations/sources/en.json +2 -1
  57. package/dist/types/InstrumentsPriceChartWidget/InstrumentsPriceChartWidget.d.ts +1 -1
  58. package/dist/types/InstrumentsPriceChartWidget/Main.d.ts +1 -1
  59. package/dist/types/InstrumentsPriceChartWidget/components/Chart.d.ts +1 -1
  60. package/dist/types/InstrumentsPriceChartWidget/components/TimeZoneLabel.d.ts +2 -0
  61. package/dist/types/InstrumentsPriceChartWidget/components/formatters.d.ts +5 -1
  62. package/dist/types/InstrumentsPriceChartWidget/components/types.d.ts +6 -4
  63. package/dist/types/InstrumentsPriceChartWidget/config.d.ts +5 -3
  64. package/dist/types/InstrumentsPriceChartWidget/types.d.ts +5 -1
  65. package/dist/types/InstrumentsPriceChartWidget/utils.d.ts +3 -0
  66. package/dist/types/gql/priceCandles.d.ts +2 -0
  67. package/dist/types/gql/types/gql.d.ts +4 -3
  68. package/dist/types/gql/types/graphql.d.ts +31 -27
  69. package/package.json +3 -3
  70. package/src/InstrumentsPriceChartWidget/InstrumentsPriceChartWidget.tsx +7 -1
  71. package/src/InstrumentsPriceChartWidget/Main.tsx +45 -19
  72. package/src/InstrumentsPriceChartWidget/components/Chart.tsx +2 -1
  73. package/src/InstrumentsPriceChartWidget/components/TimeZoneLabel.tsx +24 -0
  74. package/src/InstrumentsPriceChartWidget/components/formatters.ts +72 -13
  75. package/src/InstrumentsPriceChartWidget/components/getOption.ts +20 -21
  76. package/src/InstrumentsPriceChartWidget/components/types.ts +6 -4
  77. package/src/InstrumentsPriceChartWidget/config.ts +16 -7
  78. package/src/InstrumentsPriceChartWidget/render.tsx +12 -2
  79. package/src/InstrumentsPriceChartWidget/types.ts +5 -1
  80. package/src/InstrumentsPriceChartWidget/utils.ts +16 -0
  81. package/src/gql/{mock/getPriceCandles.ts → priceCandles.ts} +8 -7
  82. package/src/gql/types/gql.ts +4 -4
  83. package/src/gql/types/graphql.ts +62 -37
  84. package/src/translations/sources/en.json +2 -1
  85. package/test/Main.test.tsx +6 -2
  86. package/test/mocks/chartMock.ts +201 -37
  87. package/dist/main/InstrumentsPriceChartWidget/getPriceCandlesMock.js +0 -83
  88. package/dist/main/InstrumentsPriceChartWidget/getPriceCandlesMock.js.map +0 -1
  89. package/dist/main/gql/mock/getPriceCandles.js.map +0 -1
  90. package/dist/main/gql/mock/schema.graphqls +0 -62
  91. package/dist/module/InstrumentsPriceChartWidget/getPriceCandlesMock.js +0 -76
  92. package/dist/module/InstrumentsPriceChartWidget/getPriceCandlesMock.js.map +0 -1
  93. package/dist/module/gql/mock/getPriceCandles.js.map +0 -1
  94. package/dist/module/gql/mock/schema.graphqls +0 -62
  95. package/dist/types/InstrumentsPriceChartWidget/getPriceCandlesMock.d.ts +0 -9
  96. package/dist/types/gql/mock/getPriceCandles.d.ts +0 -2
  97. package/src/InstrumentsPriceChartWidget/getPriceCandlesMock.tsx +0 -75
  98. package/src/gql/mock/schema.graphqls +0 -62
@@ -56,14 +56,17 @@ export type Candle = {
56
56
  high: Scalars['Float']['output'];
57
57
  low: Scalars['Float']['output'];
58
58
  open: Scalars['Float']['output'];
59
+ /** UTC Timestamp */
60
+ point: Scalars['String']['output'];
59
61
  };
60
62
 
61
63
  export type CandlesData = {
62
64
  __typename?: 'CandlesData';
63
- candle: Candle;
64
- time: Scalars['String']['output'];
65
+ candle: Array<Maybe<Candle>>;
66
+ granularity: Granularity;
67
+ instrument: Instrument;
68
+ pipsLocation: Scalars['Int']['output'];
65
69
  timeSpan: TimeSpan;
66
- unixTime: Scalars['Int']['output'];
67
70
  };
68
71
 
69
72
  export type CorrelationHeatmap = {
@@ -157,12 +160,11 @@ export type ExtendedInstrument = {
157
160
  };
158
161
 
159
162
  export enum Granularity {
160
- Day_1 = 'DAY_1',
161
- Hour_1 = 'HOUR_1',
162
- Hour_4 = 'HOUR_4',
163
- Minute_5 = 'MINUTE_5',
164
- Minute_15 = 'MINUTE_15',
165
- Minute_30 = 'MINUTE_30',
163
+ D1 = 'D1',
164
+ H1 = 'H1',
165
+ H4 = 'H4',
166
+ M1 = 'M1',
167
+ M15 = 'M15',
166
168
  }
167
169
 
168
170
  export type Heatmap = {
@@ -227,10 +229,10 @@ export type Query = {
227
229
  correlationMatrix: CorrelationMatrix;
228
230
  currencyPowerBalance?: Maybe<Array<CurrencyPowerBalance>>;
229
231
  currencyStrength?: Maybe<Array<CurrencyStrength>>;
230
- getPriceCandles: Array<CandlesData>;
231
232
  isAllowedPartner?: Maybe<Scalars['Boolean']['output']>;
232
233
  mapInstrumentNames?: Maybe<Array<Maybe<Instrument>>>;
233
234
  orderPositionBooks: Array<Maybe<OrderPositionData>>;
235
+ priceCandles: CandlesData;
234
236
  resolveInstrumentsByDivision?: Maybe<Array<Instrument>>;
235
237
  resolveInstrumentsWithFilters?: Maybe<InstrumentTableResult>;
236
238
  sentiment?: Maybe<Array<SentimentInstrument>>;
@@ -263,13 +265,6 @@ export type QueryCurrencyPowerBalanceArgs = {
263
265
  timeUnit: CurrencyPowerBalanceTimeUnit;
264
266
  };
265
267
 
266
- export type QueryGetPriceCandlesArgs = {
267
- division?: InputMaybe<Division>;
268
- granularity: Granularity;
269
- instrument: Scalars['String']['input'];
270
- timeSpan: TimeSpan;
271
- };
272
-
273
268
  export type QueryIsAllowedPartnerArgs = {
274
269
  url: Scalars['String']['input'];
275
270
  };
@@ -287,6 +282,14 @@ export type QueryOrderPositionBooksArgs = {
287
282
  region?: InputMaybe<Region>;
288
283
  };
289
284
 
285
+ export type QueryPriceCandlesArgs = {
286
+ dataSource: InstrumentDataSource;
287
+ division: Division;
288
+ granularity: Granularity;
289
+ instrument: Scalars['String']['input'];
290
+ timeSpan: TimeSpan;
291
+ };
292
+
290
293
  export type QueryResolveInstrumentsByDivisionArgs = {
291
294
  division: Division;
292
295
  instruments: Array<InputMaybe<Scalars['String']['input']>>;
@@ -403,6 +406,7 @@ export enum TimeSpan {
403
406
  Week_2 = 'WEEK_2',
404
407
  Week_3 = 'WEEK_3',
405
408
  Year_1 = 'YEAR_1',
409
+ Year_5 = 'YEAR_5',
406
410
  }
407
411
 
408
412
  export type TopicalInstrument = {
@@ -502,28 +506,28 @@ export enum VolatilityChartTimeUnit {
502
506
  W = 'W',
503
507
  }
504
508
 
505
- export type GetPriceCandlesQueryVariables = Exact<{
506
- division?: InputMaybe<Division>;
509
+ export type PriceCandlesQueryVariables = Exact<{
510
+ division: Division;
511
+ dataSource: InstrumentDataSource;
507
512
  instrument: Scalars['String']['input'];
508
513
  granularity: Granularity;
509
514
  timeSpan: TimeSpan;
510
515
  }>;
511
516
 
512
- export type GetPriceCandlesQuery = {
517
+ export type PriceCandlesQuery = {
513
518
  __typename?: 'Query';
514
- getPriceCandles: Array<{
519
+ priceCandles: {
515
520
  __typename?: 'CandlesData';
516
- time: string;
517
- unixTime: number;
518
521
  timeSpan: TimeSpan;
519
- candle: {
522
+ candle: Array<{
520
523
  __typename?: 'Candle';
524
+ point: string;
521
525
  high: number;
522
526
  low: number;
523
527
  open: number;
524
528
  close: number;
525
- };
526
- }>;
529
+ } | null>;
530
+ };
527
531
  };
528
532
 
529
533
  export type ValidateInstrumentsQueryVariables = Exact<{
@@ -542,13 +546,13 @@ export type ValidateInstrumentsQuery = {
542
546
  } | null> | null;
543
547
  };
544
548
 
545
- export const GetPriceCandlesDocument = {
549
+ export const PriceCandlesDocument = {
546
550
  kind: 'Document',
547
551
  definitions: [
548
552
  {
549
553
  kind: 'OperationDefinition',
550
554
  operation: 'query',
551
- name: { kind: 'Name', value: 'GetPriceCandles' },
555
+ name: { kind: 'Name', value: 'PriceCandles' },
552
556
  variableDefinitions: [
553
557
  {
554
558
  kind: 'VariableDefinition',
@@ -557,8 +561,25 @@ export const GetPriceCandlesDocument = {
557
561
  name: { kind: 'Name', value: 'division' },
558
562
  },
559
563
  type: {
560
- kind: 'NamedType',
561
- name: { kind: 'Name', value: 'Division' },
564
+ kind: 'NonNullType',
565
+ type: {
566
+ kind: 'NamedType',
567
+ name: { kind: 'Name', value: 'Division' },
568
+ },
569
+ },
570
+ },
571
+ {
572
+ kind: 'VariableDefinition',
573
+ variable: {
574
+ kind: 'Variable',
575
+ name: { kind: 'Name', value: 'dataSource' },
576
+ },
577
+ type: {
578
+ kind: 'NonNullType',
579
+ type: {
580
+ kind: 'NamedType',
581
+ name: { kind: 'Name', value: 'InstrumentDataSource' },
582
+ },
562
583
  },
563
584
  },
564
585
  {
@@ -609,7 +630,7 @@ export const GetPriceCandlesDocument = {
609
630
  selections: [
610
631
  {
611
632
  kind: 'Field',
612
- name: { kind: 'Name', value: 'getPriceCandles' },
633
+ name: { kind: 'Name', value: 'priceCandles' },
613
634
  arguments: [
614
635
  {
615
636
  kind: 'Argument',
@@ -619,6 +640,14 @@ export const GetPriceCandlesDocument = {
619
640
  name: { kind: 'Name', value: 'division' },
620
641
  },
621
642
  },
643
+ {
644
+ kind: 'Argument',
645
+ name: { kind: 'Name', value: 'dataSource' },
646
+ value: {
647
+ kind: 'Variable',
648
+ name: { kind: 'Name', value: 'dataSource' },
649
+ },
650
+ },
622
651
  {
623
652
  kind: 'Argument',
624
653
  name: { kind: 'Name', value: 'instrument' },
@@ -647,14 +676,13 @@ export const GetPriceCandlesDocument = {
647
676
  selectionSet: {
648
677
  kind: 'SelectionSet',
649
678
  selections: [
650
- { kind: 'Field', name: { kind: 'Name', value: 'time' } },
651
- { kind: 'Field', name: { kind: 'Name', value: 'unixTime' } },
652
679
  {
653
680
  kind: 'Field',
654
681
  name: { kind: 'Name', value: 'candle' },
655
682
  selectionSet: {
656
683
  kind: 'SelectionSet',
657
684
  selections: [
685
+ { kind: 'Field', name: { kind: 'Name', value: 'point' } },
658
686
  { kind: 'Field', name: { kind: 'Name', value: 'high' } },
659
687
  { kind: 'Field', name: { kind: 'Name', value: 'low' } },
660
688
  { kind: 'Field', name: { kind: 'Name', value: 'open' } },
@@ -670,10 +698,7 @@ export const GetPriceCandlesDocument = {
670
698
  },
671
699
  },
672
700
  ],
673
- } as unknown as DocumentNode<
674
- GetPriceCandlesQuery,
675
- GetPriceCandlesQueryVariables
676
- >;
701
+ } as unknown as DocumentNode<PriceCandlesQuery, PriceCandlesQueryVariables>;
677
702
  export const ValidateInstrumentsDocument = {
678
703
  kind: 'Document',
679
704
  definitions: [
@@ -5,5 +5,6 @@
5
5
  "low": "Low",
6
6
  "no_matching_results": "No matching results",
7
7
  "open": "Open",
8
- "pagination_entries_range": "{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries"
8
+ "pagination_entries_range": "{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries",
9
+ "timezone_display": "Data displayed in {{timezone}} timezone"
9
10
  }
@@ -6,7 +6,7 @@ import { MockLayoutProvider } from '@oanda/labs-widget-common';
6
6
  import { render } from '@testing-library/react';
7
7
  import React from 'react';
8
8
 
9
- import { Division } from '../src/gql/types/graphql';
9
+ import { Division, InstrumentDataSource } from '../src/gql/types/graphql';
10
10
  import { Main } from '../src/InstrumentsPriceChartWidget/Main';
11
11
  import { chartMock } from './mocks';
12
12
 
@@ -15,7 +15,11 @@ describe('Main component', () => {
15
15
  const { findByTestId } = render(
16
16
  <MockedProvider mocks={chartMock}>
17
17
  <MockLayoutProvider>
18
- <Main division={Division.Oc} />
18
+ <Main
19
+ dataSource={InstrumentDataSource.Mt5}
20
+ division={Division.Oc}
21
+ instrument="EURUSD"
22
+ />
19
23
  </MockLayoutProvider>
20
24
  </MockedProvider>
21
25
  );
@@ -1,51 +1,215 @@
1
- import { getPriceCandles } from '../../src/gql/mock/getPriceCandles';
1
+ import { priceCandles } from '../../src/gql/priceCandles';
2
2
 
3
3
  export const chartMock = [
4
4
  {
5
5
  request: {
6
- query: getPriceCandles,
6
+ query: priceCandles,
7
7
  variables: {
8
- instrument: 'EUR_USD',
8
+ instrument: 'EURUSD',
9
9
  granularity: 'DAY_1',
10
10
  timeSpan: 'MONTH_1',
11
11
  },
12
12
  },
13
13
  result: {
14
14
  data: {
15
- getPriceCandles: [
16
- {
17
- __typename: 'CandlesData',
18
- time: '2025-07-10T01:11:33.362Z',
19
- unixTime: 1752109893,
20
- candle: {
21
- __typename: 'Candle',
22
- high: 1.045922851017596,
23
- low: 1.0453528401938712,
24
- open: 1.045734906133081,
25
- close: 1.0456884271571287,
26
- },
27
- instrument: {
28
- __typename: 'Instrument',
29
- displayName: 'EUR/USD',
30
- },
31
- },
32
- {
33
- __typename: 'CandlesData',
34
- time: '2025-07-10T01:41:33.362Z',
35
- unixTime: 1752111693,
36
- candle: {
37
- __typename: 'Candle',
38
- high: 1.0470140546917646,
39
- low: 1.0461029062975133,
40
- open: 1.0462692841559467,
41
- close: 1.0462351419425193,
42
- },
43
- instrument: {
44
- __typename: 'Instrument',
45
- displayName: 'EUR/USD',
46
- },
47
- },
48
- ],
15
+ priceCandles: {
16
+ candle: [
17
+ {
18
+ point: '2025-08-19T21:00:00Z',
19
+ high: 1.16523,
20
+ low: 1.16454,
21
+ open: 1.16479,
22
+ close: 1.16478,
23
+ __typename: 'Candle',
24
+ },
25
+ {
26
+ point: '2025-08-19T22:00:00Z',
27
+ high: 1.16492,
28
+ low: 1.16446,
29
+ open: 1.16475,
30
+ close: 1.16486,
31
+ __typename: 'Candle',
32
+ },
33
+ {
34
+ point: '2025-08-19T23:00:00Z',
35
+ high: 1.16489,
36
+ low: 1.1641,
37
+ open: 1.16486,
38
+ close: 1.16416,
39
+ __typename: 'Candle',
40
+ },
41
+ {
42
+ point: '2025-08-20T00:00:00Z',
43
+ high: 1.16426,
44
+ low: 1.16315,
45
+ open: 1.16416,
46
+ close: 1.16389,
47
+ __typename: 'Candle',
48
+ },
49
+ {
50
+ point: '2025-08-20T01:00:00Z',
51
+ high: 1.16423,
52
+ low: 1.16271,
53
+ open: 1.16389,
54
+ close: 1.16275,
55
+ __typename: 'Candle',
56
+ },
57
+ {
58
+ point: '2025-08-20T02:00:00Z',
59
+ high: 1.16298,
60
+ low: 1.16222,
61
+ open: 1.16275,
62
+ close: 1.16265,
63
+ __typename: 'Candle',
64
+ },
65
+ {
66
+ point: '2025-08-20T03:00:00Z',
67
+ high: 1.16364,
68
+ low: 1.16265,
69
+ open: 1.16265,
70
+ close: 1.16331,
71
+ __typename: 'Candle',
72
+ },
73
+ {
74
+ point: '2025-08-20T04:00:00Z',
75
+ high: 1.16383,
76
+ low: 1.16325,
77
+ open: 1.16331,
78
+ close: 1.16345,
79
+ __typename: 'Candle',
80
+ },
81
+ {
82
+ point: '2025-08-20T05:00:00Z',
83
+ high: 1.16403,
84
+ low: 1.16325,
85
+ open: 1.16345,
86
+ close: 1.16396,
87
+ __typename: 'Candle',
88
+ },
89
+ {
90
+ point: '2025-08-20T06:00:00Z',
91
+ high: 1.16426,
92
+ low: 1.16233,
93
+ open: 1.16395,
94
+ close: 1.16336,
95
+ __typename: 'Candle',
96
+ },
97
+ {
98
+ point: '2025-08-20T07:00:00Z',
99
+ high: 1.1647,
100
+ low: 1.16336,
101
+ open: 1.16336,
102
+ close: 1.16449,
103
+ __typename: 'Candle',
104
+ },
105
+ {
106
+ point: '2025-08-20T08:00:00Z',
107
+ high: 1.16467,
108
+ low: 1.16317,
109
+ open: 1.16449,
110
+ close: 1.1638,
111
+ __typename: 'Candle',
112
+ },
113
+ {
114
+ point: '2025-08-20T09:00:00Z',
115
+ high: 1.16463,
116
+ low: 1.1635,
117
+ open: 1.1638,
118
+ close: 1.16451,
119
+ __typename: 'Candle',
120
+ },
121
+ {
122
+ point: '2025-08-20T10:00:00Z',
123
+ high: 1.16576,
124
+ low: 1.16437,
125
+ open: 1.16451,
126
+ close: 1.16471,
127
+ __typename: 'Candle',
128
+ },
129
+ {
130
+ point: '2025-08-20T11:00:00Z',
131
+ high: 1.16501,
132
+ low: 1.16403,
133
+ open: 1.16471,
134
+ close: 1.1642,
135
+ __typename: 'Candle',
136
+ },
137
+ {
138
+ point: '2025-08-20T12:00:00Z',
139
+ high: 1.16738,
140
+ low: 1.16421,
141
+ open: 1.16421,
142
+ close: 1.16711,
143
+ __typename: 'Candle',
144
+ },
145
+ {
146
+ point: '2025-08-20T13:00:00Z',
147
+ high: 1.1672,
148
+ low: 1.1656,
149
+ open: 1.16711,
150
+ close: 1.16588,
151
+ __typename: 'Candle',
152
+ },
153
+ {
154
+ point: '2025-08-20T14:00:00Z',
155
+ high: 1.16691,
156
+ low: 1.16486,
157
+ open: 1.16588,
158
+ close: 1.16631,
159
+ __typename: 'Candle',
160
+ },
161
+ {
162
+ point: '2025-08-20T15:00:00Z',
163
+ high: 1.16632,
164
+ low: 1.16464,
165
+ open: 1.16631,
166
+ close: 1.16481,
167
+ __typename: 'Candle',
168
+ },
169
+ {
170
+ point: '2025-08-20T16:00:00Z',
171
+ high: 1.16619,
172
+ low: 1.16481,
173
+ open: 1.16481,
174
+ close: 1.16598,
175
+ __typename: 'Candle',
176
+ },
177
+ {
178
+ point: '2025-08-20T17:00:00Z',
179
+ high: 1.16726,
180
+ low: 1.16593,
181
+ open: 1.16598,
182
+ close: 1.16716,
183
+ __typename: 'Candle',
184
+ },
185
+ {
186
+ point: '2025-08-20T18:00:00Z',
187
+ high: 1.16716,
188
+ low: 1.16549,
189
+ open: 1.16716,
190
+ close: 1.16551,
191
+ __typename: 'Candle',
192
+ },
193
+ {
194
+ point: '2025-08-20T19:00:00Z',
195
+ high: 1.16587,
196
+ low: 1.16524,
197
+ open: 1.16551,
198
+ close: 1.16529,
199
+ __typename: 'Candle',
200
+ },
201
+ {
202
+ point: '2025-08-20T20:00:00Z',
203
+ high: 1.16529,
204
+ low: 1.16474,
205
+ open: 1.16528,
206
+ close: 1.16475,
207
+ __typename: 'Candle',
208
+ },
209
+ ],
210
+ timeSpan: 'DAY_1',
211
+ __typename: 'CandlesData',
212
+ },
49
213
  },
50
214
  },
51
215
  },
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getPriceCandlesMock = void 0;
7
- var _graphql = require("../gql/types/graphql");
8
- const generateMockPriceCandles = function () {
9
- let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 30;
10
- let timeSpan = arguments.length > 1 ? arguments[1] : undefined;
11
- const rawCandles = generateMockCandleData(count);
12
- return rawCandles.map(_ref => {
13
- let {
14
- high,
15
- low,
16
- timestamp,
17
- open,
18
- close
19
- } = _ref;
20
- return {
21
- __typename: 'CandlesData',
22
- time: new Date(timestamp).toISOString(),
23
- unixTime: Math.floor(timestamp / 1000),
24
- candle: {
25
- __typename: 'Candle',
26
- high,
27
- low,
28
- open,
29
- close
30
- },
31
- timeSpan
32
- };
33
- });
34
- };
35
- const generateMockCandleData = function () {
36
- let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 30;
37
- const now = Date.now();
38
- const candleInterval = 30 * 60 * 1000;
39
- let currentPrice = 1.045;
40
- const spikeIndex = Math.floor(count * 0.6);
41
- return Array.from({
42
- length: count
43
- }, (_, i) => {
44
- let trend = i < spikeIndex ? 0.0005 : -0.001;
45
- if (i === spikeIndex) {
46
- trend = 0.03;
47
- }
48
- if (i > spikeIndex + 3) {
49
- trend = 0;
50
- }
51
- currentPrice += trend;
52
- currentPrice = Math.max(1.03, Math.min(1.09, currentPrice));
53
- const noise = (Math.random() - 0.5) * 0.0005;
54
- currentPrice += noise;
55
- const open = currentPrice;
56
- const high = open + Math.random() * 0.0008;
57
- const close = open + (Math.random() - 0.5) * 0.0005;
58
- const low = open - Math.random() * 0.0008;
59
- const finalHigh = Math.max(open, close, high);
60
- const finalLow = Math.min(open, close, low);
61
- return {
62
- timestamp: now - (count - i) * candleInterval,
63
- high: finalHigh,
64
- open,
65
- close,
66
- low: finalLow
67
- };
68
- });
69
- };
70
- const getPriceCandlesMock = _ref2 => {
71
- let {
72
- division
73
- } = _ref2;
74
- return {
75
- loading: false,
76
- error: undefined,
77
- data: {
78
- getPriceCandles: generateMockPriceCandles(30, _graphql.TimeSpan.Day_1)
79
- }
80
- };
81
- };
82
- exports.getPriceCandlesMock = getPriceCandlesMock;
83
- //# sourceMappingURL=getPriceCandlesMock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPriceCandlesMock.js","names":["_graphql","require","generateMockPriceCandles","count","arguments","length","undefined","timeSpan","rawCandles","generateMockCandleData","map","_ref","high","low","timestamp","open","close","__typename","time","Date","toISOString","unixTime","Math","floor","candle","now","candleInterval","currentPrice","spikeIndex","Array","from","_","i","trend","max","min","noise","random","finalHigh","finalLow","getPriceCandlesMock","_ref2","division","loading","error","data","getPriceCandles","TimeSpan","Day_1","exports"],"sources":["../../../src/InstrumentsPriceChartWidget/getPriceCandlesMock.tsx"],"sourcesContent":["import { type CandlesData, TimeSpan } from '../gql/types/graphql';\nimport type { MainProps } from './types';\n\nconst generateMockPriceCandles = (\n count = 30,\n timeSpan: TimeSpan\n): CandlesData[] => {\n const rawCandles = generateMockCandleData(count);\n\n return rawCandles.map(({ high, low, timestamp, open, close }) => ({\n __typename: 'CandlesData',\n time: new Date(timestamp).toISOString(),\n unixTime: Math.floor(timestamp / 1000),\n candle: {\n __typename: 'Candle',\n high,\n low,\n open,\n close,\n },\n timeSpan,\n }));\n};\n\nconst generateMockCandleData = (count: number = 30) => {\n const now = Date.now();\n const candleInterval = 30 * 60 * 1000;\n\n let currentPrice = 1.045;\n const spikeIndex = Math.floor(count * 0.6);\n\n return Array.from({ length: count }, (_, i) => {\n let trend = i < spikeIndex ? 0.0005 : -0.001;\n\n if (i === spikeIndex) {\n trend = 0.03;\n }\n\n if (i > spikeIndex + 3) {\n trend = 0;\n }\n\n currentPrice += trend;\n\n currentPrice = Math.max(1.03, Math.min(1.09, currentPrice));\n\n const noise = (Math.random() - 0.5) * 0.0005;\n currentPrice += noise;\n\n const open = currentPrice;\n const high = open + Math.random() * 0.0008;\n const close = open + (Math.random() - 0.5) * 0.0005;\n const low = open - Math.random() * 0.0008;\n\n const finalHigh = Math.max(open, close, high);\n const finalLow = Math.min(open, close, low);\n\n return {\n timestamp: now - (count - i) * candleInterval,\n high: finalHigh,\n open,\n close,\n low: finalLow,\n };\n });\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const getPriceCandlesMock = ({ division }: MainProps) => ({\n loading: false,\n error: undefined,\n data: {\n getPriceCandles: generateMockPriceCandles(30, TimeSpan.Day_1),\n },\n});\n"],"mappings":"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","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPriceCandles.js","names":["_client","require","getPriceCandles","exports","gql"],"sources":["../../../../src/gql/mock/getPriceCandles.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst getPriceCandles = gql`\n query GetPriceCandles(\n $division: Division\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n getPriceCandles(\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n time\n unixTime\n candle {\n high\n low\n open\n close\n }\n timeSpan\n }\n }\n`;\n\nexport { getPriceCandles };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,WAAG;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,62 +0,0 @@
1
- enum TimeSpan {
2
- HOUR_1
3
- HOUR_12
4
- DAY_1
5
- DAY_2
6
- WEEK_1
7
- WEEK_2
8
- WEEK_3
9
- MONTH_1
10
- MONTH_3
11
- MONTH_6
12
- YEAR_1
13
- }
14
-
15
- enum Granularity {
16
- MINUTE_5
17
- MINUTE_15
18
- MINUTE_30
19
- HOUR_1
20
- HOUR_4
21
- DAY_1
22
- }
23
-
24
- enum Division {
25
- OAP
26
- OAU
27
- OC
28
- OCAN
29
- OEL
30
- OGM
31
- OJ
32
- OPT
33
- OTMS
34
- }
35
-
36
- type Candle {
37
- high: Float!
38
- low: Float!
39
- open: Float!
40
- close: Float!
41
- }
42
-
43
- type Instrument {
44
- name: String!
45
- displayName: String!
46
- }
47
-
48
- type CandlesData {
49
- time: String!
50
- unixTime: Int!
51
- candle: Candle!
52
- timeSpan: TimeSpan!
53
- }
54
-
55
- type Query {
56
- getPriceCandles(
57
- division: Division
58
- instrument: String!
59
- granularity: Granularity!
60
- timeSpan: TimeSpan!
61
- ): [CandlesData!]!
62
- }