@backtest-kit/ui 12.7.0 → 13.2.0
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/build/index.cjs +562 -1
- package/build/index.mjs +563 -2
- package/build/modules/frontend/build/assets/{Article-Cydsbo58.js → Article-CcCiTpSc.js} +1 -1
- package/build/modules/frontend/build/assets/{Background-DRUmpkiX.js → Background-DMirKacq.js} +1 -1
- package/build/modules/frontend/build/assets/{IconPhoto-DgZpsEPu.js → IconPhoto-BxDqzGvT.js} +1 -1
- package/build/modules/frontend/build/assets/{KeyboardArrowLeft-B5VvnUVe.js → KeyboardArrowLeft-Dko7SALS.js} +1 -1
- package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-Bwfzpfiq.js → PictureAsPdfOutlined-Dmg5gexr.js} +1 -1
- package/build/modules/frontend/build/assets/{Refresh-C98KWsgS.js → Refresh-CBda8h_u.js} +1 -1
- package/build/modules/frontend/build/assets/emitters-DfGc10Om.js +1 -0
- package/build/modules/frontend/build/assets/{hasRouteMatch-CJOTXNR0.js → hasRouteMatch-BSKJnbXT.js} +1 -1
- package/build/modules/frontend/build/assets/{html2canvas-uXhJyxmu.js → html2canvas-DksZ0g2p.js} +1 -1
- package/build/modules/frontend/build/assets/index-6eAhZo78.js +1 -0
- package/build/modules/frontend/build/assets/{index-DczZPFs5.js → index-B4z69zXs.js} +15 -15
- package/build/modules/frontend/build/assets/{index-CPB4v3p9.js → index-BfM_1muQ.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CmRUEFBC.js → index-C9jW4IvD.js} +1 -1
- package/build/modules/frontend/build/assets/{index-DjN5OM5o.js → index-CAviDo-e.js} +1 -1
- package/build/modules/frontend/build/assets/index-CGJADttI.js +1 -0
- package/build/modules/frontend/build/assets/{index-CQ2MYE_u.js → index-CJGWLPLp.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CD-MGreQ.js → index-CeAm-0jJ.js} +1 -1
- package/build/modules/frontend/build/assets/{index-B7bNJ6Z_.js → index-CikHR8SM.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CI-xx0Lh.js → index-CnaffmZK.js} +1 -1
- package/build/modules/frontend/build/assets/index-D3OaZoyW.js +1 -0
- package/build/modules/frontend/build/assets/{index-CMUQi4gP.js → index-DqktEUrK.js} +1 -1
- package/build/modules/frontend/build/assets/{index-Ch9gvjK6.js → index-kU3NMO0i.js} +1 -1
- package/build/modules/frontend/build/assets/{index.es-CAxNC3Z8.js → index.es-Q_57HRa4.js} +2 -2
- package/build/modules/frontend/build/assets/{markdownit-DtUrovwb.js → markdownit-BiE4Ht5c.js} +1 -1
- package/build/modules/frontend/build/index.html +1 -1
- package/package.json +3 -3
- package/types.d.ts +85 -0
- package/build/modules/frontend/build/assets/emitters-BadAAvTF.js +0 -1
- package/build/modules/frontend/build/assets/index-8bgkjw-4.js +0 -1
- package/build/modules/frontend/build/assets/index-CmO6pWII.js +0 -1
- package/build/modules/frontend/build/assets/index-CyA6jaRk.js +0 -1
package/build/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import serveHandler from 'serve-handler';
|
|
|
7
7
|
import os from 'os';
|
|
8
8
|
import { createActivator } from 'di-kit';
|
|
9
9
|
import * as BacktestKit from 'backtest-kit';
|
|
10
|
-
import { alignToInterval, Exchange, listExchangeSchema, Backtest, Live, Notification, Storage, Log, lib, Heat, Strategy, Breakeven, Risk, Partial, HighestProfit, MaxDrawdown, Schedule, Performance, Sync, Walker, StorageLive, StorageBacktest, Broker, Dump, Markdown, Memory, Recent, Report, State, getConfig } from 'backtest-kit';
|
|
10
|
+
import { alignToInterval, Exchange, listExchangeSchema, Backtest, Live, Notification, Storage, intervalStepMs, Log, lib, Heat, Strategy, Breakeven, Risk, Partial, HighestProfit, MaxDrawdown, Schedule, Performance, Sync, Walker, StorageLive, StorageBacktest, Broker, Dump, Markdown, Memory, Recent, Report, State, getConfig, Position } from 'backtest-kit';
|
|
11
11
|
import fs, { readdir, readFile } from 'fs/promises';
|
|
12
12
|
import path, { join, dirname } from 'path';
|
|
13
13
|
import mime from 'mime-types';
|
|
@@ -87,6 +87,7 @@ const mockServices$1 = {
|
|
|
87
87
|
environmentMockService: Symbol("environmentMockService"),
|
|
88
88
|
setupMockService: Symbol("setupMockService"),
|
|
89
89
|
runtimeMockService: Symbol("runtimeMockService"),
|
|
90
|
+
controlMockService: Symbol("controlMockService"),
|
|
90
91
|
};
|
|
91
92
|
const viewServices$1 = {
|
|
92
93
|
notificationViewService: Symbol("notificationViewService"),
|
|
@@ -102,6 +103,7 @@ const viewServices$1 = {
|
|
|
102
103
|
environmentViewService: Symbol("environmentViewService"),
|
|
103
104
|
setupViewService: Symbol("setupViewService"),
|
|
104
105
|
runtimeViewService: Symbol("runtimeViewService"),
|
|
106
|
+
controlViewService: Symbol("controlViewService"),
|
|
105
107
|
};
|
|
106
108
|
const TYPES = {
|
|
107
109
|
...baseServices$1,
|
|
@@ -1002,11 +1004,12 @@ class ExchangeViewService {
|
|
|
1002
1004
|
}
|
|
1003
1005
|
const { pendingAt, scheduledAt } = signal;
|
|
1004
1006
|
const eventAt = pendingAt || scheduledAt;
|
|
1007
|
+
const startAt = eventAt - intervalStepMs("1m") * HISTORY_LAST_CANDLES_LIMIT;
|
|
1005
1008
|
const updatedAt = await this.signalViewService.getLastUpdateTimestamp(signalId);
|
|
1006
1009
|
return await this.exchangeService.getRangeCandles({
|
|
1007
1010
|
symbol: signal.symbol,
|
|
1008
1011
|
exchangeName: signal.exchangeName,
|
|
1009
|
-
signalStartTime:
|
|
1012
|
+
signalStartTime: startAt,
|
|
1010
1013
|
signalStopTime: alignToInterval(new Date(updatedAt), interval).getTime(),
|
|
1011
1014
|
interval,
|
|
1012
1015
|
});
|
|
@@ -2175,6 +2178,222 @@ class RuntimeViewService {
|
|
|
2175
2178
|
}
|
|
2176
2179
|
}
|
|
2177
2180
|
|
|
2181
|
+
const MOCK_STRATEGY_PATH = "./mock/strategy.json";
|
|
2182
|
+
const MOCK_STRATEGY_INFO_PATH = "./mock/strategy-info.json";
|
|
2183
|
+
const READ_STRATEGY_FN = singleshot(async () => {
|
|
2184
|
+
const data = await fs.readFile(MOCK_STRATEGY_PATH, "utf-8");
|
|
2185
|
+
return JSON.parse(data);
|
|
2186
|
+
});
|
|
2187
|
+
const READ_STRATEGY_INFO_FN = singleshot(async () => {
|
|
2188
|
+
const data = await fs.readFile(MOCK_STRATEGY_INFO_PATH, "utf-8");
|
|
2189
|
+
return JSON.parse(data);
|
|
2190
|
+
});
|
|
2191
|
+
class ControlMockService {
|
|
2192
|
+
constructor() {
|
|
2193
|
+
this.loggerService = inject(TYPES.loggerService);
|
|
2194
|
+
this.getStatus = async (symbol, context) => {
|
|
2195
|
+
this.loggerService.log("controlMockService getStatus", {
|
|
2196
|
+
symbol,
|
|
2197
|
+
context,
|
|
2198
|
+
});
|
|
2199
|
+
const strategyInfo = await READ_STRATEGY_INFO_FN();
|
|
2200
|
+
const pendingSignal = await READ_STRATEGY_FN();
|
|
2201
|
+
const currentPrice = pendingSignal?.pnl?.priceClose ?? pendingSignal?.priceOpen ?? 0;
|
|
2202
|
+
return { strategyInfo, pendingSignal, currentPrice };
|
|
2203
|
+
};
|
|
2204
|
+
this.getAveragePrice = async (symbol, context) => {
|
|
2205
|
+
this.loggerService.log("controlMockService getAveragePrice", {
|
|
2206
|
+
symbol,
|
|
2207
|
+
context,
|
|
2208
|
+
});
|
|
2209
|
+
const pendingSignal = await READ_STRATEGY_FN();
|
|
2210
|
+
return pendingSignal?.pnl?.priceClose ?? pendingSignal?.priceOpen ?? 0;
|
|
2211
|
+
};
|
|
2212
|
+
this.commitOpenPending = async (symbol, context, dto) => {
|
|
2213
|
+
this.loggerService.log("controlMockService commitOpenPending", {
|
|
2214
|
+
symbol,
|
|
2215
|
+
context,
|
|
2216
|
+
dto,
|
|
2217
|
+
});
|
|
2218
|
+
};
|
|
2219
|
+
this.commitAverageBuy = async (symbol, context, dto) => {
|
|
2220
|
+
this.loggerService.log("controlMockService commitAverageBuy", {
|
|
2221
|
+
symbol,
|
|
2222
|
+
context,
|
|
2223
|
+
dto,
|
|
2224
|
+
});
|
|
2225
|
+
};
|
|
2226
|
+
this.commitClosePending = async (symbol, context, dto) => {
|
|
2227
|
+
this.loggerService.log("controlMockService commitClosePending", {
|
|
2228
|
+
symbol,
|
|
2229
|
+
context,
|
|
2230
|
+
dto,
|
|
2231
|
+
});
|
|
2232
|
+
};
|
|
2233
|
+
this.commitBreakeven = async (symbol, context) => {
|
|
2234
|
+
this.loggerService.log("controlMockService commitBreakeven", {
|
|
2235
|
+
symbol,
|
|
2236
|
+
context,
|
|
2237
|
+
});
|
|
2238
|
+
};
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
class ControlViewService {
|
|
2243
|
+
constructor() {
|
|
2244
|
+
this.loggerService = inject(TYPES.loggerService);
|
|
2245
|
+
this.controlMockService = inject(TYPES.controlMockService);
|
|
2246
|
+
this.getStatus = async (symbol, context) => {
|
|
2247
|
+
this.loggerService.log("controlViewService getStatus", {
|
|
2248
|
+
symbol,
|
|
2249
|
+
context,
|
|
2250
|
+
});
|
|
2251
|
+
if (CC_ENABLE_MOCK) {
|
|
2252
|
+
return await this.controlMockService.getStatus(symbol, context);
|
|
2253
|
+
}
|
|
2254
|
+
const liveList = await Live.list();
|
|
2255
|
+
const liveTarget = liveList.find((live) => live.symbol === symbol);
|
|
2256
|
+
if (liveTarget) {
|
|
2257
|
+
const currentPrice = await Exchange.getAveragePrice(symbol, {
|
|
2258
|
+
exchangeName: liveTarget.exchangeName,
|
|
2259
|
+
});
|
|
2260
|
+
const strategy = await Live.getStrategyStatus(symbol, context);
|
|
2261
|
+
const pending = await Live.getPendingSignal(symbol, currentPrice, context);
|
|
2262
|
+
return { strategyInfo: strategy, pendingSignal: pending, currentPrice };
|
|
2263
|
+
}
|
|
2264
|
+
throw new Error("ControlViewService getStatus live target not found");
|
|
2265
|
+
};
|
|
2266
|
+
this.getAveragePrice = async (symbol, context) => {
|
|
2267
|
+
this.loggerService.log("controlViewService getAveragePrice", {
|
|
2268
|
+
symbol,
|
|
2269
|
+
context,
|
|
2270
|
+
});
|
|
2271
|
+
if (CC_ENABLE_MOCK) {
|
|
2272
|
+
return await this.controlMockService.getAveragePrice(symbol, context);
|
|
2273
|
+
}
|
|
2274
|
+
const liveList = await Live.list();
|
|
2275
|
+
const liveTarget = liveList.find((live) => live.symbol === symbol);
|
|
2276
|
+
if (liveTarget) {
|
|
2277
|
+
return await Exchange.getAveragePrice(symbol, {
|
|
2278
|
+
exchangeName: liveTarget.exchangeName,
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
throw new Error("ControlViewService getAveragePrice live target not found");
|
|
2282
|
+
};
|
|
2283
|
+
this.commitOpenPending = async (symbol, context, dto) => {
|
|
2284
|
+
this.loggerService.log("controlViewService commitOpenPending", {
|
|
2285
|
+
symbol,
|
|
2286
|
+
context,
|
|
2287
|
+
dto,
|
|
2288
|
+
});
|
|
2289
|
+
if (CC_ENABLE_MOCK) {
|
|
2290
|
+
return await this.controlMockService.commitOpenPending(symbol, context, dto);
|
|
2291
|
+
}
|
|
2292
|
+
const liveList = await Live.list();
|
|
2293
|
+
const liveTarget = liveList.find((live) => live.symbol === symbol);
|
|
2294
|
+
if (liveTarget) {
|
|
2295
|
+
const currentPrice = await Exchange.getAveragePrice(symbol, {
|
|
2296
|
+
exchangeName: liveTarget.exchangeName,
|
|
2297
|
+
});
|
|
2298
|
+
const pending = await Live.getPendingSignal(symbol, currentPrice, context);
|
|
2299
|
+
const config = getConfig();
|
|
2300
|
+
if (pending) {
|
|
2301
|
+
throw new Error("ControlViewService commitOpenPending already have pending signal");
|
|
2302
|
+
}
|
|
2303
|
+
return await Live.commitCreateSignal(symbol, context, {
|
|
2304
|
+
...Position.moonbag({
|
|
2305
|
+
position: dto.position,
|
|
2306
|
+
currentPrice,
|
|
2307
|
+
percentStopLoss: config.CC_MAX_STOPLOSS_DISTANCE_PERCENT
|
|
2308
|
+
}),
|
|
2309
|
+
cost: dto.cost,
|
|
2310
|
+
note: dto.note,
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
throw new Error("ControlViewService commitOpenPending live target not found");
|
|
2314
|
+
};
|
|
2315
|
+
this.commitAverageBuy = async (symbol, context, dto) => {
|
|
2316
|
+
this.loggerService.log("controlViewService commitAverageBuy", {
|
|
2317
|
+
symbol,
|
|
2318
|
+
context,
|
|
2319
|
+
dto,
|
|
2320
|
+
});
|
|
2321
|
+
if (CC_ENABLE_MOCK) {
|
|
2322
|
+
return await this.controlMockService.commitAverageBuy(symbol, context, dto);
|
|
2323
|
+
}
|
|
2324
|
+
const liveList = await Live.list();
|
|
2325
|
+
const liveTarget = liveList.find((live) => live.symbol === symbol);
|
|
2326
|
+
if (liveTarget) {
|
|
2327
|
+
const currentPrice = await Exchange.getAveragePrice(symbol, {
|
|
2328
|
+
exchangeName: liveTarget.exchangeName,
|
|
2329
|
+
});
|
|
2330
|
+
const pending = await Live.getPendingSignal(symbol, currentPrice, context);
|
|
2331
|
+
if (!pending) {
|
|
2332
|
+
throw new Error("ControlViewService commitAverageBuy has no pending signal");
|
|
2333
|
+
}
|
|
2334
|
+
const isOk = await Live.commitAverageBuy(symbol, currentPrice, context, dto.cost);
|
|
2335
|
+
if (!isOk) {
|
|
2336
|
+
throw new Error("ControlViewService commitAverageBuy failed");
|
|
2337
|
+
}
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2340
|
+
throw new Error("ControlViewService commitAverageBuy live target not found");
|
|
2341
|
+
};
|
|
2342
|
+
this.commitClosePending = async (symbol, context, dto) => {
|
|
2343
|
+
this.loggerService.log("controlViewService commitClosePending", {
|
|
2344
|
+
symbol,
|
|
2345
|
+
context,
|
|
2346
|
+
dto,
|
|
2347
|
+
});
|
|
2348
|
+
if (CC_ENABLE_MOCK) {
|
|
2349
|
+
return await this.controlMockService.commitClosePending(symbol, context, dto);
|
|
2350
|
+
}
|
|
2351
|
+
const liveList = await Live.list();
|
|
2352
|
+
const liveTarget = liveList.find((live) => live.symbol === symbol);
|
|
2353
|
+
if (liveTarget) {
|
|
2354
|
+
const currentPrice = await Exchange.getAveragePrice(symbol, {
|
|
2355
|
+
exchangeName: liveTarget.exchangeName,
|
|
2356
|
+
});
|
|
2357
|
+
const pending = await Live.getPendingSignal(symbol, currentPrice, context);
|
|
2358
|
+
if (!pending) {
|
|
2359
|
+
throw new Error("ControlViewService commitClosePending has no pending signal");
|
|
2360
|
+
}
|
|
2361
|
+
return await Live.commitClosePending(symbol, context, {
|
|
2362
|
+
id: pending.id,
|
|
2363
|
+
note: dto.note,
|
|
2364
|
+
});
|
|
2365
|
+
}
|
|
2366
|
+
throw new Error("ControlViewService commitClosePending live target not found");
|
|
2367
|
+
};
|
|
2368
|
+
this.commitBreakeven = async (symbol, context) => {
|
|
2369
|
+
this.loggerService.log("controlViewService commitBreakeven", {
|
|
2370
|
+
symbol,
|
|
2371
|
+
context,
|
|
2372
|
+
});
|
|
2373
|
+
if (CC_ENABLE_MOCK) {
|
|
2374
|
+
return await this.controlMockService.commitBreakeven(symbol, context);
|
|
2375
|
+
}
|
|
2376
|
+
const liveList = await Live.list();
|
|
2377
|
+
const liveTarget = liveList.find((live) => live.symbol === symbol);
|
|
2378
|
+
if (liveTarget) {
|
|
2379
|
+
const currentPrice = await Exchange.getAveragePrice(symbol, {
|
|
2380
|
+
exchangeName: liveTarget.exchangeName,
|
|
2381
|
+
});
|
|
2382
|
+
const pending = await Live.getPendingSignal(symbol, currentPrice, context);
|
|
2383
|
+
if (!pending) {
|
|
2384
|
+
throw new Error("ControlViewService commitBreakeven has no pending signal");
|
|
2385
|
+
}
|
|
2386
|
+
const isOk = await Live.commitBreakeven(symbol, currentPrice, context);
|
|
2387
|
+
if (!isOk) {
|
|
2388
|
+
throw new Error("ControlViewService commitBreakeven failed");
|
|
2389
|
+
}
|
|
2390
|
+
return;
|
|
2391
|
+
}
|
|
2392
|
+
throw new Error("ControlViewService commitBreakeven live target not found");
|
|
2393
|
+
};
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2178
2397
|
{
|
|
2179
2398
|
provide(TYPES.loggerService, () => new LoggerService());
|
|
2180
2399
|
provide(TYPES.exchangeService, () => new ExchangeService());
|
|
@@ -2202,6 +2421,7 @@ class RuntimeViewService {
|
|
|
2202
2421
|
provide(TYPES.environmentMockService, () => new EnvironmentMockService());
|
|
2203
2422
|
provide(TYPES.setupMockService, () => new SetupMockService());
|
|
2204
2423
|
provide(TYPES.runtimeMockService, () => new RuntimeMockService());
|
|
2424
|
+
provide(TYPES.controlMockService, () => new ControlMockService());
|
|
2205
2425
|
}
|
|
2206
2426
|
{
|
|
2207
2427
|
provide(TYPES.notificationViewService, () => new NotificationViewService());
|
|
@@ -2217,6 +2437,7 @@ class RuntimeViewService {
|
|
|
2217
2437
|
provide(TYPES.environmentViewService, () => new EnvironmentViewService());
|
|
2218
2438
|
provide(TYPES.setupViewService, () => new SetupViewService());
|
|
2219
2439
|
provide(TYPES.runtimeViewService, () => new RuntimeViewService());
|
|
2440
|
+
provide(TYPES.controlViewService, () => new ControlViewService());
|
|
2220
2441
|
}
|
|
2221
2442
|
|
|
2222
2443
|
const baseServices = {
|
|
@@ -2246,6 +2467,7 @@ const mockServices = {
|
|
|
2246
2467
|
environmentMockService: inject(TYPES.environmentMockService),
|
|
2247
2468
|
setupMockService: inject(TYPES.setupMockService),
|
|
2248
2469
|
runtimeMockService: inject(TYPES.runtimeMockService),
|
|
2470
|
+
controlMockService: inject(TYPES.controlMockService),
|
|
2249
2471
|
};
|
|
2250
2472
|
const viewServices = {
|
|
2251
2473
|
notificationViewService: inject(TYPES.notificationViewService),
|
|
@@ -2261,6 +2483,7 @@ const viewServices = {
|
|
|
2261
2483
|
environmentViewService: inject(TYPES.environmentViewService),
|
|
2262
2484
|
setupViewService: inject(TYPES.setupViewService),
|
|
2263
2485
|
runtimeViewService: inject(TYPES.runtimeViewService),
|
|
2486
|
+
controlViewService: inject(TYPES.controlViewService),
|
|
2264
2487
|
};
|
|
2265
2488
|
const ioc = {
|
|
2266
2489
|
...baseServices,
|
|
@@ -2829,6 +3052,175 @@ router$b.post("/api/v1/mock/status_one/:id", async (req, res) => {
|
|
|
2829
3052
|
});
|
|
2830
3053
|
}
|
|
2831
3054
|
});
|
|
3055
|
+
// ControlMockService endpoints
|
|
3056
|
+
router$b.post("/api/v1/mock/control_status", async (req, res) => {
|
|
3057
|
+
try {
|
|
3058
|
+
const request = await micro.json(req);
|
|
3059
|
+
const { symbol, context, requestId, serviceName } = request;
|
|
3060
|
+
const data = await ioc.controlMockService.getStatus(symbol, context);
|
|
3061
|
+
const result = {
|
|
3062
|
+
data,
|
|
3063
|
+
status: "ok",
|
|
3064
|
+
error: "",
|
|
3065
|
+
requestId,
|
|
3066
|
+
serviceName,
|
|
3067
|
+
};
|
|
3068
|
+
ioc.loggerService.log("/api/v1/mock/control_status ok", {
|
|
3069
|
+
request,
|
|
3070
|
+
result: omit(result, "data"),
|
|
3071
|
+
});
|
|
3072
|
+
return await micro.send(res, 200, result);
|
|
3073
|
+
}
|
|
3074
|
+
catch (error) {
|
|
3075
|
+
ioc.loggerService.log("/api/v1/mock/control_status error", {
|
|
3076
|
+
error: errorData(error),
|
|
3077
|
+
});
|
|
3078
|
+
return await micro.send(res, 200, {
|
|
3079
|
+
status: "error",
|
|
3080
|
+
error: getErrorMessage(error),
|
|
3081
|
+
});
|
|
3082
|
+
}
|
|
3083
|
+
});
|
|
3084
|
+
router$b.post("/api/v1/mock/control_average_price", async (req, res) => {
|
|
3085
|
+
try {
|
|
3086
|
+
const request = await micro.json(req);
|
|
3087
|
+
const { symbol, context, requestId, serviceName } = request;
|
|
3088
|
+
const data = await ioc.controlMockService.getAveragePrice(symbol, context);
|
|
3089
|
+
const result = {
|
|
3090
|
+
data,
|
|
3091
|
+
status: "ok",
|
|
3092
|
+
error: "",
|
|
3093
|
+
requestId,
|
|
3094
|
+
serviceName,
|
|
3095
|
+
};
|
|
3096
|
+
ioc.loggerService.log("/api/v1/mock/control_average_price ok", {
|
|
3097
|
+
request,
|
|
3098
|
+
result: omit(result, "data"),
|
|
3099
|
+
});
|
|
3100
|
+
return await micro.send(res, 200, result);
|
|
3101
|
+
}
|
|
3102
|
+
catch (error) {
|
|
3103
|
+
ioc.loggerService.log("/api/v1/mock/control_average_price error", {
|
|
3104
|
+
error: errorData(error),
|
|
3105
|
+
});
|
|
3106
|
+
return await micro.send(res, 200, {
|
|
3107
|
+
status: "error",
|
|
3108
|
+
error: getErrorMessage(error),
|
|
3109
|
+
});
|
|
3110
|
+
}
|
|
3111
|
+
});
|
|
3112
|
+
router$b.post("/api/v1/mock/control_open_pending", async (req, res) => {
|
|
3113
|
+
try {
|
|
3114
|
+
const request = await micro.json(req);
|
|
3115
|
+
const { symbol, context, dto, requestId, serviceName } = request;
|
|
3116
|
+
const data = await ioc.controlMockService.commitOpenPending(symbol, context, dto);
|
|
3117
|
+
const result = {
|
|
3118
|
+
data,
|
|
3119
|
+
status: "ok",
|
|
3120
|
+
error: "",
|
|
3121
|
+
requestId,
|
|
3122
|
+
serviceName,
|
|
3123
|
+
};
|
|
3124
|
+
ioc.loggerService.log("/api/v1/mock/control_open_pending ok", {
|
|
3125
|
+
request,
|
|
3126
|
+
result: omit(result, "data"),
|
|
3127
|
+
});
|
|
3128
|
+
return await micro.send(res, 200, result);
|
|
3129
|
+
}
|
|
3130
|
+
catch (error) {
|
|
3131
|
+
ioc.loggerService.log("/api/v1/mock/control_open_pending error", {
|
|
3132
|
+
error: errorData(error),
|
|
3133
|
+
});
|
|
3134
|
+
return await micro.send(res, 200, {
|
|
3135
|
+
status: "error",
|
|
3136
|
+
error: getErrorMessage(error),
|
|
3137
|
+
});
|
|
3138
|
+
}
|
|
3139
|
+
});
|
|
3140
|
+
router$b.post("/api/v1/mock/control_average_buy", async (req, res) => {
|
|
3141
|
+
try {
|
|
3142
|
+
const request = await micro.json(req);
|
|
3143
|
+
const { symbol, context, dto, requestId, serviceName } = request;
|
|
3144
|
+
const data = await ioc.controlMockService.commitAverageBuy(symbol, context, dto);
|
|
3145
|
+
const result = {
|
|
3146
|
+
data,
|
|
3147
|
+
status: "ok",
|
|
3148
|
+
error: "",
|
|
3149
|
+
requestId,
|
|
3150
|
+
serviceName,
|
|
3151
|
+
};
|
|
3152
|
+
ioc.loggerService.log("/api/v1/mock/control_average_buy ok", {
|
|
3153
|
+
request,
|
|
3154
|
+
result: omit(result, "data"),
|
|
3155
|
+
});
|
|
3156
|
+
return await micro.send(res, 200, result);
|
|
3157
|
+
}
|
|
3158
|
+
catch (error) {
|
|
3159
|
+
ioc.loggerService.log("/api/v1/mock/control_average_buy error", {
|
|
3160
|
+
error: errorData(error),
|
|
3161
|
+
});
|
|
3162
|
+
return await micro.send(res, 200, {
|
|
3163
|
+
status: "error",
|
|
3164
|
+
error: getErrorMessage(error),
|
|
3165
|
+
});
|
|
3166
|
+
}
|
|
3167
|
+
});
|
|
3168
|
+
router$b.post("/api/v1/mock/control_close_pending", async (req, res) => {
|
|
3169
|
+
try {
|
|
3170
|
+
const request = await micro.json(req);
|
|
3171
|
+
const { symbol, context, dto, requestId, serviceName } = request;
|
|
3172
|
+
const data = await ioc.controlMockService.commitClosePending(symbol, context, dto);
|
|
3173
|
+
const result = {
|
|
3174
|
+
data,
|
|
3175
|
+
status: "ok",
|
|
3176
|
+
error: "",
|
|
3177
|
+
requestId,
|
|
3178
|
+
serviceName,
|
|
3179
|
+
};
|
|
3180
|
+
ioc.loggerService.log("/api/v1/mock/control_close_pending ok", {
|
|
3181
|
+
request,
|
|
3182
|
+
result: omit(result, "data"),
|
|
3183
|
+
});
|
|
3184
|
+
return await micro.send(res, 200, result);
|
|
3185
|
+
}
|
|
3186
|
+
catch (error) {
|
|
3187
|
+
ioc.loggerService.log("/api/v1/mock/control_close_pending error", {
|
|
3188
|
+
error: errorData(error),
|
|
3189
|
+
});
|
|
3190
|
+
return await micro.send(res, 200, {
|
|
3191
|
+
status: "error",
|
|
3192
|
+
error: getErrorMessage(error),
|
|
3193
|
+
});
|
|
3194
|
+
}
|
|
3195
|
+
});
|
|
3196
|
+
router$b.post("/api/v1/mock/control_breakeven", async (req, res) => {
|
|
3197
|
+
try {
|
|
3198
|
+
const request = await micro.json(req);
|
|
3199
|
+
const { symbol, context, requestId, serviceName } = request;
|
|
3200
|
+
const data = await ioc.controlMockService.commitBreakeven(symbol, context);
|
|
3201
|
+
const result = {
|
|
3202
|
+
data,
|
|
3203
|
+
status: "ok",
|
|
3204
|
+
error: "",
|
|
3205
|
+
requestId,
|
|
3206
|
+
serviceName,
|
|
3207
|
+
};
|
|
3208
|
+
ioc.loggerService.log("/api/v1/mock/control_breakeven ok", {
|
|
3209
|
+
request,
|
|
3210
|
+
result: omit(result, "data"),
|
|
3211
|
+
});
|
|
3212
|
+
return await micro.send(res, 200, result);
|
|
3213
|
+
}
|
|
3214
|
+
catch (error) {
|
|
3215
|
+
ioc.loggerService.log("/api/v1/mock/control_breakeven error", {
|
|
3216
|
+
error: errorData(error),
|
|
3217
|
+
});
|
|
3218
|
+
return await micro.send(res, 200, {
|
|
3219
|
+
status: "error",
|
|
3220
|
+
error: getErrorMessage(error),
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
});
|
|
2832
3224
|
// HeatMockService endpoints
|
|
2833
3225
|
router$b.post("/api/v1/mock/heat_data", async (req, res) => {
|
|
2834
3226
|
try {
|
|
@@ -3588,6 +3980,175 @@ router$a.post("/api/v1/view/status_one/:id", async (req, res) => {
|
|
|
3588
3980
|
});
|
|
3589
3981
|
}
|
|
3590
3982
|
});
|
|
3983
|
+
// ControlViewService endpoints
|
|
3984
|
+
router$a.post("/api/v1/view/control_status", async (req, res) => {
|
|
3985
|
+
try {
|
|
3986
|
+
const request = await micro.json(req);
|
|
3987
|
+
const { symbol, context, requestId, serviceName } = request;
|
|
3988
|
+
const data = await ioc.controlViewService.getStatus(symbol, context);
|
|
3989
|
+
const result = {
|
|
3990
|
+
data,
|
|
3991
|
+
status: "ok",
|
|
3992
|
+
error: "",
|
|
3993
|
+
requestId,
|
|
3994
|
+
serviceName,
|
|
3995
|
+
};
|
|
3996
|
+
ioc.loggerService.log("/api/v1/view/control_status ok", {
|
|
3997
|
+
request,
|
|
3998
|
+
result: omit(result, "data"),
|
|
3999
|
+
});
|
|
4000
|
+
return await micro.send(res, 200, result);
|
|
4001
|
+
}
|
|
4002
|
+
catch (error) {
|
|
4003
|
+
ioc.loggerService.log("/api/v1/view/control_status error", {
|
|
4004
|
+
error: errorData(error),
|
|
4005
|
+
});
|
|
4006
|
+
return await micro.send(res, 200, {
|
|
4007
|
+
status: "error",
|
|
4008
|
+
error: getErrorMessage(error),
|
|
4009
|
+
});
|
|
4010
|
+
}
|
|
4011
|
+
});
|
|
4012
|
+
router$a.post("/api/v1/view/control_average_price", async (req, res) => {
|
|
4013
|
+
try {
|
|
4014
|
+
const request = await micro.json(req);
|
|
4015
|
+
const { symbol, context, requestId, serviceName } = request;
|
|
4016
|
+
const data = await ioc.controlViewService.getAveragePrice(symbol, context);
|
|
4017
|
+
const result = {
|
|
4018
|
+
data,
|
|
4019
|
+
status: "ok",
|
|
4020
|
+
error: "",
|
|
4021
|
+
requestId,
|
|
4022
|
+
serviceName,
|
|
4023
|
+
};
|
|
4024
|
+
ioc.loggerService.log("/api/v1/view/control_average_price ok", {
|
|
4025
|
+
request,
|
|
4026
|
+
result: omit(result, "data"),
|
|
4027
|
+
});
|
|
4028
|
+
return await micro.send(res, 200, result);
|
|
4029
|
+
}
|
|
4030
|
+
catch (error) {
|
|
4031
|
+
ioc.loggerService.log("/api/v1/view/control_average_price error", {
|
|
4032
|
+
error: errorData(error),
|
|
4033
|
+
});
|
|
4034
|
+
return await micro.send(res, 200, {
|
|
4035
|
+
status: "error",
|
|
4036
|
+
error: getErrorMessage(error),
|
|
4037
|
+
});
|
|
4038
|
+
}
|
|
4039
|
+
});
|
|
4040
|
+
router$a.post("/api/v1/view/control_open_pending", async (req, res) => {
|
|
4041
|
+
try {
|
|
4042
|
+
const request = await micro.json(req);
|
|
4043
|
+
const { symbol, context, dto, requestId, serviceName } = request;
|
|
4044
|
+
const data = await ioc.controlViewService.commitOpenPending(symbol, context, dto);
|
|
4045
|
+
const result = {
|
|
4046
|
+
data,
|
|
4047
|
+
status: "ok",
|
|
4048
|
+
error: "",
|
|
4049
|
+
requestId,
|
|
4050
|
+
serviceName,
|
|
4051
|
+
};
|
|
4052
|
+
ioc.loggerService.log("/api/v1/view/control_open_pending ok", {
|
|
4053
|
+
request,
|
|
4054
|
+
result: omit(result, "data"),
|
|
4055
|
+
});
|
|
4056
|
+
return await micro.send(res, 200, result);
|
|
4057
|
+
}
|
|
4058
|
+
catch (error) {
|
|
4059
|
+
ioc.loggerService.log("/api/v1/view/control_open_pending error", {
|
|
4060
|
+
error: errorData(error),
|
|
4061
|
+
});
|
|
4062
|
+
return await micro.send(res, 200, {
|
|
4063
|
+
status: "error",
|
|
4064
|
+
error: getErrorMessage(error),
|
|
4065
|
+
});
|
|
4066
|
+
}
|
|
4067
|
+
});
|
|
4068
|
+
router$a.post("/api/v1/view/control_average_buy", async (req, res) => {
|
|
4069
|
+
try {
|
|
4070
|
+
const request = await micro.json(req);
|
|
4071
|
+
const { symbol, context, dto, requestId, serviceName } = request;
|
|
4072
|
+
const data = await ioc.controlViewService.commitAverageBuy(symbol, context, dto);
|
|
4073
|
+
const result = {
|
|
4074
|
+
data,
|
|
4075
|
+
status: "ok",
|
|
4076
|
+
error: "",
|
|
4077
|
+
requestId,
|
|
4078
|
+
serviceName,
|
|
4079
|
+
};
|
|
4080
|
+
ioc.loggerService.log("/api/v1/view/control_average_buy ok", {
|
|
4081
|
+
request,
|
|
4082
|
+
result: omit(result, "data"),
|
|
4083
|
+
});
|
|
4084
|
+
return await micro.send(res, 200, result);
|
|
4085
|
+
}
|
|
4086
|
+
catch (error) {
|
|
4087
|
+
ioc.loggerService.log("/api/v1/view/control_average_buy error", {
|
|
4088
|
+
error: errorData(error),
|
|
4089
|
+
});
|
|
4090
|
+
return await micro.send(res, 200, {
|
|
4091
|
+
status: "error",
|
|
4092
|
+
error: getErrorMessage(error),
|
|
4093
|
+
});
|
|
4094
|
+
}
|
|
4095
|
+
});
|
|
4096
|
+
router$a.post("/api/v1/view/control_close_pending", async (req, res) => {
|
|
4097
|
+
try {
|
|
4098
|
+
const request = await micro.json(req);
|
|
4099
|
+
const { symbol, context, dto, requestId, serviceName } = request;
|
|
4100
|
+
const data = await ioc.controlViewService.commitClosePending(symbol, context, dto);
|
|
4101
|
+
const result = {
|
|
4102
|
+
data,
|
|
4103
|
+
status: "ok",
|
|
4104
|
+
error: "",
|
|
4105
|
+
requestId,
|
|
4106
|
+
serviceName,
|
|
4107
|
+
};
|
|
4108
|
+
ioc.loggerService.log("/api/v1/view/control_close_pending ok", {
|
|
4109
|
+
request,
|
|
4110
|
+
result: omit(result, "data"),
|
|
4111
|
+
});
|
|
4112
|
+
return await micro.send(res, 200, result);
|
|
4113
|
+
}
|
|
4114
|
+
catch (error) {
|
|
4115
|
+
ioc.loggerService.log("/api/v1/view/control_close_pending error", {
|
|
4116
|
+
error: errorData(error),
|
|
4117
|
+
});
|
|
4118
|
+
return await micro.send(res, 200, {
|
|
4119
|
+
status: "error",
|
|
4120
|
+
error: getErrorMessage(error),
|
|
4121
|
+
});
|
|
4122
|
+
}
|
|
4123
|
+
});
|
|
4124
|
+
router$a.post("/api/v1/view/control_breakeven", async (req, res) => {
|
|
4125
|
+
try {
|
|
4126
|
+
const request = await micro.json(req);
|
|
4127
|
+
const { symbol, context, requestId, serviceName } = request;
|
|
4128
|
+
const data = await ioc.controlViewService.commitBreakeven(symbol, context);
|
|
4129
|
+
const result = {
|
|
4130
|
+
data,
|
|
4131
|
+
status: "ok",
|
|
4132
|
+
error: "",
|
|
4133
|
+
requestId,
|
|
4134
|
+
serviceName,
|
|
4135
|
+
};
|
|
4136
|
+
ioc.loggerService.log("/api/v1/view/control_breakeven ok", {
|
|
4137
|
+
request,
|
|
4138
|
+
result: omit(result, "data"),
|
|
4139
|
+
});
|
|
4140
|
+
return await micro.send(res, 200, result);
|
|
4141
|
+
}
|
|
4142
|
+
catch (error) {
|
|
4143
|
+
ioc.loggerService.log("/api/v1/view/control_breakeven error", {
|
|
4144
|
+
error: errorData(error),
|
|
4145
|
+
});
|
|
4146
|
+
return await micro.send(res, 200, {
|
|
4147
|
+
status: "error",
|
|
4148
|
+
error: getErrorMessage(error),
|
|
4149
|
+
});
|
|
4150
|
+
}
|
|
4151
|
+
});
|
|
3591
4152
|
// HeatViewService endpoints
|
|
3592
4153
|
router$a.post("/api/v1/view/heat_data", async (req, res) => {
|
|
3593
4154
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as c,f as v}from"./index-
|
|
1
|
+
import{b as c,f as v}from"./index-B4z69zXs.js";const h=c(v("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}),"Article");export{h as A};
|
package/build/modules/frontend/build/assets/{Background-DRUmpkiX.js → Background-DMirKacq.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as n,S as o}from"./index-
|
|
1
|
+
import{f as n,S as o}from"./index-B4z69zXs.js";const d=()=>n(o,{children:"\n body {\n background-color: #ddd !important;\n }\n "});export{d as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,i as t,B as r,V as s}from"./index-
|
|
1
|
+
import{f as e,i as t,B as r,V as s}from"./index-B4z69zXs.js";const o=({className:o,symbol:i,style:a,sx:n})=>e(s,{children:async()=>{try{const s=(await t.symbolGlobalService.getSymbolMap())[i],l=(null==s?void 0:s.logo)||(null==s?void 0:s.icon),c=(null==s?void 0:s.color)||"#ccc";return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:l?"transparent":c,...n},style:a,children:l?e("img",{loading:"lazy",crossOrigin:"anonymous",src:l,alt:i,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"},onError:e=>{const t=e.target,r=t.parentElement;r&&(r.style.background=c,t.style.display="none")}}):e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}catch(s){return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#ccc",...n},style:a,children:e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}}});export{o as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,f as r}from"./index-
|
|
1
|
+
import{b as o,f as r}from"./index-B4z69zXs.js";const a=o(r("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"KeyboardArrowLeft");export{a as K};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as h,f as c}from"./index-
|
|
1
|
+
import{b as h,f as c}from"./index-B4z69zXs.js";const v=h(c("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1zm-2-3h1v3h-1V9zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1v-2zm0-2h1v1h-1V9z"}),"PictureAsPdfOutlined");export{v as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bH as e,d as t,r as a,_ as s,f as i,bI as n,j as o,bJ as r,k as d,bK as m,g as u,u as p,s as x,b as c}from"./index-B4z69zXs.js";const h=e(),b=["className","component","disableGutters","fixed","maxWidth","classes"],l=m(),f=h("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),g=e=>r({props:e,name:"MuiContainer",defaultTheme:l});const W=function(e={}){const{createStyledComponent:r=f,useThemeProps:m=g,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:c,component:h="div",disableGutters:l=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,b),k=t({},r,{component:h,disableGutters:l,fixed:f,maxWidth:g}),S=((e,t)=>{const{classes:a,fixed:s,disableGutters:i,maxWidth:n}=e,r={root:["root",n&&`maxWidth${o(String(n))}`,s&&"fixed",i&&"disableGutters"]};return d(r,e=>u(t,e),a)})(k,p);return i(x,t({as:h,ownerState:k,className:n(S.root,c),ref:a},W))})}({createStyledComponent:x("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>p({props:e,name:"MuiContainer"})}),k=c(i("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"Refresh");export{W as C,k as R};
|