@oanda/labs-currency-cross-table 1.0.5 → 1.0.7
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 +60 -0
- package/codegen.ts +15 -0
- package/dist/main/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +12 -4
- package/dist/main/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/Main.js +11 -9
- package/dist/main/CurrencyCrossTableWidget/Main.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/ValidationWrapper.js +2 -1
- package/dist/main/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/components/CellValidationWrapper.js +51 -0
- package/dist/main/CurrencyCrossTableWidget/components/CellValidationWrapper.js.map +1 -0
- package/dist/main/CurrencyCrossTableWidget/components/CellWithData.js +19 -11
- package/dist/main/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/components/types.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/render.js +7 -2
- package/dist/main/CurrencyCrossTableWidget/render.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/types.js +0 -13
- package/dist/main/CurrencyCrossTableWidget/types.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/utils.js +13 -30
- package/dist/main/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js +23 -0
- package/dist/main/gql/types/fragment-masking.js.map +1 -0
- package/dist/main/gql/types/gql.js +16 -0
- package/dist/main/gql/types/gql.js.map +1 -0
- package/dist/main/gql/types/graphql.js +223 -0
- package/dist/main/gql/types/graphql.js.map +1 -0
- package/dist/main/gql/types/index.js +28 -0
- package/dist/main/gql/types/index.js.map +1 -0
- package/dist/main/gql/validateInstruments.js +16 -0
- package/dist/main/gql/validateInstruments.js.map +1 -0
- package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +10 -2
- package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/Main.js +13 -11
- package/dist/module/CurrencyCrossTableWidget/Main.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js +2 -1
- package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/CellValidationWrapper.js +44 -0
- package/dist/module/CurrencyCrossTableWidget/components/CellValidationWrapper.js.map +1 -0
- package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js +20 -12
- package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/types.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/render.js +6 -1
- package/dist/module/CurrencyCrossTableWidget/render.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/types.js +0 -12
- package/dist/module/CurrencyCrossTableWidget/types.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/utils.js +10 -29
- package/dist/module/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +15 -0
- package/dist/module/gql/types/fragment-masking.js.map +1 -0
- package/dist/module/gql/types/gql.js +8 -0
- package/dist/module/gql/types/gql.js.map +1 -0
- package/dist/module/gql/types/graphql.js +217 -0
- package/dist/module/gql/types/graphql.js.map +1 -0
- package/dist/module/gql/types/index.js +3 -0
- package/dist/module/gql/types/index.js.map +1 -0
- package/dist/module/gql/validateInstruments.js +10 -0
- package/dist/module/gql/validateInstruments.js.map +1 -0
- package/dist/types/CurrencyCrossTableWidget/CurrencyCrossTableWidget.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/Main.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/components/CellValidationWrapper.d.ts +4 -0
- package/dist/types/CurrencyCrossTableWidget/components/CellWithData.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/components/types.d.ts +15 -1
- package/dist/types/CurrencyCrossTableWidget/types.d.ts +3 -11
- package/dist/types/CurrencyCrossTableWidget/utils.d.ts +5 -6
- package/dist/types/gql/types/fragment-masking.d.ts +15 -0
- package/dist/types/gql/types/gql.d.ts +37 -0
- package/dist/types/gql/types/graphql.d.ts +384 -0
- package/dist/types/gql/types/index.d.ts +2 -0
- package/dist/types/gql/validateInstruments.d.ts +1 -0
- package/package.json +12 -4
- package/src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx +16 -6
- package/src/CurrencyCrossTableWidget/Main.tsx +19 -13
- package/src/CurrencyCrossTableWidget/ValidationWrapper.tsx +1 -0
- package/src/CurrencyCrossTableWidget/components/CellValidationWrapper.tsx +51 -0
- package/src/CurrencyCrossTableWidget/components/CellWithData.tsx +30 -14
- package/src/CurrencyCrossTableWidget/components/types.ts +15 -1
- package/src/CurrencyCrossTableWidget/render.tsx +6 -2
- package/src/CurrencyCrossTableWidget/types.tsx +3 -12
- package/src/CurrencyCrossTableWidget/utils.ts +17 -37
- package/src/gql/types/fragment-masking.ts +66 -0
- package/src/gql/types/gql.ts +42 -0
- package/src/gql/types/graphql.ts +423 -0
- package/src/gql/types/index.ts +2 -0
- package/src/gql/validateInstruments.ts +10 -0
- package/test/Main.test.tsx +12 -6
- package/test/mocks.ts +225 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
3
|
+
export type Maybe<T> = T | null;
|
|
4
|
+
export type InputMaybe<T> = Maybe<T>;
|
|
5
|
+
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
|
6
|
+
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
|
7
|
+
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
|
8
|
+
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
|
|
9
|
+
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
|
|
10
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
11
|
+
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; }
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type AssetClass = {
|
|
20
|
+
__typename?: 'AssetClass';
|
|
21
|
+
instruments: Array<Instrument>;
|
|
22
|
+
name: Scalars['String']['output'];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export enum AssetClassName {
|
|
26
|
+
Commodities = 'COMMODITIES',
|
|
27
|
+
Cryptocurrency = 'CRYPTOCURRENCY',
|
|
28
|
+
Currency = 'CURRENCY',
|
|
29
|
+
EquityShares = 'EQUITY_SHARES',
|
|
30
|
+
Indices = 'INDICES',
|
|
31
|
+
Rates = 'RATES'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export enum BookType {
|
|
35
|
+
Order = 'ORDER',
|
|
36
|
+
Position = 'POSITION'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type CorrelationHeatmap = {
|
|
40
|
+
__typename?: 'CorrelationHeatmap';
|
|
41
|
+
baseInstrument: Instrument;
|
|
42
|
+
heatmap: Array<Heatmap>;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type CorrelationMatrix = {
|
|
46
|
+
__typename?: 'CorrelationMatrix';
|
|
47
|
+
baseTimeUnit: CorrelationTimeUnit;
|
|
48
|
+
matrix: Array<Matrix>;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export enum CorrelationTimeUnit {
|
|
52
|
+
H1 = 'H1',
|
|
53
|
+
H4 = 'H4',
|
|
54
|
+
H24 = 'H24',
|
|
55
|
+
M1 = 'M1',
|
|
56
|
+
M3 = 'M3',
|
|
57
|
+
M6 = 'M6',
|
|
58
|
+
W1 = 'W1',
|
|
59
|
+
Y1 = 'Y1'
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export enum CurrencyName {
|
|
63
|
+
Aud = 'AUD',
|
|
64
|
+
Cad = 'CAD',
|
|
65
|
+
Chf = 'CHF',
|
|
66
|
+
Eur = 'EUR',
|
|
67
|
+
Gbp = 'GBP',
|
|
68
|
+
Jpy = 'JPY',
|
|
69
|
+
Nzd = 'NZD',
|
|
70
|
+
Usd = 'USD'
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type CurrencyPower = {
|
|
74
|
+
__typename?: 'CurrencyPower';
|
|
75
|
+
/** UTC Timestamp */
|
|
76
|
+
point: Scalars['String']['output'];
|
|
77
|
+
price: Scalars['Float']['output'];
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export type CurrencyPowerBalance = {
|
|
81
|
+
__typename?: 'CurrencyPowerBalance';
|
|
82
|
+
currency: CurrencyName;
|
|
83
|
+
power: Array<CurrencyPower>;
|
|
84
|
+
updatedAt: Scalars['String']['output'];
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export enum CurrencyPowerBalanceTimeUnit {
|
|
88
|
+
CurrentDay = 'CURRENT_DAY',
|
|
89
|
+
H4 = 'H4',
|
|
90
|
+
H8 = 'H8',
|
|
91
|
+
H24 = 'H24',
|
|
92
|
+
M1 = 'M1',
|
|
93
|
+
M3 = 'M3',
|
|
94
|
+
PreviousDay = 'PREVIOUS_DAY',
|
|
95
|
+
W1 = 'W1'
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type CurrencyStrength = {
|
|
99
|
+
__typename?: 'CurrencyStrength';
|
|
100
|
+
currency: CurrencyName;
|
|
101
|
+
strengthRelation?: Maybe<Array<StrengthRelation>>;
|
|
102
|
+
updatedAt: Scalars['String']['output'];
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export enum DataSource {
|
|
106
|
+
Ny4 = 'NY4',
|
|
107
|
+
Ty3 = 'TY3'
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export enum Division {
|
|
111
|
+
Oap = 'OAP',
|
|
112
|
+
Oau = 'OAU',
|
|
113
|
+
Oc = 'OC',
|
|
114
|
+
Ocan = 'OCAN',
|
|
115
|
+
Oel = 'OEL',
|
|
116
|
+
Ogm = 'OGM',
|
|
117
|
+
Oj = 'OJ',
|
|
118
|
+
Opt = 'OPT',
|
|
119
|
+
Otms = 'OTMS'
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export type Heatmap = {
|
|
123
|
+
__typename?: 'Heatmap';
|
|
124
|
+
instrument: Instrument;
|
|
125
|
+
timeCorrelation: Array<TimeCorrelation>;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export type Instrument = {
|
|
129
|
+
__typename?: 'Instrument';
|
|
130
|
+
displayName: Scalars['String']['output'];
|
|
131
|
+
name: Scalars['String']['output'];
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export type InstrumentCorrelation = {
|
|
135
|
+
__typename?: 'InstrumentCorrelation';
|
|
136
|
+
instrument: Instrument;
|
|
137
|
+
value?: Maybe<Scalars['Float']['output']>;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export type Matrix = {
|
|
141
|
+
__typename?: 'Matrix';
|
|
142
|
+
instrument: Instrument;
|
|
143
|
+
instrumentCorrelation: Array<InstrumentCorrelation>;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export type OrderPositionBucket = {
|
|
147
|
+
__typename?: 'OrderPositionBucket';
|
|
148
|
+
longCountPercent: Scalars['Float']['output'];
|
|
149
|
+
price: Scalars['Float']['output'];
|
|
150
|
+
shortCountPercent: Scalars['Float']['output'];
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export type OrderPositionData = {
|
|
154
|
+
__typename?: 'OrderPositionData';
|
|
155
|
+
bucketWidth: Scalars['Float']['output'];
|
|
156
|
+
buckets: Array<Maybe<OrderPositionBucket>>;
|
|
157
|
+
dataSource?: Maybe<Scalars['String']['output']>;
|
|
158
|
+
instrument: Scalars['String']['output'];
|
|
159
|
+
price?: Maybe<Scalars['Float']['output']>;
|
|
160
|
+
region?: Maybe<Scalars['String']['output']>;
|
|
161
|
+
time: Scalars['String']['output'];
|
|
162
|
+
unixTime: Scalars['Int']['output'];
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export type Query = {
|
|
166
|
+
__typename?: 'Query';
|
|
167
|
+
assetClasses?: Maybe<Array<Maybe<AssetClass>>>;
|
|
168
|
+
correlationHeatmap: CorrelationHeatmap;
|
|
169
|
+
correlationMatrix: CorrelationMatrix;
|
|
170
|
+
currencyPowerBalance?: Maybe<Array<CurrencyPowerBalance>>;
|
|
171
|
+
currencyStrength?: Maybe<Array<CurrencyStrength>>;
|
|
172
|
+
isAllowedPartner?: Maybe<Scalars['Boolean']['output']>;
|
|
173
|
+
mapInstrumentNames?: Maybe<Array<Maybe<Instrument>>>;
|
|
174
|
+
orderPositionBooks: Array<Maybe<OrderPositionData>>;
|
|
175
|
+
sentiment?: Maybe<Array<SentimentInstrument>>;
|
|
176
|
+
sentimentList?: Maybe<Array<SentimentInstrument>>;
|
|
177
|
+
topicalInstruments?: Maybe<Array<TopicalInstrument>>;
|
|
178
|
+
topicalInstrumentsCharts?: Maybe<Array<TopicalInstrumentChart>>;
|
|
179
|
+
topicalInstrumentsTotalCount: Scalars['Int']['output'];
|
|
180
|
+
valueAtRiskAssetClasses?: Maybe<Array<AssetClass>>;
|
|
181
|
+
valueAtRiskChart?: Maybe<ValueAtRiskChart>;
|
|
182
|
+
volatilityChart?: Maybe<Array<Maybe<VolatilityChart>>>;
|
|
183
|
+
volatilityChartAssetClasses?: Maybe<Array<AssetClass>>;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
export type QueryAssetClassesArgs = {
|
|
188
|
+
division: Division;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
export type QueryCorrelationHeatmapArgs = {
|
|
193
|
+
division: Division;
|
|
194
|
+
instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
|
|
195
|
+
timeSpans?: InputMaybe<Array<InputMaybe<CorrelationTimeUnit>>>;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
export type QueryCorrelationMatrixArgs = {
|
|
200
|
+
division: Division;
|
|
201
|
+
instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
export type QueryCurrencyPowerBalanceArgs = {
|
|
206
|
+
timeUnit: CurrencyPowerBalanceTimeUnit;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
export type QueryIsAllowedPartnerArgs = {
|
|
211
|
+
url: Scalars['String']['input'];
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
export type QueryMapInstrumentNamesArgs = {
|
|
216
|
+
division?: InputMaybe<Division>;
|
|
217
|
+
instruments: Array<InputMaybe<Scalars['String']['input']>>;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
export type QueryOrderPositionBooksArgs = {
|
|
222
|
+
bookType: BookType;
|
|
223
|
+
dataSource?: InputMaybe<DataSource>;
|
|
224
|
+
instrument: Scalars['String']['input'];
|
|
225
|
+
recentHours?: InputMaybe<Scalars['Int']['input']>;
|
|
226
|
+
region?: InputMaybe<Region>;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
export type QuerySentimentArgs = {
|
|
231
|
+
division?: InputMaybe<Division>;
|
|
232
|
+
name: Scalars['String']['input'];
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
export type QuerySentimentListArgs = {
|
|
237
|
+
division?: InputMaybe<Division>;
|
|
238
|
+
sort?: InputMaybe<Sort>;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
export type QueryTopicalInstrumentsArgs = {
|
|
243
|
+
assetClass?: InputMaybe<AssetClassName>;
|
|
244
|
+
count?: InputMaybe<Scalars['Int']['input']>;
|
|
245
|
+
division?: InputMaybe<Division>;
|
|
246
|
+
offset?: InputMaybe<Scalars['Int']['input']>;
|
|
247
|
+
sort: TopicalSort;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
export type QueryTopicalInstrumentsChartsArgs = {
|
|
252
|
+
division?: InputMaybe<Division>;
|
|
253
|
+
instruments?: InputMaybe<Array<Scalars['String']['input']>>;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
export type QueryTopicalInstrumentsTotalCountArgs = {
|
|
258
|
+
assetClass?: InputMaybe<AssetClassName>;
|
|
259
|
+
division?: InputMaybe<Division>;
|
|
260
|
+
sort: TopicalSort;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
export type QueryValueAtRiskAssetClassesArgs = {
|
|
265
|
+
division?: InputMaybe<Division>;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
export type QueryValueAtRiskChartArgs = {
|
|
270
|
+
bars: ValueAtRiskBars;
|
|
271
|
+
division?: InputMaybe<Division>;
|
|
272
|
+
duration: ValueAtRiskDuration;
|
|
273
|
+
instrument: Scalars['String']['input'];
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
export type QueryVolatilityChartArgs = {
|
|
278
|
+
division?: InputMaybe<Division>;
|
|
279
|
+
instrument: Scalars['String']['input'];
|
|
280
|
+
timeSpan: VolatilityChartTimeSpan;
|
|
281
|
+
timeUnit: VolatilityChartTimeUnit;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
export type QueryVolatilityChartAssetClassesArgs = {
|
|
286
|
+
division?: InputMaybe<Division>;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export enum Region {
|
|
290
|
+
Amer = 'AMER',
|
|
291
|
+
Apac = 'APAC',
|
|
292
|
+
Emea = 'EMEA'
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export type Sentiment = {
|
|
296
|
+
__typename?: 'Sentiment';
|
|
297
|
+
longPercent: Scalars['Float']['output'];
|
|
298
|
+
shortPercent: Scalars['Float']['output'];
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
export type SentimentInstrument = {
|
|
302
|
+
__typename?: 'SentimentInstrument';
|
|
303
|
+
displayName: Scalars['String']['output'];
|
|
304
|
+
name: Scalars['String']['output'];
|
|
305
|
+
sentiment: Sentiment;
|
|
306
|
+
updatedAt: Scalars['String']['output'];
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
export enum Sort {
|
|
310
|
+
Bearish = 'BEARISH',
|
|
311
|
+
Bullish = 'BULLISH'
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export type StrengthRelation = {
|
|
315
|
+
__typename?: 'StrengthRelation';
|
|
316
|
+
currency: CurrencyName;
|
|
317
|
+
percentage: Scalars['Float']['output'];
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export type TimeCorrelation = {
|
|
321
|
+
__typename?: 'TimeCorrelation';
|
|
322
|
+
timeUnit: CorrelationTimeUnit;
|
|
323
|
+
value?: Maybe<Scalars['Float']['output']>;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
export type TopicalInstrument = {
|
|
327
|
+
__typename?: 'TopicalInstrument';
|
|
328
|
+
assetClass?: Maybe<AssetClassName>;
|
|
329
|
+
displayName: Scalars['String']['output'];
|
|
330
|
+
name: Scalars['String']['output'];
|
|
331
|
+
sentiment: Sentiment;
|
|
332
|
+
updatedAt: Scalars['String']['output'];
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export type TopicalInstrumentChart = {
|
|
336
|
+
__typename?: 'TopicalInstrumentChart';
|
|
337
|
+
chart?: Maybe<Array<Scalars['Float']['output']>>;
|
|
338
|
+
name: Scalars['String']['output'];
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
export enum TopicalSort {
|
|
342
|
+
Bearish = 'BEARISH',
|
|
343
|
+
Bullish = 'BULLISH',
|
|
344
|
+
Hot = 'HOT',
|
|
345
|
+
Popular = 'POPULAR',
|
|
346
|
+
Volatile = 'VOLATILE'
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export enum ValueAtRiskBars {
|
|
350
|
+
C100 = 'C100',
|
|
351
|
+
C200 = 'C200',
|
|
352
|
+
C300 = 'C300'
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export type ValueAtRiskChart = {
|
|
356
|
+
__typename?: 'ValueAtRiskChart';
|
|
357
|
+
down: ValueAtRiskChartData;
|
|
358
|
+
up: ValueAtRiskChartData;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
export type ValueAtRiskChartData = {
|
|
362
|
+
__typename?: 'ValueAtRiskChartData';
|
|
363
|
+
average: Scalars['Float']['output'];
|
|
364
|
+
max: Scalars['Float']['output'];
|
|
365
|
+
median: Scalars['Float']['output'];
|
|
366
|
+
points?: Maybe<Array<ValueAtRiskChartPoint>>;
|
|
367
|
+
threshold: Scalars['Float']['output'];
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
export type ValueAtRiskChartPoint = {
|
|
371
|
+
__typename?: 'ValueAtRiskChartPoint';
|
|
372
|
+
percent: Scalars['Float']['output'];
|
|
373
|
+
pips: Scalars['Float']['output'];
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
export enum ValueAtRiskDuration {
|
|
377
|
+
C1 = 'C1',
|
|
378
|
+
C2 = 'C2',
|
|
379
|
+
C3 = 'C3',
|
|
380
|
+
C4 = 'C4',
|
|
381
|
+
C5 = 'C5',
|
|
382
|
+
C10 = 'C10'
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export type VolatilityChart = {
|
|
386
|
+
__typename?: 'VolatilityChart';
|
|
387
|
+
pips: Scalars['Float']['output'];
|
|
388
|
+
/** Time point - hour in format hh:mm, Date in UTC, Week in format 'Mo' */
|
|
389
|
+
point: Scalars['String']['output'];
|
|
390
|
+
updatedAt: Scalars['String']['output'];
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
export enum VolatilityChartTimeSpan {
|
|
394
|
+
/** Valid for: H */
|
|
395
|
+
D5 = 'D5',
|
|
396
|
+
/** Valid for: H */
|
|
397
|
+
D10 = 'D10',
|
|
398
|
+
/** Valid for: D */
|
|
399
|
+
M1 = 'M1',
|
|
400
|
+
/** Valid for: D */
|
|
401
|
+
M3 = 'M3',
|
|
402
|
+
/** Valid for: W */
|
|
403
|
+
W5 = 'W5',
|
|
404
|
+
/** Valid for: W */
|
|
405
|
+
W10 = 'W10'
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export enum VolatilityChartTimeUnit {
|
|
409
|
+
D = 'D',
|
|
410
|
+
H = 'H',
|
|
411
|
+
W = 'W'
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export type ValidateInstrumentsQueryVariables = Exact<{
|
|
415
|
+
instruments: Array<InputMaybe<Scalars['String']['input']>> | InputMaybe<Scalars['String']['input']>;
|
|
416
|
+
division?: InputMaybe<Division>;
|
|
417
|
+
}>;
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
export type ValidateInstrumentsQuery = { __typename?: 'Query', mapInstrumentNames?: Array<{ __typename?: 'Instrument', name: string, displayName: string } | null> | null };
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
export const ValidateInstrumentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"validateInstruments"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"instruments"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"division"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Division"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"mapInstrumentNames"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"instruments"},"value":{"kind":"Variable","name":{"kind":"Name","value":"instruments"}}},{"kind":"Argument","name":{"kind":"Name","value":"division"},"value":{"kind":"Variable","name":{"kind":"Name","value":"division"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}}]}}]}}]} as unknown as DocumentNode<ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const validateInstruments = gql`
|
|
4
|
+
query validateInstruments($instruments: [String]!, $division: Division) {
|
|
5
|
+
mapInstrumentNames(instruments: $instruments, division: $division) {
|
|
6
|
+
name
|
|
7
|
+
displayName
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
`;
|
package/test/Main.test.tsx
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { render } from '@testing-library/react';
|
|
6
|
+
import { MockedProvider } from '@apollo/client/testing';
|
|
6
7
|
import { ThemeContext, Size } from '@oanda/labs-widget-common';
|
|
7
8
|
import { Main } from '../src/CurrencyCrossTableWidget/Main';
|
|
9
|
+
import { Division } from '../src/gql/types/graphql';
|
|
10
|
+
import { widgetMocks } from './mocks';
|
|
8
11
|
|
|
9
12
|
describe('Main component', () => {
|
|
10
13
|
it('should render currency cross table component', () => {
|
|
@@ -12,12 +15,15 @@ describe('Main component', () => {
|
|
|
12
15
|
const instruments = ['EUR_USD', 'EUR_GBP', 'EUR_CHF', 'USD_EUR', 'USD_GBP', 'USD_CHF', 'GBP_EUR', 'GBP_USD', 'GBP_CHF', 'CHF_EUR', 'CHF_USD', 'CHF_GBP'];
|
|
13
16
|
|
|
14
17
|
const { getByTestId } = render(
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
<MockedProvider mocks={widgetMocks}>
|
|
19
|
+
<ThemeContext.Provider value={{ size: Size.DESKTOP, isDark: true }}>
|
|
20
|
+
<Main
|
|
21
|
+
currencies={currencies}
|
|
22
|
+
instruments={instruments}
|
|
23
|
+
division={Division.Oc}
|
|
24
|
+
/>
|
|
25
|
+
</ThemeContext.Provider>
|
|
26
|
+
</MockedProvider>,
|
|
21
27
|
);
|
|
22
28
|
|
|
23
29
|
expect(getByTestId('currency-cross-table-wrapper')).toBeInTheDocument();
|
package/test/mocks.ts
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { validateInstruments } from '../src/gql/validateInstruments';
|
|
2
|
+
|
|
3
|
+
const widgetMocks = [
|
|
4
|
+
{
|
|
5
|
+
request: {
|
|
6
|
+
query: validateInstruments,
|
|
7
|
+
variables: {
|
|
8
|
+
instruments: ['EUR_USD'],
|
|
9
|
+
division: 'OC',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
result: {
|
|
13
|
+
data: {
|
|
14
|
+
mapInstrumentNames: [
|
|
15
|
+
{
|
|
16
|
+
name: 'EUR_USD',
|
|
17
|
+
displayName: 'EUR/USD',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}, {
|
|
23
|
+
request: {
|
|
24
|
+
query: validateInstruments,
|
|
25
|
+
variables: {
|
|
26
|
+
instruments: ['EUR_GBP'],
|
|
27
|
+
division: 'OC',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
result: {
|
|
31
|
+
data: {
|
|
32
|
+
mapInstrumentNames: [
|
|
33
|
+
{
|
|
34
|
+
name: 'EUR_GBP',
|
|
35
|
+
displayName: 'EUR/GBP',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}, {
|
|
41
|
+
request: {
|
|
42
|
+
query: validateInstruments,
|
|
43
|
+
variables: {
|
|
44
|
+
instruments: ['EUR_CHF'],
|
|
45
|
+
division: 'OC',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
result: {
|
|
49
|
+
data: {
|
|
50
|
+
mapInstrumentNames: [
|
|
51
|
+
{
|
|
52
|
+
name: 'EUR_CHF',
|
|
53
|
+
displayName: 'EUR/CHF',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
}, {
|
|
59
|
+
request: {
|
|
60
|
+
query: validateInstruments,
|
|
61
|
+
variables: {
|
|
62
|
+
instruments: ['USD_EUR'],
|
|
63
|
+
division: 'OC',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
result: {
|
|
67
|
+
data: {
|
|
68
|
+
mapInstrumentNames: [
|
|
69
|
+
{
|
|
70
|
+
name: 'USD_EUR',
|
|
71
|
+
displayName: 'USD/EUR',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
}, {
|
|
77
|
+
request: {
|
|
78
|
+
query: validateInstruments,
|
|
79
|
+
variables: {
|
|
80
|
+
instruments: ['USD_GBP'],
|
|
81
|
+
division: 'OC',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
result: {
|
|
85
|
+
data: {
|
|
86
|
+
mapInstrumentNames: [
|
|
87
|
+
{
|
|
88
|
+
name: 'USD_GBP',
|
|
89
|
+
displayName: 'USD/GBP',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
}, {
|
|
95
|
+
request: {
|
|
96
|
+
query: validateInstruments,
|
|
97
|
+
variables: {
|
|
98
|
+
instruments: ['USD_CHF'],
|
|
99
|
+
division: 'OC',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
result: {
|
|
103
|
+
data: {
|
|
104
|
+
mapInstrumentNames: [
|
|
105
|
+
{
|
|
106
|
+
name: 'USD_CHF',
|
|
107
|
+
displayName: 'USD/CHF',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
}, {
|
|
113
|
+
request: {
|
|
114
|
+
query: validateInstruments,
|
|
115
|
+
variables: {
|
|
116
|
+
instruments: ['GBP_EUR'],
|
|
117
|
+
division: 'OC',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
result: {
|
|
121
|
+
data: {
|
|
122
|
+
mapInstrumentNames: [
|
|
123
|
+
{
|
|
124
|
+
name: 'GBP_EUR',
|
|
125
|
+
displayName: 'GBP/EUR',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
}, {
|
|
131
|
+
request: {
|
|
132
|
+
query: validateInstruments,
|
|
133
|
+
variables: {
|
|
134
|
+
instruments: ['GBP_USD'],
|
|
135
|
+
division: 'OC',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
result: {
|
|
139
|
+
data: {
|
|
140
|
+
mapInstrumentNames: [
|
|
141
|
+
{
|
|
142
|
+
name: 'GBP_USD',
|
|
143
|
+
displayName: 'GBP/USD',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
}, {
|
|
149
|
+
request: {
|
|
150
|
+
query: validateInstruments,
|
|
151
|
+
variables: {
|
|
152
|
+
instruments: ['GBP_CHF'],
|
|
153
|
+
division: 'OC',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
result: {
|
|
157
|
+
data: {
|
|
158
|
+
mapInstrumentNames: [
|
|
159
|
+
{
|
|
160
|
+
name: 'GBP_CHF',
|
|
161
|
+
displayName: 'GBP/CHF',
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
}, {
|
|
167
|
+
request: {
|
|
168
|
+
query: validateInstruments,
|
|
169
|
+
variables: {
|
|
170
|
+
instruments: ['CHF_EUR'],
|
|
171
|
+
division: 'OC',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
result: {
|
|
175
|
+
data: {
|
|
176
|
+
mapInstrumentNames: [
|
|
177
|
+
{
|
|
178
|
+
name: 'CHF_EUR',
|
|
179
|
+
displayName: 'CHF/EUR',
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
}, {
|
|
185
|
+
request: {
|
|
186
|
+
query: validateInstruments,
|
|
187
|
+
variables: {
|
|
188
|
+
instruments: ['CHF_USD'],
|
|
189
|
+
division: 'OC',
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
result: {
|
|
193
|
+
data: {
|
|
194
|
+
mapInstrumentNames: [
|
|
195
|
+
{
|
|
196
|
+
name: 'CHF_USD',
|
|
197
|
+
displayName: 'CHF/USD',
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
}, {
|
|
203
|
+
request: {
|
|
204
|
+
query: validateInstruments,
|
|
205
|
+
variables: {
|
|
206
|
+
instruments: ['CHF_GBP'],
|
|
207
|
+
division: 'OC',
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
result: {
|
|
211
|
+
data: {
|
|
212
|
+
mapInstrumentNames: [
|
|
213
|
+
{
|
|
214
|
+
name: 'CHF_GBP',
|
|
215
|
+
displayName: 'CHF/GBP',
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
];
|
|
222
|
+
|
|
223
|
+
export {
|
|
224
|
+
widgetMocks,
|
|
225
|
+
};
|