backtest-kit 3.0.9 → 3.0.11
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 +24 -0
- package/build/index.cjs +1405 -1330
- package/build/index.mjs +1405 -1331
- package/package.json +1 -1
- package/types.d.ts +133 -109
package/README.md
CHANGED
|
@@ -321,6 +321,30 @@ since = alignedWhen - 4 * stepMs
|
|
|
321
321
|
|
|
322
322
|
**Result:** Deterministic candle retrieval with exact timestamp matching.
|
|
323
323
|
|
|
324
|
+
### 🕐 Timezone Warning: Candle Boundaries Are UTC-Based
|
|
325
|
+
|
|
326
|
+
All candle timestamp alignment uses UTC (Unix epoch). For intervals like `4h`, boundaries are `00:00, 04:00, 08:00, 12:00, 16:00, 20:00 UTC`. If your local timezone offset is not a multiple of the interval, the `since` timestamps will look "uneven" in local time.
|
|
327
|
+
|
|
328
|
+
For example, in UTC+5 the same 4h candle request logs as:
|
|
329
|
+
|
|
330
|
+
```
|
|
331
|
+
since: Sat Sep 20 2025 13:00:00 GMT+0500 ← looks uneven (13:00)
|
|
332
|
+
since: Sat Sep 20 2025 17:00:00 GMT+0500 ← looks uneven (17:00)
|
|
333
|
+
since: Sat Sep 20 2025 21:00:00 GMT+0500 ← looks uneven (21:00)
|
|
334
|
+
since: Sun Sep 21 2025 05:00:00 GMT+0500 ← looks uneven (05:00)
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
But in UTC these are perfectly aligned 4h boundaries:
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
since: Sat, 20 Sep 2025 08:00:00 GMT ← 08:00 UTC ✓
|
|
341
|
+
since: Sat, 20 Sep 2025 12:00:00 GMT ← 12:00 UTC ✓
|
|
342
|
+
since: Sat, 20 Sep 2025 16:00:00 GMT ← 16:00 UTC ✓
|
|
343
|
+
since: Sun, 21 Sep 2025 00:00:00 GMT ← 00:00 UTC ✓
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Use `toUTCString()` or `toISOString()` in callbacks to see the actual aligned UTC times.
|
|
347
|
+
|
|
324
348
|
### 💭 What this means:
|
|
325
349
|
- `getCandles()` always returns data UP TO the current backtest timestamp using `async_hooks`
|
|
326
350
|
- Multi-timeframe data is automatically synchronized
|