@oanda/labs-crowd-view-widget 1.0.19 → 1.0.21
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 +172 -0
- package/dist/main/CrowdViewWidget/Main.js +4 -1
- package/dist/main/CrowdViewWidget/Main.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js +45 -0
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +67 -0
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/constants.js +11 -0
- package/dist/main/CrowdViewWidget/components/Chart/constants.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js +142 -0
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/index.js +28 -0
- package/dist/main/CrowdViewWidget/components/Chart/index.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/types.js +6 -0
- package/dist/main/CrowdViewWidget/components/Chart/types.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/utils.js +65 -0
- package/dist/main/CrowdViewWidget/components/Chart/utils.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +3 -6
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/index.js +11 -0
- package/dist/main/CrowdViewWidget/components/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/config.js +5 -1
- package/dist/main/CrowdViewWidget/config.js.map +1 -1
- package/dist/main/CrowdViewWidget/types.js.map +1 -1
- package/dist/main/gql/getOrderPositionBooks.js +30 -0
- package/dist/main/gql/getOrderPositionBooks.js.map +1 -0
- package/dist/main/gql/types/gql.js +1 -0
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +172 -1
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/module/CrowdViewWidget/Main.js +6 -3
- package/dist/module/CrowdViewWidget/Main.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js +37 -0
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +58 -0
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/constants.js +5 -0
- package/dist/module/CrowdViewWidget/components/Chart/constants.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js +132 -0
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/index.js +3 -0
- package/dist/module/CrowdViewWidget/components/Chart/index.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/types.js +2 -0
- package/dist/module/CrowdViewWidget/components/Chart/types.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/utils.js +57 -0
- package/dist/module/CrowdViewWidget/components/Chart/utils.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +2 -5
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/index.js +1 -0
- package/dist/module/CrowdViewWidget/components/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/config.js +4 -0
- package/dist/module/CrowdViewWidget/config.js.map +1 -1
- package/dist/module/CrowdViewWidget/types.js.map +1 -1
- package/dist/module/gql/getOrderPositionBooks.js +25 -0
- package/dist/module/gql/getOrderPositionBooks.js.map +1 -0
- package/dist/module/gql/types/gql.js +1 -0
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +171 -0
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/Chart.d.ts +4 -0
- package/dist/types/CrowdViewWidget/components/Chart/ChartWithData.d.ts +4 -0
- package/dist/types/CrowdViewWidget/components/Chart/constants.d.ts +4 -0
- package/dist/types/CrowdViewWidget/components/Chart/getOption.d.ts +115 -0
- package/dist/types/CrowdViewWidget/components/Chart/index.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +25 -0
- package/dist/types/CrowdViewWidget/components/Chart/utils.d.ts +3 -0
- package/dist/types/CrowdViewWidget/components/Legend/LegendBar.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/index.d.ts +1 -0
- package/dist/types/CrowdViewWidget/config.d.ts +2 -0
- package/dist/types/CrowdViewWidget/types.d.ts +10 -0
- package/dist/types/gql/getOrderPositionBooks.d.ts +2 -0
- package/dist/types/gql/types/gql.d.ts +9 -0
- package/dist/types/gql/types/graphql.d.ts +40 -0
- package/package.json +3 -3
- package/src/CrowdViewWidget/Main.tsx +4 -3
- package/src/CrowdViewWidget/components/Chart/Chart.tsx +59 -0
- package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +88 -0
- package/src/CrowdViewWidget/components/Chart/constants.tsx +4 -0
- package/src/CrowdViewWidget/components/Chart/getOption.ts +159 -0
- package/src/CrowdViewWidget/components/Chart/index.ts +2 -0
- package/src/CrowdViewWidget/components/Chart/types.ts +36 -0
- package/src/CrowdViewWidget/components/Chart/utils.ts +77 -0
- package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +4 -10
- package/src/CrowdViewWidget/components/index.ts +1 -0
- package/src/CrowdViewWidget/config.ts +5 -0
- package/src/CrowdViewWidget/types.ts +11 -0
- package/src/gql/getOrderPositionBooks.ts +26 -0
- package/src/gql/types/gql.ts +8 -0
- package/src/gql/types/graphql.ts +156 -0
- package/test/Main.test.tsx +55 -4
package/src/gql/types/graphql.ts
CHANGED
|
@@ -150,6 +150,17 @@ export type InstrumentCorrelation = {
|
|
|
150
150
|
value?: Maybe<Scalars['Float']['output']>;
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
+
export enum InstrumentDataSource {
|
|
154
|
+
Mt5 = 'MT5',
|
|
155
|
+
V20 = 'V20',
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type InstrumentTableResult = {
|
|
159
|
+
__typename?: 'InstrumentTableResult';
|
|
160
|
+
instruments: Array<Instrument>;
|
|
161
|
+
totalCount: Scalars['Int']['output'];
|
|
162
|
+
};
|
|
163
|
+
|
|
153
164
|
export type Matrix = {
|
|
154
165
|
__typename?: 'Matrix';
|
|
155
166
|
instrument: Instrument;
|
|
@@ -186,6 +197,7 @@ export type Query = {
|
|
|
186
197
|
mapInstrumentNames?: Maybe<Array<Maybe<Instrument>>>;
|
|
187
198
|
orderPositionBooks: Array<Maybe<OrderPositionData>>;
|
|
188
199
|
resolveInstrumentsByDivision?: Maybe<Array<Instrument>>;
|
|
200
|
+
resolveInstrumentsWithFilters?: Maybe<InstrumentTableResult>;
|
|
189
201
|
sentiment?: Maybe<Array<SentimentInstrument>>;
|
|
190
202
|
sentimentList?: Maybe<Array<SentimentInstrument>>;
|
|
191
203
|
topicalInstruments?: Maybe<Array<TopicalInstrument>>;
|
|
@@ -238,6 +250,16 @@ export type QueryResolveInstrumentsByDivisionArgs = {
|
|
|
238
250
|
instruments: Array<InputMaybe<Scalars['String']['input']>>;
|
|
239
251
|
};
|
|
240
252
|
|
|
253
|
+
export type QueryResolveInstrumentsWithFiltersArgs = {
|
|
254
|
+
assetClass?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
|
|
255
|
+
count?: InputMaybe<Scalars['Int']['input']>;
|
|
256
|
+
dataSource?: InputMaybe<InstrumentDataSource>;
|
|
257
|
+
division: Division;
|
|
258
|
+
instruments?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
|
|
259
|
+
offset?: InputMaybe<Scalars['Int']['input']>;
|
|
260
|
+
searchPattern?: InputMaybe<Scalars['String']['input']>;
|
|
261
|
+
};
|
|
262
|
+
|
|
241
263
|
export type QuerySentimentArgs = {
|
|
242
264
|
division?: InputMaybe<Division>;
|
|
243
265
|
name: Scalars['String']['input'];
|
|
@@ -414,6 +436,28 @@ export enum VolatilityChartTimeUnit {
|
|
|
414
436
|
W = 'W',
|
|
415
437
|
}
|
|
416
438
|
|
|
439
|
+
export type GetOrderPositionBooksQueryVariables = Exact<{
|
|
440
|
+
instrument: Scalars['String']['input'];
|
|
441
|
+
bookType: BookType;
|
|
442
|
+
recentHours?: InputMaybe<Scalars['Int']['input']>;
|
|
443
|
+
}>;
|
|
444
|
+
|
|
445
|
+
export type GetOrderPositionBooksQuery = {
|
|
446
|
+
__typename?: 'Query';
|
|
447
|
+
orderPositionBooks: Array<{
|
|
448
|
+
__typename?: 'OrderPositionData';
|
|
449
|
+
bucketWidth: number;
|
|
450
|
+
price?: number | null;
|
|
451
|
+
time: string;
|
|
452
|
+
buckets: Array<{
|
|
453
|
+
__typename?: 'OrderPositionBucket';
|
|
454
|
+
price: number;
|
|
455
|
+
longCountPercent: number;
|
|
456
|
+
shortCountPercent: number;
|
|
457
|
+
} | null>;
|
|
458
|
+
} | null>;
|
|
459
|
+
};
|
|
460
|
+
|
|
417
461
|
export type ValidateInstrumentsQueryVariables = Exact<{
|
|
418
462
|
instruments:
|
|
419
463
|
| Array<InputMaybe<Scalars['String']['input']>>
|
|
@@ -430,6 +474,118 @@ export type ValidateInstrumentsQuery = {
|
|
|
430
474
|
} | null> | null;
|
|
431
475
|
};
|
|
432
476
|
|
|
477
|
+
export const GetOrderPositionBooksDocument = {
|
|
478
|
+
kind: 'Document',
|
|
479
|
+
definitions: [
|
|
480
|
+
{
|
|
481
|
+
kind: 'OperationDefinition',
|
|
482
|
+
operation: 'query',
|
|
483
|
+
name: { kind: 'Name', value: 'GetOrderPositionBooks' },
|
|
484
|
+
variableDefinitions: [
|
|
485
|
+
{
|
|
486
|
+
kind: 'VariableDefinition',
|
|
487
|
+
variable: {
|
|
488
|
+
kind: 'Variable',
|
|
489
|
+
name: { kind: 'Name', value: 'instrument' },
|
|
490
|
+
},
|
|
491
|
+
type: {
|
|
492
|
+
kind: 'NonNullType',
|
|
493
|
+
type: {
|
|
494
|
+
kind: 'NamedType',
|
|
495
|
+
name: { kind: 'Name', value: 'String' },
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
kind: 'VariableDefinition',
|
|
501
|
+
variable: {
|
|
502
|
+
kind: 'Variable',
|
|
503
|
+
name: { kind: 'Name', value: 'bookType' },
|
|
504
|
+
},
|
|
505
|
+
type: {
|
|
506
|
+
kind: 'NonNullType',
|
|
507
|
+
type: {
|
|
508
|
+
kind: 'NamedType',
|
|
509
|
+
name: { kind: 'Name', value: 'BookType' },
|
|
510
|
+
},
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
kind: 'VariableDefinition',
|
|
515
|
+
variable: {
|
|
516
|
+
kind: 'Variable',
|
|
517
|
+
name: { kind: 'Name', value: 'recentHours' },
|
|
518
|
+
},
|
|
519
|
+
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Int' } },
|
|
520
|
+
},
|
|
521
|
+
],
|
|
522
|
+
selectionSet: {
|
|
523
|
+
kind: 'SelectionSet',
|
|
524
|
+
selections: [
|
|
525
|
+
{
|
|
526
|
+
kind: 'Field',
|
|
527
|
+
name: { kind: 'Name', value: 'orderPositionBooks' },
|
|
528
|
+
arguments: [
|
|
529
|
+
{
|
|
530
|
+
kind: 'Argument',
|
|
531
|
+
name: { kind: 'Name', value: 'instrument' },
|
|
532
|
+
value: {
|
|
533
|
+
kind: 'Variable',
|
|
534
|
+
name: { kind: 'Name', value: 'instrument' },
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
kind: 'Argument',
|
|
539
|
+
name: { kind: 'Name', value: 'bookType' },
|
|
540
|
+
value: {
|
|
541
|
+
kind: 'Variable',
|
|
542
|
+
name: { kind: 'Name', value: 'bookType' },
|
|
543
|
+
},
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
kind: 'Argument',
|
|
547
|
+
name: { kind: 'Name', value: 'recentHours' },
|
|
548
|
+
value: {
|
|
549
|
+
kind: 'Variable',
|
|
550
|
+
name: { kind: 'Name', value: 'recentHours' },
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
],
|
|
554
|
+
selectionSet: {
|
|
555
|
+
kind: 'SelectionSet',
|
|
556
|
+
selections: [
|
|
557
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'bucketWidth' } },
|
|
558
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'price' } },
|
|
559
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'time' } },
|
|
560
|
+
{
|
|
561
|
+
kind: 'Field',
|
|
562
|
+
name: { kind: 'Name', value: 'buckets' },
|
|
563
|
+
selectionSet: {
|
|
564
|
+
kind: 'SelectionSet',
|
|
565
|
+
selections: [
|
|
566
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'price' } },
|
|
567
|
+
{
|
|
568
|
+
kind: 'Field',
|
|
569
|
+
name: { kind: 'Name', value: 'longCountPercent' },
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
kind: 'Field',
|
|
573
|
+
name: { kind: 'Name', value: 'shortCountPercent' },
|
|
574
|
+
},
|
|
575
|
+
],
|
|
576
|
+
},
|
|
577
|
+
},
|
|
578
|
+
],
|
|
579
|
+
},
|
|
580
|
+
},
|
|
581
|
+
],
|
|
582
|
+
},
|
|
583
|
+
},
|
|
584
|
+
],
|
|
585
|
+
} as unknown as DocumentNode<
|
|
586
|
+
GetOrderPositionBooksQuery,
|
|
587
|
+
GetOrderPositionBooksQueryVariables
|
|
588
|
+
>;
|
|
433
589
|
export const ValidateInstrumentsDocument = {
|
|
434
590
|
kind: 'Document',
|
|
435
591
|
definitions: [
|
package/test/Main.test.tsx
CHANGED
|
@@ -1,19 +1,70 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
|
+
import { MockedProvider } from '@apollo/client/testing';
|
|
4
5
|
import { MockLayoutProvider } from '@oanda/labs-widget-common';
|
|
5
6
|
import { render } from '@testing-library/react';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
|
|
9
|
+
import { InstrumentId } from '../src';
|
|
8
10
|
import { Main } from '../src/CrowdViewWidget/Main';
|
|
9
|
-
import {
|
|
11
|
+
import { getOrderPositionBooks } from '../src/gql/getOrderPositionBooks';
|
|
12
|
+
import { BookType, Division } from '../src/gql/types/graphql';
|
|
13
|
+
|
|
14
|
+
const mocks = [
|
|
15
|
+
{
|
|
16
|
+
request: {
|
|
17
|
+
query: getOrderPositionBooks,
|
|
18
|
+
variables: {
|
|
19
|
+
instrument: InstrumentId.EUR_AUD,
|
|
20
|
+
bookType: BookType.Order,
|
|
21
|
+
recentHours: 1,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
result: {
|
|
25
|
+
data: {
|
|
26
|
+
orderPositionBooks: [
|
|
27
|
+
{
|
|
28
|
+
bucketWidth: 0.0005,
|
|
29
|
+
price: 0.8,
|
|
30
|
+
time: '2024-02-21T10:30:00Z',
|
|
31
|
+
buckets: [
|
|
32
|
+
{
|
|
33
|
+
price: 0.02,
|
|
34
|
+
longCountPercent: 0.0582,
|
|
35
|
+
shortCountPercent: 0.0,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
price: 0.7,
|
|
39
|
+
longCountPercent: 0.0582,
|
|
40
|
+
shortCountPercent: 0.0,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
price: 0.9925,
|
|
44
|
+
longCountPercent: 0.0582,
|
|
45
|
+
shortCountPercent: 0.0,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
price: 1.0,
|
|
49
|
+
longCountPercent: 0.1163,
|
|
50
|
+
shortCountPercent: 0.0,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
];
|
|
10
59
|
|
|
11
60
|
describe('Main component', () => {
|
|
12
61
|
it('should render widget', async () => {
|
|
13
62
|
const { findByTestId } = render(
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
63
|
+
<MockedProvider mocks={mocks}>
|
|
64
|
+
<MockLayoutProvider>
|
|
65
|
+
<Main division={Division.Oap} />
|
|
66
|
+
</MockLayoutProvider>
|
|
67
|
+
</MockedProvider>
|
|
17
68
|
);
|
|
18
69
|
|
|
19
70
|
expect(await findByTestId('crowd-view-widget')).toBeInTheDocument();
|