@oanda/labs-order-book-widget 1.0.87 → 1.0.89
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 +684 -0
- package/dist/main/OrderBookWidget/ChartWithData.js +12 -2
- package/dist/main/OrderBookWidget/ChartWithData.js.map +1 -1
- package/dist/main/OrderBookWidget/constants.js +8 -0
- package/dist/main/OrderBookWidget/constants.js.map +1 -0
- package/dist/main/gql/getOrderPositionBooks.js +1 -1
- package/dist/main/gql/getOrderPositionBooks.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 +40 -1
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/translations/sources/en.json +2 -0
- package/dist/main/translations/sources/zh_TW.json +2 -0
- package/dist/module/OrderBookWidget/ChartWithData.js +13 -3
- package/dist/module/OrderBookWidget/ChartWithData.js.map +1 -1
- package/dist/module/OrderBookWidget/constants.js +3 -0
- package/dist/module/OrderBookWidget/constants.js.map +1 -0
- package/dist/module/gql/getOrderPositionBooks.js +1 -1
- package/dist/module/gql/getOrderPositionBooks.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 +39 -0
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/translations/sources/en.json +2 -0
- package/dist/module/translations/sources/zh_TW.json +2 -0
- package/dist/types/OrderBookWidget/constants.d.ts +2 -0
- package/dist/types/gql/types/gql.d.ts +2 -2
- package/dist/types/gql/types/graphql.d.ts +87 -9
- package/package.json +3 -3
- package/src/OrderBookWidget/ChartWithData.tsx +51 -40
- package/src/OrderBookWidget/constants.ts +3 -0
- package/src/gql/getOrderPositionBooks.ts +1 -0
- package/src/gql/types/gql.ts +2 -2
- package/src/gql/types/graphql.ts +101 -11
- package/src/translations/sources/en.json +2 -0
- package/src/translations/sources/zh_TW.json +2 -0
- package/test/Main.test.tsx +3 -0
|
@@ -11,7 +11,7 @@ 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($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n": DocumentNode<types.GetOrderPositionBooksQuery, types.Exact<{
|
|
14
|
+
"\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n": DocumentNode<types.GetOrderPositionBooksQuery, types.Exact<{
|
|
15
15
|
instrument: string;
|
|
16
16
|
bookType: types.BookType;
|
|
17
17
|
recentHours?: types.InputMaybe<number> | undefined;
|
|
@@ -33,6 +33,6 @@ export declare function graphql(source: string): unknown;
|
|
|
33
33
|
/**
|
|
34
34
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
35
35
|
*/
|
|
36
|
-
export declare function graphql(source: "\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"): (typeof documents)["\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"];
|
|
36
|
+
export declare function graphql(source: "\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"): (typeof documents)["\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"];
|
|
37
37
|
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
|
|
38
38
|
export {};
|
|
@@ -52,6 +52,62 @@ export declare enum BookType {
|
|
|
52
52
|
Order = "ORDER",
|
|
53
53
|
Position = "POSITION"
|
|
54
54
|
}
|
|
55
|
+
export type Correlation = {
|
|
56
|
+
__typename?: 'Correlation';
|
|
57
|
+
timeUnit: CorrelationTimeUnit;
|
|
58
|
+
value: Scalars['Float']['output'];
|
|
59
|
+
};
|
|
60
|
+
export type CorrelationHeatmap = {
|
|
61
|
+
__typename?: 'CorrelationHeatmap';
|
|
62
|
+
baseInstrument: Scalars['String']['output'];
|
|
63
|
+
heatmap: Array<Heatmap>;
|
|
64
|
+
};
|
|
65
|
+
export declare enum CorrelationTimeUnit {
|
|
66
|
+
H1 = "H1",
|
|
67
|
+
H4 = "H4",
|
|
68
|
+
H24 = "H24",
|
|
69
|
+
M1 = "M1",
|
|
70
|
+
M3 = "M3",
|
|
71
|
+
M6 = "M6",
|
|
72
|
+
W1 = "W1",
|
|
73
|
+
Y1 = "Y1"
|
|
74
|
+
}
|
|
75
|
+
export declare enum CurrencyName {
|
|
76
|
+
Aud = "AUD",
|
|
77
|
+
Cad = "CAD",
|
|
78
|
+
Chf = "CHF",
|
|
79
|
+
Eur = "EUR",
|
|
80
|
+
Gbp = "GBP",
|
|
81
|
+
Jpy = "JPY",
|
|
82
|
+
Nzd = "NZD",
|
|
83
|
+
Usd = "USD"
|
|
84
|
+
}
|
|
85
|
+
export type CurrencyPower = {
|
|
86
|
+
__typename?: 'CurrencyPower';
|
|
87
|
+
/** UTC Timestamp */
|
|
88
|
+
point: Scalars['String']['output'];
|
|
89
|
+
price: Scalars['Float']['output'];
|
|
90
|
+
};
|
|
91
|
+
export type CurrencyPowerBalance = {
|
|
92
|
+
__typename?: 'CurrencyPowerBalance';
|
|
93
|
+
currency: CurrencyName;
|
|
94
|
+
power: Array<CurrencyPower>;
|
|
95
|
+
};
|
|
96
|
+
export declare enum CurrencyPowerBalanceTimeUnit {
|
|
97
|
+
CurrentDay = "CURRENT_DAY",
|
|
98
|
+
H4 = "H4",
|
|
99
|
+
H8 = "H8",
|
|
100
|
+
H24 = "H24",
|
|
101
|
+
M1 = "M1",
|
|
102
|
+
M3 = "M3",
|
|
103
|
+
PreviousDay = "PREVIOUS_DAY",
|
|
104
|
+
W1 = "W1"
|
|
105
|
+
}
|
|
106
|
+
export type CurrencyStrength = {
|
|
107
|
+
__typename?: 'CurrencyStrength';
|
|
108
|
+
currency: CurrencyName;
|
|
109
|
+
strengthRelation?: Maybe<Array<StrengthRelation>>;
|
|
110
|
+
};
|
|
55
111
|
export declare enum DataSource {
|
|
56
112
|
Ny4 = "NY4",
|
|
57
113
|
Ty3 = "TY3"
|
|
@@ -66,6 +122,11 @@ export declare enum Division {
|
|
|
66
122
|
Oj = "OJ",
|
|
67
123
|
Otms = "OTMS"
|
|
68
124
|
}
|
|
125
|
+
export type Heatmap = {
|
|
126
|
+
__typename?: 'Heatmap';
|
|
127
|
+
correlation: Array<Correlation>;
|
|
128
|
+
instrument: Scalars['String']['output'];
|
|
129
|
+
};
|
|
69
130
|
export type Instrument = {
|
|
70
131
|
__typename?: 'Instrument';
|
|
71
132
|
displayName?: Maybe<Scalars['String']['output']>;
|
|
@@ -83,7 +144,7 @@ export type OrderPositionData = {
|
|
|
83
144
|
buckets: Array<Maybe<OrderPositionBucket>>;
|
|
84
145
|
dataSource?: Maybe<Scalars['String']['output']>;
|
|
85
146
|
instrument: Scalars['String']['output'];
|
|
86
|
-
price
|
|
147
|
+
price?: Maybe<Scalars['Float']['output']>;
|
|
87
148
|
region?: Maybe<Scalars['String']['output']>;
|
|
88
149
|
time: Scalars['String']['output'];
|
|
89
150
|
unixTime: Scalars['Int']['output'];
|
|
@@ -91,6 +152,9 @@ export type OrderPositionData = {
|
|
|
91
152
|
export type Query = {
|
|
92
153
|
__typename?: 'Query';
|
|
93
154
|
assetClasses?: Maybe<Array<Maybe<AssetClass>>>;
|
|
155
|
+
correlationHeatmap: CorrelationHeatmap;
|
|
156
|
+
currencyPowerBalance?: Maybe<Array<CurrencyPowerBalance>>;
|
|
157
|
+
currencyStrength?: Maybe<Array<CurrencyStrength>>;
|
|
94
158
|
orderPositionBooks: Array<Maybe<OrderPositionData>>;
|
|
95
159
|
sentiment?: Maybe<Array<SentimentInstrument>>;
|
|
96
160
|
sentimentList?: Maybe<Array<SentimentInstrument>>;
|
|
@@ -103,6 +167,12 @@ export type Query = {
|
|
|
103
167
|
export type QueryAssetClassesArgs = {
|
|
104
168
|
division: Division;
|
|
105
169
|
};
|
|
170
|
+
export type QueryCorrelationHeatmapArgs = {
|
|
171
|
+
division: Division;
|
|
172
|
+
};
|
|
173
|
+
export type QueryCurrencyPowerBalanceArgs = {
|
|
174
|
+
timeUnit: CurrencyPowerBalanceTimeUnit;
|
|
175
|
+
};
|
|
106
176
|
export type QueryOrderPositionBooksArgs = {
|
|
107
177
|
bookType: BookType;
|
|
108
178
|
dataSource?: InputMaybe<DataSource>;
|
|
@@ -156,16 +226,22 @@ export type SentimentInstrument = {
|
|
|
156
226
|
displayName: Scalars['String']['output'];
|
|
157
227
|
name: Scalars['String']['output'];
|
|
158
228
|
sentiment: Sentiment;
|
|
229
|
+
updatedAt: Scalars['String']['output'];
|
|
159
230
|
};
|
|
160
231
|
export declare enum Sort {
|
|
161
232
|
Bearish = "BEARISH",
|
|
162
233
|
Bullish = "BULLISH"
|
|
163
234
|
}
|
|
235
|
+
export type StrengthRelation = {
|
|
236
|
+
__typename?: 'StrengthRelation';
|
|
237
|
+
currency: CurrencyName;
|
|
238
|
+
percentage: Scalars['Float']['output'];
|
|
239
|
+
};
|
|
164
240
|
export type TopicalInstrument = {
|
|
165
241
|
__typename?: 'TopicalInstrument';
|
|
166
242
|
displayName: Scalars['String']['output'];
|
|
167
243
|
name: Scalars['String']['output'];
|
|
168
|
-
sentiment:
|
|
244
|
+
sentiment: Sentiment;
|
|
169
245
|
updatedAt: Scalars['String']['output'];
|
|
170
246
|
};
|
|
171
247
|
export type TopicalInstrumentChart = {
|
|
@@ -173,11 +249,6 @@ export type TopicalInstrumentChart = {
|
|
|
173
249
|
chart?: Maybe<Array<Scalars['Float']['output']>>;
|
|
174
250
|
name: Scalars['String']['output'];
|
|
175
251
|
};
|
|
176
|
-
export type TopicalInstrumentSentiment = {
|
|
177
|
-
__typename?: 'TopicalInstrumentSentiment';
|
|
178
|
-
longPercent: Scalars['Float']['output'];
|
|
179
|
-
shortPercent: Scalars['Float']['output'];
|
|
180
|
-
};
|
|
181
252
|
export declare enum TopicalSort {
|
|
182
253
|
Bearish = "BEARISH",
|
|
183
254
|
Bullish = "BULLISH",
|
|
@@ -193,7 +264,7 @@ export type VolatilityChart = {
|
|
|
193
264
|
};
|
|
194
265
|
export type VolatilityChartAssetClass = {
|
|
195
266
|
__typename?: 'VolatilityChartAssetClass';
|
|
196
|
-
instruments
|
|
267
|
+
instruments: Array<VolatilityChartInstrument>;
|
|
197
268
|
name: Scalars['String']['output'];
|
|
198
269
|
};
|
|
199
270
|
export type VolatilityChartInstrument = {
|
|
@@ -202,11 +273,17 @@ export type VolatilityChartInstrument = {
|
|
|
202
273
|
name: Scalars['String']['output'];
|
|
203
274
|
};
|
|
204
275
|
export declare enum VolatilityChartTimeSpan {
|
|
276
|
+
/** Valid for: H */
|
|
205
277
|
D5 = "D5",
|
|
278
|
+
/** Valid for: H */
|
|
206
279
|
D10 = "D10",
|
|
280
|
+
/** Valid for: D */
|
|
207
281
|
M1 = "M1",
|
|
282
|
+
/** Valid for: D */
|
|
208
283
|
M3 = "M3",
|
|
284
|
+
/** Valid for: W */
|
|
209
285
|
W5 = "W5",
|
|
286
|
+
/** Valid for: W */
|
|
210
287
|
W10 = "W10"
|
|
211
288
|
}
|
|
212
289
|
export declare enum VolatilityChartTimeUnit {
|
|
@@ -224,7 +301,8 @@ export type GetOrderPositionBooksQuery = {
|
|
|
224
301
|
orderPositionBooks: Array<{
|
|
225
302
|
__typename?: 'OrderPositionData';
|
|
226
303
|
bucketWidth: number;
|
|
227
|
-
price
|
|
304
|
+
price?: number | null;
|
|
305
|
+
time: string;
|
|
228
306
|
buckets: Array<{
|
|
229
307
|
__typename?: 'OrderPositionBucket';
|
|
230
308
|
price: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-order-book-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.89",
|
|
4
4
|
"description": "Labs Order Book Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "UNLICENSED",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@apollo/client": "3.7.17",
|
|
16
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.89",
|
|
17
17
|
"@oanda/mono-i18n": "9.0.0",
|
|
18
18
|
"echarts": "5.4.3",
|
|
19
19
|
"echarts-for-react": "3.0.2",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@graphql-codegen/client-preset": "4.1.0",
|
|
25
25
|
"@graphql-codegen/typescript": "4.0.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "132c4c3570c0cba5114eccbd4d93a8469227a6c5"
|
|
28
28
|
}
|
|
@@ -2,18 +2,21 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import { useQuery } from '@apollo/client';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import {
|
|
5
|
-
ChartError, Size, Spinner, SpinnerSize, ThemeContext,
|
|
5
|
+
ChartError, InfoBox, Size, Spinner, SpinnerSize, ThemeContext, formatUpdatedTimestamp,
|
|
6
6
|
} from '@oanda/labs-widget-common';
|
|
7
|
+
import { useLocale } from '@oanda/mono-i18n';
|
|
7
8
|
import { ChartWithDataProps } from './types';
|
|
8
9
|
import { getOrderPositionBooks } from '../gql/getOrderPositionBooks';
|
|
9
10
|
import { GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables, BookType } from '../gql/types/graphql';
|
|
10
11
|
import { Chart } from './components/Chart/Chart';
|
|
11
12
|
import { instrumentPrecisionConfig } from './config';
|
|
13
|
+
import { EMPTY_VALUE } from './constants';
|
|
12
14
|
|
|
13
15
|
const ChartWithData = ({
|
|
14
16
|
instrument,
|
|
15
17
|
bookType,
|
|
16
18
|
}: ChartWithDataProps) => {
|
|
19
|
+
const { lang } = useLocale();
|
|
17
20
|
const { size } = useContext(ThemeContext);
|
|
18
21
|
const isDesktop = size === Size.DESKTOP;
|
|
19
22
|
|
|
@@ -30,51 +33,59 @@ const ChartWithData = ({
|
|
|
30
33
|
});
|
|
31
34
|
|
|
32
35
|
const isError = (!loading && !data?.orderPositionBooks[0]?.price) || !!error;
|
|
36
|
+
const updatedAt = data?.orderPositionBooks[0]?.time;
|
|
33
37
|
|
|
34
38
|
return (
|
|
35
|
-
|
|
36
|
-
'lw-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{isError && (
|
|
41
|
-
<div className={
|
|
42
|
-
classnames(
|
|
43
|
-
'lw-absolute lw-left-0 lw-top-0 lw-flex lw-w-full lw-items-center lw-justify-center lw-border lw-border-solid lw-border-border-primary',
|
|
44
|
-
{
|
|
45
|
-
'lw-h-full': isDesktop,
|
|
46
|
-
'lw-h-[calc(100%-40px)]': !isDesktop,
|
|
47
|
-
},
|
|
48
|
-
)
|
|
49
|
-
}
|
|
39
|
+
<>
|
|
40
|
+
<div className={classnames('lw-relative lw-w-full', {
|
|
41
|
+
'lw-h-[450px]': isDesktop,
|
|
42
|
+
'lw-h-[390px]': !isDesktop,
|
|
43
|
+
})}
|
|
50
44
|
>
|
|
51
|
-
|
|
45
|
+
{isError && (
|
|
46
|
+
<div className={
|
|
47
|
+
classnames(
|
|
48
|
+
'lw-absolute lw-left-0 lw-top-0 lw-flex lw-w-full lw-items-center lw-justify-center lw-border lw-border-solid lw-border-border-primary',
|
|
49
|
+
{
|
|
50
|
+
'lw-h-full': isDesktop,
|
|
51
|
+
'lw-h-[calc(100%-40px)]': !isDesktop,
|
|
52
|
+
},
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
>
|
|
56
|
+
<ChartError />
|
|
57
|
+
</div>
|
|
58
|
+
)}
|
|
59
|
+
{loading && (
|
|
60
|
+
<div className={
|
|
61
|
+
classnames(
|
|
62
|
+
'lw-absolute lw-left-0 lw-top-0 lw-flex lw-w-full lw-items-center lw-justify-center lw-border lw-border-solid lw-border-border-primary',
|
|
63
|
+
{
|
|
64
|
+
'lw-h-full': isDesktop,
|
|
65
|
+
'lw-h-[calc(100%-40px)]': !isDesktop,
|
|
66
|
+
},
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
>
|
|
70
|
+
<Spinner size={SpinnerSize.lg} />
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
{!isError && data && (
|
|
74
|
+
<div className="lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-full lw-w-full">
|
|
75
|
+
<Chart
|
|
76
|
+
data={data}
|
|
77
|
+
isOrderBook={bookType === BookType.Order}
|
|
78
|
+
precision={instrumentPrecisionConfig[instrument]}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
)}
|
|
52
82
|
</div>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
classnames(
|
|
57
|
-
'lw-absolute lw-left-0 lw-top-0 lw-flex lw-w-full lw-items-center lw-justify-center lw-border lw-border-solid lw-border-border-primary',
|
|
58
|
-
{
|
|
59
|
-
'lw-h-full': isDesktop,
|
|
60
|
-
'lw-h-[calc(100%-40px)]': !isDesktop,
|
|
61
|
-
},
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
>
|
|
65
|
-
<Spinner size={SpinnerSize.lg} />
|
|
83
|
+
{!isError && (
|
|
84
|
+
<div className="lw-mt-2 lw-h-8">
|
|
85
|
+
<InfoBox text={`${lang('last_updated')}: ${updatedAt ? formatUpdatedTimestamp(updatedAt, lang('today')) : EMPTY_VALUE}`} />
|
|
66
86
|
</div>
|
|
67
87
|
)}
|
|
68
|
-
|
|
69
|
-
<div className="lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-full lw-w-full">
|
|
70
|
-
<Chart
|
|
71
|
-
data={data}
|
|
72
|
-
isOrderBook={bookType === BookType.Order}
|
|
73
|
-
precision={instrumentPrecisionConfig[instrument]}
|
|
74
|
-
/>
|
|
75
|
-
</div>
|
|
76
|
-
)}
|
|
77
|
-
</div>
|
|
88
|
+
</>
|
|
78
89
|
);
|
|
79
90
|
};
|
|
80
91
|
|
package/src/gql/types/gql.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
|
|
|
13
13
|
* Therefore it is highly recommended to use the babel or swc plugin for production.
|
|
14
14
|
*/
|
|
15
15
|
const documents = {
|
|
16
|
-
"\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n": types.GetOrderPositionBooksDocument,
|
|
16
|
+
"\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n": types.GetOrderPositionBooksDocument,
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -33,7 +33,7 @@ export function graphql(source: string): unknown;
|
|
|
33
33
|
/**
|
|
34
34
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
35
35
|
*/
|
|
36
|
-
export function graphql(source: "\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"): (typeof documents)["\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"];
|
|
36
|
+
export function graphql(source: "\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"): (typeof documents)["\n query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {\n orderPositionBooks(\n instrument: $instrument\n bookType: $bookType\n recentHours: $recentHours\n ) {\n bucketWidth\n price\n time\n buckets {\n price\n longCountPercent\n shortCountPercent\n }\n }\n }\n"];
|
|
37
37
|
|
|
38
38
|
export function graphql(source: string) {
|
|
39
39
|
return (documents as any)[source] ?? {};
|
package/src/gql/types/graphql.ts
CHANGED
|
@@ -27,6 +27,70 @@ export enum BookType {
|
|
|
27
27
|
Position = 'POSITION'
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export type Correlation = {
|
|
31
|
+
__typename?: 'Correlation';
|
|
32
|
+
timeUnit: CorrelationTimeUnit;
|
|
33
|
+
value: Scalars['Float']['output'];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type CorrelationHeatmap = {
|
|
37
|
+
__typename?: 'CorrelationHeatmap';
|
|
38
|
+
baseInstrument: Scalars['String']['output'];
|
|
39
|
+
heatmap: Array<Heatmap>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export enum CorrelationTimeUnit {
|
|
43
|
+
H1 = 'H1',
|
|
44
|
+
H4 = 'H4',
|
|
45
|
+
H24 = 'H24',
|
|
46
|
+
M1 = 'M1',
|
|
47
|
+
M3 = 'M3',
|
|
48
|
+
M6 = 'M6',
|
|
49
|
+
W1 = 'W1',
|
|
50
|
+
Y1 = 'Y1'
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export enum CurrencyName {
|
|
54
|
+
Aud = 'AUD',
|
|
55
|
+
Cad = 'CAD',
|
|
56
|
+
Chf = 'CHF',
|
|
57
|
+
Eur = 'EUR',
|
|
58
|
+
Gbp = 'GBP',
|
|
59
|
+
Jpy = 'JPY',
|
|
60
|
+
Nzd = 'NZD',
|
|
61
|
+
Usd = 'USD'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type CurrencyPower = {
|
|
65
|
+
__typename?: 'CurrencyPower';
|
|
66
|
+
/** UTC Timestamp */
|
|
67
|
+
point: Scalars['String']['output'];
|
|
68
|
+
price: Scalars['Float']['output'];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type CurrencyPowerBalance = {
|
|
72
|
+
__typename?: 'CurrencyPowerBalance';
|
|
73
|
+
currency: CurrencyName;
|
|
74
|
+
power: Array<CurrencyPower>;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export enum CurrencyPowerBalanceTimeUnit {
|
|
78
|
+
CurrentDay = 'CURRENT_DAY',
|
|
79
|
+
H4 = 'H4',
|
|
80
|
+
H8 = 'H8',
|
|
81
|
+
H24 = 'H24',
|
|
82
|
+
M1 = 'M1',
|
|
83
|
+
M3 = 'M3',
|
|
84
|
+
PreviousDay = 'PREVIOUS_DAY',
|
|
85
|
+
W1 = 'W1'
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type CurrencyStrength = {
|
|
89
|
+
__typename?: 'CurrencyStrength';
|
|
90
|
+
currency: CurrencyName;
|
|
91
|
+
strengthRelation?: Maybe<Array<StrengthRelation>>;
|
|
92
|
+
};
|
|
93
|
+
|
|
30
94
|
export enum DataSource {
|
|
31
95
|
Ny4 = 'NY4',
|
|
32
96
|
Ty3 = 'TY3'
|
|
@@ -43,6 +107,12 @@ export enum Division {
|
|
|
43
107
|
Otms = 'OTMS'
|
|
44
108
|
}
|
|
45
109
|
|
|
110
|
+
export type Heatmap = {
|
|
111
|
+
__typename?: 'Heatmap';
|
|
112
|
+
correlation: Array<Correlation>;
|
|
113
|
+
instrument: Scalars['String']['output'];
|
|
114
|
+
};
|
|
115
|
+
|
|
46
116
|
export type Instrument = {
|
|
47
117
|
__typename?: 'Instrument';
|
|
48
118
|
displayName?: Maybe<Scalars['String']['output']>;
|
|
@@ -62,7 +132,7 @@ export type OrderPositionData = {
|
|
|
62
132
|
buckets: Array<Maybe<OrderPositionBucket>>;
|
|
63
133
|
dataSource?: Maybe<Scalars['String']['output']>;
|
|
64
134
|
instrument: Scalars['String']['output'];
|
|
65
|
-
price
|
|
135
|
+
price?: Maybe<Scalars['Float']['output']>;
|
|
66
136
|
region?: Maybe<Scalars['String']['output']>;
|
|
67
137
|
time: Scalars['String']['output'];
|
|
68
138
|
unixTime: Scalars['Int']['output'];
|
|
@@ -71,6 +141,9 @@ export type OrderPositionData = {
|
|
|
71
141
|
export type Query = {
|
|
72
142
|
__typename?: 'Query';
|
|
73
143
|
assetClasses?: Maybe<Array<Maybe<AssetClass>>>;
|
|
144
|
+
correlationHeatmap: CorrelationHeatmap;
|
|
145
|
+
currencyPowerBalance?: Maybe<Array<CurrencyPowerBalance>>;
|
|
146
|
+
currencyStrength?: Maybe<Array<CurrencyStrength>>;
|
|
74
147
|
orderPositionBooks: Array<Maybe<OrderPositionData>>;
|
|
75
148
|
sentiment?: Maybe<Array<SentimentInstrument>>;
|
|
76
149
|
sentimentList?: Maybe<Array<SentimentInstrument>>;
|
|
@@ -87,6 +160,16 @@ export type QueryAssetClassesArgs = {
|
|
|
87
160
|
};
|
|
88
161
|
|
|
89
162
|
|
|
163
|
+
export type QueryCorrelationHeatmapArgs = {
|
|
164
|
+
division: Division;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
export type QueryCurrencyPowerBalanceArgs = {
|
|
169
|
+
timeUnit: CurrencyPowerBalanceTimeUnit;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
|
|
90
173
|
export type QueryOrderPositionBooksArgs = {
|
|
91
174
|
bookType: BookType;
|
|
92
175
|
dataSource?: InputMaybe<DataSource>;
|
|
@@ -157,6 +240,7 @@ export type SentimentInstrument = {
|
|
|
157
240
|
displayName: Scalars['String']['output'];
|
|
158
241
|
name: Scalars['String']['output'];
|
|
159
242
|
sentiment: Sentiment;
|
|
243
|
+
updatedAt: Scalars['String']['output'];
|
|
160
244
|
};
|
|
161
245
|
|
|
162
246
|
export enum Sort {
|
|
@@ -164,11 +248,17 @@ export enum Sort {
|
|
|
164
248
|
Bullish = 'BULLISH'
|
|
165
249
|
}
|
|
166
250
|
|
|
251
|
+
export type StrengthRelation = {
|
|
252
|
+
__typename?: 'StrengthRelation';
|
|
253
|
+
currency: CurrencyName;
|
|
254
|
+
percentage: Scalars['Float']['output'];
|
|
255
|
+
};
|
|
256
|
+
|
|
167
257
|
export type TopicalInstrument = {
|
|
168
258
|
__typename?: 'TopicalInstrument';
|
|
169
259
|
displayName: Scalars['String']['output'];
|
|
170
260
|
name: Scalars['String']['output'];
|
|
171
|
-
sentiment:
|
|
261
|
+
sentiment: Sentiment;
|
|
172
262
|
updatedAt: Scalars['String']['output'];
|
|
173
263
|
};
|
|
174
264
|
|
|
@@ -178,12 +268,6 @@ export type TopicalInstrumentChart = {
|
|
|
178
268
|
name: Scalars['String']['output'];
|
|
179
269
|
};
|
|
180
270
|
|
|
181
|
-
export type TopicalInstrumentSentiment = {
|
|
182
|
-
__typename?: 'TopicalInstrumentSentiment';
|
|
183
|
-
longPercent: Scalars['Float']['output'];
|
|
184
|
-
shortPercent: Scalars['Float']['output'];
|
|
185
|
-
};
|
|
186
|
-
|
|
187
271
|
export enum TopicalSort {
|
|
188
272
|
Bearish = 'BEARISH',
|
|
189
273
|
Bullish = 'BULLISH',
|
|
@@ -201,7 +285,7 @@ export type VolatilityChart = {
|
|
|
201
285
|
|
|
202
286
|
export type VolatilityChartAssetClass = {
|
|
203
287
|
__typename?: 'VolatilityChartAssetClass';
|
|
204
|
-
instruments
|
|
288
|
+
instruments: Array<VolatilityChartInstrument>;
|
|
205
289
|
name: Scalars['String']['output'];
|
|
206
290
|
};
|
|
207
291
|
|
|
@@ -212,11 +296,17 @@ export type VolatilityChartInstrument = {
|
|
|
212
296
|
};
|
|
213
297
|
|
|
214
298
|
export enum VolatilityChartTimeSpan {
|
|
299
|
+
/** Valid for: H */
|
|
215
300
|
D5 = 'D5',
|
|
301
|
+
/** Valid for: H */
|
|
216
302
|
D10 = 'D10',
|
|
303
|
+
/** Valid for: D */
|
|
217
304
|
M1 = 'M1',
|
|
305
|
+
/** Valid for: D */
|
|
218
306
|
M3 = 'M3',
|
|
307
|
+
/** Valid for: W */
|
|
219
308
|
W5 = 'W5',
|
|
309
|
+
/** Valid for: W */
|
|
220
310
|
W10 = 'W10'
|
|
221
311
|
}
|
|
222
312
|
|
|
@@ -233,7 +323,7 @@ export type GetOrderPositionBooksQueryVariables = Exact<{
|
|
|
233
323
|
}>;
|
|
234
324
|
|
|
235
325
|
|
|
236
|
-
export type GetOrderPositionBooksQuery = { __typename?: 'Query', orderPositionBooks: Array<{ __typename?: 'OrderPositionData', bucketWidth: number, price
|
|
326
|
+
export type GetOrderPositionBooksQuery = { __typename?: 'Query', orderPositionBooks: Array<{ __typename?: 'OrderPositionData', bucketWidth: number, price?: number | null, time: string, buckets: Array<{ __typename?: 'OrderPositionBucket', price: number, longCountPercent: number, shortCountPercent: number } | null> } | null> };
|
|
237
327
|
|
|
238
328
|
|
|
239
|
-
export const GetOrderPositionBooksDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderPositionBooks"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"instrument"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"bookType"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"BookType"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"recentHours"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderPositionBooks"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"instrument"},"value":{"kind":"Variable","name":{"kind":"Name","value":"instrument"}}},{"kind":"Argument","name":{"kind":"Name","value":"bookType"},"value":{"kind":"Variable","name":{"kind":"Name","value":"bookType"}}},{"kind":"Argument","name":{"kind":"Name","value":"recentHours"},"value":{"kind":"Variable","name":{"kind":"Name","value":"recentHours"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"bucketWidth"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"buckets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"longCountPercent"}},{"kind":"Field","name":{"kind":"Name","value":"shortCountPercent"}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables>;
|
|
329
|
+
export const GetOrderPositionBooksDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderPositionBooks"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"instrument"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"bookType"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"BookType"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"recentHours"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderPositionBooks"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"instrument"},"value":{"kind":"Variable","name":{"kind":"Name","value":"instrument"}}},{"kind":"Argument","name":{"kind":"Name","value":"bookType"},"value":{"kind":"Variable","name":{"kind":"Name","value":"bookType"}}},{"kind":"Argument","name":{"kind":"Name","value":"recentHours"},"value":{"kind":"Variable","name":{"kind":"Name","value":"recentHours"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"bucketWidth"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"buckets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"longCountPercent"}},{"kind":"Field","name":{"kind":"Name","value":"shortCountPercent"}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderPositionBooksQuery, GetOrderPositionBooksQueryVariables>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"buy": "Buy",
|
|
3
3
|
"data_unavailable": "Data unavailable",
|
|
4
4
|
"instrument": "Instrument",
|
|
5
|
+
"last_updated": "Last updated",
|
|
5
6
|
"long": "Long",
|
|
6
7
|
"long_positions": "Long Positions",
|
|
7
8
|
"open_orders": "Open Orders",
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
"sell_orders": "Sell Orders",
|
|
16
17
|
"short": "Short",
|
|
17
18
|
"short_positions": "Short Positions",
|
|
19
|
+
"today": "Today",
|
|
18
20
|
"zoom_in": "Zoom In",
|
|
19
21
|
"zoom_out": "Zoom Out"
|
|
20
22
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"buy": "買進",
|
|
3
3
|
"data_unavailable": "沒有數據",
|
|
4
4
|
"instrument": "金融工具",
|
|
5
|
+
"last_updated": "最後更新",
|
|
5
6
|
"long": "長",
|
|
6
7
|
"long_positions": "長倉",
|
|
7
8
|
"open_orders": "開盤市價單",
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
"sell_orders": "賣單",
|
|
16
17
|
"short": "短",
|
|
17
18
|
"short_positions": "短倉",
|
|
19
|
+
"today": "今日",
|
|
18
20
|
"zoom_in": "放大",
|
|
19
21
|
"zoom_out": "縮小"
|
|
20
22
|
}
|
package/test/Main.test.tsx
CHANGED
|
@@ -26,6 +26,7 @@ const mocks = [
|
|
|
26
26
|
{
|
|
27
27
|
bucketWidth: 0.0005,
|
|
28
28
|
price: 0.8,
|
|
29
|
+
time: '2024-02-21T10:30:00Z',
|
|
29
30
|
buckets: [
|
|
30
31
|
{
|
|
31
32
|
price: 0.02,
|
|
@@ -68,6 +69,7 @@ const mocks = [
|
|
|
68
69
|
{
|
|
69
70
|
bucketWidth: 0.0005,
|
|
70
71
|
price: 0.8,
|
|
72
|
+
time: '2024-02-21T10:30:00Z',
|
|
71
73
|
buckets: [
|
|
72
74
|
{
|
|
73
75
|
price: 0.02,
|
|
@@ -108,6 +110,7 @@ describe('Main component', () => {
|
|
|
108
110
|
);
|
|
109
111
|
|
|
110
112
|
expect(await findByTestId('order-book-widget')).toBeInTheDocument();
|
|
113
|
+
expect(await findByTestId('info-box')).toHaveTextContent('last_updated: 10:30:00 UTC, today');
|
|
111
114
|
expect((await findByTestId('select'))).toBeInTheDocument();
|
|
112
115
|
});
|
|
113
116
|
it('should render widget component', async () => {
|