Start with the rules and data
Describe the strategy, provide historical price data, and ask for a Python implementation with its assumptions listed. ChatGPT's analysis tools can work with supplied files; the available environment determines which libraries, data access, and execution options you can use.
Keep the source data, code, and output together. That makes it easier to rerun the test and distinguish a change in strategy performance from a change in the data or implementation.
Step by step
Use a sequence you can reproduce:
- Specify the asset, interval, entry, exit, position size, and costs. Ask for unresolved choices to be listed before code is written.
- Ask for a complete, runnable Python backtest using a known library.
- Supply historical data from an identified source and check timestamps, missing rows, and the test period.
- Run the code in the available environment or a notebook you control. Resolve errors and keep the final version with the output.
- Inspect a sample of trades, check that decisions use only available information, and confirm the cost and fill assumptions.
What a successful run does not prove
Code can execute without errors and still test the wrong rule. A future price used too early, omitted fees, or misaligned timestamps can change performance without causing an exception. This applies to generated code and code written by hand.
Compare several entries and exits with the underlying data. If the strategy uses a closing price to decide, check when the next simulated fill occurs. Keep a separate period for evaluation after selecting the rules.
Using a dedicated backtesting workspace
Premiss brings strategy generation, historical data, execution, and results into a dedicated workspace. Describe the idea, then review the generated Python, trades, and metrics together. This reduces setup work while keeping the same responsibility to check the rule, costs, and timing assumptions.