@oanda/labs-crowd-view-widget 1.0.68 → 1.0.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +564 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +3 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +9 -6
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -1
- package/dist/main/gql/getSentiments.js +0 -1
- package/dist/main/gql/getSentiments.js.map +1 -1
- package/dist/main/gql/types/gql.js +1 -1
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +0 -6
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/translations/sources/ja.json +20 -19
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +3 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +9 -6
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -1
- package/dist/module/gql/getSentiments.js +0 -1
- package/dist/module/gql/getSentiments.js.map +1 -1
- package/dist/module/gql/types/gql.js +1 -1
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +0 -6
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/translations/sources/ja.json +20 -19
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.d.ts +2 -1
- package/dist/types/gql/types/gql.d.ts +2 -2
- package/dist/types/gql/types/graphql.d.ts +0 -1
- package/package.json +3 -3
- package/src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts +2 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +8 -3
- package/src/CrowdViewWidget/components/Chart/dataUtils/processSentiments.ts +3 -1
- package/src/gql/getSentiments.ts +0 -1
- package/src/gql/types/gql.ts +3 -3
- package/src/gql/types/graphql.ts +1 -9
- package/src/translations/sources/ja.json +20 -19
- package/test/components/Chart/utils/chartUtils.test.ts +4 -0
- package/test/components/Chart/utils/processSentiments.test.ts +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-crowd-view-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.70",
|
|
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.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.252",
|
|
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": "
|
|
27
|
+
"gitHead": "ae201544a004425cf83a3ba9356adbda66f7d0fd"
|
|
28
28
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Locale } from '@oanda/mono-i18n';
|
|
1
2
|
import type { TooltipComponentOption } from 'echarts';
|
|
2
3
|
|
|
3
4
|
import type { BookType } from '../../../../gql/types/graphql';
|
|
@@ -58,6 +59,7 @@ export const getTooltipConfig = ({
|
|
|
58
59
|
isDesktop,
|
|
59
60
|
locale,
|
|
60
61
|
isDark,
|
|
62
|
+
isJapanese: locale === Locale.ja,
|
|
61
63
|
}),
|
|
62
64
|
hideDelay: 0,
|
|
63
65
|
axisPointer: {
|
|
@@ -171,6 +171,7 @@ export const getTooltipFormatter = ({
|
|
|
171
171
|
isDesktop,
|
|
172
172
|
locale,
|
|
173
173
|
isDark,
|
|
174
|
+
isJapanese,
|
|
174
175
|
}: {
|
|
175
176
|
params: TooltipParam[];
|
|
176
177
|
buckets: Bucket[][];
|
|
@@ -183,6 +184,7 @@ export const getTooltipFormatter = ({
|
|
|
183
184
|
isDesktop: boolean;
|
|
184
185
|
locale: string;
|
|
185
186
|
isDark: boolean;
|
|
187
|
+
isJapanese: boolean;
|
|
186
188
|
}) => {
|
|
187
189
|
if (!params || !Array.isArray(params) || params.length === 0) {
|
|
188
190
|
return '';
|
|
@@ -250,6 +252,7 @@ export const getTooltipFormatter = ({
|
|
|
250
252
|
sentimentSection,
|
|
251
253
|
bookSection,
|
|
252
254
|
isDark,
|
|
255
|
+
isJapanese,
|
|
253
256
|
});
|
|
254
257
|
}
|
|
255
258
|
|
|
@@ -274,21 +277,23 @@ const buildDesktopTooltip = ({
|
|
|
274
277
|
sentimentSection,
|
|
275
278
|
bookSection,
|
|
276
279
|
isDark,
|
|
280
|
+
isJapanese,
|
|
277
281
|
}: TooltipSections & {
|
|
278
282
|
isDark: boolean;
|
|
283
|
+
isJapanese: boolean;
|
|
279
284
|
}): string => {
|
|
280
285
|
const backgroundColor = isDark ? colorPalette.black : colorPalette.white;
|
|
281
286
|
const fullWidth = TOOLTIP_STYLES.FULL_WIDTH;
|
|
282
287
|
|
|
283
288
|
return `<div style="width: ${fullWidth}; background-color: ${backgroundColor};">
|
|
284
289
|
<div style="width: ${fullWidth}; display: flex; justify-content: space-between;">
|
|
285
|
-
<div style="width: 40%;">
|
|
290
|
+
<div style="${isJapanese ? 'width: 45%;' : 'width: 40%;'}">
|
|
286
291
|
${candleSection}
|
|
287
292
|
</div>
|
|
288
|
-
<div style="width:
|
|
293
|
+
<div style="${isJapanese ? 'width: 24%;' : 'width: 20%;'}">
|
|
289
294
|
${sentimentSection}
|
|
290
295
|
</div>
|
|
291
|
-
<div style="width:
|
|
296
|
+
<div style="${isJapanese ? 'width: 31%;' : 'width: 40%;'}">
|
|
292
297
|
${bookSection}
|
|
293
298
|
</div>
|
|
294
299
|
</div>
|
|
@@ -21,7 +21,9 @@ export const processSentiments = (
|
|
|
21
21
|
item?.time,
|
|
22
22
|
{
|
|
23
23
|
sentimentShorts: item?.sentiment?.shortPercent ?? null,
|
|
24
|
-
sentimentLongs: item?.sentiment?.
|
|
24
|
+
sentimentLongs: item?.sentiment?.shortPercent
|
|
25
|
+
? 100 - item?.sentiment?.shortPercent
|
|
26
|
+
: null,
|
|
25
27
|
},
|
|
26
28
|
])
|
|
27
29
|
);
|
package/src/gql/getSentiments.ts
CHANGED
package/src/gql/types/gql.ts
CHANGED
|
@@ -17,7 +17,7 @@ const documents = {
|
|
|
17
17
|
types.GetOrderPositionBooksDocument,
|
|
18
18
|
'\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':
|
|
19
19
|
types.GetPriceCandlesDocument,
|
|
20
|
-
'\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
|
|
20
|
+
'\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 shortPercent\n }\n time\n }\n }\n }\n':
|
|
21
21
|
types.GetSentimentsDocument,
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -51,8 +51,8 @@ export function graphql(
|
|
|
51
51
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
52
52
|
*/
|
|
53
53
|
export function graphql(
|
|
54
|
-
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
|
|
55
|
-
): (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
|
|
54
|
+
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 shortPercent\n }\n time\n }\n }\n }\n'
|
|
55
|
+
): (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 shortPercent\n }\n time\n }\n }\n }\n'];
|
|
56
56
|
|
|
57
57
|
export function graphql(source: string) {
|
|
58
58
|
return (documents as any)[source] ?? {};
|
package/src/gql/types/graphql.ts
CHANGED
|
@@ -623,11 +623,7 @@ export type GetSentimentsQuery = {
|
|
|
623
623
|
sentiments: Array<{
|
|
624
624
|
__typename?: 'SentimentWithTime';
|
|
625
625
|
time: string;
|
|
626
|
-
sentiment: {
|
|
627
|
-
__typename?: 'Sentiment';
|
|
628
|
-
longPercent: number;
|
|
629
|
-
shortPercent: number;
|
|
630
|
-
};
|
|
626
|
+
sentiment: { __typename?: 'Sentiment'; shortPercent: number };
|
|
631
627
|
} | null>;
|
|
632
628
|
};
|
|
633
629
|
};
|
|
@@ -1115,10 +1111,6 @@ export const GetSentimentsDocument = {
|
|
|
1115
1111
|
selectionSet: {
|
|
1116
1112
|
kind: 'SelectionSet',
|
|
1117
1113
|
selections: [
|
|
1118
|
-
{
|
|
1119
|
-
kind: 'Field',
|
|
1120
|
-
name: { kind: 'Name', value: 'longPercent' },
|
|
1121
|
-
},
|
|
1122
1114
|
{
|
|
1123
1115
|
kind: 'Field',
|
|
1124
1116
|
name: { kind: 'Name', value: 'shortPercent' },
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
{
|
|
2
|
-
"buy": "
|
|
2
|
+
"buy": "買い",
|
|
3
3
|
"buy_overbalance": "買い超過",
|
|
4
|
-
"candle": "
|
|
5
|
-
"close": "
|
|
4
|
+
"candle": "四本値",
|
|
5
|
+
"close": "終値",
|
|
6
6
|
"data_unavailable": "データが利用できません",
|
|
7
|
-
"even_market_demand": "
|
|
8
|
-
"granularity": "
|
|
7
|
+
"even_market_demand": "売買均衡",
|
|
8
|
+
"granularity": "時間足",
|
|
9
9
|
"high": "高値",
|
|
10
|
+
"hour_0": "{{count}} 時間",
|
|
10
11
|
"hour_plural": "{{count}} 時間",
|
|
11
|
-
"hover_chart_to_see_more_details": "
|
|
12
|
-
"instrument": "
|
|
13
|
-
"long": "
|
|
14
|
-
"long_overbalance": "
|
|
12
|
+
"hover_chart_to_see_more_details": "チャート上にカーソルを合わせると詳細を確認できます",
|
|
13
|
+
"instrument": "銘柄",
|
|
14
|
+
"long": "買い",
|
|
15
|
+
"long_overbalance": "買い超過",
|
|
15
16
|
"low": "安値",
|
|
16
|
-
"open": "
|
|
17
|
-
"order_book": "
|
|
18
|
-
"orders": "
|
|
19
|
-
"position_book": "
|
|
17
|
+
"open": "始値",
|
|
18
|
+
"order_book": "オープンオーダー",
|
|
19
|
+
"orders": "未約定のオーダー",
|
|
20
|
+
"position_book": "オープンポジション",
|
|
20
21
|
"price": "価格",
|
|
21
|
-
"price_range": "
|
|
22
|
+
"price_range": "価格レンジ",
|
|
22
23
|
"search": "検索",
|
|
23
24
|
"sell": "売り",
|
|
24
25
|
"sell_overbalance": "売り超過",
|
|
25
|
-
"sentiment": "
|
|
26
|
-
"short": "
|
|
27
|
-
"short_overbalance": "
|
|
26
|
+
"sentiment": "売買ポジション比率",
|
|
27
|
+
"short": "売り",
|
|
28
|
+
"short_overbalance": "売り超過",
|
|
28
29
|
"tap_chart_to_see_more_details": "チャートをタップすると詳細を確認できます",
|
|
29
|
-
"trades": "
|
|
30
|
-
}
|
|
30
|
+
"trades": "未決済のポジション"
|
|
31
|
+
}
|
|
@@ -257,6 +257,7 @@ describe('chartUtils', () => {
|
|
|
257
257
|
isDesktop: true,
|
|
258
258
|
locale: 'en-US',
|
|
259
259
|
isDark: false,
|
|
260
|
+
isJapanese: false,
|
|
260
261
|
});
|
|
261
262
|
expect(html).toBeDefined();
|
|
262
263
|
expect(html).toContain('candle');
|
|
@@ -298,6 +299,7 @@ describe('chartUtils', () => {
|
|
|
298
299
|
isDesktop: true,
|
|
299
300
|
locale: 'en-US',
|
|
300
301
|
isDark: false,
|
|
302
|
+
isJapanese: false,
|
|
301
303
|
});
|
|
302
304
|
expect(html).toBeDefined();
|
|
303
305
|
expect(html).toContain('candle');
|
|
@@ -331,6 +333,7 @@ describe('chartUtils', () => {
|
|
|
331
333
|
isDesktop: true,
|
|
332
334
|
locale: 'en-US',
|
|
333
335
|
isDark: false,
|
|
336
|
+
isJapanese: false,
|
|
334
337
|
});
|
|
335
338
|
expect(html).toBe('');
|
|
336
339
|
});
|
|
@@ -348,6 +351,7 @@ describe('chartUtils', () => {
|
|
|
348
351
|
isDesktop: true,
|
|
349
352
|
locale: 'en-US',
|
|
350
353
|
isDark: false,
|
|
354
|
+
isJapanese: false,
|
|
351
355
|
});
|
|
352
356
|
expect(html).toBe('');
|
|
353
357
|
});
|
|
@@ -52,14 +52,12 @@ describe('processSentiments', () => {
|
|
|
52
52
|
time: '2025-03-15T10:30:00Z',
|
|
53
53
|
sentiment: {
|
|
54
54
|
shortPercent: 30.5,
|
|
55
|
-
longPercent: 69.5,
|
|
56
55
|
},
|
|
57
56
|
},
|
|
58
57
|
{
|
|
59
58
|
time: '2025-03-15T11:30:00Z',
|
|
60
59
|
sentiment: {
|
|
61
60
|
shortPercent: 40.2,
|
|
62
|
-
longPercent: 59.8,
|
|
63
61
|
},
|
|
64
62
|
},
|
|
65
63
|
],
|
|
@@ -81,14 +79,12 @@ describe('processSentiments', () => {
|
|
|
81
79
|
time: '2025-03-15T10:30:00Z',
|
|
82
80
|
sentiment: {
|
|
83
81
|
shortPercent: 30.5,
|
|
84
|
-
longPercent: 69.5,
|
|
85
82
|
},
|
|
86
83
|
},
|
|
87
84
|
{
|
|
88
85
|
time: '2025-03-15T12:30:00Z', // Not in dates
|
|
89
86
|
sentiment: {
|
|
90
87
|
shortPercent: 50.0,
|
|
91
|
-
longPercent: 50.0,
|
|
92
88
|
},
|
|
93
89
|
},
|
|
94
90
|
],
|
|
@@ -109,7 +105,6 @@ describe('processSentiments', () => {
|
|
|
109
105
|
time: '2025-03-15T11:30:00Z',
|
|
110
106
|
sentiment: {
|
|
111
107
|
shortPercent: 30.5,
|
|
112
|
-
longPercent: 69.5,
|
|
113
108
|
},
|
|
114
109
|
},
|
|
115
110
|
],
|
|
@@ -135,14 +130,12 @@ describe('processSentiments', () => {
|
|
|
135
130
|
time: '2025-03-15T10:30:00Z',
|
|
136
131
|
sentiment: {
|
|
137
132
|
shortPercent: 30.5,
|
|
138
|
-
longPercent: 69.5,
|
|
139
133
|
},
|
|
140
134
|
},
|
|
141
135
|
{
|
|
142
136
|
time: '2025-03-15T12:30:00Z',
|
|
143
137
|
sentiment: {
|
|
144
138
|
shortPercent: 25.0,
|
|
145
|
-
longPercent: 75.0,
|
|
146
139
|
},
|
|
147
140
|
},
|
|
148
141
|
],
|
|
@@ -181,7 +174,6 @@ describe('processSentiments', () => {
|
|
|
181
174
|
time: '2025-03-15T10:30:00Z',
|
|
182
175
|
sentiment: {
|
|
183
176
|
shortPercent: undefined as never,
|
|
184
|
-
longPercent: undefined as never,
|
|
185
177
|
},
|
|
186
178
|
},
|
|
187
179
|
],
|
|
@@ -201,7 +193,6 @@ describe('processSentiments', () => {
|
|
|
201
193
|
time: '2025-03-15T10:30:00Z',
|
|
202
194
|
sentiment: {
|
|
203
195
|
shortPercent: 30.5,
|
|
204
|
-
longPercent: 69.5,
|
|
205
196
|
},
|
|
206
197
|
},
|
|
207
198
|
],
|
|
@@ -224,7 +215,6 @@ describe('processSentiments', () => {
|
|
|
224
215
|
time: '2025-03-15T10:30:00Z',
|
|
225
216
|
sentiment: {
|
|
226
217
|
shortPercent: 30.5,
|
|
227
|
-
longPercent: 69.5,
|
|
228
218
|
},
|
|
229
219
|
},
|
|
230
220
|
],
|