@oanda/labs-sentiment-widget 1.0.173 → 1.0.175
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.
- package/CHANGELOG.md +1372 -0
- package/dist/main/SentimentWidget/SentimentWidget.js +10 -10
- package/dist/main/SentimentWidget/SentimentWidget.js.map +1 -1
- package/dist/main/SentimentWidget/Tool.js +19 -18
- package/dist/main/SentimentWidget/Tool.js.map +1 -1
- package/dist/main/SentimentWidget/Widget.js +17 -16
- package/dist/main/SentimentWidget/Widget.js.map +1 -1
- package/dist/main/SentimentWidget/components/SortSwitch/SortSwitch.js +13 -13
- package/dist/main/SentimentWidget/components/SortSwitch/SortSwitch.js.map +1 -1
- package/dist/main/SentimentWidget/render.js +9 -9
- package/dist/main/SentimentWidget/render.js.map +1 -1
- package/dist/main/SentimentWidget/types.js.map +1 -1
- package/dist/main/SentimentWidget/utils.js.map +1 -1
- package/dist/main/gql/getInstrumentSentiment.js +3 -19
- package/dist/main/gql/getInstrumentSentiment.js.map +1 -1
- package/dist/main/gql/getSentimentList.js +3 -17
- package/dist/main/gql/getSentimentList.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js +3 -2
- package/dist/main/gql/types/fragment-masking.js.map +1 -1
- package/dist/main/gql/types/gql.js +4 -3
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +154 -154
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/gql/types/index.js.map +1 -1
- package/dist/main/index.js +8 -8
- package/dist/main/index.js.map +1 -1
- package/dist/main/translations/index.js +1 -1
- package/dist/main/translations/index.js.map +1 -1
- package/dist/main/translations/translations.js.map +1 -1
- package/dist/module/SentimentWidget/SentimentWidget.js +10 -10
- package/dist/module/SentimentWidget/SentimentWidget.js.map +1 -1
- package/dist/module/SentimentWidget/Tool.js +18 -17
- package/dist/module/SentimentWidget/Tool.js.map +1 -1
- package/dist/module/SentimentWidget/Widget.js +18 -17
- package/dist/module/SentimentWidget/Widget.js.map +1 -1
- package/dist/module/SentimentWidget/components/SortSwitch/SortSwitch.js +13 -13
- package/dist/module/SentimentWidget/components/SortSwitch/SortSwitch.js.map +1 -1
- package/dist/module/SentimentWidget/render.js +9 -9
- package/dist/module/SentimentWidget/render.js.map +1 -1
- package/dist/module/SentimentWidget/types.js.map +1 -1
- package/dist/module/SentimentWidget/utils.js.map +1 -1
- package/dist/module/gql/getInstrumentSentiment.js +3 -19
- package/dist/module/gql/getInstrumentSentiment.js.map +1 -1
- package/dist/module/gql/getSentimentList.js +3 -17
- package/dist/module/gql/getSentimentList.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +3 -2
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +4 -3
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +154 -154
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/gql/types/index.js +2 -2
- package/dist/module/gql/types/index.js.map +1 -1
- package/dist/module/index.js +1 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/translations/index.js +1 -1
- package/dist/module/translations/index.js.map +1 -1
- package/dist/module/translations/translations.js.map +1 -1
- package/dist/types/SentimentWidget/SentimentWidget.d.ts +1 -1
- package/dist/types/SentimentWidget/Tool.d.ts +1 -1
- package/dist/types/SentimentWidget/Widget.d.ts +1 -1
- package/dist/types/SentimentWidget/components/SortSwitch/SortSwitch.d.ts +2 -2
- package/dist/types/SentimentWidget/types.d.ts +2 -2
- package/dist/types/SentimentWidget/utils.d.ts +2 -1
- package/dist/types/gql/types/gql.d.ts +4 -4
- package/dist/types/gql/types/index.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/translations/index.d.ts +2 -2
- package/package.json +3 -3
- package/src/SentimentWidget/SentimentWidget.tsx +18 -19
- package/src/SentimentWidget/Tool.tsx +94 -78
- package/src/SentimentWidget/Widget.tsx +70 -64
- package/src/SentimentWidget/components/SortSwitch/SortSwitch.tsx +41 -38
- package/src/SentimentWidget/render.tsx +40 -28
- package/src/SentimentWidget/types.ts +3 -2
- package/src/SentimentWidget/utils.ts +12 -4
- package/src/gql/getInstrumentSentiment.ts +2 -8
- package/src/gql/getSentimentList.ts +2 -6
- package/src/gql/types/fragment-masking.ts +41 -21
- package/src/gql/types/gql.ts +12 -5
- package/src/gql/types/graphql.ts +225 -47
- package/src/gql/types/index.ts +2 -2
- package/src/index.ts +1 -1
- package/src/translations/index.ts +4 -4
- package/src/translations/translations.ts +2 -1
- package/test/SortSwitch.test.tsx +11 -7
- package/test/Tool.test.tsx +8 -6
- package/test/Widget.test.tsx +26 -21
- package/test/sortData.test.ts +49 -13
package/src/gql/types/graphql.ts
CHANGED
|
@@ -2,18 +2,31 @@
|
|
|
2
2
|
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
3
3
|
export type Maybe<T> = T | null;
|
|
4
4
|
export type InputMaybe<T> = Maybe<T>;
|
|
5
|
-
export type Exact<T extends { [key: string]: unknown }> = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type
|
|
9
|
-
|
|
5
|
+
export type Exact<T extends { [key: string]: unknown }> = {
|
|
6
|
+
[K in keyof T]: T[K];
|
|
7
|
+
};
|
|
8
|
+
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
9
|
+
[SubKey in K]?: Maybe<T[SubKey]>;
|
|
10
|
+
};
|
|
11
|
+
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
12
|
+
[SubKey in K]: Maybe<T[SubKey]>;
|
|
13
|
+
};
|
|
14
|
+
export type MakeEmpty<
|
|
15
|
+
T extends { [key: string]: unknown },
|
|
16
|
+
K extends keyof T,
|
|
17
|
+
> = { [_ in K]?: never };
|
|
18
|
+
export type Incremental<T> =
|
|
19
|
+
| T
|
|
20
|
+
| {
|
|
21
|
+
[P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never;
|
|
22
|
+
};
|
|
10
23
|
/** All built-in and custom scalars, mapped to their actual values */
|
|
11
24
|
export type Scalars = {
|
|
12
|
-
ID: { input: string; output: string
|
|
13
|
-
String: { input: string; output: string
|
|
14
|
-
Boolean: { input: boolean; output: boolean
|
|
15
|
-
Int: { input: number; output: number
|
|
16
|
-
Float: { input: number; output: number
|
|
25
|
+
ID: { input: string; output: string };
|
|
26
|
+
String: { input: string; output: string };
|
|
27
|
+
Boolean: { input: boolean; output: boolean };
|
|
28
|
+
Int: { input: number; output: number };
|
|
29
|
+
Float: { input: number; output: number };
|
|
17
30
|
};
|
|
18
31
|
|
|
19
32
|
export type AssetClass = {
|
|
@@ -28,12 +41,12 @@ export enum AssetClassName {
|
|
|
28
41
|
Currency = 'CURRENCY',
|
|
29
42
|
EquityShares = 'EQUITY_SHARES',
|
|
30
43
|
Indices = 'INDICES',
|
|
31
|
-
Rates = 'RATES'
|
|
44
|
+
Rates = 'RATES',
|
|
32
45
|
}
|
|
33
46
|
|
|
34
47
|
export enum BookType {
|
|
35
48
|
Order = 'ORDER',
|
|
36
|
-
Position = 'POSITION'
|
|
49
|
+
Position = 'POSITION',
|
|
37
50
|
}
|
|
38
51
|
|
|
39
52
|
export type CorrelationHeatmap = {
|
|
@@ -56,7 +69,7 @@ export enum CorrelationTimeUnit {
|
|
|
56
69
|
M3 = 'M3',
|
|
57
70
|
M6 = 'M6',
|
|
58
71
|
W1 = 'W1',
|
|
59
|
-
Y1 = 'Y1'
|
|
72
|
+
Y1 = 'Y1',
|
|
60
73
|
}
|
|
61
74
|
|
|
62
75
|
export enum CurrencyName {
|
|
@@ -67,7 +80,7 @@ export enum CurrencyName {
|
|
|
67
80
|
Gbp = 'GBP',
|
|
68
81
|
Jpy = 'JPY',
|
|
69
82
|
Nzd = 'NZD',
|
|
70
|
-
Usd = 'USD'
|
|
83
|
+
Usd = 'USD',
|
|
71
84
|
}
|
|
72
85
|
|
|
73
86
|
export type CurrencyPower = {
|
|
@@ -92,7 +105,7 @@ export enum CurrencyPowerBalanceTimeUnit {
|
|
|
92
105
|
M1 = 'M1',
|
|
93
106
|
M3 = 'M3',
|
|
94
107
|
PreviousDay = 'PREVIOUS_DAY',
|
|
95
|
-
W1 = 'W1'
|
|
108
|
+
W1 = 'W1',
|
|
96
109
|
}
|
|
97
110
|
|
|
98
111
|
export type CurrencyStrength = {
|
|
@@ -104,7 +117,7 @@ export type CurrencyStrength = {
|
|
|
104
117
|
|
|
105
118
|
export enum DataSource {
|
|
106
119
|
Ny4 = 'NY4',
|
|
107
|
-
Ty3 = 'TY3'
|
|
120
|
+
Ty3 = 'TY3',
|
|
108
121
|
}
|
|
109
122
|
|
|
110
123
|
export enum Division {
|
|
@@ -116,7 +129,7 @@ export enum Division {
|
|
|
116
129
|
Ogm = 'OGM',
|
|
117
130
|
Oj = 'OJ',
|
|
118
131
|
Opt = 'OPT',
|
|
119
|
-
Otms = 'OTMS'
|
|
132
|
+
Otms = 'OTMS',
|
|
120
133
|
}
|
|
121
134
|
|
|
122
135
|
export type Heatmap = {
|
|
@@ -182,36 +195,30 @@ export type Query = {
|
|
|
182
195
|
volatilityChartAssetClasses?: Maybe<Array<AssetClass>>;
|
|
183
196
|
};
|
|
184
197
|
|
|
185
|
-
|
|
186
198
|
export type QueryAssetClassesArgs = {
|
|
187
199
|
division: Division;
|
|
188
200
|
};
|
|
189
201
|
|
|
190
|
-
|
|
191
202
|
export type QueryCorrelationHeatmapArgs = {
|
|
192
203
|
division: Division;
|
|
193
204
|
instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
|
|
194
205
|
timeSpans?: InputMaybe<Array<InputMaybe<CorrelationTimeUnit>>>;
|
|
195
206
|
};
|
|
196
207
|
|
|
197
|
-
|
|
198
208
|
export type QueryCorrelationMatrixArgs = {
|
|
199
209
|
division: Division;
|
|
200
210
|
instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
|
|
201
211
|
};
|
|
202
212
|
|
|
203
|
-
|
|
204
213
|
export type QueryCurrencyPowerBalanceArgs = {
|
|
205
214
|
timeUnit: CurrencyPowerBalanceTimeUnit;
|
|
206
215
|
};
|
|
207
216
|
|
|
208
|
-
|
|
209
217
|
export type QueryMapInstrumentNamesArgs = {
|
|
210
218
|
division?: InputMaybe<Division>;
|
|
211
219
|
instruments: Array<InputMaybe<Scalars['String']['input']>>;
|
|
212
220
|
};
|
|
213
221
|
|
|
214
|
-
|
|
215
222
|
export type QueryOrderPositionBooksArgs = {
|
|
216
223
|
bookType: BookType;
|
|
217
224
|
dataSource?: InputMaybe<DataSource>;
|
|
@@ -220,19 +227,16 @@ export type QueryOrderPositionBooksArgs = {
|
|
|
220
227
|
region?: InputMaybe<Region>;
|
|
221
228
|
};
|
|
222
229
|
|
|
223
|
-
|
|
224
230
|
export type QuerySentimentArgs = {
|
|
225
231
|
division?: InputMaybe<Division>;
|
|
226
232
|
name: Scalars['String']['input'];
|
|
227
233
|
};
|
|
228
234
|
|
|
229
|
-
|
|
230
235
|
export type QuerySentimentListArgs = {
|
|
231
236
|
division?: InputMaybe<Division>;
|
|
232
237
|
sort?: InputMaybe<Sort>;
|
|
233
238
|
};
|
|
234
239
|
|
|
235
|
-
|
|
236
240
|
export type QueryTopicalInstrumentsArgs = {
|
|
237
241
|
assetClass?: InputMaybe<AssetClassName>;
|
|
238
242
|
count?: InputMaybe<Scalars['Int']['input']>;
|
|
@@ -241,25 +245,21 @@ export type QueryTopicalInstrumentsArgs = {
|
|
|
241
245
|
sort: TopicalSort;
|
|
242
246
|
};
|
|
243
247
|
|
|
244
|
-
|
|
245
248
|
export type QueryTopicalInstrumentsChartsArgs = {
|
|
246
249
|
division?: InputMaybe<Division>;
|
|
247
250
|
instruments?: InputMaybe<Array<Scalars['String']['input']>>;
|
|
248
251
|
};
|
|
249
252
|
|
|
250
|
-
|
|
251
253
|
export type QueryTopicalInstrumentsTotalCountArgs = {
|
|
252
254
|
assetClass?: InputMaybe<AssetClassName>;
|
|
253
255
|
division?: InputMaybe<Division>;
|
|
254
256
|
sort: TopicalSort;
|
|
255
257
|
};
|
|
256
258
|
|
|
257
|
-
|
|
258
259
|
export type QueryValueAtRiskAssetClassesArgs = {
|
|
259
260
|
division?: InputMaybe<Division>;
|
|
260
261
|
};
|
|
261
262
|
|
|
262
|
-
|
|
263
263
|
export type QueryValueAtRiskChartArgs = {
|
|
264
264
|
bars: ValueAtRiskBars;
|
|
265
265
|
division?: InputMaybe<Division>;
|
|
@@ -267,7 +267,6 @@ export type QueryValueAtRiskChartArgs = {
|
|
|
267
267
|
instrument: Scalars['String']['input'];
|
|
268
268
|
};
|
|
269
269
|
|
|
270
|
-
|
|
271
270
|
export type QueryVolatilityChartArgs = {
|
|
272
271
|
division?: InputMaybe<Division>;
|
|
273
272
|
instrument: Scalars['String']['input'];
|
|
@@ -275,7 +274,6 @@ export type QueryVolatilityChartArgs = {
|
|
|
275
274
|
timeUnit: VolatilityChartTimeUnit;
|
|
276
275
|
};
|
|
277
276
|
|
|
278
|
-
|
|
279
277
|
export type QueryVolatilityChartAssetClassesArgs = {
|
|
280
278
|
division?: InputMaybe<Division>;
|
|
281
279
|
};
|
|
@@ -283,7 +281,7 @@ export type QueryVolatilityChartAssetClassesArgs = {
|
|
|
283
281
|
export enum Region {
|
|
284
282
|
Amer = 'AMER',
|
|
285
283
|
Apac = 'APAC',
|
|
286
|
-
Emea = 'EMEA'
|
|
284
|
+
Emea = 'EMEA',
|
|
287
285
|
}
|
|
288
286
|
|
|
289
287
|
export type Sentiment = {
|
|
@@ -302,7 +300,7 @@ export type SentimentInstrument = {
|
|
|
302
300
|
|
|
303
301
|
export enum Sort {
|
|
304
302
|
Bearish = 'BEARISH',
|
|
305
|
-
Bullish = 'BULLISH'
|
|
303
|
+
Bullish = 'BULLISH',
|
|
306
304
|
}
|
|
307
305
|
|
|
308
306
|
export type StrengthRelation = {
|
|
@@ -337,13 +335,13 @@ export enum TopicalSort {
|
|
|
337
335
|
Bullish = 'BULLISH',
|
|
338
336
|
Hot = 'HOT',
|
|
339
337
|
Popular = 'POPULAR',
|
|
340
|
-
Volatile = 'VOLATILE'
|
|
338
|
+
Volatile = 'VOLATILE',
|
|
341
339
|
}
|
|
342
340
|
|
|
343
341
|
export enum ValueAtRiskBars {
|
|
344
342
|
C100 = 'C100',
|
|
345
343
|
C200 = 'C200',
|
|
346
|
-
C300 = 'C300'
|
|
344
|
+
C300 = 'C300',
|
|
347
345
|
}
|
|
348
346
|
|
|
349
347
|
export type ValueAtRiskChart = {
|
|
@@ -373,7 +371,7 @@ export enum ValueAtRiskDuration {
|
|
|
373
371
|
C3 = 'C3',
|
|
374
372
|
C4 = 'C4',
|
|
375
373
|
C5 = 'C5',
|
|
376
|
-
C10 = 'C10'
|
|
374
|
+
C10 = 'C10',
|
|
377
375
|
}
|
|
378
376
|
|
|
379
377
|
export type VolatilityChart = {
|
|
@@ -396,13 +394,13 @@ export enum VolatilityChartTimeSpan {
|
|
|
396
394
|
/** Valid for: W */
|
|
397
395
|
W5 = 'W5',
|
|
398
396
|
/** Valid for: W */
|
|
399
|
-
W10 = 'W10'
|
|
397
|
+
W10 = 'W10',
|
|
400
398
|
}
|
|
401
399
|
|
|
402
400
|
export enum VolatilityChartTimeUnit {
|
|
403
401
|
D = 'D',
|
|
404
402
|
H = 'H',
|
|
405
|
-
W = 'W'
|
|
403
|
+
W = 'W',
|
|
406
404
|
}
|
|
407
405
|
|
|
408
406
|
export type GetInstrumentSentimentQueryVariables = Exact<{
|
|
@@ -410,16 +408,196 @@ export type GetInstrumentSentimentQueryVariables = Exact<{
|
|
|
410
408
|
division?: InputMaybe<Division>;
|
|
411
409
|
}>;
|
|
412
410
|
|
|
413
|
-
|
|
414
|
-
|
|
411
|
+
export type GetInstrumentSentimentQuery = {
|
|
412
|
+
__typename?: 'Query';
|
|
413
|
+
sentiment?: Array<{
|
|
414
|
+
__typename?: 'SentimentInstrument';
|
|
415
|
+
name: string;
|
|
416
|
+
displayName: string;
|
|
417
|
+
updatedAt: string;
|
|
418
|
+
sentiment: {
|
|
419
|
+
__typename?: 'Sentiment';
|
|
420
|
+
shortPercent: number;
|
|
421
|
+
longPercent: number;
|
|
422
|
+
};
|
|
423
|
+
}> | null;
|
|
424
|
+
};
|
|
415
425
|
|
|
416
426
|
export type GetSentimentListQueryVariables = Exact<{
|
|
417
427
|
division?: InputMaybe<Division>;
|
|
418
428
|
}>;
|
|
419
429
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
430
|
+
export type GetSentimentListQuery = {
|
|
431
|
+
__typename?: 'Query';
|
|
432
|
+
sentimentList?: Array<{
|
|
433
|
+
__typename?: 'SentimentInstrument';
|
|
434
|
+
name: string;
|
|
435
|
+
displayName: string;
|
|
436
|
+
updatedAt: string;
|
|
437
|
+
sentiment: {
|
|
438
|
+
__typename?: 'Sentiment';
|
|
439
|
+
shortPercent: number;
|
|
440
|
+
longPercent: number;
|
|
441
|
+
};
|
|
442
|
+
}> | null;
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
export const GetInstrumentSentimentDocument = {
|
|
446
|
+
kind: 'Document',
|
|
447
|
+
definitions: [
|
|
448
|
+
{
|
|
449
|
+
kind: 'OperationDefinition',
|
|
450
|
+
operation: 'query',
|
|
451
|
+
name: { kind: 'Name', value: 'GetInstrumentSentiment' },
|
|
452
|
+
variableDefinitions: [
|
|
453
|
+
{
|
|
454
|
+
kind: 'VariableDefinition',
|
|
455
|
+
variable: { kind: 'Variable', name: { kind: 'Name', value: 'name' } },
|
|
456
|
+
type: {
|
|
457
|
+
kind: 'NonNullType',
|
|
458
|
+
type: {
|
|
459
|
+
kind: 'NamedType',
|
|
460
|
+
name: { kind: 'Name', value: 'String' },
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
kind: 'VariableDefinition',
|
|
466
|
+
variable: {
|
|
467
|
+
kind: 'Variable',
|
|
468
|
+
name: { kind: 'Name', value: 'division' },
|
|
469
|
+
},
|
|
470
|
+
type: {
|
|
471
|
+
kind: 'NamedType',
|
|
472
|
+
name: { kind: 'Name', value: 'Division' },
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
],
|
|
476
|
+
selectionSet: {
|
|
477
|
+
kind: 'SelectionSet',
|
|
478
|
+
selections: [
|
|
479
|
+
{
|
|
480
|
+
kind: 'Field',
|
|
481
|
+
name: { kind: 'Name', value: 'sentiment' },
|
|
482
|
+
arguments: [
|
|
483
|
+
{
|
|
484
|
+
kind: 'Argument',
|
|
485
|
+
name: { kind: 'Name', value: 'name' },
|
|
486
|
+
value: {
|
|
487
|
+
kind: 'Variable',
|
|
488
|
+
name: { kind: 'Name', value: 'name' },
|
|
489
|
+
},
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
kind: 'Argument',
|
|
493
|
+
name: { kind: 'Name', value: 'division' },
|
|
494
|
+
value: {
|
|
495
|
+
kind: 'Variable',
|
|
496
|
+
name: { kind: 'Name', value: 'division' },
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
],
|
|
500
|
+
selectionSet: {
|
|
501
|
+
kind: 'SelectionSet',
|
|
502
|
+
selections: [
|
|
503
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'name' } },
|
|
504
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'displayName' } },
|
|
505
|
+
{
|
|
506
|
+
kind: 'Field',
|
|
507
|
+
name: { kind: 'Name', value: 'sentiment' },
|
|
508
|
+
selectionSet: {
|
|
509
|
+
kind: 'SelectionSet',
|
|
510
|
+
selections: [
|
|
511
|
+
{
|
|
512
|
+
kind: 'Field',
|
|
513
|
+
name: { kind: 'Name', value: 'shortPercent' },
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
kind: 'Field',
|
|
517
|
+
name: { kind: 'Name', value: 'longPercent' },
|
|
518
|
+
},
|
|
519
|
+
],
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'updatedAt' } },
|
|
523
|
+
],
|
|
524
|
+
},
|
|
525
|
+
},
|
|
526
|
+
],
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
],
|
|
530
|
+
} as unknown as DocumentNode<
|
|
531
|
+
GetInstrumentSentimentQuery,
|
|
532
|
+
GetInstrumentSentimentQueryVariables
|
|
533
|
+
>;
|
|
534
|
+
export const GetSentimentListDocument = {
|
|
535
|
+
kind: 'Document',
|
|
536
|
+
definitions: [
|
|
537
|
+
{
|
|
538
|
+
kind: 'OperationDefinition',
|
|
539
|
+
operation: 'query',
|
|
540
|
+
name: { kind: 'Name', value: 'GetSentimentList' },
|
|
541
|
+
variableDefinitions: [
|
|
542
|
+
{
|
|
543
|
+
kind: 'VariableDefinition',
|
|
544
|
+
variable: {
|
|
545
|
+
kind: 'Variable',
|
|
546
|
+
name: { kind: 'Name', value: 'division' },
|
|
547
|
+
},
|
|
548
|
+
type: {
|
|
549
|
+
kind: 'NamedType',
|
|
550
|
+
name: { kind: 'Name', value: 'Division' },
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
],
|
|
554
|
+
selectionSet: {
|
|
555
|
+
kind: 'SelectionSet',
|
|
556
|
+
selections: [
|
|
557
|
+
{
|
|
558
|
+
kind: 'Field',
|
|
559
|
+
name: { kind: 'Name', value: 'sentimentList' },
|
|
560
|
+
arguments: [
|
|
561
|
+
{
|
|
562
|
+
kind: 'Argument',
|
|
563
|
+
name: { kind: 'Name', value: 'division' },
|
|
564
|
+
value: {
|
|
565
|
+
kind: 'Variable',
|
|
566
|
+
name: { kind: 'Name', value: 'division' },
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
],
|
|
570
|
+
selectionSet: {
|
|
571
|
+
kind: 'SelectionSet',
|
|
572
|
+
selections: [
|
|
573
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'name' } },
|
|
574
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'displayName' } },
|
|
575
|
+
{
|
|
576
|
+
kind: 'Field',
|
|
577
|
+
name: { kind: 'Name', value: 'sentiment' },
|
|
578
|
+
selectionSet: {
|
|
579
|
+
kind: 'SelectionSet',
|
|
580
|
+
selections: [
|
|
581
|
+
{
|
|
582
|
+
kind: 'Field',
|
|
583
|
+
name: { kind: 'Name', value: 'shortPercent' },
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
kind: 'Field',
|
|
587
|
+
name: { kind: 'Name', value: 'longPercent' },
|
|
588
|
+
},
|
|
589
|
+
],
|
|
590
|
+
},
|
|
591
|
+
},
|
|
592
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'updatedAt' } },
|
|
593
|
+
],
|
|
594
|
+
},
|
|
595
|
+
},
|
|
596
|
+
],
|
|
597
|
+
},
|
|
598
|
+
},
|
|
599
|
+
],
|
|
600
|
+
} as unknown as DocumentNode<
|
|
601
|
+
GetSentimentListQuery,
|
|
602
|
+
GetSentimentListQueryVariables
|
|
603
|
+
>;
|
package/src/gql/types/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './fragment-masking';
|
|
2
|
+
export * from './gql';
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Translations } from '@oanda/mono-i18n';
|
|
2
|
+
import { Locale } from '@oanda/mono-i18n';
|
|
2
3
|
|
|
3
4
|
import en from './sources/en.json';
|
|
4
|
-
import zhTW from './sources/zh_TW.json';
|
|
5
5
|
import es from './sources/es.json';
|
|
6
6
|
import th from './sources/th.json';
|
|
7
|
-
|
|
8
|
-
import { defaultTranslations } from './translations';
|
|
7
|
+
import zhTW from './sources/zh_TW.json';
|
|
8
|
+
import type { defaultTranslations } from './translations';
|
|
9
9
|
|
|
10
10
|
export type TranslationKey = keyof typeof defaultTranslations;
|
|
11
11
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const defaultTranslations = {
|
|
2
2
|
data_unavailable: 'Data unavailable',
|
|
3
|
-
pagination_entries_range:
|
|
3
|
+
pagination_entries_range:
|
|
4
|
+
'{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries',
|
|
4
5
|
};
|
package/test/SortSwitch.test.tsx
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { render, fireEvent } from '@testing-library/react';
|
|
6
4
|
import { MockLayoutProvider } from '@oanda/labs-widget-common';
|
|
7
|
-
import {
|
|
5
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
SelectedArrow,
|
|
10
|
+
SortSwitch,
|
|
11
|
+
} from '../src/SentimentWidget/components/SortSwitch';
|
|
8
12
|
|
|
9
13
|
describe('SortSwitch component', () => {
|
|
10
14
|
it('should render switch component', () => {
|
|
@@ -15,7 +19,7 @@ describe('SortSwitch component', () => {
|
|
|
15
19
|
onClickButtonDown={() => {}}
|
|
16
20
|
onClickButtonUp={() => {}}
|
|
17
21
|
/>
|
|
18
|
-
</MockLayoutProvider
|
|
22
|
+
</MockLayoutProvider>
|
|
19
23
|
);
|
|
20
24
|
|
|
21
25
|
expect(getByTestId('sort-switch')).toBeInTheDocument();
|
|
@@ -33,7 +37,7 @@ describe('SortSwitch component', () => {
|
|
|
33
37
|
onClickButtonDown={() => onClickDownSpy()}
|
|
34
38
|
onClickButtonUp={() => onClickUpSpy()}
|
|
35
39
|
/>
|
|
36
|
-
</MockLayoutProvider
|
|
40
|
+
</MockLayoutProvider>
|
|
37
41
|
);
|
|
38
42
|
|
|
39
43
|
fireEvent.click(getByTestId('sort-switch-button-up'));
|
|
@@ -54,7 +58,7 @@ describe('SortSwitch component', () => {
|
|
|
54
58
|
onClickButtonDown={() => onClickDownSpy()}
|
|
55
59
|
onClickButtonUp={() => onClickUpSpy()}
|
|
56
60
|
/>
|
|
57
|
-
</MockLayoutProvider
|
|
61
|
+
</MockLayoutProvider>
|
|
58
62
|
);
|
|
59
63
|
|
|
60
64
|
fireEvent.click(getByTestId('sort-switch-button-up'));
|
|
@@ -76,7 +80,7 @@ describe('SortSwitch component', () => {
|
|
|
76
80
|
onClickButtonDown={() => onClickDownSpy()}
|
|
77
81
|
onClickButtonUp={() => onClickUpSpy()}
|
|
78
82
|
/>
|
|
79
|
-
</MockLayoutProvider
|
|
83
|
+
</MockLayoutProvider>
|
|
80
84
|
);
|
|
81
85
|
|
|
82
86
|
fireEvent.click(getByTestId('sort-switch-button-up'));
|
package/test/Tool.test.tsx
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { render } from '@testing-library/react';
|
|
6
4
|
import { MockedProvider } from '@apollo/client/testing';
|
|
7
5
|
import { MockLayoutProvider } from '@oanda/labs-widget-common';
|
|
8
|
-
import {
|
|
6
|
+
import { render } from '@testing-library/react';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
9
|
import { getSentimentList } from '../src/gql/getSentimentList';
|
|
10
10
|
import { Division } from '../src/gql/types/graphql';
|
|
11
|
+
import { Tool } from '../src/SentimentWidget/Tool';
|
|
11
12
|
|
|
12
13
|
const mocks = [
|
|
13
14
|
{
|
|
@@ -46,7 +47,8 @@ const mocks = [
|
|
|
46
47
|
shortPercent: 25.2,
|
|
47
48
|
},
|
|
48
49
|
updatedAt: '2023-12-02T10:00:08.509215576Z',
|
|
49
|
-
}
|
|
50
|
+
},
|
|
51
|
+
],
|
|
50
52
|
},
|
|
51
53
|
},
|
|
52
54
|
},
|
|
@@ -71,7 +73,7 @@ describe('Tool component', () => {
|
|
|
71
73
|
<MockLayoutProvider>
|
|
72
74
|
<Tool division={Division.Oc} />
|
|
73
75
|
</MockLayoutProvider>
|
|
74
|
-
</MockedProvider
|
|
76
|
+
</MockedProvider>
|
|
75
77
|
);
|
|
76
78
|
|
|
77
79
|
expect(await findByTestId('sentiment-tool')).toBeInTheDocument();
|
|
@@ -83,7 +85,7 @@ describe('Tool component', () => {
|
|
|
83
85
|
<MockLayoutProvider>
|
|
84
86
|
<Tool division={Division.Oc} />
|
|
85
87
|
</MockLayoutProvider>
|
|
86
|
-
</MockedProvider
|
|
88
|
+
</MockedProvider>
|
|
87
89
|
);
|
|
88
90
|
|
|
89
91
|
expect(await findByTestId('sentiment-tool')).toBeInTheDocument();
|
package/test/Widget.test.tsx
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { render } from '@testing-library/react';
|
|
6
4
|
import { MockedProvider } from '@apollo/client/testing';
|
|
7
5
|
import { MockLayoutProvider } from '@oanda/labs-widget-common';
|
|
8
|
-
import {
|
|
6
|
+
import { render } from '@testing-library/react';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
9
|
import { getInstrumentSentiment } from '../src/gql/getInstrumentSentiment';
|
|
10
10
|
import { Division } from '../src/gql/types/graphql';
|
|
11
|
+
import { Widget } from '../src/SentimentWidget/Widget';
|
|
11
12
|
|
|
12
13
|
const mocks = [
|
|
13
14
|
{
|
|
@@ -20,15 +21,17 @@ const mocks = [
|
|
|
20
21
|
},
|
|
21
22
|
result: {
|
|
22
23
|
data: {
|
|
23
|
-
sentiment: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
sentiment: [
|
|
25
|
+
{
|
|
26
|
+
name: 'EUR/USD',
|
|
27
|
+
displayName: 'EUR/USD',
|
|
28
|
+
sentiment: {
|
|
29
|
+
longPercent: 34,
|
|
30
|
+
shortPercent: 66,
|
|
31
|
+
},
|
|
32
|
+
updatedAt: '2023-12-02T10:00:08.509215576Z',
|
|
29
33
|
},
|
|
30
|
-
|
|
31
|
-
}],
|
|
34
|
+
],
|
|
32
35
|
},
|
|
33
36
|
},
|
|
34
37
|
},
|
|
@@ -45,15 +48,17 @@ const zeroPercentMocks = [
|
|
|
45
48
|
},
|
|
46
49
|
result: {
|
|
47
50
|
data: {
|
|
48
|
-
sentiment: [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
sentiment: [
|
|
52
|
+
{
|
|
53
|
+
name: 'GBP/USD',
|
|
54
|
+
displayName: 'GBP/USD',
|
|
55
|
+
sentiment: {
|
|
56
|
+
longPercent: 0,
|
|
57
|
+
shortPercent: 0,
|
|
58
|
+
},
|
|
59
|
+
updatedAt: '2023-12-02T10:00:08.509215576Z',
|
|
54
60
|
},
|
|
55
|
-
|
|
56
|
-
}],
|
|
61
|
+
],
|
|
57
62
|
},
|
|
58
63
|
},
|
|
59
64
|
},
|
|
@@ -66,7 +71,7 @@ describe('Widget component', () => {
|
|
|
66
71
|
<MockLayoutProvider>
|
|
67
72
|
<Widget division={Division.Oc} instrument="EUR/USD" />
|
|
68
73
|
</MockLayoutProvider>
|
|
69
|
-
</MockedProvider
|
|
74
|
+
</MockedProvider>
|
|
70
75
|
);
|
|
71
76
|
|
|
72
77
|
expect(await findByTestId('sentiment-widget')).toBeInTheDocument();
|
|
@@ -78,7 +83,7 @@ describe('Widget component', () => {
|
|
|
78
83
|
<MockLayoutProvider>
|
|
79
84
|
<Widget division={Division.Oc} instrument="GBP/USD" />
|
|
80
85
|
</MockLayoutProvider>
|
|
81
|
-
</MockedProvider
|
|
86
|
+
</MockedProvider>
|
|
82
87
|
);
|
|
83
88
|
|
|
84
89
|
expect(await findByTestId('sentiment-widget')).toBeInTheDocument();
|