# Auditing Online Course Strategies with AI: Out-of-Sample Backtesting and Building Your Own XQ Minute-Bar Database

- Channel: 量化交易科學園區 - 江加宏
- Published: 2026-11-18
- Series: [Quant Trading Science Park](https://xknow.app/en/s/quant-trading-science-park/?ref=agent) ([series index](https://xknow.app/en/s/quant-trading-science-park/llms.txt))
- Topics: [Technical Analysis](https://xknow.app/en/topics/technicals/llms.txt), [Warrants & Derivatives](https://xknow.app/en/topics/derivatives/llms.txt)
- Page: https://xknow.app/en/v/quant-trading-science-park-ep2/?ref=agent
- YouTube: https://www.youtube.com/watch?v=DYFHs1axcsk

> The course strategy really did make money back when the instructor taught it, but its out-of-sample results are poor, so you need AI plus a complete historical database to run a backtest audit and see whether the performance can last.

## Key ideas

- Verifying course material can be handed to AI in stages: first understand the key points of the material and decide which techniques can be quantified, then backtest the quantifiable ones, and finally produce a summary report; this time the conclusion was that the instructor did not lie, but the backtest showed no edge.
- Good in-sample performance does not mean a strategy works: it may be overfitting, or the market at the time may simply have suited it; many parameters that are extremely critical (for example, a moving average of 38 works but 39 and 37 both fail) is a warning sign, and you should also be wary when an instructor shows only successful cases.
- A backtest must confirm that there is trading volume, otherwise AI may carry over the previous bar's closing price and create fake trades; you also need to prepare the database and a pre-written research-rules prompt in advance.
- To build your own minute-bar database: in XQ, use the single-run output in the view tool, split the output into segments when the data for over 1800 stocks is large, update weekly, then convert and store it as Parquet with DuckDB; if you don't want to maintain it, you can rent the paid FinMind service instead, depending on your budget.

## Section summaries

### 0:05 Original performance of an options course, backtested by AI

This demonstrates using AI to backtest the material of an options course; besides the original conditions, the AI also tries other conditions on its own. The backtest of the original conditions did make a profit, and the period covered by the handout performed especially well, then fell back and fluctuated, yet overall it still made money, showing that the performance at the time of teaching was real.

[Page](https://xknow.app/en/v/quant-trading-science-park-ep2/?ref=agent#s-0) | [YouTube 0:05](https://www.youtube.com/watch?v=DYFHs1axcsk&t=5s)

### 1:25 AI produces the backtest analysis and summary report

Give the course's PDF and videos to AI and ask it to organize the material, decide which techniques can be quantified, backtest them and write a summary. The instructor claimed a big profit of 36 × 10,000 and a 69% win rate; the AI backtest gave about 32 × 10,000, with the gap attributed to fees and how fills are determined, confirming that what the instructor said was true. But the out-of-sample results were poor, possibly because of overfitting or because the market at the time happened to suit it: after earning the most in 2021, it lost steadily. During the process you need to prepare the database and a prompt of rules in advance, and remind the AI that a backtest must have trading volume, otherwise fake trades will appear.

[Page](https://xknow.app/en/v/quant-trading-science-park-ep2/?ref=agent#s-1) | [YouTube 1:25](https://www.youtube.com/watch?v=DYFHs1axcsk&t=85s)

### 29:45 Choosing the channel for exporting minute-bar data from XQ

Since you are already renting XQ, you should make good use of it; earlier I taught how to pull daily bars, and next we switch to minute bars. XQ has four places that can export: indicator, stock screening, view and trading. The indicator can only work one stock at a time, so it is ruled out; when exporting minute bars only two choices remain, view and trading, and here I chose view.

[Page](https://xknow.app/en/v/quant-trading-science-park-ep2/?ref=agent#s-2) | [YouTube 29:45](https://www.youtube.com/watch?v=DYFHs1axcsk&t=1785s)

### 31:45 Writing the minute-bar export script and explaining the fields

The export script is very simple: the user enters a start date, and it prints the output path, date and time, stock name, and open, high, low, close and volume; if you need other fields you can append them at the end, and you must tell the AI what each field means.

[Page](https://xknow.app/en/v/quant-trading-science-park-ep2/?ref=agent#s-3) | [YouTube 31:45](https://www.youtube.com/watch?v=DYFHs1axcsk&t=1905s)

### 34:35 Exporting 1-minute bars with a single run in Strategy Radar

Exporting 1-minute bars for over 1800 stocks by backtesting or automated trading doesn't work: because the backtest runs on XQ's servers, memory blows up quickly and only about 200–300 stocks have data. The correct way is to add the script to Strategy Radar and switch to single-run mode, setting the start date and a 1-minute bar frequency; when the data is large you must split it up, for example exporting once per half year, since pulling 5 years at once will definitely crash, and after that just update weekly.

[Page](https://xknow.app/en/v/quant-trading-science-park-ep2/?ref=agent#s-4) | [YouTube 34:35](https://www.youtube.com/watch?v=DYFHs1axcsk&t=2075s)

### 41:35 Storing minute-bar data and choosing a data source

Minute-bar data is stored with Parquet plus DuckDB rather than sqlite, because sqlite files for 1-minute bars or tick data become very large and queries are slow, while this kind of data is rarely modified, so what you want is a small footprint and fast reads. If building your own is a hassle, you can instead use the paid FinMind, at 8888 per year, which saves maintenance and includes historical options data, but has traffic limits; a self-built database has no traffic limits, so choose according to your budget.

[Page](https://xknow.app/en/v/quant-trading-science-park-ep2/?ref=agent#s-5) | [YouTube 41:35](https://www.youtube.com/watch?v=DYFHs1axcsk&t=2495s)

---

Full notes (with slides) and other episodes in this series: https://xknow.app/en/v/quant-trading-science-park-ep2/?ref=agent

Watch the original video: https://www.youtube.com/watch?v=DYFHs1axcsk
