TAYU Academy course material · Machine Learning for Trading
Course Notes
1. Understand the core idea of “Feature construction exercise” and explain it in your own words
2. Master this module's focus: Feature engineering
3. Complete the assignment on your own and check it against the reference answer
The feature construction exercise is not just about the number of columns; it also needs to prove that future additions will not rewrite past features. Past features within a fixed window should satisfy the property of prefix invariance, and full-sample normalization typically does not satisfy this.
Common features include lagging returns, volatility, technical indicators, and timeframes. All features can only use data available at the time, and labels (such as future N candles' up and down) cannot be leaked into the features. The training set and test set are divided in chronological order, and they cannot be randomly shuffled.
Example: Features use the 5- and 20-day returns and ATR from the past 5, 20 K lines, with labels for the future 4 H1 returns direction; training set from 2019-2022, testing set from 2023.
Calculate complete and truncated sample features → compare common prefix → determine time boundaries → output missing values and valid samples → retain erroneous counterexamples.
If appending a future high price changes all past standardised values, what does that show? How should the training/test handling be fixed?
Leakage from full-sample statistical methods may be used; only train and fit scales for training, testing only transforms. Online processing should also only use past data up to the current time and retain versions.
Label definition: close[t+5]/close[t]−1>0. Training ends at 100, testing starts at 101, so t=96…100. Labels touching the testing period should be removed. The last 5 rows do not have complete labels and cannot be used by comparing NaN and getting False to treat them as negative class.
Samples with adjacent time periods are highly correlated; random splitting will overestimate independence. It cannot be claimed that all leakage has been eliminated simply by adding one shift.
Install the dependencies listed for this lab in the README first. If a dependency or platform is unavailable, mark the lab as not run; downloading the source is not evidence of running it.
python ml_lab.py1. Use only information known at the time
2. Prevent label leakage
3. Split the data in time order
Risk warning: leveraged trading in forex, precious metals and similar products carries a high level of risk and you may lose all of your capital, or more. This course is for education only. It is not investment advice and does not promise any return. Example prices and contract specifications are teaching assumptions; always use what your own platform discloses. Past performance and backtests do not indicate future results.
All values, prices, accounts and cases in this course are teaching assumptions; the fixed materials can be reproduced offline. Marking a lesson complete only records your study. It is not a certification, a service approval or a promise of returns. Workbooks and answer files are currently provided in Chinese.
The feature construction exercise is not just about the number of columns; it also needs to prove that future additions will not rewrite past features. Past features within a fixed window should satisfy the property of prefix invariance, and full-sample normalization typically does not satisfy this.
Record your work and compare the reference result. Self-checks are not verified competence.
Completion records your own study, not verified competence. Exercises use fictional data; no real account or deposit is required.