@oanda/labs-currency-power-balance-widget 1.0.1
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 +8 -0
- package/codegen.ts +15 -0
- package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js +46 -0
- package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +28 -0
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/Main.js +12 -0
- package/dist/main/CurrencyPowerBalanceWidget/Main.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/Tool.js +28 -0
- package/dist/main/CurrencyPowerBalanceWidget/Tool.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +45 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/index.js +17 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/index.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +31 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +59 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +103 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js +36 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/index.js +28 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/index.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/types.js +6 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/types.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/types.js +6 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +53 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +46 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.js +17 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js +6 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/config.js +39 -0
- package/dist/main/CurrencyPowerBalanceWidget/config.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/constants.js +8 -0
- package/dist/main/CurrencyPowerBalanceWidget/constants.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/index.js +17 -0
- package/dist/main/CurrencyPowerBalanceWidget/index.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/render.js +28 -0
- package/dist/main/CurrencyPowerBalanceWidget/render.js.map +1 -0
- package/dist/main/CurrencyPowerBalanceWidget/types.js +6 -0
- package/dist/main/CurrencyPowerBalanceWidget/types.js.map +1 -0
- package/dist/main/gql/getCurrencyPowerBalance.js +11 -0
- package/dist/main/gql/getCurrencyPowerBalance.js.map +1 -0
- package/dist/main/gql/types/fragment-masking.js +24 -0
- package/dist/main/gql/types/fragment-masking.js.map +1 -0
- package/dist/main/gql/types/gql.js +17 -0
- package/dist/main/gql/types/gql.js.map +1 -0
- package/dist/main/gql/types/graphql.js +171 -0
- package/dist/main/gql/types/graphql.js.map +1 -0
- package/dist/main/gql/types/index.js +28 -0
- package/dist/main/gql/types/index.js.map +1 -0
- package/dist/main/index.js +17 -0
- package/dist/main/index.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +39 -0
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +21 -0
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/Main.js +5 -0
- package/dist/module/CurrencyPowerBalanceWidget/Main.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/Tool.js +20 -0
- package/dist/module/CurrencyPowerBalanceWidget/Tool.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +36 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/index.js +2 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/index.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +26 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +52 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +97 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js +30 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/index.js +3 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/index.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/types.js +2 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/types.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/types.js +2 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +46 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +39 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.js +2 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js +2 -0
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/config.js +34 -0
- package/dist/module/CurrencyPowerBalanceWidget/config.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/constants.js +2 -0
- package/dist/module/CurrencyPowerBalanceWidget/constants.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/index.js +2 -0
- package/dist/module/CurrencyPowerBalanceWidget/index.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/render.js +25 -0
- package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/types.js +2 -0
- package/dist/module/CurrencyPowerBalanceWidget/types.js.map +1 -0
- package/dist/module/gql/getCurrencyPowerBalance.js +5 -0
- package/dist/module/gql/getCurrencyPowerBalance.js.map +1 -0
- package/dist/module/gql/types/fragment-masking.js +16 -0
- package/dist/module/gql/types/fragment-masking.js.map +1 -0
- package/dist/module/gql/types/gql.js +9 -0
- package/dist/module/gql/types/gql.js.map +1 -0
- package/dist/module/gql/types/graphql.js +165 -0
- package/dist/module/gql/types/graphql.js.map +1 -0
- package/dist/module/gql/types/index.js +3 -0
- package/dist/module/gql/types/index.js.map +1 -0
- package/dist/module/index.js +2 -0
- package/dist/module/index.js.map +1 -0
- package/dist/types/CurrencyPowerBalanceWidget/ChartWithData.d.ts +4 -0
- package/dist/types/CurrencyPowerBalanceWidget/CurrencyPowerBalance.d.ts +4 -0
- package/dist/types/CurrencyPowerBalanceWidget/Main.d.ts +3 -0
- package/dist/types/CurrencyPowerBalanceWidget/Tool.d.ts +3 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/Chart.d.ts +4 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/index.d.ts +1 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/constants.d.ts +24 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/formatters.d.ts +5 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getOption.d.ts +74 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.d.ts +110 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/index.d.ts +2 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/types.d.ts +5 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/types.d.ts +5 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.d.ts +4 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.d.ts +4 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.d.ts +1 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.d.ts +12 -0
- package/dist/types/CurrencyPowerBalanceWidget/config.d.ts +11 -0
- package/dist/types/CurrencyPowerBalanceWidget/constants.d.ts +1 -0
- package/dist/types/CurrencyPowerBalanceWidget/index.d.ts +1 -0
- package/dist/types/CurrencyPowerBalanceWidget/render.d.ts +1 -0
- package/dist/types/CurrencyPowerBalanceWidget/types.d.ts +12 -0
- package/dist/types/gql/getCurrencyPowerBalance.d.ts +1 -0
- package/dist/types/gql/types/fragment-masking.d.ts +15 -0
- package/dist/types/gql/types/gql.d.ts +36 -0
- package/dist/types/gql/types/graphql.d.ts +274 -0
- package/dist/types/gql/types/index.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/index.ts +1 -0
- package/package.json +27 -0
- package/src/CurrencyPowerBalanceWidget/ChartWithData.tsx +48 -0
- package/src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx +24 -0
- package/src/CurrencyPowerBalanceWidget/Main.tsx +10 -0
- package/src/CurrencyPowerBalanceWidget/Tool.tsx +27 -0
- package/src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx +45 -0
- package/src/CurrencyPowerBalanceWidget/components/Chart/index.ts +1 -0
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/constants.tsx +41 -0
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts +46 -0
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts +82 -0
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts +45 -0
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/index.ts +2 -0
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/types.ts +5 -0
- package/src/CurrencyPowerBalanceWidget/components/Chart/types.ts +6 -0
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx +24 -0
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx +58 -0
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.ts +1 -0
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.ts +14 -0
- package/src/CurrencyPowerBalanceWidget/config.ts +30 -0
- package/src/CurrencyPowerBalanceWidget/constants.ts +1 -0
- package/src/CurrencyPowerBalanceWidget/index.ts +1 -0
- package/src/CurrencyPowerBalanceWidget/render.tsx +36 -0
- package/src/CurrencyPowerBalanceWidget/types.ts +15 -0
- package/src/gql/getCurrencyPowerBalance.ts +13 -0
- package/src/gql/types/fragment-masking.ts +66 -0
- package/src/gql/types/gql.ts +42 -0
- package/src/gql/types/graphql.ts +283 -0
- package/src/gql/types/index.ts +2 -0
- package/src/index.ts +1 -0
- package/test/Main.test.tsx +29 -0
- package/test/chartFormatters.test.ts +59 -0
- package/test/responsesMocks.ts +223 -0
- package/tsconfig.types.json +12 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
3
|
+
export type Maybe<T> = T | null;
|
|
4
|
+
export type InputMaybe<T> = Maybe<T>;
|
|
5
|
+
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
|
6
|
+
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
|
7
|
+
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
|
8
|
+
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
|
|
9
|
+
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
|
|
10
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
11
|
+
export type Scalars = {
|
|
12
|
+
ID: { input: string; output: string; }
|
|
13
|
+
String: { input: string; output: string; }
|
|
14
|
+
Boolean: { input: boolean; output: boolean; }
|
|
15
|
+
Int: { input: number; output: number; }
|
|
16
|
+
Float: { input: number; output: number; }
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type AssetClass = {
|
|
20
|
+
__typename?: 'AssetClass';
|
|
21
|
+
instruments?: Maybe<Array<Maybe<Instrument>>>;
|
|
22
|
+
name?: Maybe<Scalars['String']['output']>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export enum BookType {
|
|
26
|
+
Order = 'ORDER',
|
|
27
|
+
Position = 'POSITION'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export enum CurrencyName {
|
|
31
|
+
Aud = 'AUD',
|
|
32
|
+
Cad = 'CAD',
|
|
33
|
+
Chf = 'CHF',
|
|
34
|
+
Eur = 'EUR',
|
|
35
|
+
Gbp = 'GBP',
|
|
36
|
+
Jpy = 'JPY',
|
|
37
|
+
Nzd = 'NZD',
|
|
38
|
+
Usd = 'USD'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type CurrencyPower = {
|
|
42
|
+
__typename?: 'CurrencyPower';
|
|
43
|
+
/** UTC Timestamp */
|
|
44
|
+
point: Scalars['String']['output'];
|
|
45
|
+
price: Scalars['Float']['output'];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type CurrencyPowerBalance = {
|
|
49
|
+
__typename?: 'CurrencyPowerBalance';
|
|
50
|
+
currency: CurrencyName;
|
|
51
|
+
power: Array<CurrencyPower>;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export enum CurrencyPowerBalanceTimeUnit {
|
|
55
|
+
CurrentDay = 'CURRENT_DAY',
|
|
56
|
+
H4 = 'H4',
|
|
57
|
+
H8 = 'H8',
|
|
58
|
+
H24 = 'H24',
|
|
59
|
+
M1 = 'M1',
|
|
60
|
+
M3 = 'M3',
|
|
61
|
+
PreviousDay = 'PREVIOUS_DAY',
|
|
62
|
+
W1 = 'W1'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export enum DataSource {
|
|
66
|
+
Ny4 = 'NY4',
|
|
67
|
+
Ty3 = 'TY3'
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export enum Division {
|
|
71
|
+
Oap = 'OAP',
|
|
72
|
+
Oau = 'OAU',
|
|
73
|
+
Oc = 'OC',
|
|
74
|
+
Ocan = 'OCAN',
|
|
75
|
+
Oel = 'OEL',
|
|
76
|
+
Ogm = 'OGM',
|
|
77
|
+
Oj = 'OJ',
|
|
78
|
+
Otms = 'OTMS'
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type Instrument = {
|
|
82
|
+
__typename?: 'Instrument';
|
|
83
|
+
displayName?: Maybe<Scalars['String']['output']>;
|
|
84
|
+
name?: Maybe<Scalars['String']['output']>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type OrderPositionBucket = {
|
|
88
|
+
__typename?: 'OrderPositionBucket';
|
|
89
|
+
longCountPercent: Scalars['Float']['output'];
|
|
90
|
+
price: Scalars['Float']['output'];
|
|
91
|
+
shortCountPercent: Scalars['Float']['output'];
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type OrderPositionData = {
|
|
95
|
+
__typename?: 'OrderPositionData';
|
|
96
|
+
bucketWidth: Scalars['Float']['output'];
|
|
97
|
+
buckets: Array<Maybe<OrderPositionBucket>>;
|
|
98
|
+
dataSource?: Maybe<Scalars['String']['output']>;
|
|
99
|
+
instrument: Scalars['String']['output'];
|
|
100
|
+
price: Scalars['Float']['output'];
|
|
101
|
+
region?: Maybe<Scalars['String']['output']>;
|
|
102
|
+
time: Scalars['String']['output'];
|
|
103
|
+
unixTime: Scalars['Int']['output'];
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type Query = {
|
|
107
|
+
__typename?: 'Query';
|
|
108
|
+
assetClasses?: Maybe<Array<Maybe<AssetClass>>>;
|
|
109
|
+
currencyPowerBalance?: Maybe<Array<CurrencyPowerBalance>>;
|
|
110
|
+
orderPositionBooks: Array<Maybe<OrderPositionData>>;
|
|
111
|
+
sentiment?: Maybe<Array<SentimentInstrument>>;
|
|
112
|
+
sentimentList?: Maybe<Array<SentimentInstrument>>;
|
|
113
|
+
topicalInstruments?: Maybe<Array<TopicalInstrument>>;
|
|
114
|
+
topicalInstrumentsCharts?: Maybe<Array<TopicalInstrumentChart>>;
|
|
115
|
+
topicalInstrumentsTotalCount: Scalars['Int']['output'];
|
|
116
|
+
volatilityChart?: Maybe<Array<Maybe<VolatilityChart>>>;
|
|
117
|
+
volatilityChartAssetClasses?: Maybe<Array<VolatilityChartAssetClass>>;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
export type QueryAssetClassesArgs = {
|
|
122
|
+
division: Division;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
export type QueryCurrencyPowerBalanceArgs = {
|
|
127
|
+
timeUnit: CurrencyPowerBalanceTimeUnit;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
export type QueryOrderPositionBooksArgs = {
|
|
132
|
+
bookType: BookType;
|
|
133
|
+
dataSource?: InputMaybe<DataSource>;
|
|
134
|
+
instrument: Scalars['String']['input'];
|
|
135
|
+
recentHours?: InputMaybe<Scalars['Int']['input']>;
|
|
136
|
+
region?: InputMaybe<Region>;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
export type QuerySentimentArgs = {
|
|
141
|
+
division?: InputMaybe<Division>;
|
|
142
|
+
name: Scalars['String']['input'];
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
export type QuerySentimentListArgs = {
|
|
147
|
+
division?: InputMaybe<Division>;
|
|
148
|
+
sort?: InputMaybe<Sort>;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
export type QueryTopicalInstrumentsArgs = {
|
|
153
|
+
count?: InputMaybe<Scalars['Int']['input']>;
|
|
154
|
+
division?: InputMaybe<Division>;
|
|
155
|
+
offset?: InputMaybe<Scalars['Int']['input']>;
|
|
156
|
+
sort: TopicalSort;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
export type QueryTopicalInstrumentsChartsArgs = {
|
|
161
|
+
division?: InputMaybe<Division>;
|
|
162
|
+
instruments?: InputMaybe<Array<Scalars['String']['input']>>;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
export type QueryTopicalInstrumentsTotalCountArgs = {
|
|
167
|
+
division?: InputMaybe<Division>;
|
|
168
|
+
sort: TopicalSort;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
export type QueryVolatilityChartArgs = {
|
|
173
|
+
division?: InputMaybe<Division>;
|
|
174
|
+
instrument: Scalars['String']['input'];
|
|
175
|
+
timeSpan: VolatilityChartTimeSpan;
|
|
176
|
+
timeUnit: VolatilityChartTimeUnit;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
export type QueryVolatilityChartAssetClassesArgs = {
|
|
181
|
+
division?: InputMaybe<Division>;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export enum Region {
|
|
185
|
+
Amer = 'AMER',
|
|
186
|
+
Apac = 'APAC',
|
|
187
|
+
Emea = 'EMEA'
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export type Sentiment = {
|
|
191
|
+
__typename?: 'Sentiment';
|
|
192
|
+
longPercent: Scalars['Float']['output'];
|
|
193
|
+
shortPercent: Scalars['Float']['output'];
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export type SentimentInstrument = {
|
|
197
|
+
__typename?: 'SentimentInstrument';
|
|
198
|
+
displayName: Scalars['String']['output'];
|
|
199
|
+
name: Scalars['String']['output'];
|
|
200
|
+
sentiment: Sentiment;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export enum Sort {
|
|
204
|
+
Bearish = 'BEARISH',
|
|
205
|
+
Bullish = 'BULLISH'
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export type TopicalInstrument = {
|
|
209
|
+
__typename?: 'TopicalInstrument';
|
|
210
|
+
displayName: Scalars['String']['output'];
|
|
211
|
+
name: Scalars['String']['output'];
|
|
212
|
+
sentiment: TopicalInstrumentSentiment;
|
|
213
|
+
updatedAt: Scalars['String']['output'];
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export type TopicalInstrumentChart = {
|
|
217
|
+
__typename?: 'TopicalInstrumentChart';
|
|
218
|
+
chart?: Maybe<Array<Scalars['Float']['output']>>;
|
|
219
|
+
name: Scalars['String']['output'];
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export type TopicalInstrumentSentiment = {
|
|
223
|
+
__typename?: 'TopicalInstrumentSentiment';
|
|
224
|
+
longPercent: Scalars['Float']['output'];
|
|
225
|
+
shortPercent: Scalars['Float']['output'];
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export enum TopicalSort {
|
|
229
|
+
Bearish = 'BEARISH',
|
|
230
|
+
Bullish = 'BULLISH',
|
|
231
|
+
Hot = 'HOT',
|
|
232
|
+
Popular = 'POPULAR',
|
|
233
|
+
Volatile = 'VOLATILE'
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export type VolatilityChart = {
|
|
237
|
+
__typename?: 'VolatilityChart';
|
|
238
|
+
pips: Scalars['Float']['output'];
|
|
239
|
+
/** Time point - hour in format hh:mm, Date in UTC, Week in format 'Mo' */
|
|
240
|
+
point: Scalars['String']['output'];
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export type VolatilityChartAssetClass = {
|
|
244
|
+
__typename?: 'VolatilityChartAssetClass';
|
|
245
|
+
instruments: Array<VolatilityChartInstrument>;
|
|
246
|
+
name: Scalars['String']['output'];
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export type VolatilityChartInstrument = {
|
|
250
|
+
__typename?: 'VolatilityChartInstrument';
|
|
251
|
+
displayName: Scalars['String']['output'];
|
|
252
|
+
name: Scalars['String']['output'];
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export enum VolatilityChartTimeSpan {
|
|
256
|
+
D5 = 'D5',
|
|
257
|
+
/** Valid for: H */
|
|
258
|
+
D10 = 'D10',
|
|
259
|
+
/** Valid for: H */
|
|
260
|
+
M1 = 'M1',
|
|
261
|
+
/** Valid for: D */
|
|
262
|
+
M3 = 'M3',
|
|
263
|
+
/** Valid for: D */
|
|
264
|
+
W5 = 'W5',
|
|
265
|
+
/** Valid for: W */
|
|
266
|
+
W10 = 'W10'
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export enum VolatilityChartTimeUnit {
|
|
270
|
+
D = 'D',
|
|
271
|
+
H = 'H',
|
|
272
|
+
W = 'W'
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export type GetCurrencyPowerBalanceQueryVariables = Exact<{
|
|
276
|
+
timeUnit: CurrencyPowerBalanceTimeUnit;
|
|
277
|
+
}>;
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
export type GetCurrencyPowerBalanceQuery = { __typename?: 'Query', currencyPowerBalance?: Array<{ __typename?: 'CurrencyPowerBalance', currency: CurrencyName, power: Array<{ __typename?: 'CurrencyPower', point: string, price: number }> }> | null };
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
export const GetCurrencyPowerBalanceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCurrencyPowerBalance"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"timeUnit"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CurrencyPowerBalanceTimeUnit"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyPowerBalance"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"timeUnit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"timeUnit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currency"}},{"kind":"Field","name":{"kind":"Name","value":"power"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"point"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}}]}}]}}]} as unknown as DocumentNode<GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables>;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './CurrencyPowerBalanceWidget';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { render } from '@testing-library/react';
|
|
6
|
+
import { MockedProvider } from '@apollo/client/testing';
|
|
7
|
+
import { Main } from '../src/CurrencyPowerBalanceWidget/Main';
|
|
8
|
+
import { mockResponse } from './responsesMocks';
|
|
9
|
+
|
|
10
|
+
jest.mock('usehooks-ts', () => ({
|
|
11
|
+
useMediaQuery: jest.fn(),
|
|
12
|
+
useOnClickOutside: jest.fn(),
|
|
13
|
+
useElementSize: jest.fn().mockImplementation(() => [null, {
|
|
14
|
+
width: 100,
|
|
15
|
+
}]),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
describe('Main component', () => {
|
|
19
|
+
it('should render tool view', async () => {
|
|
20
|
+
const { findByTestId, getByTestId } = render(
|
|
21
|
+
<MockedProvider mocks={mockResponse}>
|
|
22
|
+
<Main />
|
|
23
|
+
</MockedProvider>,
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
expect(await findByTestId('currency-power-balance-wrapper')).toBeInTheDocument();
|
|
27
|
+
expect(getByTestId('time-unit-select')).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { xAxisLabelFormatter, tooltipFormatter } from '../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters';
|
|
6
|
+
import { CurrencyPowerBalanceTimeUnit } from '../src/gql/types/graphql';
|
|
7
|
+
|
|
8
|
+
describe('tooltipFormatter', () => {
|
|
9
|
+
it('should sort & format tooltip content', () => {
|
|
10
|
+
const values = [{
|
|
11
|
+
marker: '<span>Marker 1</span>',
|
|
12
|
+
seriesName: 'Name 1',
|
|
13
|
+
value: ['2023-10-27T14:00:00Z', '-30.91'],
|
|
14
|
+
}, {
|
|
15
|
+
marker: '<span>Marker 2</span>',
|
|
16
|
+
seriesName: 'Name 2',
|
|
17
|
+
value: ['2023-10-27T14:00:00Z', '-20.23'],
|
|
18
|
+
}];
|
|
19
|
+
|
|
20
|
+
const element = document.createElement('div');
|
|
21
|
+
element.innerHTML = tooltipFormatter(values);
|
|
22
|
+
|
|
23
|
+
expect(element.querySelector('p')).toContainHTML('<p style="margin-bottom:5px;">10/27/2023, 14:00 UTC</p>');
|
|
24
|
+
expect(element.querySelectorAll('span')[0]).toContainHTML('<span>Marker 2</span>');
|
|
25
|
+
expect(element.querySelectorAll('span')[2]).toContainHTML('<span>-20.23</span>');
|
|
26
|
+
expect(element.querySelectorAll('span')[3]).toContainHTML('<span>Marker 1</span>');
|
|
27
|
+
expect(element.querySelectorAll('span')[5]).toContainHTML('<span>-30.91</span>');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe('xAxisLabelFormatter', () => {
|
|
32
|
+
it('should format x axis label to date for 1 week time unit', () => {
|
|
33
|
+
expect(xAxisLabelFormatter('2023-10-22T10:00:00Z', CurrencyPowerBalanceTimeUnit.W1)).toEqual('10/22');
|
|
34
|
+
});
|
|
35
|
+
it('should format x axis label to date for 1 month time unit', () => {
|
|
36
|
+
expect(xAxisLabelFormatter('2023-10-20T10:00:00Z', CurrencyPowerBalanceTimeUnit.M1)).toEqual('10/20');
|
|
37
|
+
});
|
|
38
|
+
it('should format x axis label to date for 3 months time unit', () => {
|
|
39
|
+
expect(xAxisLabelFormatter('2023-10-10T10:00:00Z', CurrencyPowerBalanceTimeUnit.M3)).toEqual('10/10');
|
|
40
|
+
});
|
|
41
|
+
it('should format x axis label to date for midnight', () => {
|
|
42
|
+
expect(xAxisLabelFormatter('2023-09-20T00:00:00Z', CurrencyPowerBalanceTimeUnit.CurrentDay)).toEqual('9/20');
|
|
43
|
+
});
|
|
44
|
+
it('should format x axis label to time for current day', () => {
|
|
45
|
+
expect(xAxisLabelFormatter('2023-09-20T01:00:00Z', CurrencyPowerBalanceTimeUnit.CurrentDay)).toEqual('01:00');
|
|
46
|
+
});
|
|
47
|
+
it('should format x axis label to time for previous day', () => {
|
|
48
|
+
expect(xAxisLabelFormatter('2023-12-18T05:00:00Z', CurrencyPowerBalanceTimeUnit.PreviousDay)).toEqual('05:00');
|
|
49
|
+
});
|
|
50
|
+
it('should format x axis label to time for 24 hours', () => {
|
|
51
|
+
expect(xAxisLabelFormatter('2023-06-01T12:20:00Z', CurrencyPowerBalanceTimeUnit.H24)).toEqual('12:20');
|
|
52
|
+
});
|
|
53
|
+
it('should format x axis label to time for 8 hours', () => {
|
|
54
|
+
expect(xAxisLabelFormatter('2023-08-23T14:00:00Z', CurrencyPowerBalanceTimeUnit.H8)).toEqual('14:00');
|
|
55
|
+
});
|
|
56
|
+
it('should format x axis label to time for 4 hours', () => {
|
|
57
|
+
expect(xAxisLabelFormatter('2024-01-05T05:45:00Z', CurrencyPowerBalanceTimeUnit.H4)).toEqual('05:45');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { getCurrencyPowerBalance } from '../src/gql/getCurrencyPowerBalance';
|
|
2
|
+
|
|
3
|
+
const mockResponse = [{
|
|
4
|
+
request: {
|
|
5
|
+
query: getCurrencyPowerBalance,
|
|
6
|
+
variables: {
|
|
7
|
+
timeUnit: 'CURRENT_DAY',
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
result: {
|
|
11
|
+
data: {
|
|
12
|
+
currencyPowerBalance: [
|
|
13
|
+
{
|
|
14
|
+
currency: 'NZD',
|
|
15
|
+
power: [
|
|
16
|
+
{
|
|
17
|
+
point: '2023-10-26T22:00:00Z',
|
|
18
|
+
price: 3.86,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
point: '2023-10-27T02:00:00Z',
|
|
22
|
+
price: 3.04,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
point: '2023-10-27T06:00:00Z',
|
|
26
|
+
price: 3.84,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
point: '2023-10-27T10:00:00Z',
|
|
30
|
+
price: 4.65,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
point: '2023-10-27T14:00:00Z',
|
|
34
|
+
price: 2.43,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
point: '2023-10-27T18:00:00Z',
|
|
38
|
+
price: 1.65,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
currency: 'CHF',
|
|
44
|
+
power: [
|
|
45
|
+
{
|
|
46
|
+
point: '2023-10-26T22:00:00Z',
|
|
47
|
+
price: -5.62,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
point: '2023-10-27T02:00:00Z',
|
|
51
|
+
price: -5.57,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
point: '2023-10-27T06:00:00Z',
|
|
55
|
+
price: -7.7,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
point: '2023-10-27T10:00:00Z',
|
|
59
|
+
price: -8.75,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
point: '2023-10-27T14:00:00Z',
|
|
63
|
+
price: -10.33,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
point: '2023-10-27T18:00:00Z',
|
|
67
|
+
price: -9.15,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
currency: 'AUD',
|
|
73
|
+
power: [
|
|
74
|
+
{
|
|
75
|
+
point: '2023-10-26T22:00:00Z',
|
|
76
|
+
price: 3.8,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
point: '2023-10-27T02:00:00Z',
|
|
80
|
+
price: 3.08,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
point: '2023-10-27T06:00:00Z',
|
|
84
|
+
price: 3.37,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
point: '2023-10-27T10:00:00Z',
|
|
88
|
+
price: 3.51,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
point: '2023-10-27T14:00:00Z',
|
|
92
|
+
price: 3.91,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
point: '2023-10-27T18:00:00Z',
|
|
96
|
+
price: 4.31,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
currency: 'CAD',
|
|
102
|
+
power: [
|
|
103
|
+
{
|
|
104
|
+
point: '2023-10-26T22:00:00Z',
|
|
105
|
+
price: -6.41,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
point: '2023-10-27T02:00:00Z',
|
|
109
|
+
price: -5.54,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
point: '2023-10-27T06:00:00Z',
|
|
113
|
+
price: -4.95,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
point: '2023-10-27T10:00:00Z',
|
|
117
|
+
price: -6.56,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
point: '2023-10-27T14:00:00Z',
|
|
121
|
+
price: -9.63,
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
point: '2023-10-27T18:00:00Z',
|
|
125
|
+
price: -9.75,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
currency: 'EUR',
|
|
131
|
+
power: [
|
|
132
|
+
{
|
|
133
|
+
point: '2023-10-26T22:00:00Z',
|
|
134
|
+
price: -0.01,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
point: '2023-10-27T02:00:00Z',
|
|
138
|
+
price: 0.27,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
point: '2023-10-27T06:00:00Z',
|
|
142
|
+
price: -0.01,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
point: '2023-10-27T10:00:00Z',
|
|
146
|
+
price: -0.52,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
point: '2023-10-27T14:00:00Z',
|
|
150
|
+
price: 2.81,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
point: '2023-10-27T18:00:00Z',
|
|
154
|
+
price: 1.4,
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
currency: 'JPY',
|
|
160
|
+
power: [
|
|
161
|
+
{
|
|
162
|
+
point: '2023-10-26T22:00:00Z',
|
|
163
|
+
price: -0.24,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
point: '2023-10-27T02:00:00Z',
|
|
167
|
+
price: 0.58,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
point: '2023-10-27T06:00:00Z',
|
|
171
|
+
price: 1.59,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
point: '2023-10-27T10:00:00Z',
|
|
175
|
+
price: 3.29,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
point: '2023-10-27T14:00:00Z',
|
|
179
|
+
price: 5.54,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
point: '2023-10-27T18:00:00Z',
|
|
183
|
+
price: 6.27,
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
currency: 'USD',
|
|
189
|
+
power: [
|
|
190
|
+
{
|
|
191
|
+
point: '2023-10-26T22:00:00Z',
|
|
192
|
+
price: 3.8,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
point: '2023-10-27T02:00:00Z',
|
|
196
|
+
price: 3.08,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
point: '2023-10-27T06:00:00Z',
|
|
200
|
+
price: 3.37,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
point: '2023-10-27T10:00:00Z',
|
|
204
|
+
price: 3.51,
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
point: '2023-10-27T14:00:00Z',
|
|
208
|
+
price: 3.91,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
point: '2023-10-27T18:00:00Z',
|
|
212
|
+
price: 4.31,
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
}];
|
|
220
|
+
|
|
221
|
+
export {
|
|
222
|
+
mockResponse,
|
|
223
|
+
};
|