Skip to content

Commit 237ee5f

Browse files
committed
docs: inspecting artifacts
1 parent 7eeaea4 commit 237ee5f

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

.vitepress/config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default defineConfig({
4848
items: [
4949
{ text: 'Downloading Market Data', link: '/data-downloading' },
5050
{ text: 'Inspecting & Validating Data', link: '/data-validation' },
51+
{ text: 'Inspecting Backtest Artifacts', link: '/inspecting-artifacts' },
5152
{ text: 'Format Specification: OHLCV Data', link: '/spec-stchx' },
5253
{ text: 'Format Specification: Time-Series Data', link: '/spec-timeseries' },
5354
]

inspecting-artifacts.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Inspecting Backtest Artifacts
2+
3+
After a backtest completes, Stochastix saves the time-series data for your indicators and performance metrics into compact binary files. While the full technical specifications for these formats are available, the framework also provides simple command-line tools to quickly inspect the metadata and structure of these files without needing a binary viewer.
4+
5+
This is primarily useful for advanced debugging or for developers building custom tools on top of Stochastix's data.
6+
7+
## The Backtest Artifact Files
8+
9+
For each backtest run, two time-series data files are generated and stored in the `data/backtests/` directory alongside the main JSON result file:
10+
11+
* **`.stchxi`**: Contains the calculated values for every indicator used in the strategy (e.g., every EMA, RSI, or custom indicator value for every bar).
12+
* **`.stchxm`**: Contains the calculated time-series performance metrics, such as the portfolio's `equity` curve and `drawdown` series for each bar.
13+
14+
## Inspecting Indicator Files (`.stchxi`)
15+
16+
To view the contents of an indicator data file, use the `stochastix:data:indicator-info` command (alias: `stx:data:ind-info`).
17+
18+
### Command Signature
19+
20+
The command takes a single argument: the path to the `.stchxi` file.
21+
22+
```bash
23+
make sf c="stochastix:data:indicator-info <path-to-file>"
24+
```
25+
26+
### Example Usage
27+
28+
```bash
29+
make sf c="stochastix:data:indicator-info data/backtests/20250617-093352_sample_strategy_447393.stchxi"
30+
```
31+
32+
### Understanding the Output
33+
34+
The command outputs two main sections:
35+
36+
1. **Header Information**: General metadata about the file, including the format version, the total number of timestamps (`Timestamp Count`), and the total number of individual data series stored (`Series Count`).
37+
2. **Series Directory**: This is a crucial table listing every single data series in the file.
38+
* `Indicator Key`: The unique key you gave the indicator in your strategy (e.g., `'ema_fast'`).
39+
* `Series Key`: The specific value from that indicator (e.g., `'value'`, or `'macd'`, `'signal'` for multi-value indicators).
40+
41+
```bash
42+
📊 Stochastix STCHXI File Inspector 📊
43+
======================================
44+
45+
 File: data/backtests/20250617-093352_sample_strategy_447393.stchxi
46+
 Size: 4,194,368 bytes
47+
48+
Header Information
49+
------------------
50+
51+
 ------------------- -----------
52+
  Magic Number   STCHXI01
53+
  Format Version   1
54+
  Value Format Code   1
55+
  Timestamp Count   86,400
56+
  Series Count   2
57+
 ------------------- -----------
58+
59+
Series Directory
60+
----------------
61+
62+
 --- --------------- -----------
63+
  #   Indicator Key   Series Key
64+
 --- --------------- -----------
65+
  0   ema_fast   value
66+
  1   ema_slow   value
67+
 --- --------------- -----------
68+
69+
[OK] File metadata read successfully.
70+
```
71+
72+
## Inspecting Metric Files (`.stchxm`)
73+
74+
To view the contents of a metric data file, use the `stochastix:data:metric-info` command (alias: `stx:data:metric-info`). Its usage and output are structurally identical to the indicator command.
75+
76+
### Example Usage
77+
78+
```bash
79+
make sf c="stochastix:data:metric-info data/backtests/20250617-093352_sample_strategy_447393.stchxm"
80+
```
81+
82+
### Understanding the Output
83+
84+
The only difference is in the "Series Directory".
85+
86+
* `Metric Key`: The key for the time-series metric (e.g., `'equity'`, `'drawdown'`).
87+
* `Series Key`: The specific value from that metric, which is typically `'value'`.
88+
89+
```bash
90+
📊 Stochastix STCHXM File Inspector 📊
91+
======================================
92+
...
93+
Series Directory
94+
----------------
95+
96+
 --- ------------ -----------
97+
  #   Metric Key   Series Key
98+
 --- ------------ -----------
99+
  0   equity   value
100+
  1   drawdown   value
101+
  2   benchmark   value
102+
  3   beta   value
103+
  4   alpha   value
104+
 --- ------------ -----------
105+
106+
[OK] File metadata read successfully.
107+
```

0 commit comments

Comments
 (0)