@oanda/labs-crowd-view-widget 1.0.43 → 1.0.45

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 (180) hide show
  1. package/CHANGELOG.md +364 -0
  2. package/dist/main/CrowdViewWidget/CrowdViewWidget.js +3 -3
  3. package/dist/main/CrowdViewWidget/CrowdViewWidget.js.map +1 -1
  4. package/dist/main/CrowdViewWidget/Main.js +22 -12
  5. package/dist/main/CrowdViewWidget/Main.js.map +1 -1
  6. package/dist/main/CrowdViewWidget/components/Chart/Chart.js +16 -17
  7. package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  8. package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +16 -13
  9. package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
  10. package/dist/main/CrowdViewWidget/components/Chart/{getOption.js → chartOptions.js} +79 -62
  11. package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js.map +1 -0
  12. package/dist/main/CrowdViewWidget/components/Chart/index.js +44 -0
  13. package/dist/main/CrowdViewWidget/components/Chart/index.js.map +1 -1
  14. package/dist/main/CrowdViewWidget/components/Chart/types.js.map +1 -1
  15. package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js +184 -0
  16. package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -0
  17. package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js +107 -0
  18. package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +1 -0
  19. package/dist/main/CrowdViewWidget/components/Legend/Legend.js +3 -2
  20. package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
  21. package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +9 -11
  22. package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
  23. package/dist/main/CrowdViewWidget/constants.js +31 -0
  24. package/dist/main/CrowdViewWidget/constants.js.map +1 -0
  25. package/dist/main/CrowdViewWidget/render.js +1 -0
  26. package/dist/main/CrowdViewWidget/render.js.map +1 -1
  27. package/dist/main/CrowdViewWidget/selectConfig.js +121 -0
  28. package/dist/main/CrowdViewWidget/selectConfig.js.map +1 -0
  29. package/dist/main/CrowdViewWidget/types/index.js +17 -0
  30. package/dist/main/CrowdViewWidget/types/index.js.map +1 -0
  31. package/dist/main/CrowdViewWidget/types/instruments.js +45 -0
  32. package/dist/main/CrowdViewWidget/types/instruments.js.map +1 -0
  33. package/dist/main/CrowdViewWidget/types.js +0 -44
  34. package/dist/main/CrowdViewWidget/types.js.map +1 -1
  35. package/dist/main/CrowdViewWidget/utils/instrumentUtils.js +13 -0
  36. package/dist/main/CrowdViewWidget/utils/instrumentUtils.js.map +1 -0
  37. package/dist/main/gql/getOrderPositionBooks.js +1 -1
  38. package/dist/main/gql/getOrderPositionBooks.js.map +1 -1
  39. package/dist/main/gql/getPriceCandles.js +11 -0
  40. package/dist/main/gql/getPriceCandles.js.map +1 -0
  41. package/dist/main/gql/types/gql.js +2 -3
  42. package/dist/main/gql/types/gql.js.map +1 -1
  43. package/dist/main/gql/types/graphql.js +161 -160
  44. package/dist/main/gql/types/graphql.js.map +1 -1
  45. package/dist/main/translations/sources/en.json +24 -0
  46. package/dist/module/CrowdViewWidget/CrowdViewWidget.js +3 -3
  47. package/dist/module/CrowdViewWidget/CrowdViewWidget.js.map +1 -1
  48. package/dist/module/CrowdViewWidget/Main.js +23 -13
  49. package/dist/module/CrowdViewWidget/Main.js.map +1 -1
  50. package/dist/module/CrowdViewWidget/components/Chart/Chart.js +15 -16
  51. package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  52. package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +16 -12
  53. package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
  54. package/dist/module/CrowdViewWidget/components/Chart/{getOption.js → chartOptions.js} +77 -59
  55. package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js.map +1 -0
  56. package/dist/module/CrowdViewWidget/components/Chart/index.js +4 -0
  57. package/dist/module/CrowdViewWidget/components/Chart/index.js.map +1 -1
  58. package/dist/module/CrowdViewWidget/components/Chart/types.js.map +1 -1
  59. package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js +177 -0
  60. package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -0
  61. package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js +94 -0
  62. package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +1 -0
  63. package/dist/module/CrowdViewWidget/components/Legend/Legend.js +3 -2
  64. package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
  65. package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +9 -11
  66. package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
  67. package/dist/module/CrowdViewWidget/constants.js +25 -0
  68. package/dist/module/CrowdViewWidget/constants.js.map +1 -0
  69. package/dist/module/CrowdViewWidget/render.js +1 -0
  70. package/dist/module/CrowdViewWidget/render.js.map +1 -1
  71. package/dist/module/CrowdViewWidget/selectConfig.js +116 -0
  72. package/dist/module/CrowdViewWidget/selectConfig.js.map +1 -0
  73. package/dist/module/CrowdViewWidget/types/index.js +2 -0
  74. package/dist/module/CrowdViewWidget/types/index.js.map +1 -0
  75. package/dist/module/CrowdViewWidget/types/instruments.js +39 -0
  76. package/dist/module/CrowdViewWidget/types/instruments.js.map +1 -0
  77. package/dist/module/CrowdViewWidget/types.js +1 -43
  78. package/dist/module/CrowdViewWidget/types.js.map +1 -1
  79. package/dist/module/CrowdViewWidget/utils/instrumentUtils.js +6 -0
  80. package/dist/module/CrowdViewWidget/utils/instrumentUtils.js.map +1 -0
  81. package/dist/module/gql/getOrderPositionBooks.js +1 -1
  82. package/dist/module/gql/getOrderPositionBooks.js.map +1 -1
  83. package/dist/module/gql/getPriceCandles.js +6 -0
  84. package/dist/module/gql/getPriceCandles.js.map +1 -0
  85. package/dist/module/gql/types/gql.js +2 -3
  86. package/dist/module/gql/types/gql.js.map +1 -1
  87. package/dist/module/gql/types/graphql.js +160 -159
  88. package/dist/module/gql/types/graphql.js.map +1 -1
  89. package/dist/module/translations/sources/en.json +24 -0
  90. package/dist/types/CrowdViewWidget/CrowdViewWidget.d.ts +1 -1
  91. package/dist/types/CrowdViewWidget/components/Chart/ChartWithData.d.ts +1 -1
  92. package/dist/types/CrowdViewWidget/components/Chart/index.d.ts +4 -0
  93. package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +23 -16
  94. package/dist/types/CrowdViewWidget/components/Chart/useCrowdViewData.d.ts +2 -0
  95. package/dist/types/CrowdViewWidget/components/Chart/{utils.d.ts → utils/chartUtils.d.ts} +9 -11
  96. package/dist/types/CrowdViewWidget/components/Legend/Legend.d.ts +3 -3
  97. package/dist/types/CrowdViewWidget/constants.d.ts +24 -0
  98. package/dist/types/CrowdViewWidget/selectConfig.d.ts +19 -0
  99. package/dist/types/CrowdViewWidget/types/index.d.ts +1 -0
  100. package/dist/types/CrowdViewWidget/types/instruments.d.ts +36 -0
  101. package/dist/types/CrowdViewWidget/types.d.ts +2 -50
  102. package/dist/types/CrowdViewWidget/utils/instrumentUtils.d.ts +8 -0
  103. package/dist/types/gql/types/gql.d.ts +10 -14
  104. package/dist/types/gql/types/graphql.d.ts +71 -63
  105. package/lokalise.config.json +1 -1
  106. package/package.json +6 -4
  107. package/src/CrowdViewWidget/CrowdViewWidget.tsx +2 -2
  108. package/src/CrowdViewWidget/Main.tsx +32 -22
  109. package/src/CrowdViewWidget/components/Chart/Chart.tsx +21 -17
  110. package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +12 -12
  111. package/src/CrowdViewWidget/components/Chart/chartOptions.ts +205 -0
  112. package/src/CrowdViewWidget/components/Chart/index.ts +4 -0
  113. package/src/CrowdViewWidget/components/Chart/types.ts +30 -24
  114. package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +288 -0
  115. package/src/CrowdViewWidget/components/Chart/utils/chartUtils.ts +161 -0
  116. package/src/CrowdViewWidget/components/Legend/Legend.tsx +7 -3
  117. package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +16 -20
  118. package/src/CrowdViewWidget/constants.ts +28 -0
  119. package/src/CrowdViewWidget/render.tsx +1 -0
  120. package/src/CrowdViewWidget/{config.ts → selectConfig.ts} +65 -43
  121. package/src/CrowdViewWidget/types/index.ts +1 -0
  122. package/src/CrowdViewWidget/types/instruments.ts +37 -0
  123. package/src/CrowdViewWidget/types.ts +4 -55
  124. package/src/CrowdViewWidget/utils/instrumentUtils.ts +11 -0
  125. package/src/gql/getOrderPositionBooks.ts +9 -4
  126. package/src/gql/{mock/getPriceCandles.ts → getPriceCandles.ts} +5 -5
  127. package/src/gql/types/gql.ts +6 -14
  128. package/src/gql/types/graphql.ts +170 -160
  129. package/src/translations/sources/en.json +24 -0
  130. package/test/Main.test.tsx +73 -27
  131. package/test/components/Chart/utils/chartUtils.test.ts +172 -0
  132. package/test/components/Legend.test.tsx +3 -6
  133. package/test/components/LegendBar.test.tsx +7 -8
  134. package/test/utils/instrumentUtils.test.ts +52 -0
  135. package/dist/main/CrowdViewWidget/components/Chart/constants.js +0 -14
  136. package/dist/main/CrowdViewWidget/components/Chart/constants.js.map +0 -1
  137. package/dist/main/CrowdViewWidget/components/Chart/getOption.js.map +0 -1
  138. package/dist/main/CrowdViewWidget/components/Chart/getOrderPositionDataMock.js +0 -47
  139. package/dist/main/CrowdViewWidget/components/Chart/getOrderPositionDataMock.js.map +0 -1
  140. package/dist/main/CrowdViewWidget/components/Chart/getPriceCandlesMock.js +0 -36
  141. package/dist/main/CrowdViewWidget/components/Chart/getPriceCandlesMock.js.map +0 -1
  142. package/dist/main/CrowdViewWidget/components/Chart/utils.js +0 -166
  143. package/dist/main/CrowdViewWidget/components/Chart/utils.js.map +0 -1
  144. package/dist/main/CrowdViewWidget/config.js +0 -107
  145. package/dist/main/CrowdViewWidget/config.js.map +0 -1
  146. package/dist/main/gql/mock/getPriceCandles.js +0 -11
  147. package/dist/main/gql/mock/getPriceCandles.js.map +0 -1
  148. package/dist/main/gql/mock/schema.graphqls +0 -62
  149. package/dist/main/gql/validateInstruments.js +0 -11
  150. package/dist/main/gql/validateInstruments.js.map +0 -1
  151. package/dist/module/CrowdViewWidget/components/Chart/constants.js +0 -8
  152. package/dist/module/CrowdViewWidget/components/Chart/constants.js.map +0 -1
  153. package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +0 -1
  154. package/dist/module/CrowdViewWidget/components/Chart/getOrderPositionDataMock.js +0 -40
  155. package/dist/module/CrowdViewWidget/components/Chart/getOrderPositionDataMock.js.map +0 -1
  156. package/dist/module/CrowdViewWidget/components/Chart/getPriceCandlesMock.js +0 -29
  157. package/dist/module/CrowdViewWidget/components/Chart/getPriceCandlesMock.js.map +0 -1
  158. package/dist/module/CrowdViewWidget/components/Chart/utils.js +0 -156
  159. package/dist/module/CrowdViewWidget/components/Chart/utils.js.map +0 -1
  160. package/dist/module/CrowdViewWidget/config.js +0 -102
  161. package/dist/module/CrowdViewWidget/config.js.map +0 -1
  162. package/dist/module/gql/mock/getPriceCandles.js +0 -6
  163. package/dist/module/gql/mock/getPriceCandles.js.map +0 -1
  164. package/dist/module/gql/mock/schema.graphqls +0 -62
  165. package/dist/module/gql/validateInstruments.js +0 -5
  166. package/dist/module/gql/validateInstruments.js.map +0 -1
  167. package/dist/types/CrowdViewWidget/components/Chart/constants.d.ts +0 -7
  168. package/dist/types/CrowdViewWidget/components/Chart/getOrderPositionDataMock.d.ts +0 -14
  169. package/dist/types/CrowdViewWidget/components/Chart/getPriceCandlesMock.d.ts +0 -2
  170. package/dist/types/CrowdViewWidget/config.d.ts +0 -22
  171. package/dist/types/gql/validateInstruments.d.ts +0 -1
  172. package/src/CrowdViewWidget/components/Chart/constants.tsx +0 -8
  173. package/src/CrowdViewWidget/components/Chart/getOption.ts +0 -200
  174. package/src/CrowdViewWidget/components/Chart/getOrderPositionDataMock.ts +0 -66
  175. package/src/CrowdViewWidget/components/Chart/getPriceCandlesMock.ts +0 -43
  176. package/src/CrowdViewWidget/components/Chart/utils.ts +0 -191
  177. package/src/gql/mock/schema.graphqls +0 -62
  178. package/src/gql/validateInstruments.ts +0 -10
  179. /package/dist/types/CrowdViewWidget/components/Chart/{getOption.d.ts → chartOptions.d.ts} +0 -0
  180. /package/dist/types/gql/{mock/getPriceCandles.d.ts → getPriceCandles.d.ts} +0 -0
@@ -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 = {
@@ -133,8 +136,9 @@ export type CurrencyStrength = {
133
136
  };
134
137
 
135
138
  export enum DataSource {
136
- Ny4 = 'NY4',
137
- Ty3 = 'TY3',
139
+ All = 'ALL',
140
+ Mt5 = 'MT5',
141
+ V20 = 'V20',
138
142
  }
139
143
 
140
144
  export enum Division {
@@ -151,18 +155,17 @@ export enum Division {
151
155
 
152
156
  export type ExtendedInstrument = {
153
157
  __typename?: 'ExtendedInstrument';
158
+ dataSource: DataSource;
154
159
  displayName: Scalars['String']['output'];
155
160
  name: Scalars['String']['output'];
156
161
  tradeMode: TradeMode;
157
162
  };
158
163
 
159
164
  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',
165
+ H1 = 'H1',
166
+ H4 = 'H4',
167
+ M5 = 'M5',
168
+ M15 = 'M15',
166
169
  }
167
170
 
168
171
  export type Heatmap = {
@@ -183,11 +186,6 @@ export type InstrumentCorrelation = {
183
186
  value?: Maybe<Scalars['Float']['output']>;
184
187
  };
185
188
 
186
- export enum InstrumentDataSource {
187
- Mt5 = 'MT5',
188
- V20 = 'V20',
189
- }
190
-
191
189
  export type InstrumentTableResult = {
192
190
  __typename?: 'InstrumentTableResult';
193
191
  instruments: Array<ExtendedInstrument>;
@@ -195,17 +193,30 @@ export type InstrumentTableResult = {
195
193
  updatedAt: Scalars['String']['output'];
196
194
  };
197
195
 
196
+ export type MarginRate = {
197
+ __typename?: 'MarginRate';
198
+ instrument: Instrument;
199
+ rate: Scalars['Float']['output'];
200
+ };
201
+
198
202
  export type Matrix = {
199
203
  __typename?: 'Matrix';
200
204
  instrument: Instrument;
201
205
  instrumentCorrelation: Array<InstrumentCorrelation>;
202
206
  };
203
207
 
208
+ export enum OrderBookDataSource {
209
+ Ny4 = 'NY4',
210
+ Ny4Mt5 = 'NY4_MT5',
211
+ Ty3 = 'TY3',
212
+ }
213
+
204
214
  export type OrderPositionBucket = {
205
215
  __typename?: 'OrderPositionBucket';
206
- longCountPercent: Scalars['Float']['output'];
216
+ longCountPercent?: Maybe<Scalars['Float']['output']>;
207
217
  price: Scalars['Float']['output'];
208
- shortCountPercent: Scalars['Float']['output'];
218
+ sentiment?: Maybe<Scalars['Float']['output']>;
219
+ shortCountPercent?: Maybe<Scalars['Float']['output']>;
209
220
  };
210
221
 
211
222
  export type OrderPositionData = {
@@ -227,10 +238,12 @@ export type Query = {
227
238
  correlationMatrix: CorrelationMatrix;
228
239
  currencyPowerBalance?: Maybe<Array<CurrencyPowerBalance>>;
229
240
  currencyStrength?: Maybe<Array<CurrencyStrength>>;
230
- getPriceCandles: Array<CandlesData>;
231
241
  isAllowedPartner?: Maybe<Scalars['Boolean']['output']>;
232
242
  mapInstrumentNames?: Maybe<Array<Maybe<Instrument>>>;
243
+ marginRates?: Maybe<Array<MarginRate>>;
244
+ orderPositionBook: Array<Maybe<OrderPositionData>>;
233
245
  orderPositionBooks: Array<Maybe<OrderPositionData>>;
246
+ priceCandles: CandlesData;
234
247
  resolveInstrumentsByDivision?: Maybe<Array<Instrument>>;
235
248
  resolveInstrumentsWithFilters?: Maybe<InstrumentTableResult>;
236
249
  sentiment?: Maybe<Array<SentimentInstrument>>;
@@ -263,13 +276,6 @@ export type QueryCurrencyPowerBalanceArgs = {
263
276
  timeUnit: CurrencyPowerBalanceTimeUnit;
264
277
  };
265
278
 
266
- export type QueryGetPriceCandlesArgs = {
267
- division?: InputMaybe<Division>;
268
- granularity: Granularity;
269
- instrument: Scalars['String']['input'];
270
- timeSpan: TimeSpan;
271
- };
272
-
273
279
  export type QueryIsAllowedPartnerArgs = {
274
280
  url: Scalars['String']['input'];
275
281
  };
@@ -279,12 +285,35 @@ export type QueryMapInstrumentNamesArgs = {
279
285
  instruments: Array<InputMaybe<Scalars['String']['input']>>;
280
286
  };
281
287
 
282
- export type QueryOrderPositionBooksArgs = {
288
+ export type QueryMarginRatesArgs = {
289
+ dataSource: DataSource;
290
+ division: Division;
291
+ instruments?: InputMaybe<Array<Scalars['String']['input']>>;
292
+ tradingGroup: Scalars['Int']['input'];
293
+ };
294
+
295
+ export type QueryOrderPositionBookArgs = {
283
296
  bookType: BookType;
284
- dataSource?: InputMaybe<DataSource>;
297
+ dataSource?: InputMaybe<OrderBookDataSource>;
285
298
  instrument: Scalars['String']['input'];
286
299
  recentHours?: InputMaybe<Scalars['Int']['input']>;
287
- region?: InputMaybe<Region>;
300
+ };
301
+
302
+ export type QueryOrderPositionBooksArgs = {
303
+ bookType: BookType;
304
+ granularity: Granularity;
305
+ instrument: Scalars['String']['input'];
306
+ maxBookPrice?: InputMaybe<Scalars['Float']['input']>;
307
+ minBookPrice?: InputMaybe<Scalars['Float']['input']>;
308
+ timeSpan: TimeSpan;
309
+ };
310
+
311
+ export type QueryPriceCandlesArgs = {
312
+ dataSource: DataSource;
313
+ division: Division;
314
+ granularity: Granularity;
315
+ instrument: Scalars['String']['input'];
316
+ timeSpan: TimeSpan;
288
317
  };
289
318
 
290
319
  export type QueryResolveInstrumentsByDivisionArgs = {
@@ -295,7 +324,7 @@ export type QueryResolveInstrumentsByDivisionArgs = {
295
324
  export type QueryResolveInstrumentsWithFiltersArgs = {
296
325
  assetClass?: InputMaybe<Array<InputMaybe<AssetClassName>>>;
297
326
  count?: InputMaybe<Scalars['Int']['input']>;
298
- dataSource?: InputMaybe<InstrumentDataSource>;
327
+ dataSource: DataSource;
299
328
  division: Division;
300
329
  instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
301
330
  offset?: InputMaybe<Scalars['Int']['input']>;
@@ -392,17 +421,11 @@ export type TimeCorrelation = {
392
421
  };
393
422
 
394
423
  export enum TimeSpan {
395
- Day_1 = 'DAY_1',
396
- Day_2 = 'DAY_2',
397
- Hour_1 = 'HOUR_1',
398
- Hour_12 = 'HOUR_12',
399
- Month_1 = 'MONTH_1',
400
- Month_3 = 'MONTH_3',
401
- Month_6 = 'MONTH_6',
402
- Week_1 = 'WEEK_1',
403
- Week_2 = 'WEEK_2',
404
- Week_3 = 'WEEK_3',
405
- Year_1 = 'YEAR_1',
424
+ FiveDays = 'FIVE_DAYS',
425
+ NinetyDays = 'NINETY_DAYS',
426
+ TenDays = 'TEN_DAYS',
427
+ TwentyDays = 'TWENTY_DAYS',
428
+ TwoDays = 'TWO_DAYS',
406
429
  }
407
430
 
408
431
  export type TopicalInstrument = {
@@ -505,7 +528,10 @@ export enum VolatilityChartTimeUnit {
505
528
  export type GetOrderPositionBooksQueryVariables = Exact<{
506
529
  instrument: Scalars['String']['input'];
507
530
  bookType: BookType;
508
- recentHours?: InputMaybe<Scalars['Int']['input']>;
531
+ timeSpan: TimeSpan;
532
+ granularity: Granularity;
533
+ maxBookPrice?: InputMaybe<Scalars['Float']['input']>;
534
+ minBookPrice?: InputMaybe<Scalars['Float']['input']>;
509
535
  }>;
510
536
 
511
537
  export type GetOrderPositionBooksQuery = {
@@ -518,14 +544,14 @@ export type GetOrderPositionBooksQuery = {
518
544
  buckets: Array<{
519
545
  __typename?: 'OrderPositionBucket';
520
546
  price: number;
521
- longCountPercent: number;
522
- shortCountPercent: number;
547
+ sentiment?: number | null;
523
548
  } | null>;
524
549
  } | null>;
525
550
  };
526
551
 
527
552
  export type GetPriceCandlesQueryVariables = Exact<{
528
- division?: InputMaybe<Division>;
553
+ dataSource: DataSource;
554
+ division: Division;
529
555
  instrument: Scalars['String']['input'];
530
556
  granularity: Granularity;
531
557
  timeSpan: TimeSpan;
@@ -533,35 +559,17 @@ export type GetPriceCandlesQueryVariables = Exact<{
533
559
 
534
560
  export type GetPriceCandlesQuery = {
535
561
  __typename?: 'Query';
536
- getPriceCandles: Array<{
562
+ priceCandles: {
537
563
  __typename?: 'CandlesData';
538
- time: string;
539
- unixTime: number;
540
- timeSpan: TimeSpan;
541
- candle: {
564
+ candle: Array<{
542
565
  __typename?: 'Candle';
566
+ point: string;
543
567
  high: number;
544
568
  low: number;
545
569
  open: number;
546
570
  close: number;
547
- };
548
- }>;
549
- };
550
-
551
- export type ValidateInstrumentsQueryVariables = Exact<{
552
- instruments:
553
- | Array<InputMaybe<Scalars['String']['input']>>
554
- | InputMaybe<Scalars['String']['input']>;
555
- division?: InputMaybe<Division>;
556
- }>;
557
-
558
- export type ValidateInstrumentsQuery = {
559
- __typename?: 'Query';
560
- mapInstrumentNames?: Array<{
561
- __typename?: 'Instrument';
562
- name: string;
563
- displayName: string;
564
- } | null> | null;
571
+ } | null>;
572
+ };
565
573
  };
566
574
 
567
575
  export const GetOrderPositionBooksDocument = {
@@ -604,9 +612,45 @@ export const GetOrderPositionBooksDocument = {
604
612
  kind: 'VariableDefinition',
605
613
  variable: {
606
614
  kind: 'Variable',
607
- name: { kind: 'Name', value: 'recentHours' },
615
+ name: { kind: 'Name', value: 'timeSpan' },
616
+ },
617
+ type: {
618
+ kind: 'NonNullType',
619
+ type: {
620
+ kind: 'NamedType',
621
+ name: { kind: 'Name', value: 'TimeSpan' },
622
+ },
608
623
  },
609
- type: { kind: 'NamedType', name: { kind: 'Name', value: 'Int' } },
624
+ },
625
+ {
626
+ kind: 'VariableDefinition',
627
+ variable: {
628
+ kind: 'Variable',
629
+ name: { kind: 'Name', value: 'granularity' },
630
+ },
631
+ type: {
632
+ kind: 'NonNullType',
633
+ type: {
634
+ kind: 'NamedType',
635
+ name: { kind: 'Name', value: 'Granularity' },
636
+ },
637
+ },
638
+ },
639
+ {
640
+ kind: 'VariableDefinition',
641
+ variable: {
642
+ kind: 'Variable',
643
+ name: { kind: 'Name', value: 'maxBookPrice' },
644
+ },
645
+ type: { kind: 'NamedType', name: { kind: 'Name', value: 'Float' } },
646
+ },
647
+ {
648
+ kind: 'VariableDefinition',
649
+ variable: {
650
+ kind: 'Variable',
651
+ name: { kind: 'Name', value: 'minBookPrice' },
652
+ },
653
+ type: { kind: 'NamedType', name: { kind: 'Name', value: 'Float' } },
610
654
  },
611
655
  ],
612
656
  selectionSet: {
@@ -634,10 +678,34 @@ export const GetOrderPositionBooksDocument = {
634
678
  },
635
679
  {
636
680
  kind: 'Argument',
637
- name: { kind: 'Name', value: 'recentHours' },
681
+ name: { kind: 'Name', value: 'timeSpan' },
682
+ value: {
683
+ kind: 'Variable',
684
+ name: { kind: 'Name', value: 'timeSpan' },
685
+ },
686
+ },
687
+ {
688
+ kind: 'Argument',
689
+ name: { kind: 'Name', value: 'granularity' },
690
+ value: {
691
+ kind: 'Variable',
692
+ name: { kind: 'Name', value: 'granularity' },
693
+ },
694
+ },
695
+ {
696
+ kind: 'Argument',
697
+ name: { kind: 'Name', value: 'maxBookPrice' },
698
+ value: {
699
+ kind: 'Variable',
700
+ name: { kind: 'Name', value: 'maxBookPrice' },
701
+ },
702
+ },
703
+ {
704
+ kind: 'Argument',
705
+ name: { kind: 'Name', value: 'minBookPrice' },
638
706
  value: {
639
707
  kind: 'Variable',
640
- name: { kind: 'Name', value: 'recentHours' },
708
+ name: { kind: 'Name', value: 'minBookPrice' },
641
709
  },
642
710
  },
643
711
  ],
@@ -656,11 +724,7 @@ export const GetOrderPositionBooksDocument = {
656
724
  { kind: 'Field', name: { kind: 'Name', value: 'price' } },
657
725
  {
658
726
  kind: 'Field',
659
- name: { kind: 'Name', value: 'longCountPercent' },
660
- },
661
- {
662
- kind: 'Field',
663
- name: { kind: 'Name', value: 'shortCountPercent' },
727
+ name: { kind: 'Name', value: 'sentiment' },
664
728
  },
665
729
  ],
666
730
  },
@@ -684,6 +748,20 @@ export const GetPriceCandlesDocument = {
684
748
  operation: 'query',
685
749
  name: { kind: 'Name', value: 'GetPriceCandles' },
686
750
  variableDefinitions: [
751
+ {
752
+ kind: 'VariableDefinition',
753
+ variable: {
754
+ kind: 'Variable',
755
+ name: { kind: 'Name', value: 'dataSource' },
756
+ },
757
+ type: {
758
+ kind: 'NonNullType',
759
+ type: {
760
+ kind: 'NamedType',
761
+ name: { kind: 'Name', value: 'DataSource' },
762
+ },
763
+ },
764
+ },
687
765
  {
688
766
  kind: 'VariableDefinition',
689
767
  variable: {
@@ -691,8 +769,11 @@ export const GetPriceCandlesDocument = {
691
769
  name: { kind: 'Name', value: 'division' },
692
770
  },
693
771
  type: {
694
- kind: 'NamedType',
695
- name: { kind: 'Name', value: 'Division' },
772
+ kind: 'NonNullType',
773
+ type: {
774
+ kind: 'NamedType',
775
+ name: { kind: 'Name', value: 'Division' },
776
+ },
696
777
  },
697
778
  },
698
779
  {
@@ -743,8 +824,16 @@ export const GetPriceCandlesDocument = {
743
824
  selections: [
744
825
  {
745
826
  kind: 'Field',
746
- name: { kind: 'Name', value: 'getPriceCandles' },
827
+ name: { kind: 'Name', value: 'priceCandles' },
747
828
  arguments: [
829
+ {
830
+ kind: 'Argument',
831
+ name: { kind: 'Name', value: 'dataSource' },
832
+ value: {
833
+ kind: 'Variable',
834
+ name: { kind: 'Name', value: 'dataSource' },
835
+ },
836
+ },
748
837
  {
749
838
  kind: 'Argument',
750
839
  name: { kind: 'Name', value: 'division' },
@@ -781,14 +870,13 @@ export const GetPriceCandlesDocument = {
781
870
  selectionSet: {
782
871
  kind: 'SelectionSet',
783
872
  selections: [
784
- { kind: 'Field', name: { kind: 'Name', value: 'time' } },
785
- { kind: 'Field', name: { kind: 'Name', value: 'unixTime' } },
786
873
  {
787
874
  kind: 'Field',
788
875
  name: { kind: 'Name', value: 'candle' },
789
876
  selectionSet: {
790
877
  kind: 'SelectionSet',
791
878
  selections: [
879
+ { kind: 'Field', name: { kind: 'Name', value: 'point' } },
792
880
  { kind: 'Field', name: { kind: 'Name', value: 'high' } },
793
881
  { kind: 'Field', name: { kind: 'Name', value: 'low' } },
794
882
  { kind: 'Field', name: { kind: 'Name', value: 'open' } },
@@ -796,7 +884,6 @@ export const GetPriceCandlesDocument = {
796
884
  ],
797
885
  },
798
886
  },
799
- { kind: 'Field', name: { kind: 'Name', value: 'timeSpan' } },
800
887
  ],
801
888
  },
802
889
  },
@@ -808,80 +895,3 @@ export const GetPriceCandlesDocument = {
808
895
  GetPriceCandlesQuery,
809
896
  GetPriceCandlesQueryVariables
810
897
  >;
811
- export const ValidateInstrumentsDocument = {
812
- kind: 'Document',
813
- definitions: [
814
- {
815
- kind: 'OperationDefinition',
816
- operation: 'query',
817
- name: { kind: 'Name', value: 'validateInstruments' },
818
- variableDefinitions: [
819
- {
820
- kind: 'VariableDefinition',
821
- variable: {
822
- kind: 'Variable',
823
- name: { kind: 'Name', value: 'instruments' },
824
- },
825
- type: {
826
- kind: 'NonNullType',
827
- type: {
828
- kind: 'ListType',
829
- type: {
830
- kind: 'NamedType',
831
- name: { kind: 'Name', value: 'String' },
832
- },
833
- },
834
- },
835
- },
836
- {
837
- kind: 'VariableDefinition',
838
- variable: {
839
- kind: 'Variable',
840
- name: { kind: 'Name', value: 'division' },
841
- },
842
- type: {
843
- kind: 'NamedType',
844
- name: { kind: 'Name', value: 'Division' },
845
- },
846
- },
847
- ],
848
- selectionSet: {
849
- kind: 'SelectionSet',
850
- selections: [
851
- {
852
- kind: 'Field',
853
- name: { kind: 'Name', value: 'mapInstrumentNames' },
854
- arguments: [
855
- {
856
- kind: 'Argument',
857
- name: { kind: 'Name', value: 'instruments' },
858
- value: {
859
- kind: 'Variable',
860
- name: { kind: 'Name', value: 'instruments' },
861
- },
862
- },
863
- {
864
- kind: 'Argument',
865
- name: { kind: 'Name', value: 'division' },
866
- value: {
867
- kind: 'Variable',
868
- name: { kind: 'Name', value: 'division' },
869
- },
870
- },
871
- ],
872
- selectionSet: {
873
- kind: 'SelectionSet',
874
- selections: [
875
- { kind: 'Field', name: { kind: 'Name', value: 'name' } },
876
- { kind: 'Field', name: { kind: 'Name', value: 'displayName' } },
877
- ],
878
- },
879
- },
880
- ],
881
- },
882
- },
883
- ],
884
- } as unknown as DocumentNode<
885
- ValidateInstrumentsQuery,
886
- ValidateInstrumentsQueryVariables
887
- >;
@@ -1,2 +1,26 @@
1
1
  {
2
+ "data_unavailable": "Data unavailable",
3
+ "no_matching_results": "No matching results",
4
+ "pagination_entries_range": "{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries",
5
+ "order_book": "Order book",
6
+ "position_book": "Position book",
7
+ "long": "Long",
8
+ "short": "Short",
9
+ "instrument": "Instrument",
10
+ "granularity": "Granularity",
11
+ "search": "Search",
12
+ "5_minutes": "5 minutes",
13
+ "15_minutes": "15 minutes",
14
+ "1_hour": "1 hour",
15
+ "4_hours": "4 hours",
16
+ "candle": "Candle",
17
+ "open_price": "Open price",
18
+ "close_price": "Close price",
19
+ "low": "Low",
20
+ "high": "High",
21
+ "orders": "Orders",
22
+ "price_range": "Price range",
23
+ "sentiment": "Sentiment",
24
+ "buy_advantage": "Buy advantage",
25
+ "sell_advantage": "Sell advantage"
2
26
  }
@@ -6,49 +6,95 @@ 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 { InstrumentId } from '../src';
10
9
  import { Main } from '../src/CrowdViewWidget/Main';
10
+ import { InstrumentId } from '../src/CrowdViewWidget/types/instruments';
11
11
  import { getOrderPositionBooks } from '../src/gql/getOrderPositionBooks';
12
- import { BookType, Division } from '../src/gql/types/graphql';
12
+ import { getPriceCandles } from '../src/gql/getPriceCandles';
13
+ import {
14
+ BookType,
15
+ DataSource,
16
+ Division,
17
+ Granularity,
18
+ TimeSpan,
19
+ } from '../src/gql/types/graphql';
20
+
21
+ const instrument = InstrumentId.EUR_AUD;
22
+ const division = Division.Oap;
23
+ const granularity = Granularity.H4;
24
+ const timeSpan = TimeSpan.NinetyDays;
25
+
26
+ const candles = [
27
+ {
28
+ point: '2024-02-21T10:00:00Z',
29
+ high: 1.334,
30
+ low: 1.33,
31
+ open: 1.331,
32
+ close: 1.333,
33
+ },
34
+ {
35
+ point: '2024-02-21T10:30:00Z',
36
+ high: 1.335,
37
+ low: 1.3295,
38
+ open: 1.33,
39
+ close: 1.334,
40
+ },
41
+ {
42
+ point: '2024-02-21T11:00:00Z',
43
+ high: 1.333,
44
+ low: 1.329,
45
+ open: 1.331,
46
+ close: 1.332,
47
+ },
48
+ ];
49
+
50
+ const maxPrice = 1.335;
51
+ const minPrice = 1.329;
52
+ const bucketWidth = 0.0005;
53
+ const maxBookPrice = maxPrice + bucketWidth * 2;
54
+ const minBookPrice = minPrice - bucketWidth * 2;
13
55
 
14
56
  const mocks = [
57
+ {
58
+ request: {
59
+ query: getPriceCandles,
60
+ variables: {
61
+ dataSource: DataSource.Mt5,
62
+ division,
63
+ instrument,
64
+ granularity,
65
+ timeSpan,
66
+ },
67
+ },
68
+ result: {
69
+ data: {
70
+ priceCandles: {
71
+ candle: candles,
72
+ },
73
+ },
74
+ },
75
+ },
15
76
  {
16
77
  request: {
17
78
  query: getOrderPositionBooks,
18
79
  variables: {
19
- instrument: InstrumentId.EUR_AUD,
80
+ instrument,
20
81
  bookType: BookType.Order,
21
- recentHours: 1,
82
+ timeSpan,
83
+ granularity,
84
+ maxBookPrice,
85
+ minBookPrice,
22
86
  },
23
87
  },
24
88
  result: {
25
89
  data: {
26
90
  orderPositionBooks: [
27
91
  {
28
- bucketWidth: 0.0005,
29
- price: 0.8,
92
+ bucketWidth,
93
+ price: maxPrice,
30
94
  time: '2024-02-21T10:30:00Z',
31
95
  buckets: [
32
- {
33
- price: 0.02,
34
- longCountPercent: 0.0582,
35
- shortCountPercent: 0.0,
36
- },
37
- {
38
- price: 0.7,
39
- longCountPercent: 0.0582,
40
- shortCountPercent: 0.0,
41
- },
42
- {
43
- price: 0.9925,
44
- longCountPercent: 0.0582,
45
- shortCountPercent: 0.0,
46
- },
47
- {
48
- price: 1.0,
49
- longCountPercent: 0.1163,
50
- shortCountPercent: 0.0,
51
- },
96
+ { price: 1.3345, sentiment: 0.2 },
97
+ { price: 1.3305, sentiment: -0.3 },
52
98
  ],
53
99
  },
54
100
  ],
@@ -62,7 +108,7 @@ describe('Main component', () => {
62
108
  const { findByTestId } = render(
63
109
  <MockedProvider mocks={mocks}>
64
110
  <MockLayoutProvider>
65
- <Main division={Division.Oap} />
111
+ <Main division={division} />
66
112
  </MockLayoutProvider>
67
113
  </MockedProvider>
68
114
  );