Instructions to use vtuan9/fpt-trend-predictor-xgboost with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use vtuan9/fpt-trend-predictor-xgboost with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("vtuan9/fpt-trend-predictor-xgboost", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- README.md +87 -0
- xgboost_model.pkl +3 -0
README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: mit
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: sklearn
|
| 3 |
+
tags:
|
| 4 |
+
- xgboost
|
| 5 |
+
- stock-prediction
|
| 6 |
+
- vietnam-stock
|
| 7 |
+
- fpt
|
| 8 |
+
- time-series
|
| 9 |
+
- classification
|
| 10 |
license: mit
|
| 11 |
---
|
| 12 |
+
|
| 13 |
+
# FPT Trend Predictor - XGBoost Model
|
| 14 |
+
|
| 15 |
+
Mô hình XGBoost dự đoán xu hướng giá cổ phiếu FPT (tăng/giảm) dựa trên các chỉ báo kỹ thuật.
|
| 16 |
+
|
| 17 |
+
## Mô tả
|
| 18 |
+
|
| 19 |
+
Mô hình này được train trên dữ liệu lịch sử giá cổ phiếu FPT từ 2016-2025 để dự đoán xu hướng giá:
|
| 20 |
+
- **Target**: Dự đoán giá ngày mai tăng (1) hay giảm (0) so với ngày hôm nay
|
| 21 |
+
- **Model**: XGBoost Classifier
|
| 22 |
+
- **Features**: 10 features bao gồm giá (open, high, low, close), volume, và các chỉ báo kỹ thuật
|
| 23 |
+
|
| 24 |
+
## Features
|
| 25 |
+
|
| 26 |
+
Mô hình sử dụng các features sau:
|
| 27 |
+
1. `open`: Giá mở cửa
|
| 28 |
+
2. `high`: Giá cao nhất
|
| 29 |
+
3. `low`: Giá thấp nhất
|
| 30 |
+
4. `close`: Giá đóng cửa
|
| 31 |
+
5. `volume`: Khối lượng giao dịch
|
| 32 |
+
6. `return_1d`: Lợi suất 1 ngày
|
| 33 |
+
7. `ma_5`: Trung bình động 5 ngày
|
| 34 |
+
8. `ma_10`: Trung bình động 10 ngày
|
| 35 |
+
9. `ma_20`: Trung bình động 20 ngày
|
| 36 |
+
10. `vol_ma_5`: Trung bình động khối lượng 5 ngày
|
| 37 |
+
|
| 38 |
+
## Hiệu suất
|
| 39 |
+
|
| 40 |
+
### Training Metrics
|
| 41 |
+
- **Train Accuracy**: 92.93%
|
| 42 |
+
- **Test Accuracy**: 54.23%
|
| 43 |
+
|
| 44 |
+
### Backtest Results (2024-2025)
|
| 45 |
+
- **Strategy Total Return**: 20.26%
|
| 46 |
+
- **Buy & Hold Return**: -1.44%
|
| 47 |
+
- **Excess Return**: +21.70%
|
| 48 |
+
- **Win Rate**: 59.46%
|
| 49 |
+
- **Sharpe Ratio**: 1.05
|
| 50 |
+
- **Max Drawdown**: -10.87%
|
| 51 |
+
|
| 52 |
+
## Cách sử dụng
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
import joblib
|
| 56 |
+
import pandas as pd
|
| 57 |
+
from huggingface_hub import hf_hub_download
|
| 58 |
+
|
| 59 |
+
# Download model từ Hugging Face
|
| 60 |
+
model_path = hf_hub_download(
|
| 61 |
+
repo_id="vtuan9/fpt-trend-predictor-xgboost",
|
| 62 |
+
filename="xgboost_model.pkl"
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
# Load model
|
| 66 |
+
model = joblib.load(model_path)
|
| 67 |
+
|
| 68 |
+
# Chuẩn bị dữ liệu (cần có các features như trên)
|
| 69 |
+
# predictions = model.predict(X)
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## Chiến lược giao dịch
|
| 73 |
+
|
| 74 |
+
- Nếu model dự đoán **Tăng (1)** → Buy
|
| 75 |
+
- Nếu model dự đoán **Giảm (0)** → Hold cash
|
| 76 |
+
- Lợi nhuận = return ngày hôm sau
|
| 77 |
+
|
| 78 |
+
## Lưu ý
|
| 79 |
+
|
| 80 |
+
- Mô hình này chỉ dùng cho mục đích nghiên cứu và giáo dục
|
| 81 |
+
- Không nên sử dụng trực tiếp cho giao dịch thực tế mà không có phân tích kỹ lưỡng
|
| 82 |
+
- Hiệu suất trong quá khứ không đảm bảo kết quả trong tương lai
|
| 83 |
+
|
| 84 |
+
## Tác giả
|
| 85 |
+
|
| 86 |
+
vtuan9
|
| 87 |
+
|
| 88 |
+
## License
|
| 89 |
+
|
| 90 |
+
MIT
|
xgboost_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:21073b4bf4a87d42bf16f76ba3e0e634700c8b29e593570300a46ff6b8428837
|
| 3 |
+
size 271960
|