--- title: NIFTY 50 Forecaster Backend emoji: 📈 colorFrom: green colorTo: blue sdk: docker app_port: 7860 --- # NIFTY 50 Forecaster Backend FastAPI Hugging Face Docker Space for the NIFTY 50 first-five-minute direction forecaster. ## Endpoints - `GET /health` - `GET /dashboard` - `GET /prediction/latest` - `POST /prediction/refresh-first5` - `POST /data/refresh-daily` - `GET /cron/keepalive` - `POST /data/refresh-market-close` ## Data Parquet files live in `data/`: - `nifty50_1m.parquet` - `nifty50_1d.parquet` - `opening_direction_training_dataset.parquet` - `test_predictions.parquet` ## Runtime The API starts a daily background refresh loop. It wakes after `09:20 Asia/Kolkata`, fetches Yahoo Finance `^NSEI` 1-minute candles for the `09:15-09:19` opening window, appends them to Parquet, and writes the latest T+5 prediction. After market close it wakes again at `15:45 Asia/Kolkata`, refreshes the 1-minute and daily Parquet files, updates the opening training dataset with same-day close outcomes, and writes the saved prediction record used for the next trading session card. The `/cron/keepalive` endpoint also checks this close refresh so a Hugging Face Space that was idled still catches up when Netlify pings it. Netlify also pings `/cron/keepalive` every 10 minutes through its scheduled function.