Student
เว็บแอปพลิเคชันทำนายราคาทองคำรายวันแบบเรียลไทม์
Student
Student
Project Advisor
Project Advisor
Gold is widely regarded as a safe-haven asset, and accurate short-term forecasting can support trading and risk-management decisions. This study develops and evaluates one-step-ahead (t+1) forecasting models for daily gold prices, focusing on Gold_High, Gold_Low, and Gold_Close. The dataset combines daily market variables collected from Yahoo Finance (gold OHLC, gold volume, silver price, crude oil price, S&P 500 index, U.S. 10-year Treasury yield, and the U.S. Dollar Index) with macroeconomic indicators from Federal Reserve Bank of St. Louis via FRED (e.g., CPI). Macroeconomic series with lower frequency are aligned to the daily timeline using forward-fill to ensure consistent temporal indexing. A unified time-series evaluation protocol is applied to prevent data leakage: hyperparameters are tuned using time-series cross-validation on the initial training segment, the best configuration is refit on the combined train–validation set, and final performance is assessed using one-step-ahead walk-forward testing.
Models compared include ARIMA, linear regression, XGBoost, LightGBM, and LSTM. ARIMA parameters are selected via grid search, yielding ARIMA(0,1,1) as the best specification across targets, while XGBoost is optimized with Optuna and early stopping with alternative lag settings. Performance is measured using RMSE, MAE, MAPE, and R². Experimental results indicate that linear regression achieves the lowest test-set RMSE across all three targets (Gold_High: 27.09, Gold_Low: 30.65, Gold_Close: 39.01 USD/oz), with ARIMA remaining competitive for Gold_Close (RMSE 38.69). The best-performing model is intended for deployment in a web application to deliver accessible next-day gold price forecasts for end users.
End-to-end workflow diagrams of the system
GRALD is designed as an end-to-end system that continuously maintains an up-to-date dataset, trains forecasting models under a leak-free time-series protocol, and serves next-day (t+1) predictions through a REST API. The system also includes an optional Trade Plan Overlay module that helps users quantify trading plans (risk/reward, position sizing) and visualize Entry/SL/TP on top of the price chart. The overall system is organized into four main workflows.
gold_data_fetch.py in a Python environment on a GitHub-hosted runner.
gold_and_macro_data.csv) back to the repository via commit/push.
gold_and_macro_data.csv and run basic quality checks
(missing values, data types, date continuity, and scale sanity checks).
model.joblib, feature_schema.json (required feature names + ordering),
and metadata.json (model version, training period, metrics, timestamp).
The backend is implemented as a prediction service that loads the latest dataset and the deployed artifacts, generates the correct feature matrix, and serves results through REST endpoints. It also provides SHAP explanations for model transparency.
gold_and_macro_data.csv and the deployed artifacts;
validate schema compatibility to avoid feature mismatch at inference time.
feature_schema.json,
matching training-time transformations (including lag features).
model.predict(X) to compute next-day forecasts (t+1).
Output: Structured JSON responses consumed by the frontend to render charts, dashboards, and explanations.
This module allows users to input a trading plan and receive quantitative evaluation outputs (rather than trading signals). The output is visualized as an overlay on the price chart.
The backend acts as the single source of truth for forecasting, calculations, and explanations, while the frontend focuses on visualization and user interaction.