Skip to content

Commit a09e70b

Browse files
committed
feat: download filename param, multi-dir MCP, dashboard fixes and enhancements
- Add filename parameter to download/download_v2 functions - Support multiple -d directory flags in MCP server CLI - Fix note disappearing bug on save in dashboard report - Add challenger highlighting across all compare components - Add Top 5/10/25 strategy selection buttons to modal - Add text filter to notes strategy dropdown - Add MCP server setup instructions to dashboard export tab - Collapse sidebar tag groups by default - Fix examples/open.py path resolution - Update tutorial notebooks with new features
1 parent 9f08ed4 commit a09e70b

9 files changed

Lines changed: 334 additions & 68 deletions

File tree

examples/open.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from investing_algorithm_framework import BacktestReport, recalculate_backtests, retag_backtests
33

44

5-
batch_one_path = os.path.join("examples", "batch_one")
5+
batch_one_path = os.path.join(os.path.dirname(__file__), "batch_one")
66

77
if __name__ == "__main__":
88
retag_backtests("batch_one", directory_path=batch_one_path)

examples/tutorial/notebooks/01_data_exploration.ipynb

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@
114114
"id": "7",
115115
"metadata": {},
116116
"source": [
117-
"## Data downloading\n"
117+
"## Custom filenames\n",
118+
"\n",
119+
"By default, downloaded CSV files are named using the pattern\n",
120+
"`OHLCV_SYMBOL_MARKET_TIMEFRAME_START_END.csv`. You can override this with the\n",
121+
"`filename` parameter to use your own naming convention. The `.csv` extension is\n",
122+
"appended automatically if not present."
118123
]
119124
},
120125
{
@@ -123,6 +128,28 @@
123128
"id": "8",
124129
"metadata": {},
125130
"outputs": [],
131+
"source": [
132+
"# Example: download with a custom filename\n",
133+
"# result = download_v2(\n",
134+
"# symbol=\"BTC/EUR\",\n",
135+
"# market=MARKET,\n",
136+
"# time_frame=\"1d\",\n",
137+
"# data_type=\"ohlcv\",\n",
138+
"# start_date=backtest_window_date_range.start_date,\n",
139+
"# end_date=backtest_window_date_range.end_date,\n",
140+
"# save=True,\n",
141+
"# storage_path=str(data_storage_path),\n",
142+
"# filename=\"btc_daily_data\", # saves as btc_daily_data.csv\n",
143+
"# )\n",
144+
"# print(f\"Saved to: {result.path}\")"
145+
]
146+
},
147+
{
148+
"cell_type": "code",
149+
"execution_count": null,
150+
"id": "9",
151+
"metadata": {},
152+
"outputs": [],
126153
"source": [
127154
"from investing_algorithm_framework import download_v2, TimeFrame, tqdm\n",
128155
"in_sample_data = {}\n",
@@ -143,7 +170,9 @@
143170
" start_date=backtest_window_date_range.start_date,\n",
144171
" end_date=backtest_window_date_range.end_date,\n",
145172
" save=True,\n",
146-
" storage_path=str(data_storage_path)\n",
173+
" storage_path=str(data_storage_path),\n",
174+
" # Optional: provide a custom filename instead of the auto-generated one\n",
175+
" # filename=f\"{symbol}_{time_frame}_in_sample\",\n",
147176
" )\n",
148177
" in_sample_data[symbol][time_frame] = {\n",
149178
" \"data\": result.data,\n",
@@ -170,7 +199,9 @@
170199
" start_date=backtest_window_date_range.start_date,\n",
171200
" end_date=backtest_window_date_range.end_date,\n",
172201
" save=True,\n",
173-
" storage_path=str(data_storage_path)\n",
202+
" storage_path=str(data_storage_path),\n",
203+
" # Optional: provide a custom filename instead of the auto-generated one\n",
204+
" # filename=f\"{symbol}_{time_frame}_out_sample\",\n",
174205
" )\n",
175206
" out_sample_data[symbol][time_frame] = {\n",
176207
" \"data\": result.data,\n",
@@ -179,12 +210,12 @@
179210
" first_date = result.data.index[0]\n",
180211
"\n",
181212
" if first_date > backtest_window_date_range.start_date:\n",
182-
" print(f\"Warning: Data for {symbol_pair} starts on {first_date} which is after the requested start date of {backtest_window_date_range.start_date}.\")\n"
213+
" print(f\"Warning: Data for {symbol_pair} starts on {first_date} which is after the requested start date of {backtest_window_date_range.start_date}.\")"
183214
]
184215
},
185216
{
186217
"cell_type": "markdown",
187-
"id": "9",
218+
"id": "10",
188219
"metadata": {},
189220
"source": [
190221
"## Check data completeness and fill missing timestamps"
@@ -193,7 +224,7 @@
193224
{
194225
"cell_type": "code",
195226
"execution_count": null,
196-
"id": "10",
227+
"id": "11",
197228
"metadata": {},
198229
"outputs": [],
199230
"source": [
@@ -232,7 +263,7 @@
232263
},
233264
{
234265
"cell_type": "markdown",
235-
"id": "11",
266+
"id": "12",
236267
"metadata": {},
237268
"source": [
238269
"## Analysis on the Backtest Windows"
@@ -241,7 +272,7 @@
241272
{
242273
"cell_type": "code",
243274
"execution_count": null,
244-
"id": "12",
275+
"id": "13",
245276
"metadata": {},
246277
"outputs": [],
247278
"source": [

examples/tutorial/notebooks/09_report_and_llm_workflow.ipynb

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,20 @@
231231
"### Start the server from your terminal\n",
232232
"\n",
233233
"```bash\n",
234+
"# Single directory\n",
234235
"iaf mcp -d your_batch_directory\n",
236+
"\n",
237+
"# Multiple directories — repeat -d for each\n",
238+
"iaf mcp -d batch_one -d batch_two -d batch_three\n",
235239
"```\n",
236240
"\n",
237241
"Or if you haven't installed the CLI:\n",
238242
"\n",
239243
"```bash\n",
240244
"python -m investing_algorithm_framework.cli.mcp_server -d your_batch_directory\n",
245+
"\n",
246+
"# Multiple directories\n",
247+
"python -m investing_algorithm_framework.cli.mcp_server -d batch_one -d batch_two\n",
241248
"```\n",
242249
"\n",
243250
"### Configure VS Code to use it\n",
@@ -250,7 +257,7 @@
250257
" \"servers\": {\n",
251258
" \"backtest-analysis\": {\n",
252259
" \"command\": \"iaf\",\n",
253-
" \"args\": [\"mcp\", \"-d\", \"your_batch_directory\"]\n",
260+
" \"args\": [\"mcp\", \"-d\", \"batch_one\", \"-d\", \"batch_two\"]\n",
254261
" }\n",
255262
" }\n",
256263
" }\n",
@@ -594,27 +601,22 @@
594601
"## TL;DR — The Complete Workflow\n",
595602
"\n",
596603
"```python\n",
597-
"from investing_algorithm_framework import (\n",
598-
" BacktestReport, recalculate_backtests, retag_backtests\n",
599-
")\n",
604+
"from investing_algorithm_framework import BacktestReport, recalculate_backtests\n",
600605
"\n",
601606
"# 1. Load all backtests\n",
602607
"report = BacktestReport.open(directory_path=\"my_batch\")\n",
603608
"recalculate_backtests(report.backtests)\n",
604609
"\n",
605-
"# 1b. (Optional) Tag your backtests\n",
606-
"retag_backtests(\"experiment_A\", directory_path=\"my_batch\")\n",
607-
"\n",
608-
"# 1c. (Optional) Load from multiple directories (auto-tagged by dir name)\n",
609-
"report = BacktestReport.open(directory_path=[\"batch_A\", \"batch_B\"])\n",
610-
"\n",
611610
"# 2. Open the dashboard\n",
612611
"report.show()\n",
613612
"```\n",
614613
"\n",
615614
"```bash\n",
616615
"# 3. Start the MCP server (in a separate terminal)\n",
617616
"iaf mcp -d my_batch\n",
617+
"\n",
618+
"# Or load multiple batch directories at once\n",
619+
"iaf mcp -d batch_one -d batch_two\n",
618620
"```\n",
619621
"\n",
620622
"```\n",
@@ -626,7 +628,6 @@
626628
"# 5. On the dashboard:\n",
627629
"- Read the LLM's notes\n",
628630
"- Click \"Apply Selection\" to filter\n",
629-
"- Use the tag filter bar to show/hide batches\n",
630631
"- Capture more snapshots\n",
631632
"- Export the final report\n",
632633
"```\n",

investing_algorithm_framework/app/reporting/templates/dashboard.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ body { font-family:'Inter',-apple-system,sans-serif; background:var(--bg); color
7474
.challenger-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }
7575
.challenger-row { background:rgba(34,211,238,0.06) !important; }
7676
.challenger-row td { border-bottom:1px solid var(--accent) !important; }
77+
.challenger-col { background:rgba(34,211,238,0.06) !important; border-bottom:2px solid var(--accent) !important; }
7778
.sb-challenger { margin-left:auto; font-size:11px; color:var(--accent); }
7879
.sb-item .sb-cb { width:13px; height:13px; accent-color:var(--accent); cursor:pointer; flex-shrink:0; margin:0; }
7980
.sb-item .sb-chal-btn { background:none; border:1px solid var(--border); border-radius:3px; cursor:pointer; font-size:11px; color:var(--text-dim); padding:0 3px; margin-left:auto; line-height:1.2; transition:all 0.15s; flex-shrink:0; }

0 commit comments

Comments
 (0)