Loss-Avoidance Machine Learning Classifier for Retail Stock Day-Trading (NTT 9432 Case Study).
Overview • Features • Code Architecture • System Flow • Structure • Quick Start • License
A machine learning decision support system engineered specifically for working professionals who trade Japanese equities (NTT 9432). Rather than maximizing raw trade frequency, the model is tuned with asymmetric loss penalties to skip high-risk market days and generate an actionable binary buy/skip signal at 8:30 AM before market open (Market Open Buy & Market Close Sell).
| Icon | Feature | Outcome & Real Proof |
|---|---|---|
| 🛡️ | Asymmetric Downside Protection | Skips negative-expectation trading days to preserve capital |
| ⏰ | 8:30 AM Actionable Signal | Deterministic trade recommendation before market open for working professionals |
| 📊 | Comprehensive Technical Features | RSI, Moving Average Deviations, Volume Spikes, and ATR Volatility |
| 📈 | Realistic Backtest Verification | Evaluates Profit Factor, Maximum Drawdown, and Sharpe Ratio on historical NTT data |
-
Target Definition:
$y = 1$ if$\text{Close}_t > \text{Open}_t$ (positive intraday return), else$0$ . -
Feature Engineering:
- Price Momentum: 5-day / 20-day SMA deviation, 14-day RSI, Bollinger Bands %B.
- Volatility & Volume: Intraday ATR (Average True Range), volume spike ratios.
-
Model Tuning: LightGBM Binary Classifier optimized for Precision and Profit Factor via probability threshold tuning (
$P \ge 0.65$ ). - Backtesting Engine: Simulates realistic execution with commissions and slippage.
graph TD
CSV[(📊 NTT 9432 Historical OHLCV)] --> Feat[⚙️ Technical Indicators: RSI, SMA, %B, ATR]
Feat --> Model[🧠 LightGBM Classifier]
Model --> Prob[🎯 Prediction Probability P(Up)]
Prob --> Decision{P >= 0.65 Threshold}
Decision -->|Yes| Buy[🟢 BUY at 9:00 Open -> SELL at 15:00 Close]
Decision -->|No| Skip[🔴 SKIP / Hold Cash]
classDef primary fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff;
classDef green fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff;
classDef red fill:#ef4444,stroke:#dc2626,stroke-width:2px,color:#fff;
class Model,Prob primary;
class Buy green;
class Skip red;
day_trade_ai/
├── 📁 assets/ # High-resolution SVG banners
│ └── 🎨 hero.svg
├── 📄 stock_prediction.ipynb # Complete data prep, model training & backtest
├── 📄 stock_price.csv # NTT historical price dataset
├── 📄 slide.pdf # Project presentation deck
└── 📄 README.md # Project documentation# 1. Clone repository
git clone https://github.com/LoNebula/day_trade_ai.git
cd day_trade_ai
# 2. Install dependencies
pip install -r requirements.txt
# 3. Launch Jupyter Notebook
jupyter notebook stock_prediction.ipynbReleased under the MIT License. Crafted with precision by LoNebula