@xframes/node 0.0.11 → 0.0.13
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/dist/App.d.ts +1 -0
- package/dist/App.js +10 -0
- package/dist/components/TradingGuiDemo/CryptoAssetPanels/CryptoAssetPanels.d.ts +3 -0
- package/dist/components/TradingGuiDemo/CryptoAssetPanels/CryptoAssetPanels.js +49 -0
- package/dist/components/TradingGuiDemo/CryptoAssetsList/CryptoAssetsList.d.ts +3 -0
- package/dist/components/TradingGuiDemo/CryptoAssetsList/CryptoAssetsList.js +62 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlot.d.ts +5 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlot.js +39 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlots.d.ts +3 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoCandlestickPlots.js +17 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlot.d.ts +5 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlot.js +33 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlots.d.ts +3 -0
- package/dist/components/TradingGuiDemo/CryptoPlots/CryptoLinePlots.js +17 -0
- package/dist/components/TradingGuiDemo/CryptoQuotePrice/CryptoQuotePrice.d.ts +5 -0
- package/dist/components/TradingGuiDemo/CryptoQuotePrice/CryptoQuotePrice.js +76 -0
- package/dist/components/TradingGuiDemo/CryptoSymbolBlock/CryptoSymbolBlock.d.ts +5 -0
- package/dist/components/TradingGuiDemo/CryptoSymbolBlock/CryptoSymbolBlock.js +56 -0
- package/dist/components/TradingGuiDemo/CryptoSymbolPairs/CryptoSymbolPair.d.ts +5 -0
- package/dist/components/TradingGuiDemo/CryptoSymbolPairs/CryptoSymbolPair.js +25 -0
- package/dist/components/TradingGuiDemo/Sidebar/Sidebar.d.ts +1 -0
- package/dist/components/TradingGuiDemo/Sidebar/Sidebar.js +52 -0
- package/dist/components/TradingGuiDemo/Tabs/Tabs.d.ts +7 -0
- package/dist/components/TradingGuiDemo/Tabs/Tabs.js +95 -0
- package/dist/components/TradingGuiDemo/TradingGuiDemo.d.ts +1 -0
- package/dist/components/TradingGuiDemo/TradingGuiDemo.js +299 -0
- package/dist/components/TradingGuiDemo/cryptoSymbols.d.ts +1 -0
- package/dist/components/TradingGuiDemo/cryptoSymbols.js +64 -0
- package/dist/components/TradingGuiDemo/dataService.d.ts +22 -0
- package/dist/components/TradingGuiDemo/dataService.js +33 -0
- package/dist/components/TradingGuiDemo/dataServiceContext.d.ts +3 -0
- package/dist/components/TradingGuiDemo/dataServiceContext.js +13 -0
- package/dist/components/TradingGuiDemo/store.d.ts +17 -0
- package/dist/components/TradingGuiDemo/store.js +35 -0
- package/dist/glfw3.dll +0 -0
- package/dist/index.d.ts +1 -231
- package/dist/index.js +16 -184
- package/dist/lib/XFrames.d.ts +228 -0
- package/dist/lib/XFrames.js +9 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +7 -0
- package/dist/lib/render.d.ts +21 -0
- package/dist/lib/render.js +84 -0
- package/dist/themes.d.ts +26 -0
- package/dist/themes.js +145 -0
- package/dist/xframes.exp +0 -0
- package/dist/xframes.lib +0 -0
- package/dist/{xframes-NGGZOJ7P.node → xframes.node} +0 -0
- package/package.json +1 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TradingGuiDemo = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const common_1 = require("@xframes/common");
|
|
7
|
+
// import { HelpMarker } from "./HelpMarker/HelpMarker";
|
|
8
|
+
const CryptoLinePlots_1 = require("./CryptoPlots/CryptoLinePlots");
|
|
9
|
+
const store_1 = require("./store");
|
|
10
|
+
const CryptoAssetsList_1 = require("./CryptoAssetsList/CryptoAssetsList");
|
|
11
|
+
const dataService_1 = require("./dataService");
|
|
12
|
+
const CryptoAssetPanels_1 = require("./CryptoAssetPanels/CryptoAssetPanels");
|
|
13
|
+
const CryptoCandlestickPlots_1 = require("./CryptoPlots/CryptoCandlestickPlots");
|
|
14
|
+
const Sidebar_1 = require("./Sidebar/Sidebar");
|
|
15
|
+
const CryptoSymbolBlock_1 = require("./CryptoSymbolBlock/CryptoSymbolBlock");
|
|
16
|
+
const Tabs_1 = require("./Tabs/Tabs");
|
|
17
|
+
const XFrames_1 = require("src/lib/XFrames");
|
|
18
|
+
const themes_1 = require("src/themes");
|
|
19
|
+
const componentMap = {
|
|
20
|
+
cryptoAssetPanels: CryptoAssetPanels_1.CryptoAssetPanels,
|
|
21
|
+
cryptoAssetList: CryptoAssetsList_1.CryptoAssetsList,
|
|
22
|
+
cryptoLinePlots: CryptoLinePlots_1.CryptoLinePlots,
|
|
23
|
+
cryptoCandlestickPlots: CryptoCandlestickPlots_1.CryptoCandlestickPlots,
|
|
24
|
+
};
|
|
25
|
+
const dataService = new dataService_1.DataService();
|
|
26
|
+
const TradingGuiDemo = () => {
|
|
27
|
+
const symbols = (0, store_1.useStore)((state) => state.symbols);
|
|
28
|
+
const selectedTabIndex = (0, store_1.useStore)((state) => state.selectedTabIndex);
|
|
29
|
+
const setSelectedTabIndex = (0, store_1.useStore)((state) => state.setSelectedTabIndex);
|
|
30
|
+
const setCryptoAssets = (0, store_1.useStore)((state) => state.setCryptoAssets);
|
|
31
|
+
// const socketRef = useRef<WebSocket>();
|
|
32
|
+
const widgetRegistratonService = (0, common_1.useWidgetRegistrationService)();
|
|
33
|
+
const [selectedItemIds, setSelectedItemIds] = (0, react_1.useState)([
|
|
34
|
+
"cryptoAssetPanels",
|
|
35
|
+
]);
|
|
36
|
+
const styleSheet = (0, react_1.useMemo)(() => common_1.RWStyleSheet.create({
|
|
37
|
+
rootNode: {
|
|
38
|
+
height: "100%",
|
|
39
|
+
},
|
|
40
|
+
mainLayoutNode: {
|
|
41
|
+
flex: 1,
|
|
42
|
+
flexDirection: "row",
|
|
43
|
+
},
|
|
44
|
+
title: {
|
|
45
|
+
colors: { [common_1.ImGuiCol.Text]: themes_1.theme2Colors.green },
|
|
46
|
+
font: { name: "roboto-regular", size: 24 },
|
|
47
|
+
},
|
|
48
|
+
debugButton: {
|
|
49
|
+
positionType: "absolute",
|
|
50
|
+
position: { right: 15, bottom: 15 },
|
|
51
|
+
flexDirection: "row",
|
|
52
|
+
gap: { column: 10 },
|
|
53
|
+
},
|
|
54
|
+
button: {
|
|
55
|
+
colors: {
|
|
56
|
+
[common_1.ImGuiCol.Text]: themes_1.theme2Colors.green,
|
|
57
|
+
[common_1.ImGuiCol.Border]: themes_1.theme2Colors.green,
|
|
58
|
+
},
|
|
59
|
+
padding: { all: 8 },
|
|
60
|
+
vars: {
|
|
61
|
+
[common_1.ImGuiStyleVar.FrameBorderSize]: 1,
|
|
62
|
+
[common_1.ImGuiStyleVar.FrameRounding]: 5,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
mainNode: {
|
|
66
|
+
flex: 1,
|
|
67
|
+
},
|
|
68
|
+
mainTitleNode: {
|
|
69
|
+
flexDirection: "row",
|
|
70
|
+
borderBottom: {
|
|
71
|
+
color: "#1B1D20", // todo: remove double border
|
|
72
|
+
thickness: 1,
|
|
73
|
+
},
|
|
74
|
+
borderRight: {
|
|
75
|
+
color: "#1B1D20", // todo: remove double border
|
|
76
|
+
thickness: 1,
|
|
77
|
+
},
|
|
78
|
+
padding: { all: 20 },
|
|
79
|
+
},
|
|
80
|
+
mainTitle: {
|
|
81
|
+
font: { name: "roboto-bold", size: 32 },
|
|
82
|
+
},
|
|
83
|
+
contentNode: {
|
|
84
|
+
padding: {
|
|
85
|
+
left: 8,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
tabContent: {
|
|
89
|
+
height: "100%",
|
|
90
|
+
width: 350,
|
|
91
|
+
gap: { row: 10 },
|
|
92
|
+
padding: {
|
|
93
|
+
horizontal: 8,
|
|
94
|
+
vertical: 16,
|
|
95
|
+
},
|
|
96
|
+
borderLeft: {
|
|
97
|
+
color: "#1C1E22",
|
|
98
|
+
thickness: 1,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
marketSearchInput: {
|
|
102
|
+
vars: {
|
|
103
|
+
[common_1.ImGuiStyleVar.FrameBorderSize]: 1,
|
|
104
|
+
[common_1.ImGuiStyleVar.FramePadding]: [10, 10],
|
|
105
|
+
},
|
|
106
|
+
colors: {
|
|
107
|
+
[common_1.ImGuiCol.Border]: "#1C1E22",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
marketSearchInputHover: {
|
|
111
|
+
vars: {
|
|
112
|
+
[common_1.ImGuiStyleVar.FrameBorderSize]: 1,
|
|
113
|
+
[common_1.ImGuiStyleVar.FramePadding]: [10, 10],
|
|
114
|
+
},
|
|
115
|
+
colors: {
|
|
116
|
+
[common_1.ImGuiCol.Border]: "#fff",
|
|
117
|
+
[common_1.ImGuiCol.TextDisabled]: "#fff",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
marketSearchFilterWrapper: {
|
|
121
|
+
flexDirection: "row",
|
|
122
|
+
gap: { all: 8 },
|
|
123
|
+
flexWrap: "wrap",
|
|
124
|
+
},
|
|
125
|
+
marketSearchFilter: {
|
|
126
|
+
width: 60,
|
|
127
|
+
colors: {
|
|
128
|
+
[common_1.ImGuiCol.Button]: "#1E2025",
|
|
129
|
+
[common_1.ImGuiCol.ButtonHovered]: "#1E2025",
|
|
130
|
+
[common_1.ImGuiCol.ButtonActive]: "#1E2025",
|
|
131
|
+
[common_1.ImGuiCol.Text]: "#777B84",
|
|
132
|
+
},
|
|
133
|
+
vars: {
|
|
134
|
+
[common_1.ImGuiStyleVar.FrameRounding]: 5,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
marketSearchFilterActive: {
|
|
138
|
+
width: 60,
|
|
139
|
+
colors: {
|
|
140
|
+
[common_1.ImGuiCol.Button]: "#fff",
|
|
141
|
+
[common_1.ImGuiCol.ButtonHovered]: "#fff",
|
|
142
|
+
[common_1.ImGuiCol.ButtonActive]: "#fff",
|
|
143
|
+
[common_1.ImGuiCol.Text]: "#292A2C",
|
|
144
|
+
},
|
|
145
|
+
vars: {
|
|
146
|
+
[common_1.ImGuiStyleVar.FrameRounding]: 5,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
}), []);
|
|
150
|
+
// todo: move to dataService.ts ?
|
|
151
|
+
// const connect = useCallback(() => {
|
|
152
|
+
// socketRef.current = new WebSocket("ws://localhost:4000");
|
|
153
|
+
// socketRef.current.addEventListener("error", () => {
|
|
154
|
+
// console.log("Connected to server");
|
|
155
|
+
// });
|
|
156
|
+
// socketRef.current.addEventListener("open", () => {
|
|
157
|
+
// console.log("Connected to server");
|
|
158
|
+
// });
|
|
159
|
+
// socketRef.current.addEventListener("close", (ev) => {
|
|
160
|
+
// try {
|
|
161
|
+
// const reason = JSON.parse(ev.reason);
|
|
162
|
+
// console.log(`Disconnected from server: ${reason.message}`);
|
|
163
|
+
// } catch (error) {
|
|
164
|
+
// console.log("Disconnected from server");
|
|
165
|
+
// }
|
|
166
|
+
// });
|
|
167
|
+
// socketRef.current.addEventListener("message", (event) => {
|
|
168
|
+
// const data = JSON.parse(event.data);
|
|
169
|
+
// if (data.cryptoAssets) {
|
|
170
|
+
// // todo: remove filtering
|
|
171
|
+
// setCryptoAssets(
|
|
172
|
+
// data.cryptoAssets.filter((asset: any) => cryptoSymbols.includes(asset.symbol)),
|
|
173
|
+
// );
|
|
174
|
+
// } else if (data.cryptoQuote) {
|
|
175
|
+
// dataService.addCryptoQuote(data.cryptoQuote);
|
|
176
|
+
// } else if (data.latestCryptoQuotes) {
|
|
177
|
+
// // console.log(data.latestCryptoQuotes);
|
|
178
|
+
// Object.entries(data.latestCryptoQuotes).forEach(([symbol, cryptoQuote]) =>
|
|
179
|
+
// dataService.addCryptoQuote({ ...(cryptoQuote as any), S: symbol }),
|
|
180
|
+
// );
|
|
181
|
+
// } else if (data.cryptoSnapshots) {
|
|
182
|
+
// dataService.addCryptoSnapshots(data.cryptoSnapshots);
|
|
183
|
+
// // console.log(data.cryptoSnapshots);
|
|
184
|
+
// } else if (data.latestCryptoBars) {
|
|
185
|
+
// console.log(data.latestCryptoBars);
|
|
186
|
+
// } else if (data.cryptoBars) {
|
|
187
|
+
// dataService.addCryptoBars(data.cryptoBars);
|
|
188
|
+
// // console.log(data.cryptoBars);
|
|
189
|
+
// }
|
|
190
|
+
// });
|
|
191
|
+
// }, [setCryptoAssets]);
|
|
192
|
+
// const sendMessage = useCallback((message: any) => {
|
|
193
|
+
// if (socketRef.current) {
|
|
194
|
+
// socketRef.current.send(JSON.stringify(message));
|
|
195
|
+
// }
|
|
196
|
+
// }, []);
|
|
197
|
+
// const subscribeToLiveData = useCallback(
|
|
198
|
+
// () =>
|
|
199
|
+
// sendMessage({
|
|
200
|
+
// passkey: "",
|
|
201
|
+
// action: "subscribeForCryptoQuotes",
|
|
202
|
+
// symbols,
|
|
203
|
+
// }),
|
|
204
|
+
// [sendMessage, symbols],
|
|
205
|
+
// );
|
|
206
|
+
// const getLatestQuotes = useCallback(() => {
|
|
207
|
+
// const currentDate = new Date();
|
|
208
|
+
// const end = currentDate.toISOString();
|
|
209
|
+
// const start = subMinutes(currentDate, 1);
|
|
210
|
+
// sendMessage({
|
|
211
|
+
// action: "getQuotes",
|
|
212
|
+
// symbols,
|
|
213
|
+
// options: { start, end },
|
|
214
|
+
// });
|
|
215
|
+
// }, [symbols]);
|
|
216
|
+
// const getCryptoQuotes = useCallback(() => {
|
|
217
|
+
// const currentDate = new Date();
|
|
218
|
+
// const end = currentDate.toISOString();
|
|
219
|
+
// const start = subMinutes(currentDate, 1).toISOString();
|
|
220
|
+
// const options: GetQuotesParams = {
|
|
221
|
+
// start,
|
|
222
|
+
// end,
|
|
223
|
+
// };
|
|
224
|
+
// sendMessage({
|
|
225
|
+
// action: "getCryptoQuotes",
|
|
226
|
+
// symbols,
|
|
227
|
+
// options,
|
|
228
|
+
// });
|
|
229
|
+
// }, [symbols]);
|
|
230
|
+
// const getCryptoBars = useCallback(() => {
|
|
231
|
+
// const currentDate = new Date();
|
|
232
|
+
// const end = currentDate.toISOString();
|
|
233
|
+
// const start = subDays(currentDate, 30).toISOString();
|
|
234
|
+
// const options: GetCryptoBarsParams = { start, end, timeframe: "1D" };
|
|
235
|
+
// sendMessage({
|
|
236
|
+
// action: "getCryptoBars",
|
|
237
|
+
// symbols,
|
|
238
|
+
// options,
|
|
239
|
+
// });
|
|
240
|
+
// }, [symbols]);
|
|
241
|
+
// const getCryptoSnapshots = useCallback(
|
|
242
|
+
// () =>
|
|
243
|
+
// sendMessage({
|
|
244
|
+
// action: "getCryptoSnapshots",
|
|
245
|
+
// symbols,
|
|
246
|
+
// }),
|
|
247
|
+
// [symbols],
|
|
248
|
+
// );
|
|
249
|
+
// const getLatestCryptoQuotes = useCallback(
|
|
250
|
+
// () =>
|
|
251
|
+
// sendMessage({
|
|
252
|
+
// action: "getLatestCryptoQuotes",
|
|
253
|
+
// symbols,
|
|
254
|
+
// }),
|
|
255
|
+
// [symbols],
|
|
256
|
+
// );
|
|
257
|
+
// const getLatestCryptoBars = useCallback(
|
|
258
|
+
// () =>
|
|
259
|
+
// sendMessage({
|
|
260
|
+
// action: "getLatestCryptoBars",
|
|
261
|
+
// symbols,
|
|
262
|
+
// }),
|
|
263
|
+
// [symbols],
|
|
264
|
+
// );
|
|
265
|
+
// const getCryptoAssets = useCallback(
|
|
266
|
+
// () =>
|
|
267
|
+
// sendMessage({
|
|
268
|
+
// action: "getCryptoAssets",
|
|
269
|
+
// symbols,
|
|
270
|
+
// }),
|
|
271
|
+
// [symbols],
|
|
272
|
+
// );
|
|
273
|
+
const debugModeBtnClicked = (0, react_1.useCallback)(() => {
|
|
274
|
+
widgetRegistratonService.setDebug(true);
|
|
275
|
+
}, []);
|
|
276
|
+
const onToggleItemSelection = (0, react_1.useCallback)((itemId, selected) => {
|
|
277
|
+
setSelectedItemIds((selection) => {
|
|
278
|
+
if (selected) {
|
|
279
|
+
return [itemId];
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
return selection.filter((item) => item !== itemId);
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}, []);
|
|
286
|
+
const onMarketSearchTextChange = (0, react_1.useCallback)((evt) => {
|
|
287
|
+
console.log(evt.nativeEvent.value);
|
|
288
|
+
}, []);
|
|
289
|
+
// useEffect(() => {
|
|
290
|
+
// connect();
|
|
291
|
+
// setTimeout(() => {
|
|
292
|
+
// getCryptoAssets();
|
|
293
|
+
// }, 1000);
|
|
294
|
+
// }, [connect, getCryptoAssets]);
|
|
295
|
+
const tabs = (0, react_1.useMemo)(() => ["Markets", "History"], []);
|
|
296
|
+
const Component = componentMap[selectedItemIds[0]];
|
|
297
|
+
return ((0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { root: true, style: styleSheet.rootNode, children: [(0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.mainLayoutNode, children: [(0, jsx_runtime_1.jsx)(Sidebar_1.Sidebar, {}), (0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.mainNode, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: styleSheet.mainTitleNode, children: (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.UnformattedText, { text: "Trade", style: styleSheet.mainTitle }) }), (0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.contentNode, children: [(0, jsx_runtime_1.jsx)(CryptoSymbolBlock_1.CryptoSymbolBlock, { symbol: "BTC/USD" }), (0, jsx_runtime_1.jsx)(Tabs_1.Tabs, { tabs: tabs, selectedTabIndex: selectedTabIndex, onSelectedTabChange: setSelectedTabIndex }), (0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.tabContent, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.InputText, { onChange: onMarketSearchTextChange, hint: `${common_1.faIconMap["magnifying-glass"]} SEARCH MARKETS`, style: styleSheet.marketSearchInput, hoverStyle: styleSheet.marketSearchInputHover }), (0, jsx_runtime_1.jsxs)(XFrames_1.XFrames.Node, { style: styleSheet.marketSearchFilterWrapper, children: [(0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: common_1.faIconMap["star"], style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: "ALL", style: styleSheet.marketSearchFilterActive, hoverStyle: styleSheet.marketSearchFilterActive }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: "TOP", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: "BTC", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: "ETH", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: "USD", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: "USDC", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: "DAI", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: "MKR", style: styleSheet.marketSearchFilter, hoverStyle: styleSheet.marketSearchFilterActive })] })] })] })] })] }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: styleSheet.sidebarNode }), (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Node, { style: styleSheet.debugButton, children: (0, jsx_runtime_1.jsx)(XFrames_1.XFrames.Button, { label: common_1.faIconMap.bug, onClick: debugModeBtnClicked }) })] }));
|
|
298
|
+
};
|
|
299
|
+
exports.TradingGuiDemo = TradingGuiDemo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cryptoSymbols: string[];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cryptoSymbols = void 0;
|
|
4
|
+
exports.cryptoSymbols = [
|
|
5
|
+
"SUSHI/USD",
|
|
6
|
+
"YFI/USD",
|
|
7
|
+
"LTC/USD",
|
|
8
|
+
"DOGE/USD",
|
|
9
|
+
"BCH/USDT",
|
|
10
|
+
"BAT/USDC",
|
|
11
|
+
"BAT/USD",
|
|
12
|
+
"CRV/USDC",
|
|
13
|
+
"SHIB/USDT",
|
|
14
|
+
"BCH/USDC",
|
|
15
|
+
"LINK/USDT",
|
|
16
|
+
"LINK/USDC",
|
|
17
|
+
"BCH/USD",
|
|
18
|
+
"CRV/USD",
|
|
19
|
+
"AVAX/USDT",
|
|
20
|
+
"LTC/USDT",
|
|
21
|
+
"XTZ/USDC",
|
|
22
|
+
"BTC/USDT",
|
|
23
|
+
"AVAX/USDC",
|
|
24
|
+
"XTZ/USD",
|
|
25
|
+
// "AVAX/USD",
|
|
26
|
+
// "LTC/USDC",
|
|
27
|
+
// "LINK/USD",
|
|
28
|
+
// "LINK/BTC",
|
|
29
|
+
// "SHIB/USDC",
|
|
30
|
+
// "SOL/USDC",
|
|
31
|
+
// "GRT/USDC",
|
|
32
|
+
// "USDT/USDC",
|
|
33
|
+
// "SOL/USD",
|
|
34
|
+
// "SOL/USDT",
|
|
35
|
+
// "SHIB/USD",
|
|
36
|
+
// "DOGE/USDC",
|
|
37
|
+
// "GRT/USD",
|
|
38
|
+
// "ETH/USDT",
|
|
39
|
+
// "USDT/USD",
|
|
40
|
+
// "ETH/USDC",
|
|
41
|
+
// "LTC/BTC",
|
|
42
|
+
// "AAVE/USDT",
|
|
43
|
+
// "ETH/USD",
|
|
44
|
+
// "UNI/USDT",
|
|
45
|
+
// "ETH/BTC",
|
|
46
|
+
// "BCH/BTC",
|
|
47
|
+
// "USDC/USD",
|
|
48
|
+
// "YFI/USDT",
|
|
49
|
+
// "UNI/USDC",
|
|
50
|
+
// "DOT/USDC",
|
|
51
|
+
// "DOT/USD",
|
|
52
|
+
// "AAVE/USD",
|
|
53
|
+
// "MKR/USDC",
|
|
54
|
+
// "UNI/USD",
|
|
55
|
+
// "AAVE/USDC",
|
|
56
|
+
// "UNI/BTC",
|
|
57
|
+
// "SUSHI/USDT",
|
|
58
|
+
// "BTC/USDC",
|
|
59
|
+
// "BTC/USD",
|
|
60
|
+
// "SUSHI/USDC",
|
|
61
|
+
// "YFI/USDC",
|
|
62
|
+
// "MKR/USD",
|
|
63
|
+
// "DOGE/USDT",
|
|
64
|
+
];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CryptoBar, CryptoQuote, CryptoSnapshot } from "@alpacahq/alpaca-trade-api/dist/resources/datav2/entityv2";
|
|
2
|
+
export type CryptoQuoteWithSymbol = CryptoQuote & {
|
|
3
|
+
S: string;
|
|
4
|
+
};
|
|
5
|
+
export type CryptoSnapshots = {
|
|
6
|
+
[key: string]: CryptoSnapshot;
|
|
7
|
+
};
|
|
8
|
+
export type CryptoBarDataset = {
|
|
9
|
+
[key: string]: CryptoBar[];
|
|
10
|
+
};
|
|
11
|
+
export declare class DataService {
|
|
12
|
+
private cryptoQuotes;
|
|
13
|
+
private cryptoSnapshots;
|
|
14
|
+
private cryptoBarDatasets;
|
|
15
|
+
constructor();
|
|
16
|
+
addCryptoQuote(cryptoQuote: CryptoQuoteWithSymbol): void;
|
|
17
|
+
addCryptoSnapshots(cryptoSnapshots: CryptoSnapshots): void;
|
|
18
|
+
addCryptoBars(cryptoBarDataset: CryptoBarDataset): void;
|
|
19
|
+
getCryptoQuotes(): import("rxjs").Observable<CryptoQuoteWithSymbol>;
|
|
20
|
+
getCryptoSnapshots(): import("rxjs").Observable<CryptoSnapshots>;
|
|
21
|
+
getCryptoBarDatasets(): import("rxjs").Observable<CryptoBarDataset>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataService = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
class DataService {
|
|
6
|
+
cryptoQuotes;
|
|
7
|
+
cryptoSnapshots;
|
|
8
|
+
cryptoBarDatasets;
|
|
9
|
+
constructor() {
|
|
10
|
+
this.cryptoQuotes = new rxjs_1.ReplaySubject(100000);
|
|
11
|
+
this.cryptoSnapshots = new rxjs_1.ReplaySubject(100000);
|
|
12
|
+
this.cryptoBarDatasets = new rxjs_1.ReplaySubject(100000);
|
|
13
|
+
}
|
|
14
|
+
addCryptoQuote(cryptoQuote) {
|
|
15
|
+
this.cryptoQuotes.next(cryptoQuote);
|
|
16
|
+
}
|
|
17
|
+
addCryptoSnapshots(cryptoSnapshots) {
|
|
18
|
+
this.cryptoSnapshots.next(cryptoSnapshots);
|
|
19
|
+
}
|
|
20
|
+
addCryptoBars(cryptoBarDataset) {
|
|
21
|
+
this.cryptoBarDatasets.next(cryptoBarDataset);
|
|
22
|
+
}
|
|
23
|
+
getCryptoQuotes() {
|
|
24
|
+
return this.cryptoQuotes.asObservable();
|
|
25
|
+
}
|
|
26
|
+
getCryptoSnapshots() {
|
|
27
|
+
return this.cryptoSnapshots.asObservable();
|
|
28
|
+
}
|
|
29
|
+
getCryptoBarDatasets() {
|
|
30
|
+
return this.cryptoBarDatasets.asObservable();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.DataService = DataService;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDataService = exports.DataServiceContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.DataServiceContext = (0, react_1.createContext)(null);
|
|
6
|
+
const useDataService = () => {
|
|
7
|
+
const context = (0, react_1.useContext)(exports.DataServiceContext);
|
|
8
|
+
if (context) {
|
|
9
|
+
return context;
|
|
10
|
+
}
|
|
11
|
+
throw new Error("DataServiceContext initialisation failed");
|
|
12
|
+
};
|
|
13
|
+
exports.useDataService = useDataService;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CryptoQuote } from "@alpacahq/alpaca-trade-api/dist/resources/datav2/entityv2.d.ts";
|
|
2
|
+
export declare const onLoadCryptoQuote: (symbol: string, cryptoQuote: CryptoQuote) => void;
|
|
3
|
+
export declare const emptyCryptoQuote: Readonly<{
|
|
4
|
+
Timestamp: "";
|
|
5
|
+
BidPrice: 0;
|
|
6
|
+
BidSize: 0;
|
|
7
|
+
AskPrice: 0;
|
|
8
|
+
AskSize: 0;
|
|
9
|
+
}>;
|
|
10
|
+
export type State = {
|
|
11
|
+
symbols: string[];
|
|
12
|
+
cryptoAssets: any[];
|
|
13
|
+
selectedTabIndex: number;
|
|
14
|
+
setCryptoAssets: (cryptoAssets: any[]) => void;
|
|
15
|
+
setSelectedTabIndex: (index: number) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const useStore: import("zustand").UseBoundStore<import("zustand").StoreApi<State>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStore = exports.emptyCryptoQuote = exports.onLoadCryptoQuote = void 0;
|
|
4
|
+
const zustand_1 = require("zustand");
|
|
5
|
+
const rxjs_1 = require("rxjs");
|
|
6
|
+
const cryptoSymbols_1 = require("./cryptoSymbols");
|
|
7
|
+
const cryptoQuoteSubjectMap$ = new rxjs_1.BehaviorSubject(new Map());
|
|
8
|
+
const onLoadCryptoQuote = (symbol, cryptoQuote) => {
|
|
9
|
+
console.log(symbol, cryptoQuote);
|
|
10
|
+
const map = cryptoQuoteSubjectMap$.getValue();
|
|
11
|
+
if (!map.has(symbol)) {
|
|
12
|
+
map.set(symbol, new rxjs_1.BehaviorSubject(cryptoQuote));
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
const subject$ = map.get(symbol);
|
|
16
|
+
subject$?.next(cryptoQuote);
|
|
17
|
+
// map.set(symbol, subject$ as CryptoQuoteSubject);
|
|
18
|
+
}
|
|
19
|
+
cryptoQuoteSubjectMap$.next(map);
|
|
20
|
+
};
|
|
21
|
+
exports.onLoadCryptoQuote = onLoadCryptoQuote;
|
|
22
|
+
exports.emptyCryptoQuote = Object.freeze({
|
|
23
|
+
Timestamp: "",
|
|
24
|
+
BidPrice: 0,
|
|
25
|
+
BidSize: 0,
|
|
26
|
+
AskPrice: 0,
|
|
27
|
+
AskSize: 0,
|
|
28
|
+
});
|
|
29
|
+
exports.useStore = (0, zustand_1.create)((set) => ({
|
|
30
|
+
cryptoAssets: [],
|
|
31
|
+
symbols: cryptoSymbols_1.cryptoSymbols,
|
|
32
|
+
selectedTabIndex: 0,
|
|
33
|
+
setCryptoAssets: (cryptoAssets) => set(() => ({ cryptoAssets })),
|
|
34
|
+
setSelectedTabIndex: (index) => set(() => ({ selectedTabIndex: index })),
|
|
35
|
+
}));
|
package/dist/glfw3.dll
ADDED
|
Binary file
|