backtest-kit 1.5.24 โ 1.5.25
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 +50 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -25,8 +25,9 @@ Build reliable trading systems: backtest on historical data, deploy live bots wi
|
|
|
25
25
|
- ๐ก๏ธ **Risk Management**: Custom rules for position limits, time windows, and multi-strategy coordination.
|
|
26
26
|
- ๐ **Pluggable**: Custom data sources (CCXT), persistence (file/Redis), and sizing calculators.
|
|
27
27
|
- ๐งช **Tested**: 280+ unit/integration tests for validation, recovery, and events.
|
|
28
|
+
- ๐ **Self hosted**: Zero dependency on third-party node_modules or platforms; run entirely in your own environment.
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
## ๐ Supported Order Types
|
|
30
31
|
|
|
31
32
|
- Market/Limit entries
|
|
32
33
|
- TP/SL/OCO exits
|
|
@@ -34,6 +35,8 @@ Build reliable trading systems: backtest on historical data, deploy live bots wi
|
|
|
34
35
|
|
|
35
36
|
## ๐ Quick Start
|
|
36
37
|
|
|
38
|
+
> Link to [the source code](https://github.com/tripolskypetr/backtest-kit/tree/master/demo)
|
|
39
|
+
|
|
37
40
|
### ๐ฆ Installation
|
|
38
41
|
```bash
|
|
39
42
|
npm install backtest-kit ccxt ollama uuid
|
|
@@ -179,16 +182,14 @@ Customize via `setConfig()`:
|
|
|
179
182
|
- `CC_SCHEDULE_AWAIT_MINUTES`: Pending timeout (default: 120).
|
|
180
183
|
- `CC_AVG_PRICE_CANDLES_COUNT`: VWAP candles (default: 5).
|
|
181
184
|
|
|
182
|
-
## โ
Tested & Reliable
|
|
183
|
-
|
|
184
|
-
280+ tests cover validation, recovery, reports, and events.
|
|
185
|
-
|
|
186
185
|
## ๐ป Developer Note
|
|
187
186
|
|
|
187
|
+
Backtest Kit is **not a data-processing library** - it is a **time execution engine**. Think of the engine as an **async stream of time**, where your strategy is evaluated step by step.
|
|
188
|
+
|
|
188
189
|
### ๐ How getCandles Works
|
|
189
190
|
|
|
190
191
|
backtest-kit uses Node.js `AsyncLocalStorage` to automatically provide
|
|
191
|
-
temporal context to your strategies.
|
|
192
|
+
temporal time context to your strategies.
|
|
192
193
|
|
|
193
194
|
### ๐ญ What this means:
|
|
194
195
|
- `getCandles()` always returns data UP TO the current backtest timestamp using `async_hooks`
|
|
@@ -196,10 +197,53 @@ temporal context to your strategies.
|
|
|
196
197
|
- **Impossible to introduce look-ahead bias**
|
|
197
198
|
- Same code works in both backtest and live modes
|
|
198
199
|
|
|
200
|
+
|
|
201
|
+
## ๐ง Two Ways to Run the Engine
|
|
202
|
+
|
|
203
|
+
Backtest Kit exposes the same runtime in two equivalent forms. Both approaches use **the same engine and guarantees** - only the consumption model differs.
|
|
204
|
+
|
|
205
|
+
### 1๏ธโฃ Event-driven (background execution)
|
|
206
|
+
|
|
207
|
+
Suitable for production bots, monitoring, and long-running processes.
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
Backtest.background('BTCUSDT', config);
|
|
211
|
+
|
|
212
|
+
listenSignalBacktest(event => { /* handle signals */ });
|
|
213
|
+
listenDoneBacktest(event => { /* finalize / dump report */ });
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### 2๏ธโฃ Async Iterator (pull-based execution)
|
|
217
|
+
|
|
218
|
+
Suitable for research, scripting, testing, and LLM agents.
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
for await (const event of Backtest.run('BTCUSDT', config)) {
|
|
222
|
+
// signal | trade | progress | done
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## ๐ Think of it as...
|
|
227
|
+
|
|
228
|
+
**Open-source QuantConnect without the vendor lock-in**
|
|
229
|
+
|
|
230
|
+
Unlike cloud-based platforms, backtest-kit runs entirely in your environment. You own the entire stack from data ingestion to live execution. In addition to Ollama, you can use [neural-trader](https://www.npmjs.com/package/neural-trader) in `getSignal` function or any other third party library
|
|
231
|
+
|
|
232
|
+
- No C# required - pure TypeScript/JavaScript
|
|
233
|
+
- Self-hosted - your code, your data, your infrastructure
|
|
234
|
+
- No platform fees or hidden costs
|
|
235
|
+
- Full control over execution and data sources
|
|
236
|
+
- [GUI](https://backtest-kit.github.io/documents/design_30_markdown-report-system.html#method-signatures) for visualization and monitoring
|
|
237
|
+
|
|
238
|
+
|
|
199
239
|
## ๐ค Are you a robot?
|
|
200
240
|
|
|
201
241
|
**For language models**: Read extended description in [./LLMs.md](./LLMs.md)
|
|
202
242
|
|
|
243
|
+
## โ
Tested & Reliable
|
|
244
|
+
|
|
245
|
+
280+ tests cover validation, recovery, reports, and events.
|
|
246
|
+
|
|
203
247
|
## ๐ค Contribute
|
|
204
248
|
|
|
205
249
|
Fork/PR on [GitHub](https://github.com/tripolskypetr/backtest-kit).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backtest-kit",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.25",
|
|
4
4
|
"description": "A TypeScript library for trading system backtest",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Petr Tripolsky",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"url": "http://paypal.me/tripolskypetr"
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
|
-
"homepage": "https://backtest-kit.github.io/
|
|
15
|
+
"homepage": "https://backtest-kit.github.io/documents/example_02_first_backtest.html",
|
|
16
16
|
"keywords": [
|
|
17
17
|
"backtesting",
|
|
18
18
|
"backtest",
|