@backtest-kit/cli 0.0.1
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 +447 -0
- package/build/index.cjs +1872 -0
- package/build/index.mjs +1849 -0
- package/package.json +89 -0
- package/template/breakeven.mustache +14 -0
- package/template/cancelled.mustache +14 -0
- package/template/closed.mustache +15 -0
- package/template/opened.mustache +15 -0
- package/template/partial-loss.mustache +15 -0
- package/template/partial-profit.mustache +15 -0
- package/template/risk.mustache +18 -0
- package/template/scheduled.mustache +15 -0
- package/template/trailing-stop.mustache +15 -0
- package/template/trailing-take.mustache +15 -0
- package/types.d.ts +228 -0
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backtest-kit/cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "The CLI for launching backtests without a boilerplate",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Petr Tripolsky",
|
|
7
|
+
"email": "tripolskypetr@gmail.com",
|
|
8
|
+
"url": "https://github.com/tripolskypetr"
|
|
9
|
+
},
|
|
10
|
+
"funding": {
|
|
11
|
+
"type": "individual",
|
|
12
|
+
"url": "http://paypal.me/tripolskypetr"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://backtest-kit.github.io/documents/example_02_first_backtest.html",
|
|
16
|
+
"keywords": [],
|
|
17
|
+
"files": [
|
|
18
|
+
"build",
|
|
19
|
+
"types.d.ts",
|
|
20
|
+
"template",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/tripolskypetr/backtest-kit",
|
|
26
|
+
"documentation": "https://github.com/tripolskypetr/backtest-kit/tree/master/docs"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/tripolskypetr/backtest-kit/issues"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "rollup -c"
|
|
33
|
+
},
|
|
34
|
+
"main": "build/index.cjs",
|
|
35
|
+
"module": "build/index.mjs",
|
|
36
|
+
"source": "src/index.ts",
|
|
37
|
+
"types": "./types.d.ts",
|
|
38
|
+
"exports": {
|
|
39
|
+
"require": "./build/index.cjs",
|
|
40
|
+
"types": "./types.d.ts",
|
|
41
|
+
"import": "./build/index.mjs",
|
|
42
|
+
"default": "./build/index.cjs"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@backtest-kit/ui": "3.1.0",
|
|
46
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
47
|
+
"@types/image-size": "0.7.0",
|
|
48
|
+
"@types/jsdom": "21.1.7",
|
|
49
|
+
"@types/mustache": "4.2.6",
|
|
50
|
+
"@types/node": "22.9.0",
|
|
51
|
+
"@types/stack-trace": "0.0.33",
|
|
52
|
+
"backtest-kit": "3.1.0",
|
|
53
|
+
"glob": "11.0.1",
|
|
54
|
+
"rimraf": "6.0.1",
|
|
55
|
+
"rollup": "3.29.5",
|
|
56
|
+
"rollup-plugin-dts": "6.1.1",
|
|
57
|
+
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
58
|
+
"ts-morph": "27.0.2",
|
|
59
|
+
"tslib": "2.7.0",
|
|
60
|
+
"typedoc": "0.27.9",
|
|
61
|
+
"worker-testbed": "1.0.12"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"typescript": "^5.0.0"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"ccxt": "4.5.39",
|
|
68
|
+
"di-kit": "1.0.18",
|
|
69
|
+
"di-scoped": "1.0.21",
|
|
70
|
+
"dotenv": "17.3.1",
|
|
71
|
+
"functools-kit": "1.0.95",
|
|
72
|
+
"get-moment-stamp": "1.1.1",
|
|
73
|
+
"image-size": "1.1.1",
|
|
74
|
+
"jsdom": "26.1.0",
|
|
75
|
+
"markdownlint": "0.38.0",
|
|
76
|
+
"mustache": "4.2.0",
|
|
77
|
+
"quickchart-js": "3.1.3",
|
|
78
|
+
"resize-image-buffer": "1.0.0",
|
|
79
|
+
"sanitize-html": "2.17.0",
|
|
80
|
+
"stack-trace": "0.0.10",
|
|
81
|
+
"telegraf": "4.15.3"
|
|
82
|
+
},
|
|
83
|
+
"bin": {
|
|
84
|
+
"@backtest-kit/cli": "./build/index.mjs"
|
|
85
|
+
},
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"access": "public"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
**⚖️ Breakeven**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{position}})
|
|
4
|
+
|
|
5
|
+
**Current:** `{{currentPrice}}`
|
|
6
|
+
**Entry:** `{{priceOpen}}`
|
|
7
|
+
**Take Profit:** `{{priceTakeProfit}}`
|
|
8
|
+
**Stop Loss:** `{{priceStopLoss}}`
|
|
9
|
+
**Signal ID:** `{{signalId}}`
|
|
10
|
+
**Time:** `{{timestamp}}`
|
|
11
|
+
|
|
12
|
+
{{#backtest}}
|
|
13
|
+
_🧪 Backtest_
|
|
14
|
+
{{/backtest}}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
**🚫 Signal Cancelled**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{signal.position}})
|
|
4
|
+
|
|
5
|
+
**Reason:** `{{reason}}`
|
|
6
|
+
**Entry:** `{{signal.priceOpen}}`
|
|
7
|
+
**Current:** `{{currentPrice}}`
|
|
8
|
+
**Signal ID:** `{{signal.id}}`
|
|
9
|
+
{{#cancelId}}**Cancel ID:** `{{cancelId}}`
|
|
10
|
+
{{/cancelId}}**Time:** `{{createdAt}}`
|
|
11
|
+
|
|
12
|
+
{{#backtest}}
|
|
13
|
+
_🧪 Backtest_
|
|
14
|
+
{{/backtest}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
**🏁 Position Closed**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{signal.position}})
|
|
4
|
+
|
|
5
|
+
**Reason:** `{{closeReason}}`
|
|
6
|
+
**Entry:** `{{pnl.priceOpen}}`
|
|
7
|
+
**Exit:** `{{pnl.priceClose}}`
|
|
8
|
+
**PnL:** {{pnl.pnlPercentage}}%
|
|
9
|
+
**Signal ID:** `{{signal.id}}`
|
|
10
|
+
{{#closeId}}**Close ID:** `{{closeId}}`
|
|
11
|
+
{{/closeId}}**Time:** `{{createdAt}}`
|
|
12
|
+
|
|
13
|
+
{{#backtest}}
|
|
14
|
+
_🧪 Backtest_
|
|
15
|
+
{{/backtest}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
**🚀 Position Opened**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{signal.position}})
|
|
4
|
+
|
|
5
|
+
**Current:** `{{currentPrice}}`
|
|
6
|
+
**Entry:** `{{signal.priceOpen}}`
|
|
7
|
+
**Take Profit:** `{{signal.priceTakeProfit}}`
|
|
8
|
+
**Stop Loss:** `{{signal.priceStopLoss}}`
|
|
9
|
+
**TTL:** {{signal.minuteEstimatedTime}} min
|
|
10
|
+
**Signal ID:** `{{signal.id}}`
|
|
11
|
+
**Time:** `{{createdAt}}`
|
|
12
|
+
|
|
13
|
+
{{#backtest}}
|
|
14
|
+
_🧪 Backtest_
|
|
15
|
+
{{/backtest}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
**🔻 Partial Loss**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{position}})
|
|
4
|
+
|
|
5
|
+
**Current:** `{{currentPrice}}`
|
|
6
|
+
**Entry:** `{{priceOpen}}`
|
|
7
|
+
**Closed:** {{percentToClose}}%
|
|
8
|
+
**Take Profit:** `{{priceTakeProfit}}`
|
|
9
|
+
**Stop Loss:** `{{priceStopLoss}}`
|
|
10
|
+
**Signal ID:** `{{signalId}}`
|
|
11
|
+
**Time:** `{{timestamp}}`
|
|
12
|
+
|
|
13
|
+
{{#backtest}}
|
|
14
|
+
_🧪 Backtest_
|
|
15
|
+
{{/backtest}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
**💚 Partial Profit**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{position}})
|
|
4
|
+
|
|
5
|
+
**Current:** `{{currentPrice}}`
|
|
6
|
+
**Entry:** `{{priceOpen}}`
|
|
7
|
+
**Closed:** {{percentToClose}}%
|
|
8
|
+
**Take Profit:** `{{priceTakeProfit}}`
|
|
9
|
+
**Stop Loss:** `{{priceStopLoss}}`
|
|
10
|
+
**Signal ID:** `{{signalId}}`
|
|
11
|
+
**Time:** `{{timestamp}}`
|
|
12
|
+
|
|
13
|
+
{{#backtest}}
|
|
14
|
+
_🧪 Backtest_
|
|
15
|
+
{{/backtest}}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
**⛔ Risk Rejected**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{currentSignal.position}})
|
|
4
|
+
|
|
5
|
+
**Current:** `{{currentPrice}}`
|
|
6
|
+
**Entry:** `{{currentSignal.priceOpen}}`
|
|
7
|
+
**Take Profit:** `{{currentSignal.priceTakeProfit}}`
|
|
8
|
+
**Stop Loss:** `{{currentSignal.priceStopLoss}}`
|
|
9
|
+
**Active positions:** {{activePositionCount}}
|
|
10
|
+
{{#rejectionId}}**Rejection ID:** `{{rejectionId}}`
|
|
11
|
+
{{/rejectionId}}**Time:** `{{timestamp}}`
|
|
12
|
+
|
|
13
|
+
**Reason:**
|
|
14
|
+
{{rejectionNote}}
|
|
15
|
+
|
|
16
|
+
{{#backtest}}
|
|
17
|
+
_🧪 Backtest_
|
|
18
|
+
{{/backtest}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
**📅 Signal Scheduled**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{signal.position}})
|
|
4
|
+
|
|
5
|
+
**Current:** `{{currentPrice}}`
|
|
6
|
+
**Entry:** `{{signal.priceOpen}}`
|
|
7
|
+
**Take Profit:** `{{signal.priceTakeProfit}}`
|
|
8
|
+
**Stop Loss:** `{{signal.priceStopLoss}}`
|
|
9
|
+
**TTL:** {{signal.minuteEstimatedTime}} min
|
|
10
|
+
**Signal ID:** `{{signal.id}}`
|
|
11
|
+
**Time:** `{{createdAt}}`
|
|
12
|
+
|
|
13
|
+
{{#backtest}}
|
|
14
|
+
_🧪 Backtest_
|
|
15
|
+
{{/backtest}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
**🛡️ Trailing Stop**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{position}})
|
|
4
|
+
|
|
5
|
+
**Current:** `{{currentPrice}}`
|
|
6
|
+
**Entry:** `{{priceOpen}}`
|
|
7
|
+
**Take Profit:** `{{priceTakeProfit}}`
|
|
8
|
+
**Old Stop Loss:** `{{originalPriceStopLoss}}`
|
|
9
|
+
**New Stop Loss:** `{{priceStopLoss}}` ({{percentShift}}%)
|
|
10
|
+
**Signal ID:** `{{signalId}}`
|
|
11
|
+
**Time:** `{{timestamp}}`
|
|
12
|
+
|
|
13
|
+
{{#backtest}}
|
|
14
|
+
_🧪 Backtest_
|
|
15
|
+
{{/backtest}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
**🎯 Trailing Take**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{position}})
|
|
4
|
+
|
|
5
|
+
**Current:** `{{currentPrice}}`
|
|
6
|
+
**Entry:** `{{priceOpen}}`
|
|
7
|
+
**Old Take Profit:** `{{originalPriceTakeProfit}}`
|
|
8
|
+
**New Take Profit:** `{{priceTakeProfit}}` ({{percentShift}}%)
|
|
9
|
+
**Stop Loss:** `{{priceStopLoss}}`
|
|
10
|
+
**Signal ID:** `{{signalId}}`
|
|
11
|
+
**Time:** `{{timestamp}}`
|
|
12
|
+
|
|
13
|
+
{{#backtest}}
|
|
14
|
+
_🧪 Backtest_
|
|
15
|
+
{{/backtest}}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import * as functools_kit from 'functools-kit';
|
|
2
|
+
import { Input } from 'telegraf';
|
|
3
|
+
import { TrailingTakeCommit, TrailingStopCommit, BreakevenCommit, PartialProfitCommit, PartialLossCommit, IStrategyTickResultScheduled, IStrategyTickResultCancelled, IStrategyTickResultOpened, IStrategyTickResultClosed, RiskContract } from 'backtest-kit';
|
|
4
|
+
|
|
5
|
+
interface ILogger {
|
|
6
|
+
log(topic: string, ...args: any[]): void;
|
|
7
|
+
debug(topic: string, ...args: any[]): void;
|
|
8
|
+
info(topic: string, ...args: any[]): void;
|
|
9
|
+
warn(topic: string, ...args: any[]): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare class LoggerService implements ILogger {
|
|
13
|
+
private _commonLogger;
|
|
14
|
+
log: (topic: string, ...args: any[]) => Promise<void>;
|
|
15
|
+
debug: (topic: string, ...args: any[]) => Promise<void>;
|
|
16
|
+
info: (topic: string, ...args: any[]) => Promise<void>;
|
|
17
|
+
warn: (topic: string, ...args: any[]) => Promise<void>;
|
|
18
|
+
setLogger: (logger: ILogger) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare class PaperMainService {
|
|
22
|
+
private loggerService;
|
|
23
|
+
private exchangeSchemaService;
|
|
24
|
+
private resolveService;
|
|
25
|
+
private frontendProviderService;
|
|
26
|
+
private telegramProviderService;
|
|
27
|
+
protected init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare class LiveMainService {
|
|
31
|
+
private loggerService;
|
|
32
|
+
private exchangeSchemaService;
|
|
33
|
+
private resolveService;
|
|
34
|
+
private frontendProviderService;
|
|
35
|
+
private telegramProviderService;
|
|
36
|
+
protected init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare class BacktestMainService {
|
|
40
|
+
private loggerService;
|
|
41
|
+
private exchangeSchemaService;
|
|
42
|
+
private frameSchemaService;
|
|
43
|
+
private cacheLogicService;
|
|
44
|
+
private resolveService;
|
|
45
|
+
private frontendProviderService;
|
|
46
|
+
private telegramProviderService;
|
|
47
|
+
protected init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare class ExchangeSchemaService {
|
|
51
|
+
readonly loggerService: LoggerService;
|
|
52
|
+
init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare class FrameSchemaService {
|
|
56
|
+
readonly loggerService: LoggerService;
|
|
57
|
+
init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare class ResolveService {
|
|
61
|
+
private readonly loggerService;
|
|
62
|
+
readonly DEFAULT_TEMPLATE_DIR: string;
|
|
63
|
+
readonly OVERRIDE_TEMPLATE_DIR: string;
|
|
64
|
+
readonly OVERRIDE_MODULES_DIR: string;
|
|
65
|
+
attachEntryPoint: (entryPoint: string) => Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare class ErrorService {
|
|
69
|
+
handleGlobalError: (error: Error) => Promise<void>;
|
|
70
|
+
private _listenForError;
|
|
71
|
+
protected init: () => void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class SymbolSchemaService {
|
|
75
|
+
readonly loggerService: LoggerService;
|
|
76
|
+
init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare class FrontendProviderService {
|
|
80
|
+
private readonly loggerService;
|
|
81
|
+
enable: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
82
|
+
disable: () => void;
|
|
83
|
+
init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare class TelegramProviderService {
|
|
87
|
+
private readonly loggerService;
|
|
88
|
+
private readonly telegramLogicService;
|
|
89
|
+
enable: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
90
|
+
disable: () => void;
|
|
91
|
+
init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare class CacheLogicService {
|
|
95
|
+
private readonly loggerService;
|
|
96
|
+
execute: (dto: {
|
|
97
|
+
symbol: string;
|
|
98
|
+
frameName: string;
|
|
99
|
+
exchangeName: string;
|
|
100
|
+
}) => Promise<void>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type InputFile = ReturnType<typeof Input.fromReadableStream>;
|
|
104
|
+
type Image = string | InputFile;
|
|
105
|
+
declare class TelegramApiService {
|
|
106
|
+
publish: (channel: string, msg: string, images?: Image[]) => Promise<"Message scheduled for publication" | "Message published successfully">;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare class QuickchartApiService {
|
|
110
|
+
readonly loggerService: LoggerService;
|
|
111
|
+
getChart: (symbol: string, interval: string) => Promise<Buffer<ArrayBufferLike>>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
declare class TelegramWebService {
|
|
115
|
+
private readonly loggerService;
|
|
116
|
+
private readonly telegramApiService;
|
|
117
|
+
private readonly quickchartApiService;
|
|
118
|
+
publishNotify: (dto: {
|
|
119
|
+
symbol: string;
|
|
120
|
+
markdown: string;
|
|
121
|
+
}) => Promise<void>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare class TelegramLogicService {
|
|
125
|
+
private readonly loggerService;
|
|
126
|
+
private readonly telegramTemplateService;
|
|
127
|
+
private readonly telegramWebService;
|
|
128
|
+
private notifyTrailingTake;
|
|
129
|
+
private notifyTrailingStop;
|
|
130
|
+
private notifyBreakeven;
|
|
131
|
+
private notifyPartialProfit;
|
|
132
|
+
private notifyPartialLoss;
|
|
133
|
+
private notifyScheduled;
|
|
134
|
+
private notifyCancelled;
|
|
135
|
+
private notifyOpened;
|
|
136
|
+
private notifyClosed;
|
|
137
|
+
private notifyRisk;
|
|
138
|
+
connect: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
declare class TelegramTemplateService {
|
|
142
|
+
readonly loggerService: LoggerService;
|
|
143
|
+
readonly resolveService: ResolveService;
|
|
144
|
+
getTrailingTakeMarkdown: (event: TrailingTakeCommit) => Promise<string>;
|
|
145
|
+
getTrailingStopMarkdown: (event: TrailingStopCommit) => Promise<string>;
|
|
146
|
+
getBreakevenMarkdown: (event: BreakevenCommit) => Promise<string>;
|
|
147
|
+
getPartialProfitMarkdown: (event: PartialProfitCommit) => Promise<string>;
|
|
148
|
+
getPartialLossMarkdown: (event: PartialLossCommit) => Promise<string>;
|
|
149
|
+
getScheduledMarkdown: (event: IStrategyTickResultScheduled) => Promise<string>;
|
|
150
|
+
getCancelledMarkdown: (event: IStrategyTickResultCancelled) => Promise<string>;
|
|
151
|
+
getOpenedMarkdown: (event: IStrategyTickResultOpened) => Promise<string>;
|
|
152
|
+
getClosedMarkdown: (event: IStrategyTickResultClosed) => Promise<string>;
|
|
153
|
+
getRiskMarkdown: (event: RiskContract) => Promise<string>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
interface ILiveModule {
|
|
157
|
+
onTrailingTake(event: TrailingTakeCommit): Promise<void> | void;
|
|
158
|
+
onTrailingStop(event: TrailingStopCommit): Promise<void> | void;
|
|
159
|
+
onBreakeven(event: BreakevenCommit): Promise<void> | void;
|
|
160
|
+
onPartialProfit(event: PartialProfitCommit): Promise<void> | void;
|
|
161
|
+
onPartialLoss(event: PartialLossCommit): Promise<void> | void;
|
|
162
|
+
onScheduled(event: IStrategyTickResultScheduled): Promise<void> | void;
|
|
163
|
+
onCancelled(event: IStrategyTickResultCancelled): Promise<void> | void;
|
|
164
|
+
onOpened(event: IStrategyTickResultOpened): Promise<void> | void;
|
|
165
|
+
onClosed(event: IStrategyTickResultClosed): Promise<void> | void;
|
|
166
|
+
onRisk(event: RiskContract): Promise<void> | void;
|
|
167
|
+
}
|
|
168
|
+
type LiveModule = Partial<ILiveModule>;
|
|
169
|
+
type BaseModule = LiveModule;
|
|
170
|
+
type TBaseModuleCtor = new () => BaseModule;
|
|
171
|
+
|
|
172
|
+
declare class ModuleConnectionService {
|
|
173
|
+
readonly loggerService: LoggerService;
|
|
174
|
+
readonly resolveService: ResolveService;
|
|
175
|
+
getInstance: ((fileName: string) => Promise<BaseModule>) & functools_kit.IClearableMemoize<string> & functools_kit.IControlMemoize<string, Promise<Partial<ILiveModule>>>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
declare class LiveProviderService {
|
|
179
|
+
readonly loggerService: LoggerService;
|
|
180
|
+
readonly moduleConnectionService: ModuleConnectionService;
|
|
181
|
+
private handleTrailingTake;
|
|
182
|
+
private handleTrailingStop;
|
|
183
|
+
private handleBreakeven;
|
|
184
|
+
private handlePartialProfit;
|
|
185
|
+
private handlePartialLoss;
|
|
186
|
+
private handleScheduled;
|
|
187
|
+
private handleCancelled;
|
|
188
|
+
private handleOpened;
|
|
189
|
+
private handleClosed;
|
|
190
|
+
private handleRisk;
|
|
191
|
+
enable: (() => (...args: any[]) => any) & functools_kit.ISingleshotClearable;
|
|
192
|
+
disable: () => void;
|
|
193
|
+
init: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
declare const cli: {
|
|
197
|
+
telegramTemplateService: TelegramTemplateService;
|
|
198
|
+
telegramWebService: TelegramWebService;
|
|
199
|
+
frontendProviderService: FrontendProviderService;
|
|
200
|
+
telegramProviderService: TelegramProviderService;
|
|
201
|
+
liveProviderService: LiveProviderService;
|
|
202
|
+
exchangeSchemaService: ExchangeSchemaService;
|
|
203
|
+
symbolSchemaService: SymbolSchemaService;
|
|
204
|
+
frameSchemaService: FrameSchemaService;
|
|
205
|
+
cacheLogicService: CacheLogicService;
|
|
206
|
+
telegramLogicService: TelegramLogicService;
|
|
207
|
+
backtestMainService: BacktestMainService;
|
|
208
|
+
paperMainService: PaperMainService;
|
|
209
|
+
liveMainService: LiveMainService;
|
|
210
|
+
moduleConnectionService: ModuleConnectionService;
|
|
211
|
+
errorService: ErrorService;
|
|
212
|
+
loggerService: LoggerService;
|
|
213
|
+
resolveService: ResolveService;
|
|
214
|
+
telegramApiService: TelegramApiService;
|
|
215
|
+
quickchartApiService: QuickchartApiService;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
declare enum ExchangeName {
|
|
219
|
+
DefaultExchange = "default_exchange"
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
declare enum FrameName {
|
|
223
|
+
DefaultFrame = "default_frame"
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
declare function setLogger(logger: ILogger): void;
|
|
227
|
+
|
|
228
|
+
export { type BaseModule, ExchangeName, FrameName, type ILiveModule, type ILogger, type LiveModule, type TBaseModuleCtor, cli, setLogger };
|