@oanda/labs-order-book-widget 1.0.88 → 1.0.90

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 (42) hide show
  1. package/CHANGELOG.md +692 -0
  2. package/dist/main/OrderBookWidget/ChartWithData.js +12 -2
  3. package/dist/main/OrderBookWidget/ChartWithData.js.map +1 -1
  4. package/dist/main/OrderBookWidget/components/Chart/getOption.js +2 -1
  5. package/dist/main/OrderBookWidget/components/Chart/getOption.js.map +1 -1
  6. package/dist/main/OrderBookWidget/constants.js +8 -0
  7. package/dist/main/OrderBookWidget/constants.js.map +1 -0
  8. package/dist/main/gql/getOrderPositionBooks.js +1 -1
  9. package/dist/main/gql/getOrderPositionBooks.js.map +1 -1
  10. package/dist/main/gql/types/gql.js +1 -1
  11. package/dist/main/gql/types/gql.js.map +1 -1
  12. package/dist/main/gql/types/graphql.js +40 -1
  13. package/dist/main/gql/types/graphql.js.map +1 -1
  14. package/dist/main/translations/sources/en.json +2 -0
  15. package/dist/main/translations/sources/zh_TW.json +2 -0
  16. package/dist/module/OrderBookWidget/ChartWithData.js +13 -3
  17. package/dist/module/OrderBookWidget/ChartWithData.js.map +1 -1
  18. package/dist/module/OrderBookWidget/components/Chart/getOption.js +2 -1
  19. package/dist/module/OrderBookWidget/components/Chart/getOption.js.map +1 -1
  20. package/dist/module/OrderBookWidget/constants.js +3 -0
  21. package/dist/module/OrderBookWidget/constants.js.map +1 -0
  22. package/dist/module/gql/getOrderPositionBooks.js +1 -1
  23. package/dist/module/gql/getOrderPositionBooks.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 +39 -0
  27. package/dist/module/gql/types/graphql.js.map +1 -1
  28. package/dist/module/translations/sources/en.json +2 -0
  29. package/dist/module/translations/sources/zh_TW.json +2 -0
  30. package/dist/types/OrderBookWidget/constants.d.ts +2 -0
  31. package/dist/types/gql/types/gql.d.ts +2 -2
  32. package/dist/types/gql/types/graphql.d.ts +87 -9
  33. package/package.json +3 -3
  34. package/src/OrderBookWidget/ChartWithData.tsx +51 -40
  35. package/src/OrderBookWidget/components/Chart/getOption.ts +2 -1
  36. package/src/OrderBookWidget/constants.ts +3 -0
  37. package/src/gql/getOrderPositionBooks.ts +1 -0
  38. package/src/gql/types/gql.ts +2 -2
  39. package/src/gql/types/graphql.ts +101 -11
  40. package/src/translations/sources/en.json +2 -0
  41. package/src/translations/sources/zh_TW.json +2 -0
  42. package/test/Main.test.tsx +11 -1
@@ -2,18 +2,21 @@ import React, { useContext } from 'react';
2
2
  import { useQuery } from '@apollo/client';
3
3
  import classnames from 'classnames';
4
4
  import {
5
- ChartError, Size, Spinner, SpinnerSize, ThemeContext,
5
+ ChartError, InfoBox, Size, Spinner, SpinnerSize, ThemeContext, formatUpdatedTimestamp,
6
6
  } from '@oanda/labs-widget-common';
7
+ import { useLocale } from '@oanda/mono-i18n';
7
8
  import { ChartWithDataProps } from './types';
8
9
  import { getOrderPositionBooks } from '../gql/getOrderPositionBooks';
9
10
  import { GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables, BookType } from '../gql/types/graphql';
10
11
  import { Chart } from './components/Chart/Chart';
11
12
  import { instrumentPrecisionConfig } from './config';
13
+ import { EMPTY_VALUE } from './constants';
12
14
 
13
15
  const ChartWithData = ({
14
16
  instrument,
15
17
  bookType,
16
18
  }: ChartWithDataProps) => {
19
+ const { lang } = useLocale();
17
20
  const { size } = useContext(ThemeContext);
18
21
  const isDesktop = size === Size.DESKTOP;
19
22
 
@@ -30,51 +33,59 @@ const ChartWithData = ({
30
33
  });
31
34
 
32
35
  const isError = (!loading && !data?.orderPositionBooks[0]?.price) || !!error;
36
+ const updatedAt = data?.orderPositionBooks[0]?.time;
33
37
 
34
38
  return (
35
- <div className={classnames('lw-relative lw-w-full', {
36
- 'lw-h-[450px]': isDesktop,
37
- 'lw-h-[390px]': !isDesktop,
38
- })}
39
- >
40
- {isError && (
41
- <div className={
42
- classnames(
43
- 'lw-absolute lw-left-0 lw-top-0 lw-flex lw-w-full lw-items-center lw-justify-center lw-border lw-border-solid lw-border-border-primary',
44
- {
45
- 'lw-h-full': isDesktop,
46
- 'lw-h-[calc(100%-40px)]': !isDesktop,
47
- },
48
- )
49
- }
39
+ <>
40
+ <div className={classnames('lw-relative lw-w-full', {
41
+ 'lw-h-[450px]': isDesktop,
42
+ 'lw-h-[390px]': !isDesktop,
43
+ })}
50
44
  >
51
- <ChartError />
45
+ {isError && (
46
+ <div className={
47
+ classnames(
48
+ 'lw-absolute lw-left-0 lw-top-0 lw-flex lw-w-full lw-items-center lw-justify-center lw-border lw-border-solid lw-border-border-primary',
49
+ {
50
+ 'lw-h-full': isDesktop,
51
+ 'lw-h-[calc(100%-40px)]': !isDesktop,
52
+ },
53
+ )
54
+ }
55
+ >
56
+ <ChartError />
57
+ </div>
58
+ )}
59
+ {loading && (
60
+ <div className={
61
+ classnames(
62
+ 'lw-absolute lw-left-0 lw-top-0 lw-flex lw-w-full lw-items-center lw-justify-center lw-border lw-border-solid lw-border-border-primary',
63
+ {
64
+ 'lw-h-full': isDesktop,
65
+ 'lw-h-[calc(100%-40px)]': !isDesktop,
66
+ },
67
+ )
68
+ }
69
+ >
70
+ <Spinner size={SpinnerSize.lg} />
71
+ </div>
72
+ )}
73
+ {!isError && data && (
74
+ <div className="lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-full lw-w-full">
75
+ <Chart
76
+ data={data}
77
+ isOrderBook={bookType === BookType.Order}
78
+ precision={instrumentPrecisionConfig[instrument]}
79
+ />
80
+ </div>
81
+ )}
52
82
  </div>
53
- )}
54
- {loading && (
55
- <div className={
56
- classnames(
57
- 'lw-absolute lw-left-0 lw-top-0 lw-flex lw-w-full lw-items-center lw-justify-center lw-border lw-border-solid lw-border-border-primary',
58
- {
59
- 'lw-h-full': isDesktop,
60
- 'lw-h-[calc(100%-40px)]': !isDesktop,
61
- },
62
- )
63
- }
64
- >
65
- <Spinner size={SpinnerSize.lg} />
83
+ {!isError && (
84
+ <div className="lw-mt-2 lw-h-8">
85
+ <InfoBox text={`${lang('last_updated')}: ${updatedAt ? formatUpdatedTimestamp(updatedAt, lang('today')) : EMPTY_VALUE}`} />
66
86
  </div>
67
87
  )}
68
- {!isError && data && (
69
- <div className="lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-full lw-w-full">
70
- <Chart
71
- data={data}
72
- isOrderBook={bookType === BookType.Order}
73
- precision={instrumentPrecisionConfig[instrument]}
74
- />
75
- </div>
76
- )}
77
- </div>
88
+ </>
78
89
  );
79
90
  };
80
91
 
@@ -328,6 +328,7 @@ export const getOption: GetOptionType = ({
328
328
  silent: true,
329
329
  precision,
330
330
  symbol: ['none', 'triangle'],
331
+ symbolOffset: [0, [0, isDesktop ? 0 : -10]] as unknown as number,
331
332
  symbolRotate: 90,
332
333
  symbolSize: [20, 10],
333
334
  lineStyle: {
@@ -335,9 +336,9 @@ export const getOption: GetOptionType = ({
335
336
  width: 1,
336
337
  },
337
338
  label: {
339
+ distance: isDesktop ? 5 : -5,
338
340
  overflow: 'truncate',
339
341
  width: isDesktop ? undefined : Y_LABEL_SIZE_MOBILE,
340
- padding: isDesktop ? [5, 15, 5, 15] : [5, 12, 5, 5],
341
342
  color: isDark ? colorPalette.black : colorPalette.white,
342
343
  backgroundColor: isDark ? colorPalette.orange : colorPalette.bottleGreenDark,
343
344
  },
@@ -0,0 +1,3 @@
1
+ const EMPTY_VALUE = '\u2014';
2
+
3
+ export { EMPTY_VALUE };
@@ -9,6 +9,7 @@ const getOrderPositionBooks = gql`
9
9
  ) {
10
10
  bucketWidth
11
11
  price
12
+ time
12
13
  buckets {
13
14
  price
14
15
  longCountPercent
@@ -13,7 +13,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
13
13
  * Therefore it is highly recommended to use the babel or swc plugin for production.
14
14
  */
15
15
  const documents = {
16
- "\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n": types.GetOrderPositionBooksDocument,
16
+ "\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n": types.GetOrderPositionBooksDocument,
17
17
  };
18
18
 
19
19
  /**
@@ -33,7 +33,7 @@ export function graphql(source: string): unknown;
33
33
  /**
34
34
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
35
35
  */
36
- export function graphql(source: "\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"): (typeof documents)["\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"];
36
+ export function graphql(source: "\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"): (typeof documents)["\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"];
37
37
 
38
38
  export function graphql(source: string) {
39
39
  return (documents as any)[source] ?? {};
@@ -27,6 +27,70 @@ export enum BookType {
27
27
  Position = 'POSITION'
28
28
  }
29
29
 
30
+ export type Correlation = {
31
+ __typename?: 'Correlation';
32
+ timeUnit: CorrelationTimeUnit;
33
+ value: Scalars['Float']['output'];
34
+ };
35
+
36
+ export type CorrelationHeatmap = {
37
+ __typename?: 'CorrelationHeatmap';
38
+ baseInstrument: Scalars['String']['output'];
39
+ heatmap: Array<Heatmap>;
40
+ };
41
+
42
+ export enum CorrelationTimeUnit {
43
+ H1 = 'H1',
44
+ H4 = 'H4',
45
+ H24 = 'H24',
46
+ M1 = 'M1',
47
+ M3 = 'M3',
48
+ M6 = 'M6',
49
+ W1 = 'W1',
50
+ Y1 = 'Y1'
51
+ }
52
+
53
+ export enum CurrencyName {
54
+ Aud = 'AUD',
55
+ Cad = 'CAD',
56
+ Chf = 'CHF',
57
+ Eur = 'EUR',
58
+ Gbp = 'GBP',
59
+ Jpy = 'JPY',
60
+ Nzd = 'NZD',
61
+ Usd = 'USD'
62
+ }
63
+
64
+ export type CurrencyPower = {
65
+ __typename?: 'CurrencyPower';
66
+ /** UTC Timestamp */
67
+ point: Scalars['String']['output'];
68
+ price: Scalars['Float']['output'];
69
+ };
70
+
71
+ export type CurrencyPowerBalance = {
72
+ __typename?: 'CurrencyPowerBalance';
73
+ currency: CurrencyName;
74
+ power: Array<CurrencyPower>;
75
+ };
76
+
77
+ export enum CurrencyPowerBalanceTimeUnit {
78
+ CurrentDay = 'CURRENT_DAY',
79
+ H4 = 'H4',
80
+ H8 = 'H8',
81
+ H24 = 'H24',
82
+ M1 = 'M1',
83
+ M3 = 'M3',
84
+ PreviousDay = 'PREVIOUS_DAY',
85
+ W1 = 'W1'
86
+ }
87
+
88
+ export type CurrencyStrength = {
89
+ __typename?: 'CurrencyStrength';
90
+ currency: CurrencyName;
91
+ strengthRelation?: Maybe<Array<StrengthRelation>>;
92
+ };
93
+
30
94
  export enum DataSource {
31
95
  Ny4 = 'NY4',
32
96
  Ty3 = 'TY3'
@@ -43,6 +107,12 @@ export enum Division {
43
107
  Otms = 'OTMS'
44
108
  }
45
109
 
110
+ export type Heatmap = {
111
+ __typename?: 'Heatmap';
112
+ correlation: Array<Correlation>;
113
+ instrument: Scalars['String']['output'];
114
+ };
115
+
46
116
  export type Instrument = {
47
117
  __typename?: 'Instrument';
48
118
  displayName?: Maybe<Scalars['String']['output']>;
@@ -62,7 +132,7 @@ export type OrderPositionData = {
62
132
  buckets: Array<Maybe<OrderPositionBucket>>;
63
133
  dataSource?: Maybe<Scalars['String']['output']>;
64
134
  instrument: Scalars['String']['output'];
65
- price: Scalars['Float']['output'];
135
+ price?: Maybe<Scalars['Float']['output']>;
66
136
  region?: Maybe<Scalars['String']['output']>;
67
137
  time: Scalars['String']['output'];
68
138
  unixTime: Scalars['Int']['output'];
@@ -71,6 +141,9 @@ export type OrderPositionData = {
71
141
  export type Query = {
72
142
  __typename?: 'Query';
73
143
  assetClasses?: Maybe<Array<Maybe<AssetClass>>>;
144
+ correlationHeatmap: CorrelationHeatmap;
145
+ currencyPowerBalance?: Maybe<Array<CurrencyPowerBalance>>;
146
+ currencyStrength?: Maybe<Array<CurrencyStrength>>;
74
147
  orderPositionBooks: Array<Maybe<OrderPositionData>>;
75
148
  sentiment?: Maybe<Array<SentimentInstrument>>;
76
149
  sentimentList?: Maybe<Array<SentimentInstrument>>;
@@ -87,6 +160,16 @@ export type QueryAssetClassesArgs = {
87
160
  };
88
161
 
89
162
 
163
+ export type QueryCorrelationHeatmapArgs = {
164
+ division: Division;
165
+ };
166
+
167
+
168
+ export type QueryCurrencyPowerBalanceArgs = {
169
+ timeUnit: CurrencyPowerBalanceTimeUnit;
170
+ };
171
+
172
+
90
173
  export type QueryOrderPositionBooksArgs = {
91
174
  bookType: BookType;
92
175
  dataSource?: InputMaybe<DataSource>;
@@ -157,6 +240,7 @@ export type SentimentInstrument = {
157
240
  displayName: Scalars['String']['output'];
158
241
  name: Scalars['String']['output'];
159
242
  sentiment: Sentiment;
243
+ updatedAt: Scalars['String']['output'];
160
244
  };
161
245
 
162
246
  export enum Sort {
@@ -164,11 +248,17 @@ export enum Sort {
164
248
  Bullish = 'BULLISH'
165
249
  }
166
250
 
251
+ export type StrengthRelation = {
252
+ __typename?: 'StrengthRelation';
253
+ currency: CurrencyName;
254
+ percentage: Scalars['Float']['output'];
255
+ };
256
+
167
257
  export type TopicalInstrument = {
168
258
  __typename?: 'TopicalInstrument';
169
259
  displayName: Scalars['String']['output'];
170
260
  name: Scalars['String']['output'];
171
- sentiment: TopicalInstrumentSentiment;
261
+ sentiment: Sentiment;
172
262
  updatedAt: Scalars['String']['output'];
173
263
  };
174
264
 
@@ -178,12 +268,6 @@ export type TopicalInstrumentChart = {
178
268
  name: Scalars['String']['output'];
179
269
  };
180
270
 
181
- export type TopicalInstrumentSentiment = {
182
- __typename?: 'TopicalInstrumentSentiment';
183
- longPercent: Scalars['Float']['output'];
184
- shortPercent: Scalars['Float']['output'];
185
- };
186
-
187
271
  export enum TopicalSort {
188
272
  Bearish = 'BEARISH',
189
273
  Bullish = 'BULLISH',
@@ -201,7 +285,7 @@ export type VolatilityChart = {
201
285
 
202
286
  export type VolatilityChartAssetClass = {
203
287
  __typename?: 'VolatilityChartAssetClass';
204
- instruments?: Maybe<Array<Maybe<VolatilityChartInstrument>>>;
288
+ instruments: Array<VolatilityChartInstrument>;
205
289
  name: Scalars['String']['output'];
206
290
  };
207
291
 
@@ -212,11 +296,17 @@ export type VolatilityChartInstrument = {
212
296
  };
213
297
 
214
298
  export enum VolatilityChartTimeSpan {
299
+ /** Valid for: H */
215
300
  D5 = 'D5',
301
+ /** Valid for: H */
216
302
  D10 = 'D10',
303
+ /** Valid for: D */
217
304
  M1 = 'M1',
305
+ /** Valid for: D */
218
306
  M3 = 'M3',
307
+ /** Valid for: W */
219
308
  W5 = 'W5',
309
+ /** Valid for: W */
220
310
  W10 = 'W10'
221
311
  }
222
312
 
@@ -233,7 +323,7 @@ export type GetOrderPositionBooksQueryVariables = Exact<{
233
323
  }>;
234
324
 
235
325
 
236
- export type GetOrderPositionBooksQuery = { __typename?: 'Query', orderPositionBooks: Array<{ __typename?: 'OrderPositionData', bucketWidth: number, price: number, buckets: Array<{ __typename?: 'OrderPositionBucket', price: number, longCountPercent: number, shortCountPercent: number } | null> } | null> };
326
+ export type GetOrderPositionBooksQuery = { __typename?: 'Query', orderPositionBooks: Array<{ __typename?: 'OrderPositionData', bucketWidth: number, price?: number | null, time: string, buckets: Array<{ __typename?: 'OrderPositionBucket', price: number, longCountPercent: number, shortCountPercent: number } | null> } | null> };
237
327
 
238
328
 
239
- export const GetOrderPositionBooksDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderPositionBooks"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"instrument"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"bookType"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"BookType"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"recentHours"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderPositionBooks"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"instrument"},"value":{"kind":"Variable","name":{"kind":"Name","value":"instrument"}}},{"kind":"Argument","name":{"kind":"Name","value":"bookType"},"value":{"kind":"Variable","name":{"kind":"Name","value":"bookType"}}},{"kind":"Argument","name":{"kind":"Name","value":"recentHours"},"value":{"kind":"Variable","name":{"kind":"Name","value":"recentHours"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"bucketWidth"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"buckets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"longCountPercent"}},{"kind":"Field","name":{"kind":"Name","value":"shortCountPercent"}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables>;
329
+ export const GetOrderPositionBooksDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderPositionBooks"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"instrument"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"bookType"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"BookType"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"recentHours"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderPositionBooks"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"instrument"},"value":{"kind":"Variable","name":{"kind":"Name","value":"instrument"}}},{"kind":"Argument","name":{"kind":"Name","value":"bookType"},"value":{"kind":"Variable","name":{"kind":"Name","value":"bookType"}}},{"kind":"Argument","name":{"kind":"Name","value":"recentHours"},"value":{"kind":"Variable","name":{"kind":"Name","value":"recentHours"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"bucketWidth"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"buckets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"longCountPercent"}},{"kind":"Field","name":{"kind":"Name","value":"shortCountPercent"}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables>;
@@ -2,6 +2,7 @@
2
2
  "buy": "Buy",
3
3
  "data_unavailable": "Data unavailable",
4
4
  "instrument": "Instrument",
5
+ "last_updated": "Last updated",
5
6
  "long": "Long",
6
7
  "long_positions": "Long Positions",
7
8
  "open_orders": "Open Orders",
@@ -15,6 +16,7 @@
15
16
  "sell_orders": "Sell Orders",
16
17
  "short": "Short",
17
18
  "short_positions": "Short Positions",
19
+ "today": "Today",
18
20
  "zoom_in": "Zoom In",
19
21
  "zoom_out": "Zoom Out"
20
22
  }
@@ -2,6 +2,7 @@
2
2
  "buy": "買進",
3
3
  "data_unavailable": "沒有數據",
4
4
  "instrument": "金融工具",
5
+ "last_updated": "最後更新",
5
6
  "long": "長",
6
7
  "long_positions": "長倉",
7
8
  "open_orders": "開盤市價單",
@@ -15,6 +16,7 @@
15
16
  "sell_orders": "賣單",
16
17
  "short": "短",
17
18
  "short_positions": "短倉",
19
+ "today": "今日",
18
20
  "zoom_in": "放大",
19
21
  "zoom_out": "縮小"
20
22
  }
@@ -26,6 +26,7 @@ const mocks = [
26
26
  {
27
27
  bucketWidth: 0.0005,
28
28
  price: 0.8,
29
+ time: '2024-02-21T10:30:00Z',
29
30
  buckets: [
30
31
  {
31
32
  price: 0.02,
@@ -68,6 +69,7 @@ const mocks = [
68
69
  {
69
70
  bucketWidth: 0.0005,
70
71
  price: 0.8,
72
+ time: '2024-02-21T10:30:00Z',
71
73
  buckets: [
72
74
  {
73
75
  price: 0.02,
@@ -98,8 +100,15 @@ const mocks = [
98
100
  ];
99
101
 
100
102
  describe('Main component', () => {
103
+ beforeEach(() => {
104
+ jest.useFakeTimers();
105
+ jest.setSystemTime(new Date('2024-02-21'));
106
+ });
107
+ afterEach(() => {
108
+ jest.useRealTimers();
109
+ });
101
110
  it('should render tool component', async () => {
102
- const { findByTestId } = render(
111
+ const { findByTestId, findByText } = render(
103
112
  <MockedProvider mocks={mocks}>
104
113
  <ThemeContext.Provider value={{ size: Size.DESKTOP, isDark: true }}>
105
114
  <Main />
@@ -108,6 +117,7 @@ describe('Main component', () => {
108
117
  );
109
118
 
110
119
  expect(await findByTestId('order-book-widget')).toBeInTheDocument();
120
+ expect(await findByText('last_updated: 10:30:00 UTC, today')).toBeInTheDocument();
111
121
  expect((await findByTestId('select'))).toBeInTheDocument();
112
122
  });
113
123
  it('should render widget component', async () => {