@oanda/labs-order-book-widget 1.0.61 → 1.0.62
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 +236 -0
- package/dist/main/OrderBookWidget/components/Chart/Chart.js +4 -3
- package/dist/main/OrderBookWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/OrderBookWidget/components/Chart/getOptions.js +3 -3
- package/dist/main/OrderBookWidget/components/Chart/getOptions.js.map +1 -1
- package/dist/main/gql/getOrderPositionBooks.js +3 -17
- package/dist/main/gql/getOrderPositionBooks.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js +3 -2
- package/dist/main/gql/types/fragment-masking.js.map +1 -1
- package/dist/main/gql/types/gql.js +2 -1
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/module/OrderBookWidget/components/Chart/Chart.js +4 -3
- package/dist/module/OrderBookWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/OrderBookWidget/components/Chart/getOptions.js +3 -3
- package/dist/module/OrderBookWidget/components/Chart/getOptions.js.map +1 -1
- package/dist/module/gql/getOrderPositionBooks.js +3 -17
- package/dist/module/gql/getOrderPositionBooks.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +3 -2
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +2 -1
- package/dist/module/gql/types/gql.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,242 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.0.62 (2024-01-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.61 (2024-01-09)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.60 (2024-01-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.59 (2023-12-27)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.58 (2023-12-22)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.57 (2023-12-22)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.56 (2023-12-21)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.55 (2023-12-19)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.54 (2023-12-15)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.53 (2023-12-13)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.52 (2023-12-13)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.51 (2023-12-07)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.50 (2023-12-04)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.49 (2023-12-01)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.48 (2023-12-01)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.47 (2023-11-29)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.46 (2023-11-28)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.45 (2023-11-23)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.44 (2023-11-22)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.43 (2023-11-15)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 1.0.42 (2023-11-10)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 1.0.41 (2023-11-03)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 1.0.40 (2023-11-02)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 1.0.39 (2023-11-02)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 1.0.38 (2023-10-26)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 1.0.37 (2023-10-26)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1.0.36 (2023-10-25)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 1.0.35 (2023-10-24)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## 1.0.34 (2023-10-23)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## 1.0.33 (2023-10-23)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 1.0.32 (2023-10-23)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 1.0.31 (2023-10-20)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## 1.0.30 (2023-10-19)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## 1.0.29 (2023-10-19)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## 1.0.28 (2023-10-19)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## 1.0.27 (2023-10-18)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## 1.0.26 (2023-10-18)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## 1.0.25 (2023-10-17)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## 1.0.24 (2023-10-13)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## 1.0.23 (2023-10-13)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## 1.0.22 (2023-10-11)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 1.0.21 (2023-10-10)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## 1.0.20 (2023-10-06)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## 1.0.19 (2023-10-06)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## 1.0.18 (2023-10-05)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 1.0.17 (2023-10-04)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## 1.0.16 (2023-10-04)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## 1.0.15 (2023-10-04)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## 1.0.14 (2023-10-03)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## 1.0.13 (2023-10-03)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## 1.0.12 (2023-10-03)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## 1.0.11 (2023-10-02)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
## 1.0.10 (2023-09-29)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## 1.0.9 (2023-09-28)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## 1.0.8 (2023-09-27)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## 1.0.7 (2023-09-26)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## 1.0.6 (2023-09-21)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## 1.0.5 (2023-09-13)
|
|
235
|
+
|
|
236
|
+
**Note:** Version bump only for package @oanda/labs-order-book-widget
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
6
242
|
## 1.0.61 (2024-01-09)
|
|
7
243
|
|
|
8
244
|
|
|
@@ -9,12 +9,13 @@ var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
|
|
|
9
9
|
var _getOptions = require("./getOptions");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const Chart = _ref => {
|
|
12
|
+
var _data$orderPositionBo, _data$orderPositionBo2, _data$orderPositionBo3;
|
|
12
13
|
let {
|
|
13
14
|
data
|
|
14
15
|
} = _ref;
|
|
15
|
-
const buckets = data.orderPositionBooks[0]
|
|
16
|
-
const bucketWidth = data.orderPositionBooks[0]
|
|
17
|
-
const price = data.orderPositionBooks[0]
|
|
16
|
+
const buckets = ((_data$orderPositionBo = data.orderPositionBooks[0]) === null || _data$orderPositionBo === void 0 ? void 0 : _data$orderPositionBo.buckets) || [];
|
|
17
|
+
const bucketWidth = (_data$orderPositionBo2 = data.orderPositionBooks[0]) === null || _data$orderPositionBo2 === void 0 ? void 0 : _data$orderPositionBo2.bucketWidth;
|
|
18
|
+
const price = (_data$orderPositionBo3 = data.orderPositionBooks[0]) === null || _data$orderPositionBo3 === void 0 ? void 0 : _data$orderPositionBo3.price;
|
|
18
19
|
const chartData = buckets.map(item => [item.price, Number(item.longCountPercent), Number(item.shortCountPercent) * -1]);
|
|
19
20
|
return _react.default.createElement("div", {
|
|
20
21
|
className: "lw-relative lw-w-full"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["_react","_interopRequireDefault","require","_echartsForReact","_getOptions","obj","__esModule","default","Chart","_ref","data","buckets","orderPositionBooks","bucketWidth","price","chartData","map","item","Number","longCountPercent","shortCountPercent","createElement","className","style","height","width","option","getOptions","exports"],"sources":["../../../../../src/OrderBookWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React from 'react';\nimport ReactEcharts from 'echarts-for-react';\nimport { getOptions } from './getOptions';\nimport { GetOrderPositionBooksQuery } from '../../../gql/types/graphql';\n\ninterface ChartProps {\n data: GetOrderPositionBooksQuery;\n}\n\nexport const Chart = ({ data }: ChartProps) => {\n const buckets = data.orderPositionBooks[0]?.buckets || [];\n const bucketWidth = data.orderPositionBooks[0]?.bucketWidth;\n const price = data.orderPositionBooks[0]?.price;\n\n const chartData = buckets.map((item) => ([\n item!.price,\n Number(item!.longCountPercent),\n Number(item!.shortCountPercent) * -1,\n ]));\n\n return (\n <div className=\"lw-relative lw-w-full\">\n <div>\n {price && bucketWidth && (\n <ReactEcharts\n style={{\n height: '600px',\n width: '100%',\n }}\n option={getOptions({ data: chartData, price, bucketWidth })}\n />\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAA0C,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAOnC,MAAMG,KAAK,GAAGC,IAAA,IAA0B;EAAA,IAAzB;IAAEC;EAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["_react","_interopRequireDefault","require","_echartsForReact","_getOptions","obj","__esModule","default","Chart","_ref","_data$orderPositionBo","_data$orderPositionBo2","_data$orderPositionBo3","data","buckets","orderPositionBooks","bucketWidth","price","chartData","map","item","Number","longCountPercent","shortCountPercent","createElement","className","style","height","width","option","getOptions","exports"],"sources":["../../../../../src/OrderBookWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React from 'react';\nimport ReactEcharts from 'echarts-for-react';\nimport { getOptions } from './getOptions';\nimport { GetOrderPositionBooksQuery } from '../../../gql/types/graphql';\n\ninterface ChartProps {\n data: GetOrderPositionBooksQuery;\n}\n\nexport const Chart = ({ data }: ChartProps) => {\n const buckets = data.orderPositionBooks[0]?.buckets || [];\n const bucketWidth = data.orderPositionBooks[0]?.bucketWidth;\n const price = data.orderPositionBooks[0]?.price;\n\n const chartData = buckets.map((item) => ([\n item!.price,\n Number(item!.longCountPercent),\n Number(item!.shortCountPercent) * -1,\n ]));\n\n return (\n <div className=\"lw-relative lw-w-full\">\n <div>\n {price && bucketWidth && (\n <ReactEcharts\n style={{\n height: '600px',\n width: '100%',\n }}\n option={getOptions({ data: chartData, price, bucketWidth })}\n />\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAA0C,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAOnC,MAAMG,KAAK,GAAGC,IAAA,IAA0B;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA;EAAA,IAAzB;IAAEC;EAAiB,CAAC,GAAAJ,IAAA;EACxC,MAAMK,OAAO,GAAG,EAAAJ,qBAAA,GAAAG,IAAI,CAACE,kBAAkB,CAAC,CAAC,CAAC,cAAAL,qBAAA,uBAA1BA,qBAAA,CAA4BI,OAAO,KAAI,EAAE;EACzD,MAAME,WAAW,IAAAL,sBAAA,GAAGE,IAAI,CAACE,kBAAkB,CAAC,CAAC,CAAC,cAAAJ,sBAAA,uBAA1BA,sBAAA,CAA4BK,WAAW;EAC3D,MAAMC,KAAK,IAAAL,sBAAA,GAAGC,IAAI,CAACE,kBAAkB,CAAC,CAAC,CAAC,cAAAH,sBAAA,uBAA1BA,sBAAA,CAA4BK,KAAK;EAE/C,MAAMC,SAAS,GAAGJ,OAAO,CAACK,GAAG,CAAEC,IAAI,IAAM,CACvCA,IAAI,CAAEH,KAAK,EACXI,MAAM,CAACD,IAAI,CAAEE,gBAAgB,CAAC,EAC9BD,MAAM,CAACD,IAAI,CAAEG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CACpC,CAAC;EAEH,OACEvB,MAAA,CAAAO,OAAA,CAAAiB,aAAA;IAAKC,SAAS,EAAC;EAAuB,GACpCzB,MAAA,CAAAO,OAAA,CAAAiB,aAAA,cACGP,KAAK,IAAID,WAAW,IACnBhB,MAAA,CAAAO,OAAA,CAAAiB,aAAA,CAACrB,gBAAA,CAAAI,OAAY;IACXmB,KAAK,EAAE;MACLC,MAAM,EAAE,OAAO;MACfC,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAE,IAAAC,sBAAU,EAAC;MAAEjB,IAAI,EAAEK,SAAS;MAAED,KAAK;MAAED;IAAY,CAAC;EAAE,CAC7D,CAEA,CACF,CAAC;AAEV,CAAC;AAACe,OAAA,CAAAvB,KAAA,GAAAA,KAAA"}
|
|
@@ -107,7 +107,7 @@ const getOptions = _ref => {
|
|
|
107
107
|
textStyle: {},
|
|
108
108
|
formatter: params => {
|
|
109
109
|
const values = params[0].data;
|
|
110
|
-
return
|
|
110
|
+
return "Price: ".concat(values[0], "<br />Buy: ").concat(values[1], "%<br/>Sell: ").concat(Math.abs(values[2]), "%");
|
|
111
111
|
},
|
|
112
112
|
axisPointer: {
|
|
113
113
|
axis: 'y'
|
|
@@ -216,7 +216,7 @@ const getOptions = _ref => {
|
|
|
216
216
|
padding: [0, 0, 16, 0]
|
|
217
217
|
}
|
|
218
218
|
},
|
|
219
|
-
formatter: (value, index) => index ?
|
|
219
|
+
formatter: (value, index) => index ? "".concat(value) : "{a|".concat(value, "}")
|
|
220
220
|
}
|
|
221
221
|
},
|
|
222
222
|
xAxis: {
|
|
@@ -236,7 +236,7 @@ const getOptions = _ref => {
|
|
|
236
236
|
padding: [7, 0, 0, 0],
|
|
237
237
|
showMinLabel: false,
|
|
238
238
|
showMaxLabel: false,
|
|
239
|
-
formatter: value => value === 0 ? '%' :
|
|
239
|
+
formatter: value => value === 0 ? '%' : "".concat(Math.abs(value), "%")
|
|
240
240
|
}
|
|
241
241
|
},
|
|
242
242
|
series: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOptions.js","names":["_labsWidgetCommon","require","_constants","getOptions","_ref","data","price","bucketWidth","toolbox","itemSize","itemGap","bottom","right","showTitle","iconStyle","borderColor","emphasis","tooltip","show","backgroundColor","formatter","val","title","position","confine","textStyle","color","feature","myZoomIn","icon","chartSharedOptions","icons","zoomInIcon","onclick","model","instance","startValue","endValue","option","dataZoom","halfZoomValue","ZOOM_BARS","dispatchAction","type","myZoomOut","zoomOutIcon","myResetZoom","resetZoomIcon","INITIAL_BARS","realtime","yAxisIndex","dataset","source","trigger","borderRadius","shadowBlur","shadowOffsetX","shadowOffsetY","shadowColor","params","values","Math","abs","axisPointer","axis","grid","top","left","width","height","graphic","silent","children","z","shape","style","fill","text","yAxis","axisLine","axisTick","splitLine","lineStyle","axisLabel","padding","rich","a","value","index","xAxis","min","max","showMinLabel","showMaxLabel","series","encode","x","y","itemStyle","renderItem","api","yValue","xStart","coord","xEnd","bucketWidthHeight","size","rectShape","markLine","animation","precision","symbol","symbolRotate","symbolSize","label","exports"],"sources":["../../../../../src/OrderBookWidget/components/Chart/getOptions.ts"],"sourcesContent":["import { EChartsOption, Model, EChartsType } from 'echarts';\nimport { chartSharedOptions } from '@oanda/labs-widget-common';\nimport { ZOOM_BARS, INITIAL_BARS } from './constants';\n\nexport const getOptions = (\n {\n data,\n price,\n bucketWidth,\n } :\n {\n data: number[][],\n price: number,\n bucketWidth: number\n },\n): EChartsOption => (\n {\n toolbox: {\n itemSize: 18,\n itemGap: 14,\n bottom: 6,\n right: 6,\n showTitle: false,\n iconStyle: {\n borderColor: '#00214A',\n },\n emphasis: {\n iconStyle: {\n borderColor: '#008573',\n },\n },\n tooltip: {\n show: true,\n backgroundColor: '#00214A',\n formatter: (val) => val.title,\n position: 'top',\n confine: true,\n textStyle: {\n color: '#fff',\n },\n },\n feature: {\n myZoomIn: {\n show: true,\n title: 'Zoom in',\n icon: chartSharedOptions.icons.zoomInIcon,\n onclick: (model: Model, instance: EChartsType) => {\n const { startValue, endValue } = model.option.dataZoom[0];\n // @todo handle zoom with minimal step\n const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;\n\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: startValue + halfZoomValue,\n endValue: endValue - halfZoomValue,\n });\n },\n },\n myZoomOut: {\n show: true,\n title: 'Zoom out',\n icon: chartSharedOptions.icons.zoomOutIcon,\n onclick: (model: Model, instance: EChartsType) => {\n const { startValue, endValue } = model.option.dataZoom[0];\n // @todo handle zoom with full chart range\n const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;\n\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: startValue - halfZoomValue,\n endValue: endValue + halfZoomValue,\n });\n },\n },\n myResetZoom: {\n show: true,\n title: 'ResetZoom',\n icon: chartSharedOptions.icons.resetZoomIcon,\n onclick: (model: Model, instance: EChartsType) => {\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: price - (bucketWidth * INITIAL_BARS * 0.5),\n endValue: price + (bucketWidth * INITIAL_BARS * 0.5),\n });\n },\n },\n },\n },\n dataZoom: [\n {\n type: 'inside',\n realtime: true,\n startValue: price - (bucketWidth * INITIAL_BARS * 0.5),\n endValue: price + (bucketWidth * INITIAL_BARS * 0.5),\n yAxisIndex: 0,\n // @todo\n // minSpan: 2,\n },\n ],\n dataset: {\n source: data,\n },\n textStyle: {\n // @todo, broken due dark mode\n // ...chartSharedOptions.textStyle,\n },\n tooltip: {\n trigger: 'axis',\n borderRadius: 0,\n shadowBlur: 24,\n shadowOffsetX: 0,\n shadowOffsetY: 6,\n shadowColor: 'rgba(0,0,0,0.1)',\n textStyle: {\n // @todo, broken due dark mode\n // ...chartSharedOptions.textStyle,\n },\n formatter: (params) => {\n const values = (params as { data: number[] }[])[0].data;\n return `Price: ${values[0]}<br />Buy: ${values[1]}%<br/>Sell: ${Math.abs(values[2])}%`;\n },\n axisPointer: {\n axis: 'y',\n },\n },\n grid: [\n {\n top: '1px',\n left: '1px',\n right: '121px',\n bottom: '41px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n {\n bottom: '1px',\n right: '1px',\n width: '120px',\n height: '40px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n {\n top: '1px',\n left: '1px',\n right: '1px',\n bottom: '1px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n ],\n graphic: [\n {\n type: 'group',\n left: '8px',\n top: '8px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n left: 'center',\n top: 'middle',\n shape: {\n width: 60,\n height: 30,\n },\n style: {\n fill: '#fff',\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: 'rgba(0,0,0,0.1)',\n },\n },\n {\n type: 'text',\n z: 100,\n left: 'center',\n top: 'middle',\n style: {\n width: 60,\n height: 30,\n // @todo\n text: 'Sell',\n },\n },\n ],\n },\n {\n type: 'group',\n right: '128px',\n top: '8px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 60,\n height: 30,\n },\n style: {\n fill: '#fff',\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: 'rgba(0,0,0,0.1)',\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n width: 60,\n height: 30,\n // @todo\n text: 'Buy',\n },\n },\n ],\n },\n ],\n yAxis: {\n type: 'value',\n position: 'right',\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n lineStyle: {\n // @todo, broken due dark mode\n // color: chartSharedOptions.colors.axis,\n },\n },\n axisLabel: {\n padding: [0, 0, 0, 10],\n rich: {\n a: {\n padding: [0, 0, 16, 0],\n },\n },\n // @todo add decimal places\n formatter: (value, index) => (index ? `${value}` : `{a|${value}}`),\n },\n },\n xAxis: {\n type: 'value',\n // @todo\n min: -1.1,\n max: 1.1,\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n lineStyle: {\n // @todo, broken due dark mode\n // color: chartSharedOptions.colors.axis,\n },\n },\n axisLabel: {\n padding: [7, 0, 0, 0],\n showMinLabel: false,\n showMaxLabel: false,\n formatter: (value) => (value === 0 ? '%' : `${Math.abs(value)}%`),\n },\n },\n series: [\n {\n type: 'custom',\n encode: {\n x: 1,\n y: 0,\n tooltip: 1,\n },\n itemStyle: {\n color: '#00B89E',\n },\n renderItem: (params, api) => {\n const yValue = api.value(0);\n const xStart = api.coord([api.value(1), yValue]);\n const xEnd = api.coord([0, yValue]);\n const bucketWidthHeight = api.size ? (api.size([0, bucketWidth]) as number[])[1] : 0;\n const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;\n\n const rectShape = {\n x: xStart[0] + 0.5,\n y: xStart[1] - height / 2,\n width: xEnd[0] - xStart[0],\n height,\n };\n\n return {\n type: 'rect',\n shape: rectShape,\n style: api.style(),\n };\n },\n },\n {\n type: 'custom',\n encode: {\n x: 1,\n y: 0,\n tooltip: 2,\n },\n markLine: {\n animation: false,\n silent: true,\n // @todo confirm precision\n precision: 4,\n symbol: ['none', 'triangle'],\n symbolRotate: 90,\n symbolSize: [20, 10],\n lineStyle: {\n color: '#008573',\n width: 1,\n },\n label: {\n padding: [5, 15, 5, 15],\n color: '#fff',\n backgroundColor: '#008573',\n },\n data: [\n {\n yAxis: price,\n },\n ],\n },\n itemStyle: {\n color: '#E5226E',\n },\n renderItem: (params, api) => {\n const yValue = api.value(0);\n const xStart = api.coord([api.value(2), yValue]);\n const xEnd = api.coord([0, yValue]);\n const bucketWidthHeight = api.size ? (api.size([0, bucketWidth]) as number[])[1] : 0;\n const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;\n\n const rectShape = {\n x: xStart[0] - 0.5,\n y: xStart[1] - height / 2,\n width: xEnd[0] - xStart[0],\n height,\n };\n\n return {\n type: 'rect',\n shape: rectShape,\n style: api.style(),\n };\n },\n },\n ],\n }\n);\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEO,MAAME,UAAU,GAAGC,IAAA;EAAA,IACxB;IACEC,IAAI;IACJC,KAAK;IACLC;EAMF,CAAC,GAAAH,IAAA;EAAA,OAED;IACEI,OAAO,EAAE;MACPC,QAAQ,EAAE,EAAE;MACZC,OAAO,EAAE,EAAE;MACXC,MAAM,EAAE,CAAC;MACTC,KAAK,EAAE,CAAC;MACRC,SAAS,EAAE,KAAK;MAChBC,SAAS,EAAE;QACTC,WAAW,EAAE;MACf,CAAC;MACDC,QAAQ,EAAE;QACRF,SAAS,EAAE;UACTC,WAAW,EAAE;QACf;MACF,CAAC;MACDE,OAAO,EAAE;QACPC,IAAI,EAAE,IAAI;QACVC,eAAe,EAAE,SAAS;QAC1BC,SAAS,EAAGC,GAAG,IAAKA,GAAG,CAACC,KAAK;QAC7BC,QAAQ,EAAE,KAAK;QACfC,OAAO,EAAE,IAAI;QACbC,SAAS,EAAE;UACTC,KAAK,EAAE;QACT;MACF,CAAC;MACDC,OAAO,EAAE;QACPC,QAAQ,EAAE;UACRV,IAAI,EAAE,IAAI;UACVI,KAAK,EAAE,SAAS;UAChBO,IAAI,EAAEC,oCAAkB,CAACC,KAAK,CAACC,UAAU;UACzCC,OAAO,EAAEA,CAACC,KAAY,EAAEC,QAAqB,KAAK;YAChD,MAAM;cAAEC,UAAU;cAAEC;YAAS,CAAC,GAAGH,KAAK,CAACI,MAAM,CAACC,QAAQ,CAAC,CAAC,CAAC;YAEzD,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K,MAAM,CAAC,CAAC,CAAC,GAAGjC,MAAM,GAAG,CAAC;UACzBD,KAAK,EAAEoC,IAAI,CAAC,CAAC,CAAC,GAAGF,MAAM,CAAC,CAAC,CAAC;UAC1BjC;QACF,CAAC;QAED,OAAO;UACL1B,IAAI,EAAE,MAAM;UACZ+B,KAAK,EAAEiC,SAAS;UAChBhC,KAAK,EAAEyB,GAAG,CAACzB,KAAK,CAAC;QACnB,CAAC;MACH;IACF,CAAC;EAEL,CAAC;AAAA,CACF;AAACwC,OAAA,CAAAhH,UAAA,GAAAA,UAAA"}
|
|
1
|
+
{"version":3,"file":"getOptions.js","names":["_labsWidgetCommon","require","_constants","getOptions","_ref","data","price","bucketWidth","toolbox","itemSize","itemGap","bottom","right","showTitle","iconStyle","borderColor","emphasis","tooltip","show","backgroundColor","formatter","val","title","position","confine","textStyle","color","feature","myZoomIn","icon","chartSharedOptions","icons","zoomInIcon","onclick","model","instance","startValue","endValue","option","dataZoom","halfZoomValue","ZOOM_BARS","dispatchAction","type","myZoomOut","zoomOutIcon","myResetZoom","resetZoomIcon","INITIAL_BARS","realtime","yAxisIndex","dataset","source","trigger","borderRadius","shadowBlur","shadowOffsetX","shadowOffsetY","shadowColor","params","values","concat","Math","abs","axisPointer","axis","grid","top","left","width","height","graphic","silent","children","z","shape","style","fill","text","yAxis","axisLine","axisTick","splitLine","lineStyle","axisLabel","padding","rich","a","value","index","xAxis","min","max","showMinLabel","showMaxLabel","series","encode","x","y","itemStyle","renderItem","api","yValue","xStart","coord","xEnd","bucketWidthHeight","size","rectShape","markLine","animation","precision","symbol","symbolRotate","symbolSize","label","exports"],"sources":["../../../../../src/OrderBookWidget/components/Chart/getOptions.ts"],"sourcesContent":["import { EChartsOption, Model, EChartsType } from 'echarts';\nimport { chartSharedOptions } from '@oanda/labs-widget-common';\nimport { ZOOM_BARS, INITIAL_BARS } from './constants';\n\nexport const getOptions = (\n {\n data,\n price,\n bucketWidth,\n } :\n {\n data: number[][],\n price: number,\n bucketWidth: number\n },\n): EChartsOption => (\n {\n toolbox: {\n itemSize: 18,\n itemGap: 14,\n bottom: 6,\n right: 6,\n showTitle: false,\n iconStyle: {\n borderColor: '#00214A',\n },\n emphasis: {\n iconStyle: {\n borderColor: '#008573',\n },\n },\n tooltip: {\n show: true,\n backgroundColor: '#00214A',\n formatter: (val) => val.title,\n position: 'top',\n confine: true,\n textStyle: {\n color: '#fff',\n },\n },\n feature: {\n myZoomIn: {\n show: true,\n title: 'Zoom in',\n icon: chartSharedOptions.icons.zoomInIcon,\n onclick: (model: Model, instance: EChartsType) => {\n const { startValue, endValue } = model.option.dataZoom[0];\n // @todo handle zoom with minimal step\n const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;\n\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: startValue + halfZoomValue,\n endValue: endValue - halfZoomValue,\n });\n },\n },\n myZoomOut: {\n show: true,\n title: 'Zoom out',\n icon: chartSharedOptions.icons.zoomOutIcon,\n onclick: (model: Model, instance: EChartsType) => {\n const { startValue, endValue } = model.option.dataZoom[0];\n // @todo handle zoom with full chart range\n const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;\n\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: startValue - halfZoomValue,\n endValue: endValue + halfZoomValue,\n });\n },\n },\n myResetZoom: {\n show: true,\n title: 'ResetZoom',\n icon: chartSharedOptions.icons.resetZoomIcon,\n onclick: (model: Model, instance: EChartsType) => {\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: price - (bucketWidth * INITIAL_BARS * 0.5),\n endValue: price + (bucketWidth * INITIAL_BARS * 0.5),\n });\n },\n },\n },\n },\n dataZoom: [\n {\n type: 'inside',\n realtime: true,\n startValue: price - (bucketWidth * INITIAL_BARS * 0.5),\n endValue: price + (bucketWidth * INITIAL_BARS * 0.5),\n yAxisIndex: 0,\n // @todo\n // minSpan: 2,\n },\n ],\n dataset: {\n source: data,\n },\n textStyle: {\n // @todo, broken due dark mode\n // ...chartSharedOptions.textStyle,\n },\n tooltip: {\n trigger: 'axis',\n borderRadius: 0,\n shadowBlur: 24,\n shadowOffsetX: 0,\n shadowOffsetY: 6,\n shadowColor: 'rgba(0,0,0,0.1)',\n textStyle: {\n // @todo, broken due dark mode\n // ...chartSharedOptions.textStyle,\n },\n formatter: (params) => {\n const values = (params as { data: number[] }[])[0].data;\n return `Price: ${values[0]}<br />Buy: ${values[1]}%<br/>Sell: ${Math.abs(values[2])}%`;\n },\n axisPointer: {\n axis: 'y',\n },\n },\n grid: [\n {\n top: '1px',\n left: '1px',\n right: '121px',\n bottom: '41px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n {\n bottom: '1px',\n right: '1px',\n width: '120px',\n height: '40px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n {\n top: '1px',\n left: '1px',\n right: '1px',\n bottom: '1px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n ],\n graphic: [\n {\n type: 'group',\n left: '8px',\n top: '8px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n left: 'center',\n top: 'middle',\n shape: {\n width: 60,\n height: 30,\n },\n style: {\n fill: '#fff',\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: 'rgba(0,0,0,0.1)',\n },\n },\n {\n type: 'text',\n z: 100,\n left: 'center',\n top: 'middle',\n style: {\n width: 60,\n height: 30,\n // @todo\n text: 'Sell',\n },\n },\n ],\n },\n {\n type: 'group',\n right: '128px',\n top: '8px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 60,\n height: 30,\n },\n style: {\n fill: '#fff',\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: 'rgba(0,0,0,0.1)',\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n width: 60,\n height: 30,\n // @todo\n text: 'Buy',\n },\n },\n ],\n },\n ],\n yAxis: {\n type: 'value',\n position: 'right',\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n lineStyle: {\n // @todo, broken due dark mode\n // color: chartSharedOptions.colors.axis,\n },\n },\n axisLabel: {\n padding: [0, 0, 0, 10],\n rich: {\n a: {\n padding: [0, 0, 16, 0],\n },\n },\n // @todo add decimal places\n formatter: (value, index) => (index ? `${value}` : `{a|${value}}`),\n },\n },\n xAxis: {\n type: 'value',\n // @todo\n min: -1.1,\n max: 1.1,\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n lineStyle: {\n // @todo, broken due dark mode\n // color: chartSharedOptions.colors.axis,\n },\n },\n axisLabel: {\n padding: [7, 0, 0, 0],\n showMinLabel: false,\n showMaxLabel: false,\n formatter: (value) => (value === 0 ? '%' : `${Math.abs(value)}%`),\n },\n },\n series: [\n {\n type: 'custom',\n encode: {\n x: 1,\n y: 0,\n tooltip: 1,\n },\n itemStyle: {\n color: '#00B89E',\n },\n renderItem: (params, api) => {\n const yValue = api.value(0);\n const xStart = api.coord([api.value(1), yValue]);\n const xEnd = api.coord([0, yValue]);\n const bucketWidthHeight = api.size ? (api.size([0, bucketWidth]) as number[])[1] : 0;\n const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;\n\n const rectShape = {\n x: xStart[0] + 0.5,\n y: xStart[1] - height / 2,\n width: xEnd[0] - xStart[0],\n height,\n };\n\n return {\n type: 'rect',\n shape: rectShape,\n style: api.style(),\n };\n },\n },\n {\n type: 'custom',\n encode: {\n x: 1,\n y: 0,\n tooltip: 2,\n },\n markLine: {\n animation: false,\n silent: true,\n // @todo confirm precision\n precision: 4,\n symbol: ['none', 'triangle'],\n symbolRotate: 90,\n symbolSize: [20, 10],\n lineStyle: {\n color: '#008573',\n width: 1,\n },\n label: {\n padding: [5, 15, 5, 15],\n color: '#fff',\n backgroundColor: '#008573',\n },\n data: [\n {\n yAxis: price,\n },\n ],\n },\n itemStyle: {\n color: '#E5226E',\n },\n renderItem: (params, api) => {\n const yValue = api.value(0);\n const xStart = api.coord([api.value(2), yValue]);\n const xEnd = api.coord([0, yValue]);\n const bucketWidthHeight = api.size ? (api.size([0, bucketWidth]) as number[])[1] : 0;\n const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;\n\n const rectShape = {\n x: xStart[0] - 0.5,\n y: xStart[1] - height / 2,\n width: xEnd[0] - xStart[0],\n height,\n };\n\n return {\n type: 'rect',\n shape: rectShape,\n style: api.style(),\n };\n },\n },\n ],\n }\n);\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEO,MAAME,UAAU,GAAGC,IAAA;EAAA,IACxB;IACEC,IAAI;IACJC,KAAK;IACLC;EAMF,CAAC,GAAAH,IAAA;EAAA,OAED;IACEI,OAAO,EAAE;MACPC,QAAQ,EAAE,EAAE;MACZC,OAAO,EAAE,EAAE;MACXC,MAAM,EAAE,CAAC;MACTC,KAAK,EAAE,CAAC;MACRC,SAAS,EAAE,KAAK;MAChBC,SAAS,EAAE;QACTC,WAAW,EAAE;MACf,CAAC;MACDC,QAAQ,EAAE;QACRF,SAAS,EAAE;UACTC,WAAW,EAAE;QACf;MACF,CAAC;MACDE,OAAO,EAAE;QACPC,IAAI,EAAE,IAAI;QACVC,eAAe,EAAE,SAAS;QAC1BC,SAAS,EAAGC,GAAG,IAAKA,GAAG,CAACC,KAAK;QAC7BC,QAAQ,EAAE,KAAK;QACfC,OAAO,EAAE,IAAI;QACbC,SAAS,EAAE;UACTC,KAAK,EAAE;QACT;MACF,CAAC;MACDC,OAAO,EAAE;QACPC,QAAQ,EAAE;UACRV,IAAI,EAAE,IAAI;UACVI,KAAK,EAAE,SAAS;UAChBO,IAAI,EAAEC,oCAAkB,CAACC,KAAK,CAACC,UAAU;UACzCC,OAAO,EAAEA,CAACC,KAAY,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AM+D,MAAM,GAAGoC,iBAAiB,GAAG,CAAC,GAAGA,iBAAiB,GAAG,GAAG,GAAGA,iBAAiB;QAElF,MAAME,SAAS,GAAG;UAChBX,CAAC,EAAEM,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG;UAClBL,CAAC,EAAEK,MAAM,CAAC,CAAC,CAAC,GAAGjC,MAAM,GAAG,CAAC;UACzBD,KAAK,EAAEoC,IAAI,CAAC,CAAC,CAAC,GAAGF,MAAM,CAAC,CAAC,CAAC;UAC1BjC;QACF,CAAC;QAED,OAAO;UACL3B,IAAI,EAAE,MAAM;UACZgC,KAAK,EAAEiC,SAAS;UAChBhC,KAAK,EAAEyB,GAAG,CAACzB,KAAK,CAAC;QACnB,CAAC;MACH;IACF,CAAC;EAEL,CAAC;AAAA,CACF;AAACwC,OAAA,CAAAjH,UAAA,GAAAA,UAAA"}
|
|
@@ -5,21 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getOrderPositionBooks = void 0;
|
|
7
7
|
var _client = require("@apollo/client");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
orderPositionBooks(
|
|
11
|
-
instrument: $instrument
|
|
12
|
-
bookType: $bookType
|
|
13
|
-
recentHours: $recentHours
|
|
14
|
-
) {
|
|
15
|
-
bucketWidth
|
|
16
|
-
price
|
|
17
|
-
buckets {
|
|
18
|
-
price
|
|
19
|
-
longCountPercent
|
|
20
|
-
shortCountPercent
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
8
|
+
var _templateObject;
|
|
9
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
10
|
+
const getOrderPositionBooks = exports.getOrderPositionBooks = (0, _client.gql)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])));
|
|
25
11
|
//# sourceMappingURL=getOrderPositionBooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrderPositionBooks.js","names":["_client","require","getOrderPositionBooks","exports","gql"],"sources":["../../../src/gql/getOrderPositionBooks.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst getOrderPositionBooks = gql`\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`;\n\nexport { getOrderPositionBooks };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"file":"getOrderPositionBooks.js","names":["_client","require","_templateObject","_taggedTemplateLiteral","strings","raw","slice","Object","freeze","defineProperties","value","getOrderPositionBooks","exports","gql"],"sources":["../../../src/gql/getOrderPositionBooks.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst getOrderPositionBooks = gql`\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`;\n\nexport { getOrderPositionBooks };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAqC,IAAAC,eAAA;AAAA,SAAAC,uBAAAC,OAAA,EAAAC,GAAA,SAAAA,GAAA,IAAAA,GAAA,GAAAD,OAAA,CAAAE,KAAA,cAAAC,MAAA,CAAAC,MAAA,CAAAD,MAAA,CAAAE,gBAAA,CAAAL,OAAA,IAAAC,GAAA,IAAAK,KAAA,EAAAH,MAAA,CAAAC,MAAA,CAAAH,GAAA;AAErC,MAAMM,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,OAAGE,WAAG,EAAAX,eAAA,KAAAA,eAAA,GAAAC,sBAAA,iXAgBhC"}
|
|
@@ -13,10 +13,11 @@ function makeFragmentData(data, _fragment) {
|
|
|
13
13
|
return data;
|
|
14
14
|
}
|
|
15
15
|
function isFragmentReady(queryNode, fragmentNode, data) {
|
|
16
|
-
|
|
16
|
+
var _meta__, _fragDef$name;
|
|
17
|
+
const deferredFields = (_meta__ = queryNode.__meta__) === null || _meta__ === void 0 ? void 0 : _meta__.deferredFields;
|
|
17
18
|
if (!deferredFields) return true;
|
|
18
19
|
const fragDef = fragmentNode.definitions[0];
|
|
19
|
-
const fragName = fragDef
|
|
20
|
+
const fragName = fragDef === null || fragDef === void 0 || (_fragDef$name = fragDef.name) === null || _fragDef$name === void 0 ? void 0 : _fragDef$name.value;
|
|
20
21
|
const fields = fragName && deferredFields[fragName] || [];
|
|
21
22
|
return fields.length > 0 && fields.every(field => data && field in data);
|
|
22
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\n\nexport type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<\n infer TType,\n any\n>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__\n ?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every(field => data && field in data);\n}\n"],"mappings":";;;;;;;;AAoCO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAAmJ,EAClG;EACjD,OAAOA,YAAY;AACrB;AAGO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAAiF,EACtC;EAC3C,
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","_meta__","_fragDef$name","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\n\nexport type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<\n infer TType,\n any\n>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__\n ?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every(field => data && field in data);\n}\n"],"mappings":";;;;;;;;AAoCO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAAmJ,EAClG;EACjD,OAAOA,YAAY;AACrB;AAGO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAAiF,EACtC;EAAA,IAAAK,OAAA,EAAAC,aAAA;EAC3C,MAAMC,cAAc,IAAAF,OAAA,GAAIF,SAAS,CAAwEK,QAAQ,cAAAH,OAAA,uBAA1FA,OAAA,CACnBE,cAAc;EAElB,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGL,YAAY,CAACM,WAAW,CAAC,CAAC,CAAuC;EACjF,MAAMC,QAAQ,GAAGF,OAAO,aAAPA,OAAO,gBAAAH,aAAA,GAAPG,OAAO,CAAEG,IAAI,cAAAN,aAAA,uBAAbA,aAAA,CAAeO,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAACC,KAAK,IAAIjB,IAAI,IAAIiB,KAAK,IAAIjB,IAAI,CAAC;AAC1E"}
|
|
@@ -11,6 +11,7 @@ const documents = {
|
|
|
11
11
|
"\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
|
|
12
12
|
};
|
|
13
13
|
function graphql(source) {
|
|
14
|
-
|
|
14
|
+
var _source;
|
|
15
|
+
return (_source = documents[source]) !== null && _source !== void 0 ? _source : {};
|
|
15
16
|
}
|
|
16
17
|
//# sourceMappingURL=gql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","documents","GetOrderPositionBooksDocument","graphql","source"],"sources":["../../../../src/gql/types/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n \"\\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,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport 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\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAanC,MAAMY,SAAS,GAAG;EACd,2WAA2W,EAAExB,KAAK,CAACyB;AACvX,CAAC;AAqBM,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","documents","GetOrderPositionBooksDocument","graphql","source","_source"],"sources":["../../../../src/gql/types/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n \"\\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,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport 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\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAanC,MAAMY,SAAS,GAAG;EACd,2WAA2W,EAAExB,KAAK,CAACyB;AACvX,CAAC;AAqBM,SAASC,OAAOA,CAACC,MAAc,EAAE;EAAA,IAAAC,OAAA;EACtC,QAAAA,OAAA,GAAQJ,SAAS,CAASG,MAAM,CAAC,cAAAC,OAAA,cAAAA,OAAA,GAAI,CAAC,CAAC;AACzC"}
|
|
@@ -2,12 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import ReactEcharts from 'echarts-for-react';
|
|
3
3
|
import { getOptions } from './getOptions';
|
|
4
4
|
export const Chart = _ref => {
|
|
5
|
+
var _data$orderPositionBo, _data$orderPositionBo2, _data$orderPositionBo3;
|
|
5
6
|
let {
|
|
6
7
|
data
|
|
7
8
|
} = _ref;
|
|
8
|
-
const buckets = data.orderPositionBooks[0]
|
|
9
|
-
const bucketWidth = data.orderPositionBooks[0]
|
|
10
|
-
const price = data.orderPositionBooks[0]
|
|
9
|
+
const buckets = ((_data$orderPositionBo = data.orderPositionBooks[0]) === null || _data$orderPositionBo === void 0 ? void 0 : _data$orderPositionBo.buckets) || [];
|
|
10
|
+
const bucketWidth = (_data$orderPositionBo2 = data.orderPositionBooks[0]) === null || _data$orderPositionBo2 === void 0 ? void 0 : _data$orderPositionBo2.bucketWidth;
|
|
11
|
+
const price = (_data$orderPositionBo3 = data.orderPositionBooks[0]) === null || _data$orderPositionBo3 === void 0 ? void 0 : _data$orderPositionBo3.price;
|
|
11
12
|
const chartData = buckets.map(item => [item.price, Number(item.longCountPercent), Number(item.shortCountPercent) * -1]);
|
|
12
13
|
return React.createElement("div", {
|
|
13
14
|
className: "lw-relative lw-w-full"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["React","ReactEcharts","getOptions","Chart","_ref","data","buckets","orderPositionBooks","bucketWidth","price","chartData","map","item","Number","longCountPercent","shortCountPercent","createElement","className","style","height","width","option"],"sources":["../../../../../src/OrderBookWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React from 'react';\nimport ReactEcharts from 'echarts-for-react';\nimport { getOptions } from './getOptions';\nimport { GetOrderPositionBooksQuery } from '../../../gql/types/graphql';\n\ninterface ChartProps {\n data: GetOrderPositionBooksQuery;\n}\n\nexport const Chart = ({ data }: ChartProps) => {\n const buckets = data.orderPositionBooks[0]?.buckets || [];\n const bucketWidth = data.orderPositionBooks[0]?.bucketWidth;\n const price = data.orderPositionBooks[0]?.price;\n\n const chartData = buckets.map((item) => ([\n item!.price,\n Number(item!.longCountPercent),\n Number(item!.shortCountPercent) * -1,\n ]));\n\n return (\n <div className=\"lw-relative lw-w-full\">\n <div>\n {price && bucketWidth && (\n <ReactEcharts\n style={{\n height: '600px',\n width: '100%',\n }}\n option={getOptions({ data: chartData, price, bucketWidth })}\n />\n )}\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,YAAY,MAAM,mBAAmB;AAC5C,SAASC,UAAU,QAAQ,cAAc;AAOzC,OAAO,MAAMC,KAAK,GAAGC,IAAA,IAA0B;EAAA,IAAzB;IAAEC;EAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["React","ReactEcharts","getOptions","Chart","_ref","_data$orderPositionBo","_data$orderPositionBo2","_data$orderPositionBo3","data","buckets","orderPositionBooks","bucketWidth","price","chartData","map","item","Number","longCountPercent","shortCountPercent","createElement","className","style","height","width","option"],"sources":["../../../../../src/OrderBookWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React from 'react';\nimport ReactEcharts from 'echarts-for-react';\nimport { getOptions } from './getOptions';\nimport { GetOrderPositionBooksQuery } from '../../../gql/types/graphql';\n\ninterface ChartProps {\n data: GetOrderPositionBooksQuery;\n}\n\nexport const Chart = ({ data }: ChartProps) => {\n const buckets = data.orderPositionBooks[0]?.buckets || [];\n const bucketWidth = data.orderPositionBooks[0]?.bucketWidth;\n const price = data.orderPositionBooks[0]?.price;\n\n const chartData = buckets.map((item) => ([\n item!.price,\n Number(item!.longCountPercent),\n Number(item!.shortCountPercent) * -1,\n ]));\n\n return (\n <div className=\"lw-relative lw-w-full\">\n <div>\n {price && bucketWidth && (\n <ReactEcharts\n style={{\n height: '600px',\n width: '100%',\n }}\n option={getOptions({ data: chartData, price, bucketWidth })}\n />\n )}\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,YAAY,MAAM,mBAAmB;AAC5C,SAASC,UAAU,QAAQ,cAAc;AAOzC,OAAO,MAAMC,KAAK,GAAGC,IAAA,IAA0B;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA;EAAA,IAAzB;IAAEC;EAAiB,CAAC,GAAAJ,IAAA;EACxC,MAAMK,OAAO,GAAG,EAAAJ,qBAAA,GAAAG,IAAI,CAACE,kBAAkB,CAAC,CAAC,CAAC,cAAAL,qBAAA,uBAA1BA,qBAAA,CAA4BI,OAAO,KAAI,EAAE;EACzD,MAAME,WAAW,IAAAL,sBAAA,GAAGE,IAAI,CAACE,kBAAkB,CAAC,CAAC,CAAC,cAAAJ,sBAAA,uBAA1BA,sBAAA,CAA4BK,WAAW;EAC3D,MAAMC,KAAK,IAAAL,sBAAA,GAAGC,IAAI,CAACE,kBAAkB,CAAC,CAAC,CAAC,cAAAH,sBAAA,uBAA1BA,sBAAA,CAA4BK,KAAK;EAE/C,MAAMC,SAAS,GAAGJ,OAAO,CAACK,GAAG,CAAEC,IAAI,IAAM,CACvCA,IAAI,CAAEH,KAAK,EACXI,MAAM,CAACD,IAAI,CAAEE,gBAAgB,CAAC,EAC9BD,MAAM,CAACD,IAAI,CAAEG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CACpC,CAAC;EAEH,OACElB,KAAA,CAAAmB,aAAA;IAAKC,SAAS,EAAC;EAAuB,GACpCpB,KAAA,CAAAmB,aAAA,cACGP,KAAK,IAAID,WAAW,IACnBX,KAAA,CAAAmB,aAAA,CAAClB,YAAY;IACXoB,KAAK,EAAE;MACLC,MAAM,EAAE,OAAO;MACfC,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAEtB,UAAU,CAAC;MAAEM,IAAI,EAAEK,SAAS;MAAED,KAAK;MAAED;IAAY,CAAC;EAAE,CAC7D,CAEA,CACF,CAAC;AAEV,CAAC"}
|
|
@@ -101,7 +101,7 @@ export const getOptions = _ref => {
|
|
|
101
101
|
textStyle: {},
|
|
102
102
|
formatter: params => {
|
|
103
103
|
const values = params[0].data;
|
|
104
|
-
return
|
|
104
|
+
return "Price: ".concat(values[0], "<br />Buy: ").concat(values[1], "%<br/>Sell: ").concat(Math.abs(values[2]), "%");
|
|
105
105
|
},
|
|
106
106
|
axisPointer: {
|
|
107
107
|
axis: 'y'
|
|
@@ -210,7 +210,7 @@ export const getOptions = _ref => {
|
|
|
210
210
|
padding: [0, 0, 16, 0]
|
|
211
211
|
}
|
|
212
212
|
},
|
|
213
|
-
formatter: (value, index) => index ?
|
|
213
|
+
formatter: (value, index) => index ? "".concat(value) : "{a|".concat(value, "}")
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
216
|
xAxis: {
|
|
@@ -230,7 +230,7 @@ export const getOptions = _ref => {
|
|
|
230
230
|
padding: [7, 0, 0, 0],
|
|
231
231
|
showMinLabel: false,
|
|
232
232
|
showMaxLabel: false,
|
|
233
|
-
formatter: value => value === 0 ? '%' :
|
|
233
|
+
formatter: value => value === 0 ? '%' : "".concat(Math.abs(value), "%")
|
|
234
234
|
}
|
|
235
235
|
},
|
|
236
236
|
series: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOptions.js","names":["chartSharedOptions","ZOOM_BARS","INITIAL_BARS","getOptions","_ref","data","price","bucketWidth","toolbox","itemSize","itemGap","bottom","right","showTitle","iconStyle","borderColor","emphasis","tooltip","show","backgroundColor","formatter","val","title","position","confine","textStyle","color","feature","myZoomIn","icon","icons","zoomInIcon","onclick","model","instance","startValue","endValue","option","dataZoom","halfZoomValue","dispatchAction","type","myZoomOut","zoomOutIcon","myResetZoom","resetZoomIcon","realtime","yAxisIndex","dataset","source","trigger","borderRadius","shadowBlur","shadowOffsetX","shadowOffsetY","shadowColor","params","values","Math","abs","axisPointer","axis","grid","top","left","width","height","graphic","silent","children","z","shape","style","fill","text","yAxis","axisLine","axisTick","splitLine","lineStyle","axisLabel","padding","rich","a","value","index","xAxis","min","max","showMinLabel","showMaxLabel","series","encode","x","y","itemStyle","renderItem","api","yValue","xStart","coord","xEnd","bucketWidthHeight","size","rectShape","markLine","animation","precision","symbol","symbolRotate","symbolSize","label"],"sources":["../../../../../src/OrderBookWidget/components/Chart/getOptions.ts"],"sourcesContent":["import { EChartsOption, Model, EChartsType } from 'echarts';\nimport { chartSharedOptions } from '@oanda/labs-widget-common';\nimport { ZOOM_BARS, INITIAL_BARS } from './constants';\n\nexport const getOptions = (\n {\n data,\n price,\n bucketWidth,\n } :\n {\n data: number[][],\n price: number,\n bucketWidth: number\n },\n): EChartsOption => (\n {\n toolbox: {\n itemSize: 18,\n itemGap: 14,\n bottom: 6,\n right: 6,\n showTitle: false,\n iconStyle: {\n borderColor: '#00214A',\n },\n emphasis: {\n iconStyle: {\n borderColor: '#008573',\n },\n },\n tooltip: {\n show: true,\n backgroundColor: '#00214A',\n formatter: (val) => val.title,\n position: 'top',\n confine: true,\n textStyle: {\n color: '#fff',\n },\n },\n feature: {\n myZoomIn: {\n show: true,\n title: 'Zoom in',\n icon: chartSharedOptions.icons.zoomInIcon,\n onclick: (model: Model, instance: EChartsType) => {\n const { startValue, endValue } = model.option.dataZoom[0];\n // @todo handle zoom with minimal step\n const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;\n\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: startValue + halfZoomValue,\n endValue: endValue - halfZoomValue,\n });\n },\n },\n myZoomOut: {\n show: true,\n title: 'Zoom out',\n icon: chartSharedOptions.icons.zoomOutIcon,\n onclick: (model: Model, instance: EChartsType) => {\n const { startValue, endValue } = model.option.dataZoom[0];\n // @todo handle zoom with full chart range\n const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;\n\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: startValue - halfZoomValue,\n endValue: endValue + halfZoomValue,\n });\n },\n },\n myResetZoom: {\n show: true,\n title: 'ResetZoom',\n icon: chartSharedOptions.icons.resetZoomIcon,\n onclick: (model: Model, instance: EChartsType) => {\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: price - (bucketWidth * INITIAL_BARS * 0.5),\n endValue: price + (bucketWidth * INITIAL_BARS * 0.5),\n });\n },\n },\n },\n },\n dataZoom: [\n {\n type: 'inside',\n realtime: true,\n startValue: price - (bucketWidth * INITIAL_BARS * 0.5),\n endValue: price + (bucketWidth * INITIAL_BARS * 0.5),\n yAxisIndex: 0,\n // @todo\n // minSpan: 2,\n },\n ],\n dataset: {\n source: data,\n },\n textStyle: {\n // @todo, broken due dark mode\n // ...chartSharedOptions.textStyle,\n },\n tooltip: {\n trigger: 'axis',\n borderRadius: 0,\n shadowBlur: 24,\n shadowOffsetX: 0,\n shadowOffsetY: 6,\n shadowColor: 'rgba(0,0,0,0.1)',\n textStyle: {\n // @todo, broken due dark mode\n // ...chartSharedOptions.textStyle,\n },\n formatter: (params) => {\n const values = (params as { data: number[] }[])[0].data;\n return `Price: ${values[0]}<br />Buy: ${values[1]}%<br/>Sell: ${Math.abs(values[2])}%`;\n },\n axisPointer: {\n axis: 'y',\n },\n },\n grid: [\n {\n top: '1px',\n left: '1px',\n right: '121px',\n bottom: '41px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n {\n bottom: '1px',\n right: '1px',\n width: '120px',\n height: '40px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n {\n top: '1px',\n left: '1px',\n right: '1px',\n bottom: '1px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n ],\n graphic: [\n {\n type: 'group',\n left: '8px',\n top: '8px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n left: 'center',\n top: 'middle',\n shape: {\n width: 60,\n height: 30,\n },\n style: {\n fill: '#fff',\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: 'rgba(0,0,0,0.1)',\n },\n },\n {\n type: 'text',\n z: 100,\n left: 'center',\n top: 'middle',\n style: {\n width: 60,\n height: 30,\n // @todo\n text: 'Sell',\n },\n },\n ],\n },\n {\n type: 'group',\n right: '128px',\n top: '8px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 60,\n height: 30,\n },\n style: {\n fill: '#fff',\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: 'rgba(0,0,0,0.1)',\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n width: 60,\n height: 30,\n // @todo\n text: 'Buy',\n },\n },\n ],\n },\n ],\n yAxis: {\n type: 'value',\n position: 'right',\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n lineStyle: {\n // @todo, broken due dark mode\n // color: chartSharedOptions.colors.axis,\n },\n },\n axisLabel: {\n padding: [0, 0, 0, 10],\n rich: {\n a: {\n padding: [0, 0, 16, 0],\n },\n },\n // @todo add decimal places\n formatter: (value, index) => (index ? `${value}` : `{a|${value}}`),\n },\n },\n xAxis: {\n type: 'value',\n // @todo\n min: -1.1,\n max: 1.1,\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n lineStyle: {\n // @todo, broken due dark mode\n // color: chartSharedOptions.colors.axis,\n },\n },\n axisLabel: {\n padding: [7, 0, 0, 0],\n showMinLabel: false,\n showMaxLabel: false,\n formatter: (value) => (value === 0 ? '%' : `${Math.abs(value)}%`),\n },\n },\n series: [\n {\n type: 'custom',\n encode: {\n x: 1,\n y: 0,\n tooltip: 1,\n },\n itemStyle: {\n color: '#00B89E',\n },\n renderItem: (params, api) => {\n const yValue = api.value(0);\n const xStart = api.coord([api.value(1), yValue]);\n const xEnd = api.coord([0, yValue]);\n const bucketWidthHeight = api.size ? (api.size([0, bucketWidth]) as number[])[1] : 0;\n const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;\n\n const rectShape = {\n x: xStart[0] + 0.5,\n y: xStart[1] - height / 2,\n width: xEnd[0] - xStart[0],\n height,\n };\n\n return {\n type: 'rect',\n shape: rectShape,\n style: api.style(),\n };\n },\n },\n {\n type: 'custom',\n encode: {\n x: 1,\n y: 0,\n tooltip: 2,\n },\n markLine: {\n animation: false,\n silent: true,\n // @todo confirm precision\n precision: 4,\n symbol: ['none', 'triangle'],\n symbolRotate: 90,\n symbolSize: [20, 10],\n lineStyle: {\n color: '#008573',\n width: 1,\n },\n label: {\n padding: [5, 15, 5, 15],\n color: '#fff',\n backgroundColor: '#008573',\n },\n data: [\n {\n yAxis: price,\n },\n ],\n },\n itemStyle: {\n color: '#E5226E',\n },\n renderItem: (params, api) => {\n const yValue = api.value(0);\n const xStart = api.coord([api.value(2), yValue]);\n const xEnd = api.coord([0, yValue]);\n const bucketWidthHeight = api.size ? (api.size([0, bucketWidth]) as number[])[1] : 0;\n const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;\n\n const rectShape = {\n x: xStart[0] - 0.5,\n y: xStart[1] - height / 2,\n width: xEnd[0] - xStart[0],\n height,\n };\n\n return {\n type: 'rect',\n shape: rectShape,\n style: api.style(),\n };\n },\n },\n ],\n }\n);\n"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,2BAA2B;AAC9D,SAASC,SAAS,EAAEC,YAAY,QAAQ,aAAa;AAErD,OAAO,MAAMC,UAAU,GAAGC,IAAA;EAAA,IACxB;IACEC,IAAI;IACJC,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","bucketWidth","toolbox","itemSize","itemGap","bottom","right","showTitle","iconStyle","borderColor","emphasis","tooltip","show","backgroundColor","formatter","val","title","position","confine","textStyle","color","feature","myZoomIn","icon","icons","zoomInIcon","onclick","model","instance","startValue","endValue","option","dataZoom","halfZoomValue","dispatchAction","type","myZoomOut","zoomOutIcon","myResetZoom","resetZoomIcon","realtime","yAxisIndex","dataset","source","trigger","borderRadius","shadowBlur","shadowOffsetX","shadowOffsetY","shadowColor","params","values","concat","Math","abs","axisPointer","axis","grid","top","left","width","height","graphic","silent","children","z","shape","style","fill","text","yAxis","axisLine","axisTick","splitLine","lineStyle","axisLabel","padding","rich","a","value","index","xAxis","min","max","showMinLabel","showMaxLabel","series","encode","x","y","itemStyle","renderItem","api","yValue","xStart","coord","xEnd","bucketWidthHeight","size","rectShape","markLine","animation","precision","symbol","symbolRotate","symbolSize","label"],"sources":["../../../../../src/OrderBookWidget/components/Chart/getOptions.ts"],"sourcesContent":["import { EChartsOption, Model, EChartsType } from 'echarts';\nimport { chartSharedOptions } from '@oanda/labs-widget-common';\nimport { ZOOM_BARS, INITIAL_BARS } from './constants';\n\nexport const getOptions = (\n {\n data,\n price,\n bucketWidth,\n } :\n {\n data: number[][],\n price: number,\n bucketWidth: number\n },\n): EChartsOption => (\n {\n toolbox: {\n itemSize: 18,\n itemGap: 14,\n bottom: 6,\n right: 6,\n showTitle: false,\n iconStyle: {\n borderColor: '#00214A',\n },\n emphasis: {\n iconStyle: {\n borderColor: '#008573',\n },\n },\n tooltip: {\n show: true,\n backgroundColor: '#00214A',\n formatter: (val) => val.title,\n position: 'top',\n confine: true,\n textStyle: {\n color: '#fff',\n },\n },\n feature: {\n myZoomIn: {\n show: true,\n title: 'Zoom in',\n icon: chartSharedOptions.icons.zoomInIcon,\n onclick: (model: Model, instance: EChartsType) => {\n const { startValue, endValue } = model.option.dataZoom[0];\n // @todo handle zoom with minimal step\n const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;\n\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: startValue + halfZoomValue,\n endValue: endValue - halfZoomValue,\n });\n },\n },\n myZoomOut: {\n show: true,\n title: 'Zoom out',\n icon: chartSharedOptions.icons.zoomOutIcon,\n onclick: (model: Model, instance: EChartsType) => {\n const { startValue, endValue } = model.option.dataZoom[0];\n // @todo handle zoom with full chart range\n const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;\n\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: startValue - halfZoomValue,\n endValue: endValue + halfZoomValue,\n });\n },\n },\n myResetZoom: {\n show: true,\n title: 'ResetZoom',\n icon: chartSharedOptions.icons.resetZoomIcon,\n onclick: (model: Model, instance: EChartsType) => {\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: price - (bucketWidth * INITIAL_BARS * 0.5),\n endValue: price + (bucketWidth * INITIAL_BARS * 0.5),\n });\n },\n },\n },\n },\n dataZoom: [\n {\n type: 'inside',\n realtime: true,\n startValue: price - (bucketWidth * INITIAL_BARS * 0.5),\n endValue: price + (bucketWidth * INITIAL_BARS * 0.5),\n yAxisIndex: 0,\n // @todo\n // minSpan: 2,\n },\n ],\n dataset: {\n source: data,\n },\n textStyle: {\n // @todo, broken due dark mode\n // ...chartSharedOptions.textStyle,\n },\n tooltip: {\n trigger: 'axis',\n borderRadius: 0,\n shadowBlur: 24,\n shadowOffsetX: 0,\n shadowOffsetY: 6,\n shadowColor: 'rgba(0,0,0,0.1)',\n textStyle: {\n // @todo, broken due dark mode\n // ...chartSharedOptions.textStyle,\n },\n formatter: (params) => {\n const values = (params as { data: number[] }[])[0].data;\n return `Price: ${values[0]}<br />Buy: ${values[1]}%<br/>Sell: ${Math.abs(values[2])}%`;\n },\n axisPointer: {\n axis: 'y',\n },\n },\n grid: [\n {\n top: '1px',\n left: '1px',\n right: '121px',\n bottom: '41px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n {\n bottom: '1px',\n right: '1px',\n width: '120px',\n height: '40px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n {\n top: '1px',\n left: '1px',\n right: '1px',\n bottom: '1px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n ],\n graphic: [\n {\n type: 'group',\n left: '8px',\n top: '8px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n left: 'center',\n top: 'middle',\n shape: {\n width: 60,\n height: 30,\n },\n style: {\n fill: '#fff',\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: 'rgba(0,0,0,0.1)',\n },\n },\n {\n type: 'text',\n z: 100,\n left: 'center',\n top: 'middle',\n style: {\n width: 60,\n height: 30,\n // @todo\n text: 'Sell',\n },\n },\n ],\n },\n {\n type: 'group',\n right: '128px',\n top: '8px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 60,\n height: 30,\n },\n style: {\n fill: '#fff',\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: 'rgba(0,0,0,0.1)',\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n width: 60,\n height: 30,\n // @todo\n text: 'Buy',\n },\n },\n ],\n },\n ],\n yAxis: {\n type: 'value',\n position: 'right',\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n lineStyle: {\n // @todo, broken due dark mode\n // color: chartSharedOptions.colors.axis,\n },\n },\n axisLabel: {\n padding: [0, 0, 0, 10],\n rich: {\n a: {\n padding: [0, 0, 16, 0],\n },\n },\n // @todo add decimal places\n formatter: (value, index) => (index ? `${value}` : `{a|${value}}`),\n },\n },\n xAxis: {\n type: 'value',\n // @todo\n min: -1.1,\n max: 1.1,\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n lineStyle: {\n // @todo, broken due dark mode\n // color: chartSharedOptions.colors.axis,\n },\n },\n axisLabel: {\n padding: [7, 0, 0, 0],\n showMinLabel: false,\n showMaxLabel: false,\n formatter: (value) => (value === 0 ? '%' : `${Math.abs(value)}%`),\n },\n },\n series: [\n {\n type: 'custom',\n encode: {\n x: 1,\n y: 0,\n tooltip: 1,\n },\n itemStyle: {\n color: '#00B89E',\n },\n renderItem: (params, api) => {\n const yValue = api.value(0);\n const xStart = api.coord([api.value(1), yValue]);\n const xEnd = api.coord([0, yValue]);\n const bucketWidthHeight = api.size ? (api.size([0, bucketWidth]) as number[])[1] : 0;\n const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;\n\n const rectShape = {\n x: xStart[0] + 0.5,\n y: xStart[1] - height / 2,\n width: xEnd[0] - xStart[0],\n height,\n };\n\n return {\n type: 'rect',\n shape: rectShape,\n style: api.style(),\n };\n },\n },\n {\n type: 'custom',\n encode: {\n x: 1,\n y: 0,\n tooltip: 2,\n },\n markLine: {\n animation: false,\n silent: true,\n // @todo confirm precision\n precision: 4,\n symbol: ['none', 'triangle'],\n symbolRotate: 90,\n symbolSize: [20, 10],\n lineStyle: {\n color: '#008573',\n width: 1,\n },\n label: {\n padding: [5, 15, 5, 15],\n color: '#fff',\n backgroundColor: '#008573',\n },\n data: [\n {\n yAxis: price,\n },\n ],\n },\n itemStyle: {\n color: '#E5226E',\n },\n renderItem: (params, api) => {\n const yValue = api.value(0);\n const xStart = api.coord([api.value(2), yValue]);\n const xEnd = api.coord([0, yValue]);\n const bucketWidthHeight = api.size ? (api.size([0, bucketWidth]) as number[])[1] : 0;\n const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;\n\n const rectShape = {\n x: xStart[0] - 0.5,\n y: xStart[1] - height / 2,\n width: xEnd[0] - xStart[0],\n height,\n };\n\n return {\n type: 'rect',\n shape: rectShape,\n style: api.style(),\n };\n },\n },\n ],\n }\n);\n"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,2BAA2B;AAC9D,SAASC,SAAS,EAAEC,YAAY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;QACnB,CAAC;MACH;IACF,CAAC;EAEL,CAAC;AAAA,CACF"}
|
|
@@ -1,20 +1,6 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
1
3
|
import { gql } from '@apollo/client';
|
|
2
|
-
const getOrderPositionBooks = gql
|
|
3
|
-
query GetOrderPositionBooks($instrument: String!, $bookType: BookType!, $recentHours: Int) {
|
|
4
|
-
orderPositionBooks(
|
|
5
|
-
instrument: $instrument
|
|
6
|
-
bookType: $bookType
|
|
7
|
-
recentHours: $recentHours
|
|
8
|
-
) {
|
|
9
|
-
bucketWidth
|
|
10
|
-
price
|
|
11
|
-
buckets {
|
|
12
|
-
price
|
|
13
|
-
longCountPercent
|
|
14
|
-
shortCountPercent
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
`;
|
|
4
|
+
const getOrderPositionBooks = gql(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])));
|
|
19
5
|
export { getOrderPositionBooks };
|
|
20
6
|
//# sourceMappingURL=getOrderPositionBooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrderPositionBooks.js","names":["gql","getOrderPositionBooks"],"sources":["../../../src/gql/getOrderPositionBooks.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst getOrderPositionBooks = gql`\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`;\n\nexport { getOrderPositionBooks };\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,MAAMC,qBAAqB,GAAGD,
|
|
1
|
+
{"version":3,"file":"getOrderPositionBooks.js","names":["gql","getOrderPositionBooks","_templateObject","_taggedTemplateLiteral"],"sources":["../../../src/gql/getOrderPositionBooks.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst getOrderPositionBooks = gql`\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`;\n\nexport { getOrderPositionBooks };\n"],"mappings":";;AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,MAAMC,qBAAqB,GAAGD,GAAG,CAAAE,eAAA,KAAAA,eAAA,GAAAC,sBAAA,iXAgBhC;AAED,SAASF,qBAAqB"}
|
|
@@ -5,10 +5,11 @@ export function makeFragmentData(data, _fragment) {
|
|
|
5
5
|
return data;
|
|
6
6
|
}
|
|
7
7
|
export function isFragmentReady(queryNode, fragmentNode, data) {
|
|
8
|
-
|
|
8
|
+
var _meta__, _fragDef$name;
|
|
9
|
+
const deferredFields = (_meta__ = queryNode.__meta__) === null || _meta__ === void 0 ? void 0 : _meta__.deferredFields;
|
|
9
10
|
if (!deferredFields) return true;
|
|
10
11
|
const fragDef = fragmentNode.definitions[0];
|
|
11
|
-
const fragName = fragDef
|
|
12
|
+
const fragName = fragDef === null || fragDef === void 0 || (_fragDef$name = fragDef.name) === null || _fragDef$name === void 0 ? void 0 : _fragDef$name.value;
|
|
12
13
|
const fields = fragName && deferredFields[fragName] || [];
|
|
13
14
|
return fields.length > 0 && fields.every(field => data && field in data);
|
|
14
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\n\nexport type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<\n infer TType,\n any\n>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__\n ?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every(field => data && field in data);\n}\n"],"mappings":"AAoCA,OAAO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAAmJ,EAClG;EACjD,OAAOA,YAAY;AACrB;AAGA,OAAO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACA,OAAO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAAiF,EACtC;EAC3C,
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","_meta__","_fragDef$name","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\n\nexport type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<\n infer TType,\n any\n>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__\n ?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every(field => data && field in data);\n}\n"],"mappings":"AAoCA,OAAO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAAmJ,EAClG;EACjD,OAAOA,YAAY;AACrB;AAGA,OAAO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACA,OAAO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAAiF,EACtC;EAAA,IAAAK,OAAA,EAAAC,aAAA;EAC3C,MAAMC,cAAc,IAAAF,OAAA,GAAIF,SAAS,CAAwEK,QAAQ,cAAAH,OAAA,uBAA1FA,OAAA,CACnBE,cAAc;EAElB,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGL,YAAY,CAACM,WAAW,CAAC,CAAC,CAAuC;EACjF,MAAMC,QAAQ,GAAGF,OAAO,aAAPA,OAAO,gBAAAH,aAAA,GAAPG,OAAO,CAAEG,IAAI,cAAAN,aAAA,uBAAbA,aAAA,CAAeO,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAACC,KAAK,IAAIjB,IAAI,IAAIiB,KAAK,IAAIjB,IAAI,CAAC;AAC1E"}
|
|
@@ -3,6 +3,7 @@ const documents = {
|
|
|
3
3
|
"\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
|
|
4
4
|
};
|
|
5
5
|
export function graphql(source) {
|
|
6
|
-
|
|
6
|
+
var _source;
|
|
7
|
+
return (_source = documents[source]) !== null && _source !== void 0 ? _source : {};
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=gql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","documents","GetOrderPositionBooksDocument","graphql","source"],"sources":["../../../../src/gql/types/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n \"\\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,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport 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\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,WAAW;AAalC,MAAMC,SAAS,GAAG;EACd,2WAA2W,EAAED,KAAK,CAACE;AACvX,CAAC;AAqBD,OAAO,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","documents","GetOrderPositionBooksDocument","graphql","source","_source"],"sources":["../../../../src/gql/types/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n \"\\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,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport 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\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,WAAW;AAalC,MAAMC,SAAS,GAAG;EACd,2WAA2W,EAAED,KAAK,CAACE;AACvX,CAAC;AAqBD,OAAO,SAASC,OAAOA,CAACC,MAAc,EAAE;EAAA,IAAAC,OAAA;EACtC,QAAAA,OAAA,GAAQJ,SAAS,CAASG,MAAM,CAAC,cAAAC,OAAA,cAAAA,OAAA,GAAI,CAAC,CAAC;AACzC"}
|
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.62",
|
|
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.62",
|
|
17
17
|
"@oanda/mono-i18n": "9.0.0",
|
|
18
18
|
"classnames": "2.3.2",
|
|
19
19
|
"echarts": "5.4.3",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"@graphql-codegen/client-preset": "4.1.0",
|
|
26
26
|
"@graphql-codegen/typescript": "4.0.1"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "0954a60e9c2d28ec2c2d4240fc15fbf132f827d2"
|
|
29
29
|
}
|