@backtest-kit/cli 0.0.1 → 0.0.2
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/README.md +41 -41
- package/build/index.cjs +212 -107
- package/build/index.mjs +213 -109
- package/package.json +19 -3
- package/template/project/.gitkeep +0 -0
- package/types.d.ts +47 -13
package/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as functools_kit from 'functools-kit';
|
|
2
|
+
import { CandleInterval, TrailingTakeCommit, TrailingStopCommit, BreakevenCommit, PartialProfitCommit, PartialLossCommit, IStrategyTickResultScheduled, IStrategyTickResultCancelled, IStrategyTickResultOpened, IStrategyTickResultClosed, RiskContract } from 'backtest-kit';
|
|
2
3
|
import { Input } from 'telegraf';
|
|
3
|
-
import { TrailingTakeCommit, TrailingStopCommit, BreakevenCommit, PartialProfitCommit, PartialLossCommit, IStrategyTickResultScheduled, IStrategyTickResultCancelled, IStrategyTickResultOpened, IStrategyTickResultClosed, RiskContract } from 'backtest-kit';
|
|
4
4
|
|
|
5
5
|
interface ILogger {
|
|
6
6
|
log(topic: string, ...args: any[]): void;
|
|
@@ -20,41 +20,68 @@ declare class LoggerService implements ILogger {
|
|
|
20
20
|
|
|
21
21
|
declare class PaperMainService {
|
|
22
22
|
private loggerService;
|
|
23
|
-
private exchangeSchemaService;
|
|
24
23
|
private resolveService;
|
|
24
|
+
private exchangeSchemaService;
|
|
25
|
+
private symbolSchemaService;
|
|
25
26
|
private frontendProviderService;
|
|
26
27
|
private telegramProviderService;
|
|
28
|
+
run: ((payload: {
|
|
29
|
+
entryPoint: string;
|
|
30
|
+
symbol: string;
|
|
31
|
+
strategy: string;
|
|
32
|
+
exchange: string;
|
|
33
|
+
verbose: boolean;
|
|
34
|
+
}) => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
27
35
|
protected init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
declare class LiveMainService {
|
|
31
39
|
private loggerService;
|
|
32
|
-
private exchangeSchemaService;
|
|
33
40
|
private resolveService;
|
|
41
|
+
private exchangeSchemaService;
|
|
42
|
+
private symbolSchemaService;
|
|
34
43
|
private frontendProviderService;
|
|
35
44
|
private telegramProviderService;
|
|
45
|
+
private liveProviderService;
|
|
46
|
+
run: ((payload: {
|
|
47
|
+
entryPoint: string;
|
|
48
|
+
symbol: string;
|
|
49
|
+
strategy: string;
|
|
50
|
+
exchange: string;
|
|
51
|
+
verbose: boolean;
|
|
52
|
+
}) => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
36
53
|
protected init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
37
54
|
}
|
|
38
55
|
|
|
39
56
|
declare class BacktestMainService {
|
|
40
57
|
private loggerService;
|
|
58
|
+
private resolveService;
|
|
41
59
|
private exchangeSchemaService;
|
|
42
60
|
private frameSchemaService;
|
|
61
|
+
private symbolSchemaService;
|
|
43
62
|
private cacheLogicService;
|
|
44
|
-
private resolveService;
|
|
45
63
|
private frontendProviderService;
|
|
46
64
|
private telegramProviderService;
|
|
65
|
+
run: ((payload: {
|
|
66
|
+
entryPoint: string;
|
|
67
|
+
symbol: string;
|
|
68
|
+
strategy: string;
|
|
69
|
+
exchange: string;
|
|
70
|
+
frame: string;
|
|
71
|
+
cacheList: string[];
|
|
72
|
+
verbose: boolean;
|
|
73
|
+
}) => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
47
74
|
protected init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
48
75
|
}
|
|
49
76
|
|
|
50
77
|
declare class ExchangeSchemaService {
|
|
51
78
|
readonly loggerService: LoggerService;
|
|
52
|
-
|
|
79
|
+
addSchema: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
53
80
|
}
|
|
54
81
|
|
|
55
82
|
declare class FrameSchemaService {
|
|
56
83
|
readonly loggerService: LoggerService;
|
|
57
|
-
|
|
84
|
+
addSchema: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
58
85
|
}
|
|
59
86
|
|
|
60
87
|
declare class ResolveService {
|
|
@@ -68,19 +95,19 @@ declare class ResolveService {
|
|
|
68
95
|
declare class ErrorService {
|
|
69
96
|
handleGlobalError: (error: Error) => Promise<void>;
|
|
70
97
|
private _listenForError;
|
|
71
|
-
protected init: () => void;
|
|
98
|
+
protected init: (() => void) & functools_kit.ISingleshotClearable;
|
|
72
99
|
}
|
|
73
100
|
|
|
74
101
|
declare class SymbolSchemaService {
|
|
75
102
|
readonly loggerService: LoggerService;
|
|
76
|
-
|
|
103
|
+
addSchema: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
77
104
|
}
|
|
78
105
|
|
|
79
106
|
declare class FrontendProviderService {
|
|
80
107
|
private readonly loggerService;
|
|
81
108
|
enable: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
82
109
|
disable: () => void;
|
|
83
|
-
|
|
110
|
+
connect: (() => Promise<() => void>) & functools_kit.ISingleshotClearable;
|
|
84
111
|
}
|
|
85
112
|
|
|
86
113
|
declare class TelegramProviderService {
|
|
@@ -88,12 +115,12 @@ declare class TelegramProviderService {
|
|
|
88
115
|
private readonly telegramLogicService;
|
|
89
116
|
enable: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
90
117
|
disable: () => void;
|
|
91
|
-
|
|
118
|
+
connect: (() => Promise<() => void>) & functools_kit.ISingleshotClearable;
|
|
92
119
|
}
|
|
93
120
|
|
|
94
121
|
declare class CacheLogicService {
|
|
95
122
|
private readonly loggerService;
|
|
96
|
-
execute: (dto: {
|
|
123
|
+
execute: (intervalList: CandleInterval[], dto: {
|
|
97
124
|
symbol: string;
|
|
98
125
|
frameName: string;
|
|
99
126
|
exchangeName: string;
|
|
@@ -190,7 +217,7 @@ declare class LiveProviderService {
|
|
|
190
217
|
private handleRisk;
|
|
191
218
|
enable: (() => (...args: any[]) => any) & functools_kit.ISingleshotClearable;
|
|
192
219
|
disable: () => void;
|
|
193
|
-
|
|
220
|
+
connect: (() => Promise<() => void>) & functools_kit.ISingleshotClearable;
|
|
194
221
|
}
|
|
195
222
|
|
|
196
223
|
declare const cli: {
|
|
@@ -225,4 +252,11 @@ declare enum FrameName {
|
|
|
225
252
|
|
|
226
253
|
declare function setLogger(logger: ILogger): void;
|
|
227
254
|
|
|
228
|
-
|
|
255
|
+
type PayloadBacktest = Parameters<typeof cli.backtestMainService.run>[0];
|
|
256
|
+
type PayloadPaper = Parameters<typeof cli.paperMainService.run>[0];
|
|
257
|
+
type PayloadLive = Parameters<typeof cli.liveMainService.run>[0];
|
|
258
|
+
type Mode = "backtest" | "live" | "paper";
|
|
259
|
+
type Args = Partial<PayloadBacktest> | Partial<PayloadPaper> | Partial<PayloadLive>;
|
|
260
|
+
declare function run(mode: Mode, args: Args): Promise<void>;
|
|
261
|
+
|
|
262
|
+
export { type BaseModule, ExchangeName, FrameName, type ILiveModule, type ILogger, type LiveModule, type TBaseModuleCtor, cli, run, setLogger };
|