gitmyhub

revenue-yoy-backtest

Jupyter Notebook ★ 23 updated 1mo ago

月營收 YoY 回測分析教材

This is a set of Jupyter Notebooks for backtesting a stock trading strategy based on year-over-year monthly revenue growth. The core question it answers is: when a stock's monthly revenue grows by more than a set percentage compared to the same month the previous year, what is the historical win rate if you buy and hold for a fixed number of days? It is described as educational material for learning how to build such an analysis.

The project offers three notebook versions for different users. A teaching version walks through every step with explanations, suited for first-time learners. A single-cell version condenses everything into one block to run quickly after adjusting parameters. A command-input version lets you type natural-language instructions to run backtests without modifying any code — for example, typing a stock ticker, a revenue growth threshold, and a number of hold days. All three can be run directly in Google Colab, a free online coding environment that needs no local installation.

Parameters include the stock ticker code, the market (Taiwan Stock Exchange or OTC), the year-over-year growth threshold, the number of days to hold after buying, and a start date for the backtest period. Monthly revenue data comes from FinMind, a financial data platform, and stock price data comes from the yfinance library. The project is written in Python and runs in Jupyter Notebook.

This is intended for learners interested in Taiwanese stock markets who want to understand how to build and test a simple quantitative strategy. The README notes that backtest results are for educational purposes only and do not constitute investment advice.