backtest-kit 5.9.0 → 5.10.0

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 CHANGED
@@ -135,7 +135,7 @@ addFrameSchema({
135
135
  ### 💡 Example Strategy (with LLM)
136
136
  ```typescript
137
137
  import { v4 as uuid } from 'uuid';
138
- import { addStrategySchema, dumpSignalData, getCandles } from 'backtest-kit';
138
+ import { addStrategySchema, getCandles, Dump } from 'backtest-kit';
139
139
  import { json } from './utils/json.mjs'; // LLM wrapper
140
140
  import { getMessages } from './utils/messages.mjs'; // Market data prep
141
141
 
@@ -159,7 +159,20 @@ addStrategySchema({
159
159
 
160
160
  const resultId = uuid();
161
161
  const signal = await json(messages); // LLM generates signal
162
- await dumpSignalData(resultId, messages, signal); // Log
162
+
163
+ Dump.dumpAgentAnswer(messages, {
164
+ dumpId: "position-context",
165
+ bucketName: "multi-timeframe-strategy",
166
+ signalId: resultId,
167
+ description: signal.description, // search keywords for BM25 index
168
+ });
169
+
170
+ Dump.dumpRecord(signal, {
171
+ dumpId: "position-entry",
172
+ bucketName: "multi-timeframe-strategy",
173
+ signalId: resultId,
174
+ description: signal.description, // agent can review the history using RAG
175
+ });
163
176
 
164
177
  return { ...signal, id: resultId };
165
178
  },
@@ -215,7 +228,7 @@ Backtest Kit is **not a data-processing library** - it is a **time execution eng
215
228
  These three functions work together to dynamically manage the position. To reduce position linearity, by default, each DCA entry is formatted as a fixed **unit of $100**. This can be changed. No mathematical knowledge is required.
216
229
 
217
230
  **Public API:**
218
- - **`commitAverageBuy`** — adds a new DCA entry. For LONG, **only accepted when current price is below a new low**. Silently rejected otherwise. This prevents averaging up. Can be overridden using `setConfig`
231
+ - **`commitAverageBuy`** — adds a new DCA entry. By default, **only accepted when current price is below a new low**. Silently rejected otherwise. This prevents averaging up. Can be overridden using `setConfig`
219
232
  - **`commitPartialProfit`** — closes X% of the position at a profit. Locks in gains while keeping exposure.
220
233
  - **`commitPartialLoss`** — closes X% of the position at a loss. Cuts exposure before the stop-loss is hit.
221
234
 
@@ -1675,7 +1688,7 @@ npm start
1675
1688
 
1676
1689
  ## ✅ Tested & Reliable
1677
1690
 
1678
- 500+ tests cover validation, recovery, reports, and events.
1691
+ 515+ tests cover validation, recovery, reports, and events.
1679
1692
 
1680
1693
  ## 🤝 Contribute
1681
1694