@oanda/labs-instruments-table-widget 1.0.41 → 1.0.42

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 (41) hide show
  1. package/CHANGELOG.md +172 -0
  2. package/dist/main/InstrumentsTableWidget/InstrumentsTableWidget.js +4 -2
  3. package/dist/main/InstrumentsTableWidget/InstrumentsTableWidget.js.map +1 -1
  4. package/dist/main/InstrumentsTableWidget/render.js +1 -1
  5. package/dist/main/InstrumentsTableWidget/render.js.map +1 -1
  6. package/dist/main/InstrumentsTableWidget/types.js.map +1 -1
  7. package/dist/main/InstrumentsTableWidget/utils.js +4 -4
  8. package/dist/main/InstrumentsTableWidget/utils.js.map +1 -1
  9. package/dist/main/gql/resolveInstrumentsWithFilters.js +1 -1
  10. package/dist/main/gql/resolveInstrumentsWithFilters.js.map +1 -1
  11. package/dist/main/gql/types/gql.js +1 -1
  12. package/dist/main/gql/types/gql.js.map +1 -1
  13. package/dist/main/gql/types/graphql.js +39 -11
  14. package/dist/main/gql/types/graphql.js.map +1 -1
  15. package/dist/module/InstrumentsTableWidget/InstrumentsTableWidget.js +4 -2
  16. package/dist/module/InstrumentsTableWidget/InstrumentsTableWidget.js.map +1 -1
  17. package/dist/module/InstrumentsTableWidget/render.js +2 -2
  18. package/dist/module/InstrumentsTableWidget/render.js.map +1 -1
  19. package/dist/module/InstrumentsTableWidget/types.js.map +1 -1
  20. package/dist/module/InstrumentsTableWidget/utils.js +5 -5
  21. package/dist/module/InstrumentsTableWidget/utils.js.map +1 -1
  22. package/dist/module/gql/resolveInstrumentsWithFilters.js +1 -1
  23. package/dist/module/gql/resolveInstrumentsWithFilters.js.map +1 -1
  24. package/dist/module/gql/types/gql.js +1 -1
  25. package/dist/module/gql/types/gql.js.map +1 -1
  26. package/dist/module/gql/types/graphql.js +38 -10
  27. package/dist/module/gql/types/graphql.js.map +1 -1
  28. package/dist/types/InstrumentsTableWidget/types.d.ts +3 -3
  29. package/dist/types/InstrumentsTableWidget/utils.d.ts +3 -2
  30. package/dist/types/gql/types/gql.d.ts +3 -3
  31. package/dist/types/gql/types/graphql.d.ts +70 -9
  32. package/package.json +3 -3
  33. package/src/InstrumentsTableWidget/InstrumentsTableWidget.tsx +6 -2
  34. package/src/InstrumentsTableWidget/render.tsx +3 -3
  35. package/src/InstrumentsTableWidget/types.ts +3 -3
  36. package/src/InstrumentsTableWidget/utils.ts +8 -6
  37. package/src/gql/resolveInstrumentsWithFilters.ts +1 -1
  38. package/src/gql/types/gql.ts +3 -3
  39. package/src/gql/types/graphql.ts +83 -12
  40. package/test/Main.test.tsx +8 -12
  41. package/test/utils.test.ts +5 -5
@@ -50,6 +50,25 @@ export enum BookType {
50
50
  Position = 'POSITION',
51
51
  }
52
52
 
53
+ export type Candle = {
54
+ __typename?: 'Candle';
55
+ close: Scalars['Float']['output'];
56
+ high: Scalars['Float']['output'];
57
+ low: Scalars['Float']['output'];
58
+ open: Scalars['Float']['output'];
59
+ /** UTC Timestamp */
60
+ point: Scalars['String']['output'];
61
+ };
62
+
63
+ export type CandlesData = {
64
+ __typename?: 'CandlesData';
65
+ candle: Array<Maybe<Candle>>;
66
+ granularity: Granularity;
67
+ instrument: Instrument;
68
+ pipsLocation: Scalars['Int']['output'];
69
+ timeSpan: TimeSpan;
70
+ };
71
+
53
72
  export type CorrelationHeatmap = {
54
73
  __typename?: 'CorrelationHeatmap';
55
74
  baseInstrument: Instrument;
@@ -117,8 +136,9 @@ export type CurrencyStrength = {
117
136
  };
118
137
 
119
138
  export enum DataSource {
120
- Ny4 = 'NY4',
121
- Ty3 = 'TY3',
139
+ All = 'ALL',
140
+ Mt5 = 'MT5',
141
+ V20 = 'V20',
122
142
  }
123
143
 
124
144
  export enum Division {
@@ -135,11 +155,20 @@ export enum Division {
135
155
 
136
156
  export type ExtendedInstrument = {
137
157
  __typename?: 'ExtendedInstrument';
158
+ dataSource: DataSource;
138
159
  displayName: Scalars['String']['output'];
139
160
  name: Scalars['String']['output'];
140
161
  tradeMode: TradeMode;
141
162
  };
142
163
 
164
+ export enum Granularity {
165
+ D1 = 'D1',
166
+ H1 = 'H1',
167
+ H4 = 'H4',
168
+ M1 = 'M1',
169
+ M15 = 'M15',
170
+ }
171
+
143
172
  export type Heatmap = {
144
173
  __typename?: 'Heatmap';
145
174
  instrument: Instrument;
@@ -158,11 +187,6 @@ export type InstrumentCorrelation = {
158
187
  value?: Maybe<Scalars['Float']['output']>;
159
188
  };
160
189
 
161
- export enum InstrumentDataSource {
162
- Mt5 = 'MT5',
163
- V20 = 'V20',
164
- }
165
-
166
190
  export type InstrumentTableResult = {
167
191
  __typename?: 'InstrumentTableResult';
168
192
  instruments: Array<ExtendedInstrument>;
@@ -170,12 +194,24 @@ export type InstrumentTableResult = {
170
194
  updatedAt: Scalars['String']['output'];
171
195
  };
172
196
 
197
+ export type MarginRate = {
198
+ __typename?: 'MarginRate';
199
+ instrument: Instrument;
200
+ rate: Scalars['Float']['output'];
201
+ };
202
+
173
203
  export type Matrix = {
174
204
  __typename?: 'Matrix';
175
205
  instrument: Instrument;
176
206
  instrumentCorrelation: Array<InstrumentCorrelation>;
177
207
  };
178
208
 
209
+ export enum OrderBookDataSource {
210
+ Ny4 = 'NY4',
211
+ Ny4Mt5 = 'NY4_MT5',
212
+ Ty3 = 'TY3',
213
+ }
214
+
179
215
  export type OrderPositionBucket = {
180
216
  __typename?: 'OrderPositionBucket';
181
217
  longCountPercent: Scalars['Float']['output'];
@@ -204,7 +240,9 @@ export type Query = {
204
240
  currencyStrength?: Maybe<Array<CurrencyStrength>>;
205
241
  isAllowedPartner?: Maybe<Scalars['Boolean']['output']>;
206
242
  mapInstrumentNames?: Maybe<Array<Maybe<Instrument>>>;
243
+ marginRates?: Maybe<Array<MarginRate>>;
207
244
  orderPositionBooks: Array<Maybe<OrderPositionData>>;
245
+ priceCandles: CandlesData;
208
246
  resolveInstrumentsByDivision?: Maybe<Array<Instrument>>;
209
247
  resolveInstrumentsWithFilters?: Maybe<InstrumentTableResult>;
210
248
  sentiment?: Maybe<Array<SentimentInstrument>>;
@@ -246,14 +284,29 @@ export type QueryMapInstrumentNamesArgs = {
246
284
  instruments: Array<InputMaybe<Scalars['String']['input']>>;
247
285
  };
248
286
 
287
+ export type QueryMarginRatesArgs = {
288
+ dataSource: DataSource;
289
+ division: Division;
290
+ instruments?: InputMaybe<Array<Scalars['String']['input']>>;
291
+ tradingGroup: Scalars['Int']['input'];
292
+ };
293
+
249
294
  export type QueryOrderPositionBooksArgs = {
250
295
  bookType: BookType;
251
- dataSource?: InputMaybe<DataSource>;
296
+ dataSource?: InputMaybe<OrderBookDataSource>;
252
297
  instrument: Scalars['String']['input'];
253
298
  recentHours?: InputMaybe<Scalars['Int']['input']>;
254
299
  region?: InputMaybe<Region>;
255
300
  };
256
301
 
302
+ export type QueryPriceCandlesArgs = {
303
+ dataSource: DataSource;
304
+ division: Division;
305
+ granularity: Granularity;
306
+ instrument: Scalars['String']['input'];
307
+ timeSpan: TimeSpan;
308
+ };
309
+
257
310
  export type QueryResolveInstrumentsByDivisionArgs = {
258
311
  division: Division;
259
312
  instruments: Array<InputMaybe<Scalars['String']['input']>>;
@@ -262,7 +315,7 @@ export type QueryResolveInstrumentsByDivisionArgs = {
262
315
  export type QueryResolveInstrumentsWithFiltersArgs = {
263
316
  assetClass?: InputMaybe<Array<InputMaybe<AssetClassName>>>;
264
317
  count?: InputMaybe<Scalars['Int']['input']>;
265
- dataSource?: InputMaybe<InstrumentDataSource>;
318
+ dataSource: DataSource;
266
319
  division: Division;
267
320
  instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
268
321
  offset?: InputMaybe<Scalars['Int']['input']>;
@@ -358,6 +411,21 @@ export type TimeCorrelation = {
358
411
  value?: Maybe<Scalars['Float']['output']>;
359
412
  };
360
413
 
414
+ export enum TimeSpan {
415
+ Day_1 = 'DAY_1',
416
+ Day_2 = 'DAY_2',
417
+ Hour_1 = 'HOUR_1',
418
+ Hour_12 = 'HOUR_12',
419
+ Month_1 = 'MONTH_1',
420
+ Month_3 = 'MONTH_3',
421
+ Month_6 = 'MONTH_6',
422
+ Week_1 = 'WEEK_1',
423
+ Week_2 = 'WEEK_2',
424
+ Week_3 = 'WEEK_3',
425
+ Year_1 = 'YEAR_1',
426
+ Year_5 = 'YEAR_5',
427
+ }
428
+
361
429
  export type TopicalInstrument = {
362
430
  __typename?: 'TopicalInstrument';
363
431
  assetClass?: Maybe<AssetClassName>;
@@ -460,7 +528,7 @@ export type ResolveInstrumentsWithFiltersQueryVariables = Exact<{
460
528
  assetClass?: InputMaybe<
461
529
  Array<InputMaybe<AssetClassName>> | InputMaybe<AssetClassName>
462
530
  >;
463
- dataSource?: InputMaybe<InstrumentDataSource>;
531
+ dataSource: DataSource;
464
532
  instruments?: InputMaybe<
465
533
  | Array<InputMaybe<Scalars['String']['input']>>
466
534
  | InputMaybe<Scalars['String']['input']>
@@ -530,8 +598,11 @@ export const ResolveInstrumentsWithFiltersDocument = {
530
598
  name: { kind: 'Name', value: 'dataSource' },
531
599
  },
532
600
  type: {
533
- kind: 'NamedType',
534
- name: { kind: 'Name', value: 'InstrumentDataSource' },
601
+ kind: 'NonNullType',
602
+ type: {
603
+ kind: 'NamedType',
604
+ name: { kind: 'Name', value: 'DataSource' },
605
+ },
535
606
  },
536
607
  },
537
608
  {
@@ -10,11 +10,7 @@ import {
10
10
  import { fireEvent, render, waitFor } from '@testing-library/react';
11
11
  import React from 'react';
12
12
 
13
- import {
14
- AssetClassName,
15
- Division,
16
- InstrumentDataSource,
17
- } from '../src/gql/types/graphql';
13
+ import { AssetClassName, DataSource, Division } from '../src/gql/types/graphql';
18
14
  import { Main } from '../src/InstrumentsTableWidget/Main';
19
15
  import {
20
16
  mockErrorQuery,
@@ -30,7 +26,7 @@ describe('Main component', () => {
30
26
  <LiveRatesProvider url="oanda.com">
31
27
  <MockLayoutProvider>
32
28
  <Main
33
- dataSource={InstrumentDataSource.V20}
29
+ dataSource={DataSource.V20}
34
30
  division={Division.Oc}
35
31
  instruments={['EUR_USD', 'GBP_USD']}
36
32
  recordsPerPage={10}
@@ -55,7 +51,7 @@ describe('Main component', () => {
55
51
  isAssetClassFilterEnabled
56
52
  isInstrumentSearchEnabled
57
53
  assetClasses={[AssetClassName.Etfs, AssetClassName.Currency]}
58
- dataSource={InstrumentDataSource.V20}
54
+ dataSource={DataSource.V20}
59
55
  division={Division.Oc}
60
56
  instruments={['EUR_USD', 'GBP_USD']}
61
57
  />
@@ -75,7 +71,7 @@ describe('Main component', () => {
75
71
  <Main
76
72
  isAssetClassFilterEnabled
77
73
  assetClasses={[AssetClassName.Etfs, AssetClassName.Currency]}
78
- dataSource={InstrumentDataSource.V20}
74
+ dataSource={DataSource.V20}
79
75
  division={Division.Oc}
80
76
  instruments={['EUR_USD', 'GBP_USD']}
81
77
  />
@@ -93,7 +89,7 @@ describe('Main component', () => {
93
89
  <LiveRatesProvider url="oanda.com">
94
90
  <MockLayoutProvider>
95
91
  <Main
96
- dataSource={InstrumentDataSource.V20}
92
+ dataSource={DataSource.V20}
97
93
  division={Division.Oc}
98
94
  instruments={['EUR_USD', 'GBP_USD']}
99
95
  />
@@ -110,7 +106,7 @@ describe('Main component', () => {
110
106
  <LiveRatesProvider url="oanda.com">
111
107
  <MockLayoutProvider>
112
108
  <Main
113
- dataSource={InstrumentDataSource.V20}
109
+ dataSource={DataSource.V20}
114
110
  division={Division.Oc}
115
111
  instruments={['EUR_USD', 'GBP_USD']}
116
112
  />
@@ -128,7 +124,7 @@ describe('Main component', () => {
128
124
  <LiveRatesProvider url="oanda.com">
129
125
  <MockLayoutProvider>
130
126
  <Main
131
- dataSource={InstrumentDataSource.V20}
127
+ dataSource={DataSource.V20}
132
128
  division={Division.Oc}
133
129
  instruments={['EUR_USD', 'GBP_USD']}
134
130
  />
@@ -165,7 +161,7 @@ describe('Main component', () => {
165
161
  <Main
166
162
  assetClasses={[AssetClassName.Etfs]}
167
163
  columns={[DataRecordType.TRADE_MODE, DataRecordType.SYMBOL]}
168
- dataSource={InstrumentDataSource.Mt5}
164
+ dataSource={DataSource.Mt5}
169
165
  division={Division.Oel}
170
166
  />
171
167
  </MockLayoutProvider>
@@ -1,21 +1,21 @@
1
1
  import { PriceType } from '../src';
2
- import { Division, InstrumentDataSource } from '../src/gql/types/graphql';
2
+ import { DataSource, Division } from '../src/gql/types/graphql';
3
3
  import { getLiveRatesDivisionCode } from '../src/InstrumentsTableWidget/utils';
4
4
 
5
5
  describe('getLiveRatesDivisionCode', () => {
6
6
  it('should return Division.Oc for PriceType.Raw and InstrumentDataSource.Mt5', () => {
7
7
  const division = Division.Oc;
8
8
  const priceType = PriceType.Raw;
9
- const dataSource = InstrumentDataSource.Mt5;
9
+ const dataSource = DataSource.Mt5;
10
10
  expect(getLiveRatesDivisionCode(division, priceType, dataSource)).toBe(
11
11
  Division.Oc
12
12
  );
13
13
  });
14
14
 
15
- it('should return "MKTD" for PriceType.Raw and InstrumentDataSource.V20', () => {
15
+ it('should return "MKTD" for PriceType.Raw and DataSource.V20', () => {
16
16
  const division = Division.Oc;
17
17
  const priceType = PriceType.Raw;
18
- const dataSource = InstrumentDataSource.V20;
18
+ const dataSource = DataSource.V20;
19
19
  expect(getLiveRatesDivisionCode(division, priceType, dataSource)).toBe(
20
20
  'MKTD'
21
21
  );
@@ -24,7 +24,7 @@ describe('getLiveRatesDivisionCode', () => {
24
24
  it('should return the division for PriceType.Division', () => {
25
25
  const division = Division.Oc;
26
26
  const priceType = PriceType.Division;
27
- const dataSource = InstrumentDataSource.Mt5;
27
+ const dataSource = DataSource.Mt5;
28
28
  expect(getLiveRatesDivisionCode(division, priceType, dataSource)).toBe(
29
29
  Division.Oc
30
30
  );