2025-08-12 15:12:07 +08:00
|
|
|
# OHLCV Predictor - Inference (Quick Reference)
|
2025-08-08 09:38:18 +08:00
|
|
|
|
2025-08-12 15:12:07 +08:00
|
|
|
For full instructions, see the main README.
|
2025-08-08 09:38:18 +08:00
|
|
|
|
2025-08-12 15:12:07 +08:00
|
|
|
## Minimal usage
|
2025-08-08 09:38:18 +08:00
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
from predictor import OHLCVPredictor
|
|
|
|
|
|
2025-08-12 15:12:07 +08:00
|
|
|
predictor = OHLCVPredictor('../data/xgboost_model_all_features.json')
|
2025-08-08 09:38:18 +08:00
|
|
|
predictions = predictor.predict(your_ohlcv_dataframe)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Your DataFrame needs these columns:
|
2025-08-12 15:12:07 +08:00
|
|
|
- `Timestamp`, `Open`, `High`, `Low`, `Close`, `Volume`, `log_return`
|
2025-08-08 09:38:18 +08:00
|
|
|
|
2025-08-12 15:12:07 +08:00
|
|
|
Note: If you are only running inference (not training with `main.py`), compute `log_return` first:
|
2025-08-08 09:38:18 +08:00
|
|
|
|
2025-08-12 15:12:07 +08:00
|
|
|
```python
|
|
|
|
|
import numpy as np
|
|
|
|
|
df['log_return'] = np.log(df['Close'] / df['Close'].shift(1))
|
2025-08-08 09:38:18 +08:00
|
|
|
```
|
2025-08-12 15:12:07 +08:00
|
|
|
|
|
|
|
|
## Files to reuse in other projects
|
|
|
|
|
|
|
|
|
|
- `predictor.py`
|
|
|
|
|
- `custom_xgboost.py`
|
|
|
|
|
- `feature_engineering.py`
|
|
|
|
|
- `technical_indicator_functions.py`
|
|
|
|
|
- your trained model file (e.g., `xgboost_model_all_features.json`)
|