@oanda/labs-crowd-view-widget 1.0.51 → 1.0.53

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 (153) hide show
  1. package/CHANGELOG.md +428 -0
  2. package/dist/main/CrowdViewWidget/Main.js +1 -5
  3. package/dist/main/CrowdViewWidget/Main.js.map +1 -1
  4. package/dist/main/CrowdViewWidget/components/Chart/Chart.js +73 -24
  5. package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  6. package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +18 -9
  7. package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
  8. package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js +265 -59
  9. package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js.map +1 -1
  10. package/dist/main/CrowdViewWidget/components/Chart/types.js.map +1 -1
  11. package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js +68 -26
  12. package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
  13. package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js +20 -19
  14. package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +1 -1
  15. package/dist/main/CrowdViewWidget/components/Chart/utils/getChartStyles.js +27 -0
  16. package/dist/main/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +1 -0
  17. package/dist/main/CrowdViewWidget/components/Chart/utils/getGridLines.js +123 -0
  18. package/dist/main/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +1 -0
  19. package/dist/main/CrowdViewWidget/components/Chart/utils/index.js +15 -26
  20. package/dist/main/CrowdViewWidget/components/Chart/utils/index.js.map +1 -1
  21. package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js +54 -12
  22. package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +1 -1
  23. package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js +49 -27
  24. package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +1 -1
  25. package/dist/main/CrowdViewWidget/components/Chart/utils/processSentiments.js +43 -0
  26. package/dist/main/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +1 -0
  27. package/dist/main/CrowdViewWidget/components/Chart/utils/validateData.js +8 -2
  28. package/dist/main/CrowdViewWidget/components/Chart/utils/validateData.js.map +1 -1
  29. package/dist/main/CrowdViewWidget/components/Legend/Legend.js +3 -4
  30. package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
  31. package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +2 -2
  32. package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
  33. package/dist/main/CrowdViewWidget/constants.js +14 -8
  34. package/dist/main/CrowdViewWidget/constants.js.map +1 -1
  35. package/dist/main/gql/getOrderPositionBooks.js +1 -1
  36. package/dist/main/gql/getOrderPositionBooks.js.map +1 -1
  37. package/dist/main/gql/getPriceCandles.js +1 -1
  38. package/dist/main/gql/getPriceCandles.js.map +1 -1
  39. package/dist/main/gql/getSentiments.js +11 -0
  40. package/dist/main/gql/getSentiments.js.map +1 -0
  41. package/dist/main/gql/types/gql.js +3 -2
  42. package/dist/main/gql/types/gql.js.map +1 -1
  43. package/dist/main/gql/types/graphql.js +273 -19
  44. package/dist/main/gql/types/graphql.js.map +1 -1
  45. package/dist/module/CrowdViewWidget/Main.js +2 -6
  46. package/dist/module/CrowdViewWidget/Main.js.map +1 -1
  47. package/dist/module/CrowdViewWidget/components/Chart/Chart.js +76 -27
  48. package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  49. package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +18 -9
  50. package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
  51. package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js +265 -60
  52. package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js.map +1 -1
  53. package/dist/module/CrowdViewWidget/components/Chart/types.js.map +1 -1
  54. package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js +69 -27
  55. package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
  56. package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js +21 -20
  57. package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +1 -1
  58. package/dist/module/CrowdViewWidget/components/Chart/utils/getChartStyles.js +20 -0
  59. package/dist/module/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +1 -0
  60. package/dist/module/CrowdViewWidget/components/Chart/utils/getGridLines.js +116 -0
  61. package/dist/module/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +1 -0
  62. package/dist/module/CrowdViewWidget/components/Chart/utils/index.js +2 -3
  63. package/dist/module/CrowdViewWidget/components/Chart/utils/index.js.map +1 -1
  64. package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js +54 -12
  65. package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +1 -1
  66. package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js +49 -27
  67. package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +1 -1
  68. package/dist/module/CrowdViewWidget/components/Chart/utils/processSentiments.js +36 -0
  69. package/dist/module/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +1 -0
  70. package/dist/module/CrowdViewWidget/components/Chart/utils/validateData.js +8 -2
  71. package/dist/module/CrowdViewWidget/components/Chart/utils/validateData.js.map +1 -1
  72. package/dist/module/CrowdViewWidget/components/Legend/Legend.js +3 -4
  73. package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
  74. package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +2 -2
  75. package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
  76. package/dist/module/CrowdViewWidget/constants.js +13 -7
  77. package/dist/module/CrowdViewWidget/constants.js.map +1 -1
  78. package/dist/module/gql/getOrderPositionBooks.js +1 -1
  79. package/dist/module/gql/getOrderPositionBooks.js.map +1 -1
  80. package/dist/module/gql/getPriceCandles.js +1 -1
  81. package/dist/module/gql/getPriceCandles.js.map +1 -1
  82. package/dist/module/gql/getSentiments.js +6 -0
  83. package/dist/module/gql/getSentiments.js.map +1 -0
  84. package/dist/module/gql/types/gql.js +3 -2
  85. package/dist/module/gql/types/gql.js.map +1 -1
  86. package/dist/module/gql/types/graphql.js +272 -18
  87. package/dist/module/gql/types/graphql.js.map +1 -1
  88. package/dist/types/CrowdViewWidget/components/Chart/Chart.d.ts +1 -1
  89. package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +69 -9
  90. package/dist/types/CrowdViewWidget/components/Chart/utils/chartUtils.d.ts +5 -6
  91. package/dist/types/CrowdViewWidget/components/Chart/utils/getChartStyles.d.ts +10 -0
  92. package/dist/types/CrowdViewWidget/components/Chart/utils/getGridLines.d.ts +97 -0
  93. package/dist/types/CrowdViewWidget/components/Chart/utils/index.d.ts +2 -3
  94. package/dist/types/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.d.ts +10 -7
  95. package/dist/types/CrowdViewWidget/components/Chart/utils/processPriceCandles.d.ts +6 -21
  96. package/dist/types/CrowdViewWidget/components/Chart/utils/processSentiments.d.ts +6 -0
  97. package/dist/types/CrowdViewWidget/components/Chart/utils/validateData.d.ts +1 -1
  98. package/dist/types/CrowdViewWidget/components/Legend/Legend.d.ts +2 -2
  99. package/dist/types/CrowdViewWidget/components/Legend/LegendBar.d.ts +1 -1
  100. package/dist/types/CrowdViewWidget/constants.d.ts +12 -6
  101. package/dist/types/gql/getSentiments.d.ts +2 -0
  102. package/dist/types/gql/types/gql.d.ts +15 -4
  103. package/dist/types/gql/types/graphql.d.ts +66 -11
  104. package/package.json +3 -3
  105. package/src/CrowdViewWidget/Main.tsx +2 -4
  106. package/src/CrowdViewWidget/components/Chart/Chart.tsx +99 -38
  107. package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +24 -7
  108. package/src/CrowdViewWidget/components/Chart/chartOptions.ts +305 -87
  109. package/src/CrowdViewWidget/components/Chart/types.ts +82 -16
  110. package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +105 -56
  111. package/src/CrowdViewWidget/components/Chart/utils/chartUtils.ts +65 -34
  112. package/src/CrowdViewWidget/components/Chart/utils/getChartStyles.ts +42 -0
  113. package/src/CrowdViewWidget/components/Chart/utils/getGridLines.ts +148 -0
  114. package/src/CrowdViewWidget/components/Chart/utils/index.ts +2 -3
  115. package/src/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.ts +84 -22
  116. package/src/CrowdViewWidget/components/Chart/utils/processPriceCandles.ts +52 -38
  117. package/src/CrowdViewWidget/components/Chart/utils/processSentiments.ts +55 -0
  118. package/src/CrowdViewWidget/components/Chart/utils/validateData.ts +10 -2
  119. package/src/CrowdViewWidget/components/Legend/Legend.tsx +5 -6
  120. package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +3 -3
  121. package/src/CrowdViewWidget/constants.ts +18 -7
  122. package/src/gql/getOrderPositionBooks.ts +13 -5
  123. package/src/gql/getPriceCandles.ts +1 -0
  124. package/src/gql/getSentiments.ts +25 -0
  125. package/src/gql/types/gql.ts +14 -6
  126. package/src/gql/types/graphql.ts +259 -16
  127. package/test/components/Chart/utils/chartUtils.test.ts +105 -13
  128. package/test/components/Chart/utils/getChartStyles.test.ts +64 -0
  129. package/test/components/Chart/utils/processSentiments.test.ts +238 -0
  130. package/test/utils/processOrderPositionBooks.test.ts +201 -84
  131. package/test/utils/processPriceCandles.test.ts +93 -67
  132. package/test/utils/validateData.test.ts +136 -38
  133. package/dist/main/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js +0 -37
  134. package/dist/main/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js.map +0 -1
  135. package/dist/main/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js +0 -14
  136. package/dist/main/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js.map +0 -1
  137. package/dist/main/CrowdViewWidget/components/Chart/utils/processBuckets.js +0 -29
  138. package/dist/main/CrowdViewWidget/components/Chart/utils/processBuckets.js.map +0 -1
  139. package/dist/module/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js +0 -29
  140. package/dist/module/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js.map +0 -1
  141. package/dist/module/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js +0 -7
  142. package/dist/module/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js.map +0 -1
  143. package/dist/module/CrowdViewWidget/components/Chart/utils/processBuckets.js +0 -22
  144. package/dist/module/CrowdViewWidget/components/Chart/utils/processBuckets.js.map +0 -1
  145. package/dist/types/CrowdViewWidget/components/Chart/utils/aggregateBuckets.d.ts +0 -2
  146. package/dist/types/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.d.ts +0 -3
  147. package/dist/types/CrowdViewWidget/components/Chart/utils/processBuckets.d.ts +0 -3
  148. package/src/CrowdViewWidget/components/Chart/utils/aggregateBuckets.ts +0 -44
  149. package/src/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.ts +0 -13
  150. package/src/CrowdViewWidget/components/Chart/utils/processBuckets.ts +0 -43
  151. package/test/utils/aggregateBuckets.test.ts +0 -82
  152. package/test/utils/getTargetBucketWidth.test.ts +0 -37
  153. package/test/utils/processBuckets.test.ts +0 -153
@@ -1,6 +1,6 @@
1
1
  import { BookType, Granularity, TimeSpan } from '../../../../gql/types/graphql';
2
- import type { Bucket, GetLabelsDataProps } from '../types';
3
- export declare const getLabelData: ({ xAxisData, isGreaterThanTwoWeeks, }: GetLabelsDataProps) => {
2
+ import type { Bucket, GetLabelsDataProps, TooltipParam } from '../types';
3
+ export declare const getLabelData: ({ dates, isGreaterThanTwoWeeks, }: GetLabelsDataProps) => {
4
4
  name: string;
5
5
  xAxis: string;
6
6
  y: number;
@@ -18,13 +18,12 @@ export declare const getLabelData: ({ xAxisData, isGreaterThanTwoWeeks, }: GetLa
18
18
  }[];
19
19
  export declare const isDifferenceGreaterThanTwoWeeks: (startDate: string, endDate: string) => boolean;
20
20
  export declare const getTimeSpanForGranularity: (granularity: Granularity) => TimeSpan;
21
- export declare const getRectColor: (sentiment: number, isDark: boolean) => string;
22
- export declare const getTooltipFormatter: ({ params, buckets, bucketWidth, selectedPrice, precision, bookType, labelCallback, }: {
23
- params: unknown;
21
+ export declare const getRectColor: (sentiment: number, isDark: boolean, minThreshold: number, maxThreshold: number) => string;
22
+ export declare const getTooltipFormatter: ({ params, buckets, bucketWidth, selectedPrice, bookType, labelCallback, }: {
23
+ params: TooltipParam[];
24
24
  buckets: Bucket[][];
25
25
  bucketWidth: number;
26
26
  selectedPrice: number;
27
- precision: number;
28
27
  bookType: BookType;
29
28
  labelCallback: (key: string) => string;
30
29
  }) => string | undefined;
@@ -0,0 +1,10 @@
1
+ export interface ChartStyles {
2
+ sentimentLongColor: string;
3
+ sentimentShortColor: string;
4
+ candleLongColor: string;
5
+ candleShortColor: string;
6
+ sentimentAreaOpacity: number;
7
+ tooltipLinesColor: string;
8
+ sentimentLabelColor: string;
9
+ }
10
+ export declare const getChartStyles: (isDark: boolean) => ChartStyles;
@@ -0,0 +1,97 @@
1
+ export declare const getGridLines: ({ isDark, isDesktop, }: {
2
+ isDark: boolean;
3
+ isDesktop: boolean;
4
+ }) => ({
5
+ top: number;
6
+ shape: {
7
+ x1: number;
8
+ y1: number;
9
+ x2: 9999;
10
+ y2: number;
11
+ };
12
+ type: string;
13
+ silent: boolean;
14
+ z: number;
15
+ style: {
16
+ stroke: string;
17
+ lineWidth: number;
18
+ };
19
+ } | {
20
+ right: number;
21
+ shape: {
22
+ x1: number;
23
+ y1: number;
24
+ x2: number;
25
+ y2: number;
26
+ };
27
+ type: string;
28
+ silent: boolean;
29
+ z: number;
30
+ style: {
31
+ stroke: string;
32
+ lineWidth: number;
33
+ };
34
+ } | {
35
+ left: number;
36
+ shape: {
37
+ x1: number;
38
+ y1: number;
39
+ x2: number;
40
+ y2: number;
41
+ };
42
+ type: string;
43
+ silent: boolean;
44
+ z: number;
45
+ style: {
46
+ stroke: string;
47
+ lineWidth: number;
48
+ };
49
+ } | {
50
+ right: number;
51
+ top: number;
52
+ shape: {
53
+ x1: number;
54
+ y1: number;
55
+ x2: number;
56
+ y2: 400;
57
+ };
58
+ type: string;
59
+ silent: boolean;
60
+ z: number;
61
+ style: {
62
+ stroke: string;
63
+ lineWidth: number;
64
+ };
65
+ } | {
66
+ top: number;
67
+ right: number;
68
+ shape: {
69
+ x1: number;
70
+ y1: number;
71
+ x2: number;
72
+ y2: 120;
73
+ };
74
+ type: string;
75
+ silent: boolean;
76
+ z: number;
77
+ style: {
78
+ stroke: string;
79
+ lineWidth: number;
80
+ };
81
+ } | {
82
+ top: number;
83
+ left: number;
84
+ shape: {
85
+ x1: number;
86
+ y1: number;
87
+ x2: number;
88
+ y2: 120;
89
+ };
90
+ type: string;
91
+ silent: boolean;
92
+ z: number;
93
+ style: {
94
+ stroke: string;
95
+ lineWidth: number;
96
+ };
97
+ })[];
@@ -1,7 +1,6 @@
1
- export * from './aggregateBuckets';
2
1
  export * from './chartUtils';
3
- export * from './getTargetBucketWidth';
4
- export * from './processBuckets';
2
+ export * from './getChartStyles';
5
3
  export * from './processOrderPositionBooks';
6
4
  export * from './processPriceCandles';
5
+ export * from './processSentiments';
7
6
  export * from './validateData';
@@ -1,8 +1,11 @@
1
1
  import type { GetOrderPositionBooksQuery } from '../../../../gql/types/graphql';
2
- export declare const processOrderPositionBooks: (orderPositionData: GetOrderPositionBooksQuery | undefined, candleMap: Map<string, {
3
- point?: string;
4
- high?: number;
5
- low?: number;
6
- open?: number;
7
- close?: number;
8
- }>) => [string, number | null, number][];
2
+ import type { Bucket } from '../types';
3
+ export declare const processOrderPositionBooks: (orderPositionData: GetOrderPositionBooksQuery | undefined, dates: string[]) => {
4
+ bookPrices: (number | null)[];
5
+ bookIndexes: number[];
6
+ buckets: Bucket[][];
7
+ bucketWidth: number;
8
+ sentimentThresholdMin: number;
9
+ sentimentThresholdMax: number;
10
+ hasValidBooks: boolean;
11
+ };
@@ -2,26 +2,11 @@ import type { GetPriceCandlesQuery } from '../../../../gql/types/graphql';
2
2
  export declare const processPriceCandles: (priceCandlesData: GetPriceCandlesQuery | undefined) => {
3
3
  minPrice: number;
4
4
  maxPrice: number;
5
+ candlesOpen: number[];
6
+ candlesClose: number[];
7
+ candlesLow: number[];
8
+ candlesHigh: number[];
9
+ dates: string[];
5
10
  hasValidCandles: boolean;
6
- candleMap: Map<any, any>;
7
- candles: never[];
8
- } | {
9
- minPrice: number;
10
- maxPrice: number;
11
- hasValidCandles: boolean;
12
- candleMap: Map<string, {
13
- point?: string;
14
- high?: number;
15
- low?: number;
16
- open?: number;
17
- close?: number;
18
- }>;
19
- candles: ({
20
- __typename?: "Candle";
21
- point: string;
22
- high: number;
23
- low: number;
24
- open: number;
25
- close: number;
26
- } | null)[];
11
+ pipsLocation: number;
27
12
  };
@@ -0,0 +1,6 @@
1
+ import type { GetSentimentsQuery } from '../../../../gql/types/graphql';
2
+ export declare const processSentiments: (sentimentsData: GetSentimentsQuery | undefined, dates: string[]) => {
3
+ sentimentLongs: (number | null)[];
4
+ sentimentShorts: (number | null)[];
5
+ hasValidSentiments: boolean;
6
+ };
@@ -1,2 +1,2 @@
1
1
  import type { GetOrderPositionBooksQuery, GetPriceCandlesQuery } from '../../../../gql/types/graphql';
2
- export declare const validateData: (priceCandlesData: GetPriceCandlesQuery | undefined, orderPositionData: GetOrderPositionBooksQuery | undefined, hasValidCandles: boolean) => Error | null;
2
+ export declare const validateData: (priceCandlesData: GetPriceCandlesQuery | undefined, orderPositionData: GetOrderPositionBooksQuery | undefined, hasValidCandles: boolean, hasValidBooks: boolean, hasValidSentiments: boolean) => Error | null;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { BookType } from '../../../gql/types/graphql';
3
3
  interface LegendProps {
4
- longValues?: [number, number];
5
- shortValues?: [number, number];
4
+ longValues: (number | undefined)[];
5
+ shortValues: (number | undefined)[];
6
6
  bookType: BookType;
7
7
  isDark: boolean;
8
8
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  export type LegendType = 'long' | 'short';
3
3
  interface LegendBarProps {
4
- values: number[];
4
+ values: (number | undefined)[];
5
5
  type: LegendType;
6
6
  label: string;
7
7
  isDark: boolean;
@@ -1,17 +1,15 @@
1
1
  import { InstrumentId } from './types';
2
- export declare const BOOKS_THRESHOLDS: {
3
- readonly MIN: 0.15;
4
- readonly MAX: 0.55;
5
- };
6
2
  export declare const BUCKET_CONFIG: {
7
3
  readonly MULTIPLIER: 4;
8
- readonly PRICE_PADDING_MULTIPLIER: 2;
4
+ readonly PRICE_MARGIN_MULTIPLIER: 2;
9
5
  };
10
6
  export declare const TIME_THRESHOLDS: {
11
7
  readonly TWO_WEEKS_MS: number;
12
8
  };
13
9
  export declare const CHART_CONFIG: {
14
- readonly HEIGHT: 425;
10
+ readonly MAIN_HEIGHT: 400;
11
+ readonly MARGIN_BETWEEN: 50;
12
+ readonly SENTIMENT_HEIGHT: 120;
15
13
  readonly WIDTH: 9999;
16
14
  readonly X_LABEL_SIZE: 40;
17
15
  readonly Y_LABEL_SIZE_DESKTOP: 60;
@@ -19,6 +17,14 @@ export declare const CHART_CONFIG: {
19
17
  readonly INITIAL_START_ZOOM: 80;
20
18
  readonly INITIAL_END_ZOOM: 100;
21
19
  readonly X_AXIS_DATE_PADDING: " ";
20
+ readonly SENTIMENT_MIN: 0;
21
+ readonly SENTIMENT_MAX: 100;
22
+ readonly SENTIMENT_INTERVAL: 25;
23
+ readonly SENTIMENT_TEXT_OFFSET: 16;
24
+ };
25
+ export declare const CHART_CONFIG_CALCULATED: {
26
+ FULL_HEIGHT: number;
27
+ SENTIMENT_TEXT_POSITION: number;
22
28
  };
23
29
  export declare const COLOR_MAP: {
24
30
  readonly dark: {
@@ -0,0 +1,2 @@
1
+ declare const getSentiments: import("@apollo/client").DocumentNode;
2
+ export { getSentiments };
@@ -11,21 +11,28 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
11
11
  * Therefore it is highly recommended to use the babel or swc plugin for production.
12
12
  */
13
13
  declare const documents: {
14
- '\n query GetOrderPositionBooks(\n $instrument: String!\n $bookType: BookType!\n $timeSpan: TimeSpan!\n $granularity: Granularity!\n $maxBookPrice: Float\n $minBookPrice: Float\n ) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n timeSpan: $timeSpan\n granularity: $granularity\n maxBookPrice: $maxBookPrice\n minBookPrice: $minBookPrice\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n sentiment\n }\n }\n }\n': DocumentNode<types.GetOrderPositionBooksQuery, types.Exact<{
14
+ '\n query GetOrderPositionBooks(\n $instrument: String!\n $bookType: BookType!\n $timeSpan: TimeSpan!\n $granularity: Granularity!\n $maxBookPrice: Float\n $minBookPrice: Float\n $bucketMultiplier: Int!\n $bucketMargin: Int!\n ) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n timeSpan: $timeSpan\n granularity: $granularity\n maxBookPrice: $maxBookPrice\n minBookPrice: $minBookPrice\n bucketMultiplier: $bucketMultiplier\n bucketMargin: $bucketMargin\n ) {\n books {\n time\n price\n buckets {\n price\n sentiment\n }\n }\n bucketWidth\n sentimentThresholdMax\n sentimentThresholdMin\n }\n }\n': DocumentNode<types.GetOrderPositionBooksQuery, types.Exact<{
15
15
  instrument: types.Scalars["String"]["input"];
16
16
  bookType: types.BookType;
17
17
  timeSpan: types.TimeSpan;
18
18
  granularity: types.Granularity;
19
19
  maxBookPrice?: types.InputMaybe<types.Scalars["Float"]["input"]>;
20
20
  minBookPrice?: types.InputMaybe<types.Scalars["Float"]["input"]>;
21
+ bucketMultiplier: types.Scalars["Int"]["input"];
22
+ bucketMargin: types.Scalars["Int"]["input"];
21
23
  }>>;
22
- '\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n }\n }\n': DocumentNode<types.GetPriceCandlesQuery, types.Exact<{
24
+ '\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n pipsLocation\n }\n }\n': DocumentNode<types.GetPriceCandlesQuery, types.Exact<{
23
25
  dataSource: types.DataSource;
24
26
  division: types.Division;
25
27
  instrument: types.Scalars["String"]["input"];
26
28
  granularity: types.Granularity;
27
29
  timeSpan: types.TimeSpan;
28
30
  }>>;
31
+ '\n query GetSentiments(\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n sentiments(\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n sentiments {\n sentiment {\n longPercent\n shortPercent\n }\n time\n }\n }\n }\n': DocumentNode<types.GetSentimentsQuery, types.Exact<{
32
+ instrument: types.Scalars["String"]["input"];
33
+ granularity: types.Granularity;
34
+ timeSpan: types.TimeSpan;
35
+ }>>;
29
36
  };
30
37
  /**
31
38
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
@@ -43,10 +50,14 @@ export declare function graphql(source: string): unknown;
43
50
  /**
44
51
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
45
52
  */
46
- export declare function graphql(source: '\n query GetOrderPositionBooks(\n $instrument: String!\n $bookType: BookType!\n $timeSpan: TimeSpan!\n $granularity: Granularity!\n $maxBookPrice: Float\n $minBookPrice: Float\n ) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n timeSpan: $timeSpan\n granularity: $granularity\n maxBookPrice: $maxBookPrice\n minBookPrice: $minBookPrice\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n sentiment\n }\n }\n }\n'): (typeof documents)['\n query GetOrderPositionBooks(\n $instrument: String!\n $bookType: BookType!\n $timeSpan: TimeSpan!\n $granularity: Granularity!\n $maxBookPrice: Float\n $minBookPrice: Float\n ) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n timeSpan: $timeSpan\n granularity: $granularity\n maxBookPrice: $maxBookPrice\n minBookPrice: $minBookPrice\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n sentiment\n }\n }\n }\n'];
53
+ export declare function graphql(source: '\n query GetOrderPositionBooks(\n $instrument: String!\n $bookType: BookType!\n $timeSpan: TimeSpan!\n $granularity: Granularity!\n $maxBookPrice: Float\n $minBookPrice: Float\n $bucketMultiplier: Int!\n $bucketMargin: Int!\n ) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n timeSpan: $timeSpan\n granularity: $granularity\n maxBookPrice: $maxBookPrice\n minBookPrice: $minBookPrice\n bucketMultiplier: $bucketMultiplier\n bucketMargin: $bucketMargin\n ) {\n books {\n time\n price\n buckets {\n price\n sentiment\n }\n }\n bucketWidth\n sentimentThresholdMax\n sentimentThresholdMin\n }\n }\n'): (typeof documents)['\n query GetOrderPositionBooks(\n $instrument: String!\n $bookType: BookType!\n $timeSpan: TimeSpan!\n $granularity: Granularity!\n $maxBookPrice: Float\n $minBookPrice: Float\n $bucketMultiplier: Int!\n $bucketMargin: Int!\n ) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n timeSpan: $timeSpan\n granularity: $granularity\n maxBookPrice: $maxBookPrice\n minBookPrice: $minBookPrice\n bucketMultiplier: $bucketMultiplier\n bucketMargin: $bucketMargin\n ) {\n books {\n time\n price\n buckets {\n price\n sentiment\n }\n }\n bucketWidth\n sentimentThresholdMax\n sentimentThresholdMin\n }\n }\n'];
54
+ /**
55
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
56
+ */
57
+ export declare function graphql(source: '\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n pipsLocation\n }\n }\n'): (typeof documents)['\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n pipsLocation\n }\n }\n'];
47
58
  /**
48
59
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
49
60
  */
50
- export declare function graphql(source: '\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n }\n }\n'): (typeof documents)['\n query GetPriceCandles(\n $dataSource: DataSource!\n $division: Division!\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n priceCandles(\n dataSource: $dataSource\n division: $division\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n candle {\n point\n high\n low\n open\n close\n }\n }\n }\n'];
61
+ export declare function graphql(source: '\n query GetSentiments(\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n sentiments(\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n sentiments {\n sentiment {\n longPercent\n shortPercent\n }\n time\n }\n }\n }\n'): (typeof documents)['\n query GetSentiments(\n $instrument: String!\n $granularity: Granularity!\n $timeSpan: TimeSpan!\n ) {\n sentiments(\n instrument: $instrument\n granularity: $granularity\n timeSpan: $timeSpan\n ) {\n sentiments {\n sentiment {\n longPercent\n shortPercent\n }\n time\n }\n }\n }\n'];
51
62
  export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
52
63
  export {};
@@ -55,6 +55,7 @@ export declare enum AssetClassName {
55
55
  EquityShares = "EQUITY_SHARES",
56
56
  Etfs = "ETFS",
57
57
  Indices = "INDICES",
58
+ Metals = "METALS",
58
59
  Rates = "RATES"
59
60
  }
60
61
  export declare enum BookType {
@@ -201,6 +202,14 @@ export declare enum OrderBookDataSource {
201
202
  Ny4Mt5 = "NY4_MT5",
202
203
  Ty3 = "TY3"
203
204
  }
205
+ export type OrderPositionBooksData = {
206
+ __typename?: 'OrderPositionBooksData';
207
+ books?: Maybe<Array<OrderPositionData>>;
208
+ bucketWidth: Scalars['Float']['output'];
209
+ displayPrecision: Scalars['Int']['output'];
210
+ sentimentThresholdMax: Scalars['Float']['output'];
211
+ sentimentThresholdMin: Scalars['Float']['output'];
212
+ };
204
213
  export type OrderPositionBucket = {
205
214
  __typename?: 'OrderPositionBucket';
206
215
  longCountPercent?: Maybe<Scalars['Float']['output']>;
@@ -230,12 +239,13 @@ export type Query = {
230
239
  mapInstrumentNames?: Maybe<Array<Maybe<Instrument>>>;
231
240
  marginRates?: Maybe<Array<MarginRate>>;
232
241
  orderPositionBook: Array<Maybe<OrderPositionData>>;
233
- orderPositionBooks: Array<Maybe<OrderPositionData>>;
242
+ orderPositionBooks: OrderPositionBooksData;
234
243
  priceCandles: CandlesData;
235
244
  resolveInstrumentsByDivision?: Maybe<Array<Instrument>>;
236
245
  resolveInstrumentsWithFilters?: Maybe<InstrumentTableResult>;
237
246
  sentiment?: Maybe<Array<SentimentInstrument>>;
238
247
  sentimentList?: Maybe<Array<SentimentInstrument>>;
248
+ sentiments: SentimentData;
239
249
  topicalInstruments?: Maybe<Array<TopicalInstrument>>;
240
250
  topicalInstrumentsCharts?: Maybe<Array<TopicalInstrumentChart>>;
241
251
  topicalInstrumentsTotalCount: Scalars['Int']['output'];
@@ -280,6 +290,8 @@ export type QueryOrderPositionBookArgs = {
280
290
  };
281
291
  export type QueryOrderPositionBooksArgs = {
282
292
  bookType: BookType;
293
+ bucketMargin?: Scalars['Int']['input'];
294
+ bucketMultiplier?: Scalars['Int']['input'];
283
295
  granularity: Granularity;
284
296
  instrument: Scalars['String']['input'];
285
297
  maxBookPrice?: InputMaybe<Scalars['Float']['input']>;
@@ -315,6 +327,11 @@ export type QuerySentimentListArgs = {
315
327
  division?: InputMaybe<Division>;
316
328
  sort?: InputMaybe<Sort>;
317
329
  };
330
+ export type QuerySentimentsArgs = {
331
+ granularity: Granularity;
332
+ instrument: Scalars['String']['input'];
333
+ timeSpan: TimeSpan;
334
+ };
318
335
  export type QueryTopicalInstrumentsArgs = {
319
336
  assetClass?: InputMaybe<AssetClassName>;
320
337
  count?: InputMaybe<Scalars['Int']['input']>;
@@ -359,6 +376,10 @@ export type Sentiment = {
359
376
  longPercent: Scalars['Float']['output'];
360
377
  shortPercent: Scalars['Float']['output'];
361
378
  };
379
+ export type SentimentData = {
380
+ __typename?: 'SentimentData';
381
+ sentiments: Array<Maybe<SentimentWithTime>>;
382
+ };
362
383
  export type SentimentInstrument = {
363
384
  __typename?: 'SentimentInstrument';
364
385
  displayName: Scalars['String']['output'];
@@ -366,6 +387,11 @@ export type SentimentInstrument = {
366
387
  sentiment: Sentiment;
367
388
  updatedAt: Scalars['String']['output'];
368
389
  };
390
+ export type SentimentWithTime = {
391
+ __typename?: 'SentimentWithTime';
392
+ sentiment: Sentiment;
393
+ time: Scalars['String']['output'];
394
+ };
369
395
  export declare enum Sort {
370
396
  Bearish = "BEARISH",
371
397
  Bullish = "BULLISH"
@@ -479,20 +505,27 @@ export type GetOrderPositionBooksQueryVariables = Exact<{
479
505
  granularity: Granularity;
480
506
  maxBookPrice?: InputMaybe<Scalars['Float']['input']>;
481
507
  minBookPrice?: InputMaybe<Scalars['Float']['input']>;
508
+ bucketMultiplier: Scalars['Int']['input'];
509
+ bucketMargin: Scalars['Int']['input'];
482
510
  }>;
483
511
  export type GetOrderPositionBooksQuery = {
484
512
  __typename?: 'Query';
485
- orderPositionBooks: Array<{
486
- __typename?: 'OrderPositionData';
513
+ orderPositionBooks: {
514
+ __typename?: 'OrderPositionBooksData';
487
515
  bucketWidth: number;
488
- price?: number | null;
489
- time: string;
490
- buckets: Array<{
491
- __typename?: 'OrderPositionBucket';
492
- price: number;
493
- sentiment?: number | null;
494
- } | null>;
495
- } | null>;
516
+ sentimentThresholdMax: number;
517
+ sentimentThresholdMin: number;
518
+ books?: Array<{
519
+ __typename?: 'OrderPositionData';
520
+ time: string;
521
+ price?: number | null;
522
+ buckets: Array<{
523
+ __typename?: 'OrderPositionBucket';
524
+ price: number;
525
+ sentiment?: number | null;
526
+ } | null>;
527
+ }> | null;
528
+ };
496
529
  };
497
530
  export type GetPriceCandlesQueryVariables = Exact<{
498
531
  dataSource: DataSource;
@@ -505,6 +538,7 @@ export type GetPriceCandlesQuery = {
505
538
  __typename?: 'Query';
506
539
  priceCandles: {
507
540
  __typename?: 'CandlesData';
541
+ pipsLocation: number;
508
542
  candle: Array<{
509
543
  __typename?: 'Candle';
510
544
  point: string;
@@ -515,5 +549,26 @@ export type GetPriceCandlesQuery = {
515
549
  } | null>;
516
550
  };
517
551
  };
552
+ export type GetSentimentsQueryVariables = Exact<{
553
+ instrument: Scalars['String']['input'];
554
+ granularity: Granularity;
555
+ timeSpan: TimeSpan;
556
+ }>;
557
+ export type GetSentimentsQuery = {
558
+ __typename?: 'Query';
559
+ sentiments: {
560
+ __typename?: 'SentimentData';
561
+ sentiments: Array<{
562
+ __typename?: 'SentimentWithTime';
563
+ time: string;
564
+ sentiment: {
565
+ __typename?: 'Sentiment';
566
+ longPercent: number;
567
+ shortPercent: number;
568
+ };
569
+ } | null>;
570
+ };
571
+ };
518
572
  export declare const GetOrderPositionBooksDocument: DocumentNode<GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables>;
519
573
  export declare const GetPriceCandlesDocument: DocumentNode<GetPriceCandlesQuery, GetPriceCandlesQueryVariables>;
574
+ export declare const GetSentimentsDocument: DocumentNode<GetSentimentsQuery, GetSentimentsQueryVariables>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oanda/labs-crowd-view-widget",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "description": "Labs Crowd View 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.233",
16
+ "@oanda/labs-widget-common": "^1.0.235",
17
17
  "@oanda/mono-i18n": "10.0.1",
18
18
  "chroma-js": "^3.1.2",
19
19
  "decimal.js": "^10.6.0",
@@ -24,5 +24,5 @@
24
24
  "@graphql-codegen/client-preset": "4.1.0",
25
25
  "@types/chroma-js": "^3.1.2"
26
26
  },
27
- "gitHead": "b752d4ec60a8f713166f66cd7baad569484bec2f"
27
+ "gitHead": "4ee940ddbff3283e2d6e412b0216df56a4eff346"
28
28
  }
@@ -10,14 +10,14 @@ import React, { useEffect, useMemo, useState } from 'react';
10
10
 
11
11
  import type { Granularity } from '../gql/types/graphql';
12
12
  import { BookType } from '../gql/types/graphql';
13
- import { ChartWithData, Legend } from './components';
13
+ import { ChartWithData } from './components';
14
14
  import { granularitySelectConfig, navigationConfig } from './selectConfig';
15
15
  import type { InstrumentId, MainProps } from './types';
16
16
  import { getInstrumentConfigForDivision } from './utils/instrumentUtils';
17
17
 
18
18
  const Main = ({ division }: MainProps) => {
19
19
  const { lang } = useLocale();
20
- const { size, isDark } = useLayoutProvider();
20
+ const { size } = useLayoutProvider();
21
21
  const isDesktop = size === Size.DESKTOP;
22
22
 
23
23
  const [bookType, setBookType] = useState(BookType.Order);
@@ -107,8 +107,6 @@ const Main = ({ division }: MainProps) => {
107
107
  granularity={granularity.id}
108
108
  instrument={instrument.id}
109
109
  />
110
-
111
- <Legend bookType={bookType} isDark={isDark} />
112
110
  </div>
113
111
  )}
114
112
  </>