@oanda/labs-order-book-widget 1.0.226 → 1.0.228

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 (40) hide show
  1. package/CHANGELOG.md +1796 -0
  2. package/dist/main/OrderBookWidget/ChartWithData.js +5 -5
  3. package/dist/main/OrderBookWidget/ChartWithData.js.map +1 -1
  4. package/dist/main/OrderBookWidget/components/Chart/getOption.js +4 -4
  5. package/dist/main/OrderBookWidget/components/Chart/getOption.js.map +1 -1
  6. package/dist/main/OrderBookWidget/components/Chart/types.js.map +1 -1
  7. package/dist/main/gql/getOrderPositionBook.js +11 -0
  8. package/dist/main/gql/getOrderPositionBook.js.map +1 -0
  9. package/dist/main/gql/types/gql.js +1 -1
  10. package/dist/main/gql/types/gql.js.map +1 -1
  11. package/dist/main/gql/types/graphql.js +38 -6
  12. package/dist/main/gql/types/graphql.js.map +1 -1
  13. package/dist/module/OrderBookWidget/ChartWithData.js +5 -5
  14. package/dist/module/OrderBookWidget/ChartWithData.js.map +1 -1
  15. package/dist/module/OrderBookWidget/components/Chart/getOption.js +4 -4
  16. package/dist/module/OrderBookWidget/components/Chart/getOption.js.map +1 -1
  17. package/dist/module/OrderBookWidget/components/Chart/types.js.map +1 -1
  18. package/dist/module/gql/getOrderPositionBook.js +6 -0
  19. package/dist/module/gql/getOrderPositionBook.js.map +1 -0
  20. package/dist/module/gql/types/gql.js +1 -1
  21. package/dist/module/gql/types/gql.js.map +1 -1
  22. package/dist/module/gql/types/graphql.js +37 -5
  23. package/dist/module/gql/types/graphql.js.map +1 -1
  24. package/dist/types/OrderBookWidget/components/Chart/types.d.ts +3 -3
  25. package/dist/types/gql/getOrderPositionBook.d.ts +2 -0
  26. package/dist/types/gql/types/gql.d.ts +2 -2
  27. package/dist/types/gql/types/graphql.d.ts +135 -13
  28. package/package.json +3 -3
  29. package/src/OrderBookWidget/ChartWithData.tsx +12 -8
  30. package/src/OrderBookWidget/components/Chart/getOption.ts +4 -4
  31. package/src/OrderBookWidget/components/Chart/types.ts +3 -3
  32. package/src/gql/{getOrderPositionBooks.ts → getOrderPositionBook.ts} +4 -4
  33. package/src/gql/types/gql.ts +4 -4
  34. package/src/gql/types/graphql.ts +157 -17
  35. package/test/Main.test.tsx +3 -3
  36. package/dist/main/gql/getOrderPositionBooks.js +0 -11
  37. package/dist/main/gql/getOrderPositionBooks.js.map +0 -1
  38. package/dist/module/gql/getOrderPositionBooks.js +0 -6
  39. package/dist/module/gql/getOrderPositionBooks.js.map +0 -1
  40. package/dist/types/gql/getOrderPositionBooks.d.ts +0 -2
@@ -53,6 +53,7 @@ export declare enum AssetClassName {
53
53
  Cryptocurrency = "CRYPTOCURRENCY",
54
54
  Currency = "CURRENCY",
55
55
  EquityShares = "EQUITY_SHARES",
56
+ Etfs = "ETFS",
56
57
  Indices = "INDICES",
57
58
  Rates = "RATES"
58
59
  }
@@ -60,6 +61,23 @@ export declare enum BookType {
60
61
  Order = "ORDER",
61
62
  Position = "POSITION"
62
63
  }
64
+ export type Candle = {
65
+ __typename?: 'Candle';
66
+ close: Scalars['Float']['output'];
67
+ high: Scalars['Float']['output'];
68
+ low: Scalars['Float']['output'];
69
+ open: Scalars['Float']['output'];
70
+ /** UTC Timestamp */
71
+ point: Scalars['String']['output'];
72
+ };
73
+ export type CandlesData = {
74
+ __typename?: 'CandlesData';
75
+ candle: Array<Maybe<Candle>>;
76
+ granularity: Granularity;
77
+ instrument: Instrument;
78
+ pipsLocation: Scalars['Int']['output'];
79
+ timeSpan: TimeSpan;
80
+ };
63
81
  export type CorrelationHeatmap = {
64
82
  __typename?: 'CorrelationHeatmap';
65
83
  baseInstrument: Instrument;
@@ -119,8 +137,9 @@ export type CurrencyStrength = {
119
137
  updatedAt: Scalars['String']['output'];
120
138
  };
121
139
  export declare enum DataSource {
122
- Ny4 = "NY4",
123
- Ty3 = "TY3"
140
+ All = "ALL",
141
+ Mt5 = "MT5",
142
+ V20 = "V20"
124
143
  }
125
144
  export declare enum Division {
126
145
  Oap = "OAP",
@@ -133,6 +152,19 @@ export declare enum Division {
133
152
  Opt = "OPT",
134
153
  Otms = "OTMS"
135
154
  }
155
+ export type ExtendedInstrument = {
156
+ __typename?: 'ExtendedInstrument';
157
+ dataSource: DataSource;
158
+ displayName: Scalars['String']['output'];
159
+ name: Scalars['String']['output'];
160
+ tradeMode: TradeMode;
161
+ };
162
+ export declare enum Granularity {
163
+ H1 = "H1",
164
+ H4 = "H4",
165
+ M5 = "M5",
166
+ M15 = "M15"
167
+ }
136
168
  export type Heatmap = {
137
169
  __typename?: 'Heatmap';
138
170
  instrument: Instrument;
@@ -148,16 +180,33 @@ export type InstrumentCorrelation = {
148
180
  instrument: Instrument;
149
181
  value?: Maybe<Scalars['Float']['output']>;
150
182
  };
183
+ export type InstrumentTableResult = {
184
+ __typename?: 'InstrumentTableResult';
185
+ instruments: Array<ExtendedInstrument>;
186
+ totalCount: Scalars['Int']['output'];
187
+ updatedAt: Scalars['String']['output'];
188
+ };
189
+ export type MarginRate = {
190
+ __typename?: 'MarginRate';
191
+ instrument: Instrument;
192
+ rate: Scalars['Float']['output'];
193
+ };
151
194
  export type Matrix = {
152
195
  __typename?: 'Matrix';
153
196
  instrument: Instrument;
154
197
  instrumentCorrelation: Array<InstrumentCorrelation>;
155
198
  };
199
+ export declare enum OrderBookDataSource {
200
+ Ny4 = "NY4",
201
+ Ny4Mt5 = "NY4_MT5",
202
+ Ty3 = "TY3"
203
+ }
156
204
  export type OrderPositionBucket = {
157
205
  __typename?: 'OrderPositionBucket';
158
- longCountPercent: Scalars['Float']['output'];
206
+ longCountPercent?: Maybe<Scalars['Float']['output']>;
159
207
  price: Scalars['Float']['output'];
160
- shortCountPercent: Scalars['Float']['output'];
208
+ sentiment?: Maybe<Scalars['Float']['output']>;
209
+ shortCountPercent?: Maybe<Scalars['Float']['output']>;
161
210
  };
162
211
  export type OrderPositionData = {
163
212
  __typename?: 'OrderPositionData';
@@ -177,10 +226,17 @@ export type Query = {
177
226
  correlationMatrix: CorrelationMatrix;
178
227
  currencyPowerBalance?: Maybe<Array<CurrencyPowerBalance>>;
179
228
  currencyStrength?: Maybe<Array<CurrencyStrength>>;
229
+ isAllowedPartner?: Maybe<Scalars['Boolean']['output']>;
180
230
  mapInstrumentNames?: Maybe<Array<Maybe<Instrument>>>;
231
+ marginRates?: Maybe<Array<MarginRate>>;
232
+ orderPositionBook: Array<Maybe<OrderPositionData>>;
181
233
  orderPositionBooks: Array<Maybe<OrderPositionData>>;
234
+ priceCandles: CandlesData;
235
+ resolveInstrumentsByDivision?: Maybe<Array<Instrument>>;
236
+ resolveInstrumentsWithFilters?: Maybe<InstrumentTableResult>;
182
237
  sentiment?: Maybe<Array<SentimentInstrument>>;
183
238
  sentimentList?: Maybe<Array<SentimentInstrument>>;
239
+ sentiments: SentimentData;
184
240
  topicalInstruments?: Maybe<Array<TopicalInstrument>>;
185
241
  topicalInstrumentsCharts?: Maybe<Array<TopicalInstrumentChart>>;
186
242
  topicalInstrumentsTotalCount: Scalars['Int']['output'];
@@ -204,16 +260,53 @@ export type QueryCorrelationMatrixArgs = {
204
260
  export type QueryCurrencyPowerBalanceArgs = {
205
261
  timeUnit: CurrencyPowerBalanceTimeUnit;
206
262
  };
263
+ export type QueryIsAllowedPartnerArgs = {
264
+ url: Scalars['String']['input'];
265
+ };
207
266
  export type QueryMapInstrumentNamesArgs = {
208
267
  division?: InputMaybe<Division>;
209
268
  instruments: Array<InputMaybe<Scalars['String']['input']>>;
210
269
  };
211
- export type QueryOrderPositionBooksArgs = {
270
+ export type QueryMarginRatesArgs = {
271
+ dataSource: DataSource;
272
+ division: Division;
273
+ instruments?: InputMaybe<Array<Scalars['String']['input']>>;
274
+ tradingGroup: Scalars['Int']['input'];
275
+ };
276
+ export type QueryOrderPositionBookArgs = {
212
277
  bookType: BookType;
213
- dataSource?: InputMaybe<DataSource>;
278
+ dataSource?: InputMaybe<OrderBookDataSource>;
214
279
  instrument: Scalars['String']['input'];
215
280
  recentHours?: InputMaybe<Scalars['Int']['input']>;
216
- region?: InputMaybe<Region>;
281
+ };
282
+ export type QueryOrderPositionBooksArgs = {
283
+ bookType: BookType;
284
+ granularity: Granularity;
285
+ instrument: Scalars['String']['input'];
286
+ maxBookPrice?: InputMaybe<Scalars['Float']['input']>;
287
+ minBookPrice?: InputMaybe<Scalars['Float']['input']>;
288
+ timeSpan: TimeSpan;
289
+ };
290
+ export type QueryPriceCandlesArgs = {
291
+ dataSource: DataSource;
292
+ division: Division;
293
+ granularity: Granularity;
294
+ instrument: Scalars['String']['input'];
295
+ timeSpan: TimeSpan;
296
+ };
297
+ export type QueryResolveInstrumentsByDivisionArgs = {
298
+ division: Division;
299
+ instruments: Array<InputMaybe<Scalars['String']['input']>>;
300
+ };
301
+ export type QueryResolveInstrumentsWithFiltersArgs = {
302
+ assetClass?: InputMaybe<Array<InputMaybe<AssetClassName>>>;
303
+ count?: InputMaybe<Scalars['Int']['input']>;
304
+ dataSource: DataSource;
305
+ division: Division;
306
+ instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
307
+ offset?: InputMaybe<Scalars['Int']['input']>;
308
+ searchPattern?: InputMaybe<Scalars['String']['input']>;
309
+ tradeModes?: InputMaybe<Array<InputMaybe<TradeMode>>>;
217
310
  };
218
311
  export type QuerySentimentArgs = {
219
312
  division?: InputMaybe<Division>;
@@ -223,6 +316,11 @@ export type QuerySentimentListArgs = {
223
316
  division?: InputMaybe<Division>;
224
317
  sort?: InputMaybe<Sort>;
225
318
  };
319
+ export type QuerySentimentsArgs = {
320
+ granularity: Granularity;
321
+ instrument: Scalars['String']['input'];
322
+ timeSpan: TimeSpan;
323
+ };
226
324
  export type QueryTopicalInstrumentsArgs = {
227
325
  assetClass?: InputMaybe<AssetClassName>;
228
326
  count?: InputMaybe<Scalars['Int']['input']>;
@@ -267,6 +365,10 @@ export type Sentiment = {
267
365
  longPercent: Scalars['Float']['output'];
268
366
  shortPercent: Scalars['Float']['output'];
269
367
  };
368
+ export type SentimentData = {
369
+ __typename?: 'SentimentData';
370
+ sentiments: Array<Maybe<SentimentWithTime>>;
371
+ };
270
372
  export type SentimentInstrument = {
271
373
  __typename?: 'SentimentInstrument';
272
374
  displayName: Scalars['String']['output'];
@@ -274,6 +376,11 @@ export type SentimentInstrument = {
274
376
  sentiment: Sentiment;
275
377
  updatedAt: Scalars['String']['output'];
276
378
  };
379
+ export type SentimentWithTime = {
380
+ __typename?: 'SentimentWithTime';
381
+ sentiment: Sentiment;
382
+ time: Scalars['String']['output'];
383
+ };
277
384
  export declare enum Sort {
278
385
  Bearish = "BEARISH",
279
386
  Bullish = "BULLISH"
@@ -288,6 +395,13 @@ export type TimeCorrelation = {
288
395
  timeUnit: CorrelationTimeUnit;
289
396
  value?: Maybe<Scalars['Float']['output']>;
290
397
  };
398
+ export declare enum TimeSpan {
399
+ FiveDays = "FIVE_DAYS",
400
+ NinetyDays = "NINETY_DAYS",
401
+ TenDays = "TEN_DAYS",
402
+ TwentyDays = "TWENTY_DAYS",
403
+ TwoDays = "TWO_DAYS"
404
+ }
291
405
  export type TopicalInstrument = {
292
406
  __typename?: 'TopicalInstrument';
293
407
  assetClass?: Maybe<AssetClassName>;
@@ -308,6 +422,14 @@ export declare enum TopicalSort {
308
422
  Popular = "POPULAR",
309
423
  Volatile = "VOLATILE"
310
424
  }
425
+ export declare enum TradeMode {
426
+ TradeCloseonly = "TRADE_CLOSEONLY",
427
+ TradeDisabled = "TRADE_DISABLED",
428
+ TradeFull = "TRADE_FULL",
429
+ TradeLongonly = "TRADE_LONGONLY",
430
+ TradeShortonly = "TRADE_SHORTONLY",
431
+ TradeUndefined = "TRADE_UNDEFINED"
432
+ }
311
433
  export declare enum ValueAtRiskBars {
312
434
  C100 = "C100",
313
435
  C200 = "C200",
@@ -365,14 +487,14 @@ export declare enum VolatilityChartTimeUnit {
365
487
  H = "H",
366
488
  W = "W"
367
489
  }
368
- export type GetOrderPositionBooksQueryVariables = Exact<{
490
+ export type GetOrderPositionBookQueryVariables = Exact<{
369
491
  instrument: Scalars['String']['input'];
370
492
  bookType: BookType;
371
493
  recentHours?: InputMaybe<Scalars['Int']['input']>;
372
494
  }>;
373
- export type GetOrderPositionBooksQuery = {
495
+ export type GetOrderPositionBookQuery = {
374
496
  __typename?: 'Query';
375
- orderPositionBooks: Array<{
497
+ orderPositionBook: Array<{
376
498
  __typename?: 'OrderPositionData';
377
499
  bucketWidth: number;
378
500
  price?: number | null;
@@ -380,9 +502,9 @@ export type GetOrderPositionBooksQuery = {
380
502
  buckets: Array<{
381
503
  __typename?: 'OrderPositionBucket';
382
504
  price: number;
383
- longCountPercent: number;
384
- shortCountPercent: number;
505
+ longCountPercent?: number | null;
506
+ shortCountPercent?: number | null;
385
507
  } | null>;
386
508
  } | null>;
387
509
  };
388
- export declare const GetOrderPositionBooksDocument: DocumentNode<GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables>;
510
+ export declare const GetOrderPositionBookDocument: DocumentNode<GetOrderPositionBookQuery, GetOrderPositionBookQueryVariables>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oanda/labs-order-book-widget",
3
- "version": "1.0.226",
3
+ "version": "1.0.228",
4
4
  "description": "Labs Order Book Widget",
5
5
  "main": "dist/main/index.js",
6
6
  "module": "dist/module/index.js",
@@ -13,7 +13,7 @@
13
13
  "author": "OANDA",
14
14
  "license": "UNLICENSED",
15
15
  "dependencies": {
16
- "@oanda/labs-widget-common": "^1.0.226",
16
+ "@oanda/labs-widget-common": "^1.0.228",
17
17
  "@oanda/mono-i18n": "10.0.1",
18
18
  "echarts": "6.0.0",
19
19
  "echarts-for-react": "3.0.4",
@@ -24,5 +24,5 @@
24
24
  "@graphql-codegen/client-preset": "4.1.0",
25
25
  "@graphql-codegen/typescript": "4.0.1"
26
26
  },
27
- "gitHead": "4709e181ae37de87e1c5d5569391c5f6cfeeca33"
27
+ "gitHead": "8e6597b98667ce51cc5610dddc94f020a2a82908"
28
28
  }
@@ -11,10 +11,10 @@ import { useLocale } from '@oanda/mono-i18n';
11
11
  import classnames from 'classnames';
12
12
  import React from 'react';
13
13
 
14
- import { getOrderPositionBooks } from '../gql/getOrderPositionBooks';
14
+ import { getOrderPositionBook } from '../gql/getOrderPositionBook';
15
15
  import type {
16
- GetOrderPositionBooksQuery,
17
- GetOrderPositionBooksQueryVariables,
16
+ GetOrderPositionBookQuery,
17
+ GetOrderPositionBookQueryVariables,
18
18
  } from '../gql/types/graphql';
19
19
  import { BookType } from '../gql/types/graphql';
20
20
  import { Chart } from './components/Chart/Chart';
@@ -27,9 +27,9 @@ const ChartWithData = ({ instrument, bookType }: ChartWithDataProps) => {
27
27
  const isDesktop = size === Size.DESKTOP;
28
28
 
29
29
  const { loading, data, error } = useQuery<
30
- GetOrderPositionBooksQuery,
31
- GetOrderPositionBooksQueryVariables
32
- >(getOrderPositionBooks, {
30
+ GetOrderPositionBookQuery,
31
+ GetOrderPositionBookQueryVariables
32
+ >(getOrderPositionBook, {
33
33
  variables: {
34
34
  instrument,
35
35
  bookType,
@@ -38,8 +38,12 @@ const ChartWithData = ({ instrument, bookType }: ChartWithDataProps) => {
38
38
  fetchPolicy: 'network-only',
39
39
  });
40
40
 
41
- const isError = (!loading && !data?.orderPositionBooks[0]?.price) || !!error;
42
- const updatedAt = data?.orderPositionBooks[0]?.time;
41
+ const isError =
42
+ (!loading &&
43
+ (!data?.orderPositionBook?.length ||
44
+ !data?.orderPositionBook[0]?.price)) ||
45
+ !!error;
46
+ const updatedAt = data?.orderPositionBook?.[0]?.time;
43
47
 
44
48
  return (
45
49
  <>
@@ -25,10 +25,10 @@ export const getOption: GetOptionType = ({
25
25
  isDesktop,
26
26
  lang,
27
27
  }) => {
28
- const buckets = data.orderPositionBooks[0]?.buckets || [];
29
- const bucketWidth = data.orderPositionBooks[0]?.bucketWidth!;
30
- const price = data.orderPositionBooks[0]?.price!;
31
- const bucketPrecision = bucketWidth.toString().split('.')[1].length || 0;
28
+ const buckets = data.orderPositionBook[0]?.buckets || [];
29
+ const bucketWidth = data.orderPositionBook[0]?.bucketWidth!;
30
+ const price = data.orderPositionBook[0]?.price!;
31
+ const bucketPrecision = bucketWidth?.toString().split('.')[1].length || 0;
32
32
 
33
33
  const dataset = buckets.map((item) => [
34
34
  item!.price,
@@ -1,15 +1,15 @@
1
1
  import type { EChartsOption } from 'echarts';
2
2
 
3
- import type { GetOrderPositionBooksQuery } from '../../../gql/types/graphql';
3
+ import type { GetOrderPositionBookQuery } from '../../../gql/types/graphql';
4
4
 
5
5
  export interface ChartProps {
6
- data: GetOrderPositionBooksQuery;
6
+ data: GetOrderPositionBookQuery;
7
7
  isOrderBook: boolean;
8
8
  precision: number;
9
9
  }
10
10
 
11
11
  export interface GetOptionProps {
12
- data: GetOrderPositionBooksQuery;
12
+ data: GetOrderPositionBookQuery;
13
13
  precision: number;
14
14
  isDark: boolean;
15
15
  isOrderBook: boolean;
@@ -1,12 +1,12 @@
1
1
  import { gql } from '@apollo/client';
2
2
 
3
- const getOrderPositionBooks = gql`
4
- query GetOrderPositionBooks(
3
+ const getOrderPositionBook = gql`
4
+ query GetOrderPositionBook(
5
5
  $instrument: String!
6
6
  $bookType: BookType!
7
7
  $recentHours: Int
8
8
  ) {
9
- orderPositionBooks(
9
+ orderPositionBook(
10
10
  instrument: $instrument
11
11
  bookType: $bookType
12
12
  recentHours: $recentHours
@@ -23,4 +23,4 @@ const getOrderPositionBooks = gql`
23
23
  }
24
24
  `;
25
25
 
26
- export { getOrderPositionBooks };
26
+ export { getOrderPositionBook };
@@ -13,8 +13,8 @@ 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 time\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n':
17
- types.GetOrderPositionBooksDocument,
16
+ '\n query GetOrderPositionBook(\n $instrument: String!\n $bookType: BookType!\n $recentHours: Int\n ) {\n orderPositionBook(\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':
17
+ types.GetOrderPositionBookDocument,
18
18
  };
19
19
 
20
20
  /**
@@ -35,8 +35,8 @@ export function graphql(source: string): unknown;
35
35
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
36
36
  */
37
37
  export function graphql(
38
- 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'
39
- ): (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'];
38
+ source: '\n query GetOrderPositionBook(\n $instrument: String!\n $bookType: BookType!\n $recentHours: Int\n ) {\n orderPositionBook(\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'
39
+ ): (typeof documents)['\n query GetOrderPositionBook(\n $instrument: String!\n $bookType: BookType!\n $recentHours: Int\n ) {\n orderPositionBook(\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'];
40
40
 
41
41
  export function graphql(source: string) {
42
42
  return (documents as any)[source] ?? {};