Spaces:
Running
Running
Upload 42 files
Browse files- app.py +12 -3
- models/nifty_opening_mfe_regressor/__init__.py +1 -0
- models/nifty_opening_mfe_regressor/__pycache__/__init__.cpython-311.pyc +0 -0
- models/nifty_opening_mfe_regressor/__pycache__/train.cpython-311.pyc +0 -0
- models/nifty_opening_mfe_regressor/outputs/latest_prediction.csv +1 -1
- models/nifty_opening_mfe_regressor/outputs/summary.json +47 -1
- models/nifty_opening_mfe_regressor/outputs/test_predictions.csv +86 -86
- models/nifty_opening_mfe_regressor/train.py +422 -0
app.py
CHANGED
|
@@ -228,9 +228,11 @@ def attach_market_state(payload: dict) -> dict:
|
|
| 228 |
payload["nifty_quote"] = None
|
| 229 |
payload["nifty_quote_error"] = {"status": 502, "message": str(exc)}
|
| 230 |
|
| 231 |
-
t5_latest = payload.get("latest") or {}
|
| 232 |
-
tomorrow_latest = payload.get("tomorrow_latest") or {}
|
| 233 |
-
tplus1_latest = payload.get("tplus1_latest") or {}
|
|
|
|
|
|
|
| 234 |
t5_available = bool(state["t5_available"] and t5_latest.get("prediction"))
|
| 235 |
tplus1_available = bool(state["tplus1_available"] and tplus1_latest.get("prediction"))
|
| 236 |
tomorrow_available = bool(tomorrow_latest.get("prediction"))
|
|
@@ -286,6 +288,13 @@ def attach_market_state(payload: dict) -> dict:
|
|
| 286 |
"validation_accuracy": (payload.get("tplus1_summary") or {}).get("validation_accuracy"),
|
| 287 |
"test_accuracy": (payload.get("tplus1_summary") or {}).get("test_accuracy"),
|
| 288 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
}
|
| 290 |
return payload
|
| 291 |
|
|
|
|
| 228 |
payload["nifty_quote"] = None
|
| 229 |
payload["nifty_quote_error"] = {"status": 502, "message": str(exc)}
|
| 230 |
|
| 231 |
+
t5_latest = payload.get("predictions", {}).get("t5", {}).get("latest") or payload.get("latest") or {}
|
| 232 |
+
tomorrow_latest = payload.get("predictions", {}).get("tomorrow", {}).get("latest") or payload.get("tomorrow_latest") or {}
|
| 233 |
+
tplus1_latest = payload.get("predictions", {}).get("tplus1", {}).get("latest") or payload.get("tplus1_latest") or {}
|
| 234 |
+
mfe_latest = payload.get("predictions", {}).get("mfe", {}).get("latest") or {}
|
| 235 |
+
mfe_summary = payload.get("predictions", {}).get("mfe", {}).get("summary") or {}
|
| 236 |
t5_available = bool(state["t5_available"] and t5_latest.get("prediction"))
|
| 237 |
tplus1_available = bool(state["tplus1_available"] and tplus1_latest.get("prediction"))
|
| 238 |
tomorrow_available = bool(tomorrow_latest.get("prediction"))
|
|
|
|
| 288 |
"validation_accuracy": (payload.get("tplus1_summary") or {}).get("validation_accuracy"),
|
| 289 |
"test_accuracy": (payload.get("tplus1_summary") or {}).get("test_accuracy"),
|
| 290 |
},
|
| 291 |
+
"mfe": {
|
| 292 |
+
"available": t5_available,
|
| 293 |
+
"status": "Ready" if t5_available else state["t5_status"],
|
| 294 |
+
"reason": None if t5_available else state["t5_detail"],
|
| 295 |
+
"latest": mfe_latest,
|
| 296 |
+
"summary": mfe_summary,
|
| 297 |
+
},
|
| 298 |
}
|
| 299 |
return payload
|
| 300 |
|
models/nifty_opening_mfe_regressor/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"""First-five-minute NIFTY MFE regression model."""
|
models/nifty_opening_mfe_regressor/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (264 Bytes). View file
|
|
|
models/nifty_opening_mfe_regressor/__pycache__/train.cpython-311.pyc
ADDED
|
Binary file (30.3 kB). View file
|
|
|
models/nifty_opening_mfe_regressor/outputs/latest_prediction.csv
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
input_date,first5_start,first5_end,first5_close,predicted_up_points,predicted_down_points
|
| 2 |
-
2026-06-
|
|
|
|
| 1 |
input_date,first5_start,first5_end,first5_close,predicted_up_points,predicted_down_points
|
| 2 |
+
2026-06-09,2026-06-09 09:15:00,2026-06-09 09:19:00,23234.849609375,63.15162391627527,71.5788486914341
|
models/nifty_opening_mfe_regressor/outputs/summary.json
CHANGED
|
@@ -1 +1,47 @@
|
|
| 1 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"target_definition": "Predict remaining same-day NIFTY upside/downside points after the first five 1-minute bars.",
|
| 3 |
+
"train_rows": 2221,
|
| 4 |
+
"valid_rows": 405,
|
| 5 |
+
"test_rows": 199,
|
| 6 |
+
"train_start": "2015-01-09",
|
| 7 |
+
"train_end": "2023-12-29",
|
| 8 |
+
"valid_start": "2024-01-01",
|
| 9 |
+
"valid_end": "2025-08-14",
|
| 10 |
+
"test_start": "2025-08-18",
|
| 11 |
+
"test_end": "2026-06-09",
|
| 12 |
+
"feature_count": 188,
|
| 13 |
+
"up": {
|
| 14 |
+
"target": "after5_up_points",
|
| 15 |
+
"selected_model": "random_forest_d6_l10_all+affine_s1.26_b-4",
|
| 16 |
+
"selected_feature_count": 188,
|
| 17 |
+
"validation_mae_points": 62.814071097341994,
|
| 18 |
+
"validation_rmse_points": 95.96458512713473,
|
| 19 |
+
"test_mae_points": 55.869403284612446,
|
| 20 |
+
"test_rmse_points": 79.459874253419,
|
| 21 |
+
"test_high_mfe_mae_points": 120.36235726321215,
|
| 22 |
+
"test_low_mfe_mae_points": 34.22747241931052,
|
| 23 |
+
"baseline_test_mae_points": 75.35728446922032,
|
| 24 |
+
"test_mae_improvement_pct": 25.860646813205825,
|
| 25 |
+
"latest_prediction_points": 63.15162391627527
|
| 26 |
+
},
|
| 27 |
+
"down": {
|
| 28 |
+
"target": "after5_down_points",
|
| 29 |
+
"selected_model": "random_forest_d7_l10_150",
|
| 30 |
+
"selected_feature_count": 150,
|
| 31 |
+
"validation_mae_points": 72.01385673724953,
|
| 32 |
+
"validation_rmse_points": 122.53041341022657,
|
| 33 |
+
"test_mae_points": 62.985231430060715,
|
| 34 |
+
"test_rmse_points": 97.51356947384825,
|
| 35 |
+
"test_high_mfe_mae_points": 141.1492761242954,
|
| 36 |
+
"test_low_mfe_mae_points": 36.75568623065309,
|
| 37 |
+
"baseline_test_mae_points": 77.89575416143268,
|
| 38 |
+
"test_mae_improvement_pct": 19.141637297035604,
|
| 39 |
+
"latest_prediction_points": 71.5788486914341
|
| 40 |
+
},
|
| 41 |
+
"latest_input_date": "2026-06-09",
|
| 42 |
+
"latest_first5_start": "2026-06-09 09:15:00",
|
| 43 |
+
"latest_first5_end": "2026-06-09 09:19:00",
|
| 44 |
+
"latest_first5_close": 23234.849609375,
|
| 45 |
+
"latest_predicted_up_points": 63.15162391627527,
|
| 46 |
+
"latest_predicted_down_points": 71.5788486914341
|
| 47 |
+
}
|
models/nifty_opening_mfe_regressor/outputs/test_predictions.csv
CHANGED
|
@@ -1,20 +1,20 @@
|
|
| 1 |
date,first5_close,day_high,day_low,day_close,after5_up_points,after5_down_points,predicted_up_points,predicted_down_points
|
| 2 |
-
2025-08-18,24943.3,25022.0,24852.85,24884.05,78.70000000000073,90.
|
| 3 |
-
2025-08-19,24905.95,25012.65,24873.95,24989.7,106.
|
| 4 |
2025-08-20,24943.7,25088.7,24929.7,25047.15,145.0,14.0,72.2215386978149,66.87535067178419
|
| 5 |
2025-08-21,25074.4,25153.65,25054.9,25076.95,79.25,19.5,75.9678756477438,85.01325608135507
|
| 6 |
-
2025-08-22,25022.5,25084.85,24859.15,24869.45,62.
|
| 7 |
2025-08-25,24923.8,25021.55,24894.35,24978.55,97.75,29.450000000000728,72.08624856357176,72.36965738462226
|
| 8 |
2025-08-26,24849.75,24919.65,24689.6,24710.7,69.90000000000146,160.15000000000146,81.82237433198587,75.67181816799939
|
| 9 |
-
2025-08-28,24577.25,24702.65,24481.6,24533.1,125.40000000000146,95.65000000000146,107.37349857848692,103.
|
| 10 |
-
2025-08-29,24507.4,24572.45,24404.7,24433.65,65.04999999999927,102.
|
| 11 |
-
2025-09-01,24523.5,24635.6,24432.7,24624.3,112.09999999999854,90.
|
| 12 |
-
2025-09-02,24662.9,24756.1,24522.35,24575.0,93.
|
| 13 |
-
2025-09-03,24541.0,24737.05,24533.2,24713.6,196.04999999999927,7.799999999999272,97.
|
| 14 |
-
2025-09-04,24863.8,24980.75,24708.2,24739.8,116.
|
| 15 |
-
2025-09-05,24827.5,24832.35,24621.6,24743.95,4.849999999998545,205.
|
| 16 |
2025-09-08,24787.65,24885.5,24751.55,24791.2,97.84999999999854,36.10000000000218,72.29944694258762,65.75039472494996
|
| 17 |
-
2025-09-09,24854.2,24891.8,24814.0,24878.8,37.
|
| 18 |
2025-09-10,24962.65,25035.7,24915.05,24977.55,73.04999999999927,47.60000000000218,71.89450651813125,72.72213315583208
|
| 19 |
2025-09-11,25000.8,25037.3,24940.15,25008.1,36.5,60.64999999999782,70.68275488183907,73.77386846663569
|
| 20 |
2025-09-12,25053.3,25139.45,25038.05,25107.7,86.15000000000146,15.25,72.04701987775606,72.71521942996507
|
|
@@ -27,138 +27,138 @@ date,first5_close,day_high,day_low,day_close,after5_up_points,after5_down_points
|
|
| 27 |
2025-09-23,25228.05,25261.9,25084.65,25185.8,33.85000000000218,143.39999999999782,69.2148241834104,84.93267760178357
|
| 28 |
2025-09-24,25092.3,25149.85,25027.45,25060.9,57.54999999999927,64.84999999999854,73.87437120520443,78.18656010430726
|
| 29 |
2025-09-25,25054.4,25092.7,24878.3,24904.55,38.29999999999927,176.10000000000218,71.65598616236045,87.4073952684888
|
| 30 |
-
2025-09-26,24816.0,24868.6,24629.45,24673.1,52.
|
| 31 |
-
2025-09-29,24673.7,24791.3,24606.2,24677.55,117.59999999999854,67.5,83.37538480505997,95.
|
| 32 |
-
2025-09-30,24713.65,24731.8,24587.7,24633.6,18.149999999997817,125.
|
| 33 |
-
2025-10-01,24620.5,24867.95,24605.95,24853.4,247.
|
| 34 |
2025-10-03,24785.05,24904.8,24747.55,24895.0,119.75,37.5,81.10550551698013,78.1100418959116
|
| 35 |
2025-10-06,24927.05,25095.95,24881.65,25072.55,168.90000000000146,45.39999999999782,69.46213473733515,68.8959058147205
|
| 36 |
2025-10-07,25084.9,25220.9,25076.3,25112.8,136.0,8.600000000002183,78.44188298577762,71.62453401261332
|
| 37 |
2025-10-08,25146.05,25192.5,25008.5,25023.8,46.45000000000073,137.54999999999927,70.87032840015426,81.93097812216612
|
| 38 |
2025-10-09,25058.95,25199.25,25024.3,25170.3,140.29999999999927,34.650000000001455,69.72385100925113,89.36013847299986
|
| 39 |
-
2025-10-10,25221.2,25330.75,25156.85,25278.2,109.
|
| 40 |
2025-10-13,25213.8,25267.3,25152.3,25237.15,53.5,61.5,72.9387780959113,71.96467174317387
|
| 41 |
2025-10-14,25293.3,25310.35,25060.55,25123.35,17.049999999999272,232.75,69.75624962391593,75.72942009497733
|
| 42 |
-
2025-10-15,25239.95,25365.15,25159.35,25327.75,125.
|
| 43 |
2025-10-16,25412.15,25625.4,25376.85,25566.3,213.25,35.30000000000291,69.37806626638448,75.22834036609319
|
| 44 |
-
2025-10-17,25554.05,25781.5,25508.6,25704.7,227.
|
| 45 |
-
2025-10-20,25902.8,25926.2,25788.5,25850.7,23.
|
| 46 |
2025-10-21,25903.25,25934.35,25826.3,25833.3,31.099999999998545,76.95000000000073,70.4734596248554,72.82024209764482
|
| 47 |
-
2025-10-23,26003.75,26104.2,25862.45,25870.3,100.
|
| 48 |
2025-10-24,25850.8,25944.15,25718.2,25797.45,93.35000000000218,132.59999999999854,85.9352895781675,84.67147328741909
|
| 49 |
2025-10-27,25861.4,26005.95,25827.0,25974.0,144.54999999999927,34.400000000001455,49.17301873308348,61.10766648725366
|
| 50 |
2025-10-28,25968.1,26041.7,25810.05,25965.4,73.60000000000218,158.04999999999927,72.5812143633312,85.61675283659459
|
| 51 |
2025-10-29,25979.75,26097.85,25960.3,26068.3,118.09999999999854,19.450000000000728,75.08031314406708,79.68242908469409
|
| 52 |
2025-10-30,25985.15,26032.05,25845.25,25891.2,46.89999999999782,139.90000000000146,73.39380876964638,74.325383761321
|
| 53 |
2025-10-31,25862.85,25953.75,25711.2,25732.55,90.90000000000146,151.64999999999782,73.94864338763755,79.1021674617272
|
| 54 |
-
2025-11-03,25687.85,25803.1,25645.5,25774.3,115.25,42.
|
| 55 |
2025-11-04,25755.4,25787.4,25578.4,25586.25,32.0,177.0,71.3743139533095,89.3481792230919
|
| 56 |
-
2025-11-06,25666.7,25679.15,25491.55,25519.95,12.450000000000728,175.15000000000146,77.85466759246198,90.
|
| 57 |
2025-11-07,25378.15,25551.25,25318.45,25510.05,173.09999999999854,59.70000000000073,82.87633192312792,90.85600003629604
|
| 58 |
-
2025-11-10,25554.6,25653.45,25503.5,25574.25,98.85000000000218,51.
|
| 59 |
-
2025-11-11,25544.8,25715.8,25449.25,25705.55,171.0,95.
|
| 60 |
2025-11-12,25807.2,25934.55,25781.15,25874.0,127.34999999999854,26.049999999999272,72.59276739431719,69.43894779255301
|
| 61 |
2025-11-13,25843.95,26010.7,25808.4,25884.1,166.75,35.54999999999927,78.67378928776296,67.05446226149067
|
| 62 |
2025-11-14,25810.7,25940.2,25740.8,25916.8,129.5,69.90000000000146,73.19872933440267,87.55904589996446
|
| 63 |
-
2025-11-17,25951.05,26024.2,25906.35,26014.3,73.15000000000146,44.70000000000073,69.76315356672858,97.
|
| 64 |
2025-11-18,25947.35,26029.85,25876.5,25894.7,82.5,70.84999999999854,85.51147346645418,80.55471837004212
|
| 65 |
-
2025-11-19,25857.5,26074.65,25856.2,26052.7,217.
|
| 66 |
2025-11-20,26099.7,26246.65,26063.2,26197.4,146.95000000000073,36.5,70.58602673534355,77.26577489877992
|
| 67 |
2025-11-21,26138.75,26179.2,26052.2,26063.95,40.45000000000073,86.54999999999927,72.78494759917074,88.50537506994732
|
| 68 |
-
2025-11-24,26097.25,26142.8,25912.15,25943.35,45.54999999999927,185.
|
| 69 |
2025-11-25,25965.0,26032.6,25857.5,25860.3,67.59999999999854,107.5,74.81866080624437,97.64266493121366
|
| 70 |
-
2025-11-26,25969.7,26215.15,25842.95,26203.5,245.
|
| 71 |
-
2025-11-27,26251.95,26310.45,26141.9,26219.85,58.5,110.
|
| 72 |
-
2025-11-28,26242.15,26280.75,26172.4,26204.55,38.
|
| 73 |
2025-12-01,26285.3,26325.8,26124.2,26175.95,40.5,161.09999999999854,70.47431107358459,75.68478873086691
|
| 74 |
2025-12-02,26141.5,26154.6,25997.85,26057.0,13.099999999998545,143.65000000000146,74.4344525604593,86.98101762857138
|
| 75 |
2025-12-03,26031.25,26066.45,25891.0,25985.1,35.20000000000073,140.25,70.95415206130762,80.43735765423229
|
| 76 |
2025-12-04,25949.55,26098.25,25938.95,26017.1,148.70000000000073,10.599999999998545,70.73708673203622,80.01080718413094
|
| 77 |
2025-12-05,26051.05,26202.6,25985.35,26176.65,151.54999999999927,65.70000000000073,72.41683194442193,96.03195181892916
|
| 78 |
2025-12-08,26159.7,26178.7,25892.25,25932.8,19.0,267.4500000000007,69.67299117722322,81.02444831648698
|
| 79 |
-
2025-12-09,25819.8,25923.65,25728.0,25841.75,103.85000000000218,91.
|
| 80 |
2025-12-10,25880.55,25947.65,25734.55,25742.65,67.10000000000218,146.0,71.70553491482723,98.1837081927547
|
| 81 |
-
2025-12-11,25757.1,25922.8,25693.25,25898.4,165.70000000000073,63.
|
| 82 |
2025-12-12,26002.55,26057.6,25938.45,26043.0,55.04999999999927,64.09999999999854,69.67619298888475,79.50154765698446
|
| 83 |
2025-12-15,25953.3,26047.15,25904.75,26014.0,93.85000000000218,48.54999999999927,75.17828185471886,76.85009428534134
|
| 84 |
-
2025-12-16,25943.3,25980.75,25834.35,25851.35,37.45000000000073,108.
|
| 85 |
2025-12-17,25872.6,25929.15,25770.35,25821.8,56.55000000000291,102.25,72.35835339450391,87.43541006469988
|
| 86 |
2025-12-18,25777.75,25902.35,25726.3,25815.65,124.59999999999854,51.45000000000073,74.43183502860306,85.33298803694375
|
| 87 |
2025-12-19,25925.1,25993.35,25880.45,25961.4,68.25,44.64999999999782,70.77069567565373,83.78604666129061
|
| 88 |
2025-12-22,26093.9,26180.7,26047.8,26162.75,86.79999999999927,46.10000000000218,70.42228403925822,72.76339644091539
|
| 89 |
2025-12-23,26166.7,26233.55,26119.05,26165.95,66.84999999999854,47.650000000001455,74.84971589574519,69.426936900949
|
| 90 |
2025-12-24,26198.25,26236.4,26123.0,26141.65,38.150000000001455,75.25,71.48754603427759,73.72186108153664
|
| 91 |
-
2025-12-26,26131.05,26144.2,26008.6,26047.65,13.150000000001455,122.
|
| 92 |
2025-12-29,26050.5,26106.8,25920.3,25949.8,56.29999999999927,130.20000000000073,75.70015606822022,78.00564702749449
|
| 93 |
2025-12-30,25908.05,25976.75,25878.0,25970.55,68.70000000000073,30.049999999999272,75.2522086126314,77.13518357533343
|
| 94 |
2025-12-31,26013.65,26187.95,25969.0,26141.85,174.29999999999927,44.650000000001455,73.24189431613242,73.79354269787787
|
| 95 |
2026-01-01,26167.8,26197.55,26113.4,26140.25,29.75,54.39999999999782,71.71010503029348,73.54519160205173
|
| 96 |
2026-01-02,26181.65,26340.0,26118.4,26335.7,158.34999999999854,63.25,45.480429907888656,57.12647950293099
|
| 97 |
2026-01-05,26340.25,26373.2,26210.05,26244.65,32.95000000000073,130.20000000000073,70.46179801639443,81.45276466292157
|
| 98 |
-
2026-01-06,26195.8,26273.95,26124.75,26174.65,78.15000000000146,71.04999999999927,79.36914045104106,92.
|
| 99 |
2026-01-07,26125.65,26187.15,26067.9,26142.9,61.5,57.75,72.55581417361594,83.15694141096833
|
| 100 |
2026-01-08,26123.25,26133.2,25858.45,25868.9,9.950000000000728,264.7999999999993,71.04783101366327,82.46291134118252
|
| 101 |
-
2026-01-09,25938.8,25940.6,25623.0,25703.7,1.7999999999992724,315.7999999999993,86.53974081668476,121.
|
| 102 |
-
2026-01-12,25611.95,25813.15,25473.4,25806.1,201.
|
| 103 |
-
2026-01-13,25846.25,25899.8,25603.3,25714.2,53.54999999999927,242.
|
| 104 |
2026-01-14,25683.25,25791.75,25603.95,25669.1,108.5,79.29999999999927,82.35604656222411,99.82529425771892
|
| 105 |
-
2026-01-16,25730.45,25873.5,25662.4,25701.9,143.04999999999927,68.04999999999927,72.2288158291699,96.
|
| 106 |
-
2026-01-19,25597.4,25653.3,25494.35,25555.5,55.89999999999782,103.
|
| 107 |
-
2026-01-20,25558.25,25585.0,25171.35,25225.35,26.75,386.
|
| 108 |
2026-01-21,25242.4,25300.95,24919.8,25168.1,58.54999999999927,322.6000000000022,130.94997110273525,147.75173361890398
|
| 109 |
2026-01-22,25318.0,25435.75,25168.5,25320.45,117.75,149.5,85.07263391734676,130.19406357107007
|
| 110 |
2026-01-23,25275.3,25347.95,25025.3,25064.75,72.65000000000146,250.0,86.95616205286174,98.93004959582946
|
| 111 |
-
2026-01-27,25009.95,25246.65,24932.55,25234.1,236.
|
| 112 |
-
2026-01-28,25336.3,25372.1,25187.65,25348.05,35.79999999999927,148.64999999999782,89.71179240489799,109.
|
| 113 |
2026-01-29,25280.55,25458.15,25159.8,25422.1,177.60000000000218,120.75,91.59350021026472,87.43822382386271
|
| 114 |
2026-01-30,25259.3,25370.7,25213.65,25315.8,111.40000000000146,45.64999999999782,79.05064818970524,100.1312421862931
|
| 115 |
2026-02-01,25282.8,25440.9,24571.75,24768.0,158.10000000000218,711.0499999999993,80.05582527903351,87.1593675112166
|
| 116 |
-
2026-02-02,24806.35,25108.1,24679.4,25079.9,301.75,126.
|
| 117 |
2026-02-03,25809.75,26341.2,25641.3,25714.8,531.4500000000007,168.45000000000073,209.3466476279516,140.6950158750343
|
| 118 |
2026-02-04,25710.7,25818.55,25563.95,25737.5,107.84999999999854,146.75,123.34674640202677,112.15100241628755
|
| 119 |
-
2026-02-05,25727.35,25757.65,25579.5,25641.6,30.30000000000291,147.84999999999854,78.92667069768866,93.
|
| 120 |
-
2026-02-06,25603.5,25703.95,25491.9,25673.6,100.
|
| 121 |
-
2026-02-09,25815.55,25922.25,25780.9,25863.3,106.
|
| 122 |
-
2026-02-10,25918.05,25989.45,25870.45,25916.8,71.40000000000146,47.
|
| 123 |
-
2026-02-11,25985.0,26009.4,25899.8,25945.35,24.
|
| 124 |
2026-02-12,25855.25,25906.7,25752.4,25796.15,51.45000000000073,102.84999999999854,74.42962687752149,69.6320381757916
|
| 125 |
-
2026-02-13,25596.4,25630.35,25444.3,25460.55,33.94999999999709,152.10000000000218,78.73111917226437,92.
|
| 126 |
2026-02-16,25472.2,25697.0,25372.7,25682.45,224.79999999999927,99.5,87.51077339277226,135.77441133340997
|
| 127 |
2026-02-17,25612.45,25764.4,25570.3,25716.0,151.95000000000073,42.150000000001455,74.20532764340571,70.59556735334088
|
| 128 |
2026-02-18,25742.05,25828.05,25645.15,25805.7,86.0,96.89999999999782,69.60174388514015,87.14731231617911
|
| 129 |
-
2026-02-19,25853.9,25885.3,25388.75,25416.45,31.399999999997817,465.
|
| 130 |
-
2026-02-20,25452.9,25663.55,25379.75,25565.9,210.
|
| 131 |
-
2026-02-23,25698.35,25771.45,25609.35,25704.0,73.10000000000218,89.0,78.13994225569839,102.
|
| 132 |
-
2026-02-24,25570.55,25641.8,25327.6,25460.25,71.25,242.
|
| 133 |
-
2026-02-25,25561.8,25652.6,25428.2,25478.65,90.
|
| 134 |
2026-02-26,25535.1,25572.95,25400.95,25493.3,37.85000000000218,134.14999999999782,73.42761359209224,92.16432309346206
|
| 135 |
-
2026-02-27,25395.4,25476.4,25141.3,25181.8,81.0,254.
|
| 136 |
2026-03-02,24892.95,24989.35,24603.5,24849.75,96.39999999999782,289.4500000000007,111.27759797579716,107.15701801512222
|
| 137 |
-
2026-03-04,24385.1,24602.45,24305.4,24473.95,217.
|
| 138 |
2026-03-05,24584.85,24854.2,24529.4,24737.45,269.3500000000022,55.44999999999709,162.08234784984276,162.40605803165704
|
| 139 |
-
2026-03-06,24594.4,24700.9,24415.75,24469.4,106.5,178.65000000000146,117.
|
| 140 |
-
2026-03-09,23774.35,24078.15,23697.8,24005.8,303.8000000000029,76.54999999999927,192.
|
| 141 |
-
2026-03-10,24149.0,24303.8,24079.95,24286.15,154.79999999999927,69.04999999999927,192.
|
| 142 |
2026-03-11,24285.9,24299.0,23834.3,23848.2,13.099999999998545,451.6000000000022,133.54653076939334,121.19414544015564
|
| 143 |
-
2026-03-12,23563.15,23833.15,23556.3,23639.35,270.0,6.850000000002183,192.
|
| 144 |
2026-03-13,23450.25,23492.4,23112.0,23170.9,42.150000000001455,338.25,145.7091162926563,146.68104013479658
|
| 145 |
-
2026-03-16,23172.55,23502.0,22955.25,23355.6,329.4500000000007,217.29999999999927,170.38500881814582,207.
|
| 146 |
2026-03-17,23395.55,23656.8,23346.6,23558.8,261.25,48.95000000000073,156.7943098659703,149.21233378254283
|
| 147 |
-
2026-03-18,23721.9,23862.25,23618.45,23764.1,140.34999999999854,103.
|
| 148 |
-
2026-03-19,23289.5,23378.7,22930.35,23087.85,89.20000000000073,359.15000000000146,133.90428933906327,137.
|
| 149 |
-
2026-03-20,23281.5,23345.15,23067.6,23134.65,63.650000000001455,213.
|
| 150 |
-
2026-03-23,22687.45,22851.7,22471.25,22492.65,164.25,216.
|
| 151 |
2026-03-24,22785.15,23057.3,22624.2,22958.4,272.1499999999978,160.95000000000073,207.01095264874107,154.6488830452536
|
| 152 |
2026-03-25,23162.6,23465.35,23063.2,23309.0,302.75,99.39999999999782,132.30015580160267,124.7102392167061
|
| 153 |
2026-03-27,23041.8,23186.1,22804.55,22839.5,144.29999999999927,237.25,138.49642324859562,132.77812683059364
|
| 154 |
-
2026-03-30,22522.45,22714.1,22283.85,22379.2,191.
|
| 155 |
2026-04-01,22887.0,22941.3,22618.6,22703.15,54.29999999999927,268.40000000000146,171.94720651853035,142.51587723198915
|
| 156 |
2026-04-02,22228.0,22782.3,22182.55,22700.7,554.2999999999993,45.45000000000073,157.50885517232763,135.03847736028655
|
| 157 |
2026-04-06,22666.05,22998.35,22542.95,22959.45,332.2999999999993,123.09999999999854,144.97157821899438,110.86736478379764
|
| 158 |
-
2026-04-07,22773.05,23153.85,22719.3,23129.95,380.7999999999993,53.75,111.
|
| 159 |
-
2026-04-08,23899.95,23961.25,23837.65,23892.75,61.29999999999927,62.29999999999927,102.
|
| 160 |
-
2026-04-09,23935.650390625,23989.75,23683.349609375,23766.05078125,54.099609375,252.30078125,97.
|
| 161 |
-
2026-04-10,23965.69921875,24073.80078125,23867.19921875,24051.80078125,108.1015625,98.5,85.23780890426106,116.
|
| 162 |
2026-04-13,23578.55078125,23905.650390625,23556.150390625,23818.900390625,327.099609375,22.400390625,101.5126595166479,98.57767387007569
|
| 163 |
2026-04-15,24230.849609375,24273.150390625,24146.69921875,24211.900390625,42.30078125,84.150390625,87.99325993978478,100.5389864062017
|
| 164 |
2026-04-16,24390.55078125,24400.099609375,24103.099609375,24188.400390625,9.548828125,287.451171875,75.10031206149125,96.78284688386456
|
|
@@ -166,35 +166,35 @@ date,first5_close,day_high,day_low,day_close,after5_up_points,after5_down_points
|
|
| 166 |
2026-04-20,24373.099609375,24394.05078125,24318.0,24330.900390625,20.951171875,55.099609375,74.03118715657969,70.17966380671794
|
| 167 |
2026-04-21,24468.849609375,24600.849609375,24357.150390625,24581.05078125,132.0,111.69921875,86.20844571936449,102.2667119048698
|
| 168 |
2026-04-22,24479.30078125,24515.75,24353.69921875,24367.650390625,36.44921875,125.6015625,78.71803618671171,105.18692808784276
|
| 169 |
-
2026-04-23,24201.349609375,24309.900390625,24138.849609375,24156.05078125,108.55078125,62.5,84.05594012758098,99.
|
| 170 |
2026-04-24,24124.19921875,24203.349609375,23815.349609375,23903.94921875,79.150390625,308.849609375,90.14180250621698,136.87579336691633
|
| 171 |
-
2026-04-27,24020.349609375,24130.30078125,23952.0,24110.19921875,109.951171875,68.349609375,99.59614157374158,118.
|
| 172 |
2026-04-28,24093.849609375,24181.75,23958.05078125,24016.5,87.900390625,135.798828125,88.15968826749,106.64812371296172
|
| 173 |
2026-04-29,24090.80078125,24334.19921875,24060.650390625,24163.599609375,243.3984375,30.150390625,87.90088049432329,124.95795081910784
|
| 174 |
2026-04-30,23945.25,24086.94921875,23797.05078125,23997.55078125,141.69921875,148.19921875,139.48308205556245,111.61338896287434
|
| 175 |
2026-05-04,24177.05078125,24289.19921875,24005.30078125,24119.30078125,112.1484375,171.75,147.62463980491148,110.82979739572832
|
| 176 |
-
2026-05-05,24064.19921875,24080.94921875,23883.5,24032.80078125,16.75,180.69921875,104.
|
| 177 |
2026-05-06,24175.80078125,24355.55078125,23999.0,24330.94921875,179.75,176.80078125,89.34877716071158,100.09239323156596
|
| 178 |
-
2026-05-07,24318.25,24481.94921875,24284.650390625,24326.650390625,163.69921875,33.599609375,144.18742265088838,101.
|
| 179 |
2026-05-08,24219.30078125,24253.44921875,24127.69921875,24176.150390625,34.1484375,91.6015625,113.44501924079982,105.61263750990524
|
| 180 |
-
2026-05-11,23918.75,23997.0,23801.25,23820.349609375,78.25,117.5,115.
|
| 181 |
2026-05-12,23736.900390625,23754.150390625,23349.099609375,23430.55078125,17.25,387.80078125,116.96920740241298,142.73344731125428
|
| 182 |
2026-05-13,23405.400390625,23582.80078125,23263.05078125,23428.69921875,177.400390625,142.349609375,175.97531700031948,150.41964833343525
|
| 183 |
-
2026-05-14,23550.05078125,23776.650390625,23426.849609375,23713.75,226.599609375,123.201171875,172.47993492418186,120.
|
| 184 |
2026-05-15,23718.900390625,23838.94921875,23610.80078125,23643.5,120.048828125,108.099609375,116.92088358715652,117.22659612227842
|
| 185 |
-
2026-05-18,23400.5,23695.400390625,23317.55078125,23644.44921875,294.900390625,82.94921875,122.
|
| 186 |
-
2026-05-19,23735.099609375,23782.19921875,23587.25,23606.150390625,47.099609375,147.849609375,89.25678651875887,118.
|
| 187 |
-
2026-05-20,23460.650390625,23690.75,23403.75,23664.349609375,230.099609375,56.900390625,90.6801349163642,107.
|
| 188 |
2026-05-21,23766.849609375,23859.150390625,23596.849609375,23654.69921875,92.30078125,170.0,143.97390699531186,119.33033220862224
|
| 189 |
-
2026-05-22,23693.5,23835.599609375,23675.349609375,23748.849609375,142.099609375,18.150390625,110.
|
| 190 |
-
2026-05-25,23967.599609375,24054.400390625,23924.400390625,24049.900390625,86.80078125,43.19921875,94.
|
| 191 |
2026-05-26,24012.55078125,24089.55078125,23885.44921875,23933.75,77.0,127.1015625,79.73076033164853,83.18524021655392
|
| 192 |
2026-05-27,23926.349609375,23983.0,23858.55078125,23907.150390625,56.650390625,67.798828125,82.86160430091547,111.90618562168372
|
| 193 |
2026-05-29,23963.30078125,23998.69921875,23486.599609375,23547.75,35.3984375,476.701171875,103.19623464475224,101.30160095874687
|
| 194 |
2026-06-01,23633.0,23727.650390625,23358.150390625,23379.19921875,94.650390625,274.849609375,147.97873066706777,108.07717150797622
|
| 195 |
2026-06-02,23283.19921875,23556.599609375,23229.150390625,23520.69921875,273.400390625,54.048828125,104.11710291744272,127.52289995410068
|
| 196 |
-
2026-06-03,23299.30078125,23459.349609375,23152.150390625,23396.94921875,160.048828125,147.150390625,119.81095584527132,121.
|
| 197 |
-
2026-06-04,23345.900390625,23465.150390625,23249.599609375,23416.55078125,119.25,96.30078125,96.
|
| 198 |
-
2026-06-05,23456.150390625,23513.650390625,23282.80078125,23366.69921875,57.5,173.349609375,113.
|
| 199 |
2026-06-08,23130.55078125,23266.849609375,23071.5,23123.0,136.298828125,59.05078125,71.99673733444993,66.32122469457533
|
| 200 |
-
2026-06-09,23234.849609375,,,,,,
|
|
|
|
| 1 |
date,first5_close,day_high,day_low,day_close,after5_up_points,after5_down_points,predicted_up_points,predicted_down_points
|
| 2 |
+
2025-08-18,24943.3,25022.0,24852.85,24884.05,78.70000000000073,90.45000000000073,70.74537556748926,69.95608867077122
|
| 3 |
+
2025-08-19,24905.95,25012.65,24873.95,24989.7,106.70000000000073,32.0,69.58622767243469,72.86841515213641
|
| 4 |
2025-08-20,24943.7,25088.7,24929.7,25047.15,145.0,14.0,72.2215386978149,66.87535067178419
|
| 5 |
2025-08-21,25074.4,25153.65,25054.9,25076.95,79.25,19.5,75.9678756477438,85.01325608135507
|
| 6 |
+
2025-08-22,25022.5,25084.85,24859.15,24869.45,62.349999999998545,163.34999999999854,76.00333285776364,74.38421945646837
|
| 7 |
2025-08-25,24923.8,25021.55,24894.35,24978.55,97.75,29.450000000000728,72.08624856357176,72.36965738462226
|
| 8 |
2025-08-26,24849.75,24919.65,24689.6,24710.7,69.90000000000146,160.15000000000146,81.82237433198587,75.67181816799939
|
| 9 |
+
2025-08-28,24577.25,24702.65,24481.6,24533.1,125.40000000000146,95.65000000000146,107.37349857848692,103.48101375434891
|
| 10 |
+
2025-08-29,24507.4,24572.45,24404.7,24433.65,65.04999999999927,102.70000000000073,92.69929951194534,127.36320204934307
|
| 11 |
+
2025-09-01,24523.5,24635.6,24432.7,24624.3,112.09999999999854,90.79999999999927,85.59277839975796,102.11100920697749
|
| 12 |
+
2025-09-02,24662.9,24756.1,24522.35,24575.0,93.19999999999709,140.5500000000029,71.68120758636995,76.0402487590437
|
| 13 |
+
2025-09-03,24541.0,24737.05,24533.2,24713.6,196.04999999999927,7.799999999999272,97.43911992220335,85.04967811472694
|
| 14 |
+
2025-09-04,24863.8,24980.75,24708.2,24739.8,116.95000000000073,155.59999999999854,103.12730476704783,78.17111502420333
|
| 15 |
+
2025-09-05,24827.5,24832.35,24621.6,24743.95,4.849999999998545,205.90000000000146,73.98230098745448,85.62699852482866
|
| 16 |
2025-09-08,24787.65,24885.5,24751.55,24791.2,97.84999999999854,36.10000000000218,72.29944694258762,65.75039472494996
|
| 17 |
+
2025-09-09,24854.2,24891.8,24814.0,24878.8,37.599999999998545,40.20000000000073,69.44370753005204,77.52099482542334
|
| 18 |
2025-09-10,24962.65,25035.7,24915.05,24977.55,73.04999999999927,47.60000000000218,71.89450651813125,72.72213315583208
|
| 19 |
2025-09-11,25000.8,25037.3,24940.15,25008.1,36.5,60.64999999999782,70.68275488183907,73.77386846663569
|
| 20 |
2025-09-12,25053.3,25139.45,25038.05,25107.7,86.15000000000146,15.25,72.04701987775606,72.71521942996507
|
|
|
|
| 27 |
2025-09-23,25228.05,25261.9,25084.65,25185.8,33.85000000000218,143.39999999999782,69.2148241834104,84.93267760178357
|
| 28 |
2025-09-24,25092.3,25149.85,25027.45,25060.9,57.54999999999927,64.84999999999854,73.87437120520443,78.18656010430726
|
| 29 |
2025-09-25,25054.4,25092.7,24878.3,24904.55,38.29999999999927,176.10000000000218,71.65598616236045,87.4073952684888
|
| 30 |
+
2025-09-26,24816.0,24868.6,24629.45,24673.1,52.599999999998545,186.54999999999927,75.98342218786617,112.06060895062173
|
| 31 |
+
2025-09-29,24673.7,24791.3,24606.2,24677.55,117.59999999999854,67.5,83.37538480505997,95.65712047233477
|
| 32 |
+
2025-09-30,24713.65,24731.8,24587.7,24633.6,18.149999999997817,125.95000000000073,74.9517147798891,87.6251433757387
|
| 33 |
+
2025-10-01,24620.5,24867.95,24605.95,24853.4,247.45000000000073,14.549999999999272,77.12668758054085,85.91485675791243
|
| 34 |
2025-10-03,24785.05,24904.8,24747.55,24895.0,119.75,37.5,81.10550551698013,78.1100418959116
|
| 35 |
2025-10-06,24927.05,25095.95,24881.65,25072.55,168.90000000000146,45.39999999999782,69.46213473733515,68.8959058147205
|
| 36 |
2025-10-07,25084.9,25220.9,25076.3,25112.8,136.0,8.600000000002183,78.44188298577762,71.62453401261332
|
| 37 |
2025-10-08,25146.05,25192.5,25008.5,25023.8,46.45000000000073,137.54999999999927,70.87032840015426,81.93097812216612
|
| 38 |
2025-10-09,25058.95,25199.25,25024.3,25170.3,140.29999999999927,34.650000000001455,69.72385100925113,89.36013847299986
|
| 39 |
+
2025-10-10,25221.2,25330.75,25156.85,25278.2,109.54999999999927,64.35000000000218,73.60123392651,77.07921283623484
|
| 40 |
2025-10-13,25213.8,25267.3,25152.3,25237.15,53.5,61.5,72.9387780959113,71.96467174317387
|
| 41 |
2025-10-14,25293.3,25310.35,25060.55,25123.35,17.049999999999272,232.75,69.75624962391593,75.72942009497733
|
| 42 |
+
2025-10-15,25239.95,25365.15,25159.35,25327.75,125.20000000000073,80.60000000000218,79.00736543634586,89.70179097400522
|
| 43 |
2025-10-16,25412.15,25625.4,25376.85,25566.3,213.25,35.30000000000291,69.37806626638448,75.22834036609319
|
| 44 |
+
2025-10-17,25554.05,25781.5,25508.6,25704.7,227.45000000000073,45.45000000000073,70.6399534752275,82.59735724680043
|
| 45 |
+
2025-10-20,25902.8,25926.2,25788.5,25850.7,23.400000000001455,114.29999999999927,82.0103286656743,71.42501744995688
|
| 46 |
2025-10-21,25903.25,25934.35,25826.3,25833.3,31.099999999998545,76.95000000000073,70.4734596248554,72.82024209764482
|
| 47 |
+
2025-10-23,26003.75,26104.2,25862.45,25870.3,100.45000000000073,141.29999999999927,78.25616002674558,75.58880300627324
|
| 48 |
2025-10-24,25850.8,25944.15,25718.2,25797.45,93.35000000000218,132.59999999999854,85.9352895781675,84.67147328741909
|
| 49 |
2025-10-27,25861.4,26005.95,25827.0,25974.0,144.54999999999927,34.400000000001455,49.17301873308348,61.10766648725366
|
| 50 |
2025-10-28,25968.1,26041.7,25810.05,25965.4,73.60000000000218,158.04999999999927,72.5812143633312,85.61675283659459
|
| 51 |
2025-10-29,25979.75,26097.85,25960.3,26068.3,118.09999999999854,19.450000000000728,75.08031314406708,79.68242908469409
|
| 52 |
2025-10-30,25985.15,26032.05,25845.25,25891.2,46.89999999999782,139.90000000000146,73.39380876964638,74.325383761321
|
| 53 |
2025-10-31,25862.85,25953.75,25711.2,25732.55,90.90000000000146,151.64999999999782,73.94864338763755,79.1021674617272
|
| 54 |
+
2025-11-03,25687.85,25803.1,25645.5,25774.3,115.25,42.349999999998545,48.84044727691018,67.28257199135699
|
| 55 |
2025-11-04,25755.4,25787.4,25578.4,25586.25,32.0,177.0,71.3743139533095,89.3481792230919
|
| 56 |
+
2025-11-06,25666.7,25679.15,25491.55,25519.95,12.450000000000728,175.15000000000146,77.85466759246198,90.57445591555327
|
| 57 |
2025-11-07,25378.15,25551.25,25318.45,25510.05,173.09999999999854,59.70000000000073,82.87633192312792,90.85600003629604
|
| 58 |
+
2025-11-10,25554.6,25653.45,25503.5,25574.25,98.85000000000218,51.099999999998545,76.07720514892765,92.5203310121857
|
| 59 |
+
2025-11-11,25544.8,25715.8,25449.25,25705.55,171.0,95.54999999999927,84.99031835536154,91.46776795888675
|
| 60 |
2025-11-12,25807.2,25934.55,25781.15,25874.0,127.34999999999854,26.049999999999272,72.59276739431719,69.43894779255301
|
| 61 |
2025-11-13,25843.95,26010.7,25808.4,25884.1,166.75,35.54999999999927,78.67378928776296,67.05446226149067
|
| 62 |
2025-11-14,25810.7,25940.2,25740.8,25916.8,129.5,69.90000000000146,73.19872933440267,87.55904589996446
|
| 63 |
+
2025-11-17,25951.05,26024.2,25906.35,26014.3,73.15000000000146,44.70000000000073,69.76315356672858,97.59555559580077
|
| 64 |
2025-11-18,25947.35,26029.85,25876.5,25894.7,82.5,70.84999999999854,85.51147346645418,80.55471837004212
|
| 65 |
+
2025-11-19,25857.5,26074.65,25856.2,26052.7,217.15000000000146,1.2999999999992724,80.68382090556915,94.60263251195181
|
| 66 |
2025-11-20,26099.7,26246.65,26063.2,26197.4,146.95000000000073,36.5,70.58602673534355,77.26577489877992
|
| 67 |
2025-11-21,26138.75,26179.2,26052.2,26063.95,40.45000000000073,86.54999999999927,72.78494759917074,88.50537506994732
|
| 68 |
+
2025-11-24,26097.25,26142.8,25912.15,25943.35,45.54999999999927,185.09999999999854,71.59439136628663,98.01259127172162
|
| 69 |
2025-11-25,25965.0,26032.6,25857.5,25860.3,67.59999999999854,107.5,74.81866080624437,97.64266493121366
|
| 70 |
+
2025-11-26,25969.7,26215.15,25842.95,26203.5,245.45000000000073,126.75,90.3814582306311,86.97774096205734
|
| 71 |
+
2025-11-27,26251.95,26310.45,26141.9,26219.85,58.5,110.04999999999927,71.40800619164884,75.89199618666595
|
| 72 |
+
2025-11-28,26242.15,26280.75,26172.4,26204.55,38.599999999998545,69.75,72.7899189230503,68.94343157609912
|
| 73 |
2025-12-01,26285.3,26325.8,26124.2,26175.95,40.5,161.09999999999854,70.47431107358459,75.68478873086691
|
| 74 |
2025-12-02,26141.5,26154.6,25997.85,26057.0,13.099999999998545,143.65000000000146,74.4344525604593,86.98101762857138
|
| 75 |
2025-12-03,26031.25,26066.45,25891.0,25985.1,35.20000000000073,140.25,70.95415206130762,80.43735765423229
|
| 76 |
2025-12-04,25949.55,26098.25,25938.95,26017.1,148.70000000000073,10.599999999998545,70.73708673203622,80.01080718413094
|
| 77 |
2025-12-05,26051.05,26202.6,25985.35,26176.65,151.54999999999927,65.70000000000073,72.41683194442193,96.03195181892916
|
| 78 |
2025-12-08,26159.7,26178.7,25892.25,25932.8,19.0,267.4500000000007,69.67299117722322,81.02444831648698
|
| 79 |
+
2025-12-09,25819.8,25923.65,25728.0,25841.75,103.85000000000218,91.79999999999927,77.47469251817466,95.02942758445397
|
| 80 |
2025-12-10,25880.55,25947.65,25734.55,25742.65,67.10000000000218,146.0,71.70553491482723,98.1837081927547
|
| 81 |
+
2025-12-11,25757.1,25922.8,25693.25,25898.4,165.70000000000073,63.849999999998545,76.56354511911341,101.94574105996686
|
| 82 |
2025-12-12,26002.55,26057.6,25938.45,26043.0,55.04999999999927,64.09999999999854,69.67619298888475,79.50154765698446
|
| 83 |
2025-12-15,25953.3,26047.15,25904.75,26014.0,93.85000000000218,48.54999999999927,75.17828185471886,76.85009428534134
|
| 84 |
+
2025-12-16,25943.3,25980.75,25834.35,25851.35,37.45000000000073,108.95000000000073,71.27112421993293,81.85242825234664
|
| 85 |
2025-12-17,25872.6,25929.15,25770.35,25821.8,56.55000000000291,102.25,72.35835339450391,87.43541006469988
|
| 86 |
2025-12-18,25777.75,25902.35,25726.3,25815.65,124.59999999999854,51.45000000000073,74.43183502860306,85.33298803694375
|
| 87 |
2025-12-19,25925.1,25993.35,25880.45,25961.4,68.25,44.64999999999782,70.77069567565373,83.78604666129061
|
| 88 |
2025-12-22,26093.9,26180.7,26047.8,26162.75,86.79999999999927,46.10000000000218,70.42228403925822,72.76339644091539
|
| 89 |
2025-12-23,26166.7,26233.55,26119.05,26165.95,66.84999999999854,47.650000000001455,74.84971589574519,69.426936900949
|
| 90 |
2025-12-24,26198.25,26236.4,26123.0,26141.65,38.150000000001455,75.25,71.48754603427759,73.72186108153664
|
| 91 |
+
2025-12-26,26131.05,26144.2,26008.6,26047.65,13.150000000001455,122.45000000000073,45.48128688932305,57.062560579537895
|
| 92 |
2025-12-29,26050.5,26106.8,25920.3,25949.8,56.29999999999927,130.20000000000073,75.70015606822022,78.00564702749449
|
| 93 |
2025-12-30,25908.05,25976.75,25878.0,25970.55,68.70000000000073,30.049999999999272,75.2522086126314,77.13518357533343
|
| 94 |
2025-12-31,26013.65,26187.95,25969.0,26141.85,174.29999999999927,44.650000000001455,73.24189431613242,73.79354269787787
|
| 95 |
2026-01-01,26167.8,26197.55,26113.4,26140.25,29.75,54.39999999999782,71.71010503029348,73.54519160205173
|
| 96 |
2026-01-02,26181.65,26340.0,26118.4,26335.7,158.34999999999854,63.25,45.480429907888656,57.12647950293099
|
| 97 |
2026-01-05,26340.25,26373.2,26210.05,26244.65,32.95000000000073,130.20000000000073,70.46179801639443,81.45276466292157
|
| 98 |
+
2026-01-06,26195.8,26273.95,26124.75,26174.65,78.15000000000146,71.04999999999927,79.36914045104106,92.38591642666191
|
| 99 |
2026-01-07,26125.65,26187.15,26067.9,26142.9,61.5,57.75,72.55581417361594,83.15694141096833
|
| 100 |
2026-01-08,26123.25,26133.2,25858.45,25868.9,9.950000000000728,264.7999999999993,71.04783101366327,82.46291134118252
|
| 101 |
+
2026-01-09,25938.8,25940.6,25623.0,25703.7,1.7999999999992724,315.7999999999993,86.53974081668476,121.44759821661057
|
| 102 |
+
2026-01-12,25611.95,25813.15,25473.4,25806.1,201.20000000000073,138.54999999999927,83.95949739270267,120.28936873981168
|
| 103 |
+
2026-01-13,25846.25,25899.8,25603.3,25714.2,53.54999999999927,242.95000000000073,78.19680117941645,84.9829292741713
|
| 104 |
2026-01-14,25683.25,25791.75,25603.95,25669.1,108.5,79.29999999999927,82.35604656222411,99.82529425771892
|
| 105 |
+
2026-01-16,25730.45,25873.5,25662.4,25701.9,143.04999999999927,68.04999999999927,72.2288158291699,96.07795888190775
|
| 106 |
+
2026-01-19,25597.4,25653.3,25494.35,25555.5,55.89999999999782,103.05000000000291,93.52077464705306,93.8292063036645
|
| 107 |
+
2026-01-20,25558.25,25585.0,25171.35,25225.35,26.75,386.90000000000146,76.71942144430174,79.78554817218038
|
| 108 |
2026-01-21,25242.4,25300.95,24919.8,25168.1,58.54999999999927,322.6000000000022,130.94997110273525,147.75173361890398
|
| 109 |
2026-01-22,25318.0,25435.75,25168.5,25320.45,117.75,149.5,85.07263391734676,130.19406357107007
|
| 110 |
2026-01-23,25275.3,25347.95,25025.3,25064.75,72.65000000000146,250.0,86.95616205286174,98.93004959582946
|
| 111 |
+
2026-01-27,25009.95,25246.65,24932.55,25234.1,236.70000000000073,77.40000000000146,110.68260525851476,129.7114495843547
|
| 112 |
+
2026-01-28,25336.3,25372.1,25187.65,25348.05,35.79999999999927,148.64999999999782,89.71179240489799,109.83708610878165
|
| 113 |
2026-01-29,25280.55,25458.15,25159.8,25422.1,177.60000000000218,120.75,91.59350021026472,87.43822382386271
|
| 114 |
2026-01-30,25259.3,25370.7,25213.65,25315.8,111.40000000000146,45.64999999999782,79.05064818970524,100.1312421862931
|
| 115 |
2026-02-01,25282.8,25440.9,24571.75,24768.0,158.10000000000218,711.0499999999993,80.05582527903351,87.1593675112166
|
| 116 |
+
2026-02-02,24806.35,25108.1,24679.4,25079.9,301.75,126.94999999999709,86.6858901745076,81.9244305205442
|
| 117 |
2026-02-03,25809.75,26341.2,25641.3,25714.8,531.4500000000007,168.45000000000073,209.3466476279516,140.6950158750343
|
| 118 |
2026-02-04,25710.7,25818.55,25563.95,25737.5,107.84999999999854,146.75,123.34674640202677,112.15100241628755
|
| 119 |
+
2026-02-05,25727.35,25757.65,25579.5,25641.6,30.30000000000291,147.84999999999854,78.92667069768866,93.48294833342887
|
| 120 |
+
2026-02-06,25603.5,25703.95,25491.9,25673.6,100.45000000000073,111.59999999999854,81.63730431628646,108.84971109953882
|
| 121 |
+
2026-02-09,25815.55,25922.25,25780.9,25863.3,106.70000000000073,34.64999999999782,97.04614278500875,83.38428889831818
|
| 122 |
+
2026-02-10,25918.05,25989.45,25870.45,25916.8,71.40000000000146,47.599999999998545,72.55379470719815,80.47042331164333
|
| 123 |
+
2026-02-11,25985.0,26009.4,25899.8,25945.35,24.400000000001455,85.20000000000073,70.82761961162062,78.822407881009
|
| 124 |
2026-02-12,25855.25,25906.7,25752.4,25796.15,51.45000000000073,102.84999999999854,74.42962687752149,69.6320381757916
|
| 125 |
+
2026-02-13,25596.4,25630.35,25444.3,25460.55,33.94999999999709,152.10000000000218,78.73111917226437,92.65335041306251
|
| 126 |
2026-02-16,25472.2,25697.0,25372.7,25682.45,224.79999999999927,99.5,87.51077339277226,135.77441133340997
|
| 127 |
2026-02-17,25612.45,25764.4,25570.3,25716.0,151.95000000000073,42.150000000001455,74.20532764340571,70.59556735334088
|
| 128 |
2026-02-18,25742.05,25828.05,25645.15,25805.7,86.0,96.89999999999782,69.60174388514015,87.14731231617911
|
| 129 |
+
2026-02-19,25853.9,25885.3,25388.75,25416.45,31.399999999997817,465.15000000000146,72.82233481769892,77.47993082146262
|
| 130 |
+
2026-02-20,25452.9,25663.55,25379.75,25565.9,210.64999999999782,73.15000000000146,101.23325383545429,120.39677579437908
|
| 131 |
+
2026-02-23,25698.35,25771.45,25609.35,25704.0,73.10000000000218,89.0,78.13994225569839,102.68054122730979
|
| 132 |
+
2026-02-24,25570.55,25641.8,25327.6,25460.25,71.25,242.95000000000073,84.66998953575761,78.35520991871599
|
| 133 |
+
2026-02-25,25561.8,25652.6,25428.2,25478.65,90.79999999999927,133.59999999999854,78.48076576983638,96.14961930214675
|
| 134 |
2026-02-26,25535.1,25572.95,25400.95,25493.3,37.85000000000218,134.14999999999782,73.42761359209224,92.16432309346206
|
| 135 |
+
2026-02-27,25395.4,25476.4,25141.3,25181.8,81.0,254.10000000000218,84.86928109002694,89.3313420570492
|
| 136 |
2026-03-02,24892.95,24989.35,24603.5,24849.75,96.39999999999782,289.4500000000007,111.27759797579716,107.15701801512222
|
| 137 |
+
2026-03-04,24385.1,24602.45,24305.4,24473.95,217.35000000000218,79.69999999999709,133.72126269580576,155.30789682765342
|
| 138 |
2026-03-05,24584.85,24854.2,24529.4,24737.45,269.3500000000022,55.44999999999709,162.08234784984276,162.40605803165704
|
| 139 |
+
2026-03-06,24594.4,24700.9,24415.75,24469.4,106.5,178.65000000000146,117.98380433944611,116.83602544783805
|
| 140 |
+
2026-03-09,23774.35,24078.15,23697.8,24005.8,303.8000000000029,76.54999999999927,192.35915867956317,146.88020524223515
|
| 141 |
+
2026-03-10,24149.0,24303.8,24079.95,24286.15,154.79999999999927,69.04999999999927,192.79377380977922,158.9186209194774
|
| 142 |
2026-03-11,24285.9,24299.0,23834.3,23848.2,13.099999999998545,451.6000000000022,133.54653076939334,121.19414544015564
|
| 143 |
+
2026-03-12,23563.15,23833.15,23556.3,23639.35,270.0,6.850000000002183,192.63588830558837,120.53074403063889
|
| 144 |
2026-03-13,23450.25,23492.4,23112.0,23170.9,42.150000000001455,338.25,145.7091162926563,146.68104013479658
|
| 145 |
+
2026-03-16,23172.55,23502.0,22955.25,23355.6,329.4500000000007,217.29999999999927,170.38500881814582,207.84422103932636
|
| 146 |
2026-03-17,23395.55,23656.8,23346.6,23558.8,261.25,48.95000000000073,156.7943098659703,149.21233378254283
|
| 147 |
+
2026-03-18,23721.9,23862.25,23618.45,23764.1,140.34999999999854,103.45000000000073,121.95109115304878,116.42727703008954
|
| 148 |
+
2026-03-19,23289.5,23378.7,22930.35,23087.85,89.20000000000073,359.15000000000146,133.90428933906327,137.31867907141645
|
| 149 |
+
2026-03-20,23281.5,23345.15,23067.6,23134.65,63.650000000001455,213.90000000000146,159.7676630786322,165.0265464253639
|
| 150 |
+
2026-03-23,22687.45,22851.7,22471.25,22492.65,164.25,216.20000000000073,145.85353407241462,152.4341252582677
|
| 151 |
2026-03-24,22785.15,23057.3,22624.2,22958.4,272.1499999999978,160.95000000000073,207.01095264874107,154.6488830452536
|
| 152 |
2026-03-25,23162.6,23465.35,23063.2,23309.0,302.75,99.39999999999782,132.30015580160267,124.7102392167061
|
| 153 |
2026-03-27,23041.8,23186.1,22804.55,22839.5,144.29999999999927,237.25,138.49642324859562,132.77812683059364
|
| 154 |
+
2026-03-30,22522.45,22714.1,22283.85,22379.2,191.64999999999782,238.60000000000218,137.43517166951938,113.26298404384518
|
| 155 |
2026-04-01,22887.0,22941.3,22618.6,22703.15,54.29999999999927,268.40000000000146,171.94720651853035,142.51587723198915
|
| 156 |
2026-04-02,22228.0,22782.3,22182.55,22700.7,554.2999999999993,45.45000000000073,157.50885517232763,135.03847736028655
|
| 157 |
2026-04-06,22666.05,22998.35,22542.95,22959.45,332.2999999999993,123.09999999999854,144.97157821899438,110.86736478379764
|
| 158 |
+
2026-04-07,22773.05,23153.85,22719.3,23129.95,380.7999999999993,53.75,111.37572308047561,120.98351003129397
|
| 159 |
+
2026-04-08,23899.95,23961.25,23837.65,23892.75,61.29999999999927,62.29999999999927,102.28015924968139,103.1134383545202
|
| 160 |
+
2026-04-09,23935.650390625,23989.75,23683.349609375,23766.05078125,54.099609375,252.30078125,97.56128839578805,120.80458797190984
|
| 161 |
+
2026-04-10,23965.69921875,24073.80078125,23867.19921875,24051.80078125,108.1015625,98.5,85.23780890426106,116.17509968142505
|
| 162 |
2026-04-13,23578.55078125,23905.650390625,23556.150390625,23818.900390625,327.099609375,22.400390625,101.5126595166479,98.57767387007569
|
| 163 |
2026-04-15,24230.849609375,24273.150390625,24146.69921875,24211.900390625,42.30078125,84.150390625,87.99325993978478,100.5389864062017
|
| 164 |
2026-04-16,24390.55078125,24400.099609375,24103.099609375,24188.400390625,9.548828125,287.451171875,75.10031206149125,96.78284688386456
|
|
|
|
| 166 |
2026-04-20,24373.099609375,24394.05078125,24318.0,24330.900390625,20.951171875,55.099609375,74.03118715657969,70.17966380671794
|
| 167 |
2026-04-21,24468.849609375,24600.849609375,24357.150390625,24581.05078125,132.0,111.69921875,86.20844571936449,102.2667119048698
|
| 168 |
2026-04-22,24479.30078125,24515.75,24353.69921875,24367.650390625,36.44921875,125.6015625,78.71803618671171,105.18692808784276
|
| 169 |
+
2026-04-23,24201.349609375,24309.900390625,24138.849609375,24156.05078125,108.55078125,62.5,84.05594012758098,99.00734685037857
|
| 170 |
2026-04-24,24124.19921875,24203.349609375,23815.349609375,23903.94921875,79.150390625,308.849609375,90.14180250621698,136.87579336691633
|
| 171 |
+
2026-04-27,24020.349609375,24130.30078125,23952.0,24110.19921875,109.951171875,68.349609375,99.59614157374158,118.31424726361337
|
| 172 |
2026-04-28,24093.849609375,24181.75,23958.05078125,24016.5,87.900390625,135.798828125,88.15968826749,106.64812371296172
|
| 173 |
2026-04-29,24090.80078125,24334.19921875,24060.650390625,24163.599609375,243.3984375,30.150390625,87.90088049432329,124.95795081910784
|
| 174 |
2026-04-30,23945.25,24086.94921875,23797.05078125,23997.55078125,141.69921875,148.19921875,139.48308205556245,111.61338896287434
|
| 175 |
2026-05-04,24177.05078125,24289.19921875,24005.30078125,24119.30078125,112.1484375,171.75,147.62463980491148,110.82979739572832
|
| 176 |
+
2026-05-05,24064.19921875,24080.94921875,23883.5,24032.80078125,16.75,180.69921875,104.19136737845045,118.00286130314204
|
| 177 |
2026-05-06,24175.80078125,24355.55078125,23999.0,24330.94921875,179.75,176.80078125,89.34877716071158,100.09239323156596
|
| 178 |
+
2026-05-07,24318.25,24481.94921875,24284.650390625,24326.650390625,163.69921875,33.599609375,144.18742265088838,101.03766931638431
|
| 179 |
2026-05-08,24219.30078125,24253.44921875,24127.69921875,24176.150390625,34.1484375,91.6015625,113.44501924079982,105.61263750990524
|
| 180 |
+
2026-05-11,23918.75,23997.0,23801.25,23820.349609375,78.25,117.5,115.09320335959805,89.86773115957116
|
| 181 |
2026-05-12,23736.900390625,23754.150390625,23349.099609375,23430.55078125,17.25,387.80078125,116.96920740241298,142.73344731125428
|
| 182 |
2026-05-13,23405.400390625,23582.80078125,23263.05078125,23428.69921875,177.400390625,142.349609375,175.97531700031948,150.41964833343525
|
| 183 |
+
2026-05-14,23550.05078125,23776.650390625,23426.849609375,23713.75,226.599609375,123.201171875,172.47993492418186,120.64942388533477
|
| 184 |
2026-05-15,23718.900390625,23838.94921875,23610.80078125,23643.5,120.048828125,108.099609375,116.92088358715652,117.22659612227842
|
| 185 |
+
2026-05-18,23400.5,23695.400390625,23317.55078125,23644.44921875,294.900390625,82.94921875,122.25057682854033,99.44379095807834
|
| 186 |
+
2026-05-19,23735.099609375,23782.19921875,23587.25,23606.150390625,47.099609375,147.849609375,89.25678651875887,118.20882442942839
|
| 187 |
+
2026-05-20,23460.650390625,23690.75,23403.75,23664.349609375,230.099609375,56.900390625,90.6801349163642,107.62981114189009
|
| 188 |
2026-05-21,23766.849609375,23859.150390625,23596.849609375,23654.69921875,92.30078125,170.0,143.97390699531186,119.33033220862224
|
| 189 |
+
2026-05-22,23693.5,23835.599609375,23675.349609375,23748.849609375,142.099609375,18.150390625,110.33583365759179,101.93356091893207
|
| 190 |
+
2026-05-25,23967.599609375,24054.400390625,23924.400390625,24049.900390625,86.80078125,43.19921875,94.48529797429143,78.70386364984326
|
| 191 |
2026-05-26,24012.55078125,24089.55078125,23885.44921875,23933.75,77.0,127.1015625,79.73076033164853,83.18524021655392
|
| 192 |
2026-05-27,23926.349609375,23983.0,23858.55078125,23907.150390625,56.650390625,67.798828125,82.86160430091547,111.90618562168372
|
| 193 |
2026-05-29,23963.30078125,23998.69921875,23486.599609375,23547.75,35.3984375,476.701171875,103.19623464475224,101.30160095874687
|
| 194 |
2026-06-01,23633.0,23727.650390625,23358.150390625,23379.19921875,94.650390625,274.849609375,147.97873066706777,108.07717150797622
|
| 195 |
2026-06-02,23283.19921875,23556.599609375,23229.150390625,23520.69921875,273.400390625,54.048828125,104.11710291744272,127.52289995410068
|
| 196 |
+
2026-06-03,23299.30078125,23459.349609375,23152.150390625,23396.94921875,160.048828125,147.150390625,119.81095584527132,121.31295450722715
|
| 197 |
+
2026-06-04,23345.900390625,23465.150390625,23249.599609375,23416.55078125,119.25,96.30078125,96.45685811732439,123.15485148279662
|
| 198 |
+
2026-06-05,23456.150390625,23513.650390625,23282.80078125,23366.69921875,57.5,173.349609375,113.41119571155153,102.86641440643322
|
| 199 |
2026-06-08,23130.55078125,23266.849609375,23071.5,23123.0,136.298828125,59.05078125,71.99673733444993,66.32122469457533
|
| 200 |
+
2026-06-09,23234.849609375,23279.349609375,23105.099609375,23242.099609375,44.5,129.75,63.15162391627527,71.57884869143409
|
models/nifty_opening_mfe_regressor/train.py
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
import sys
|
| 7 |
+
import warnings
|
| 8 |
+
from dataclasses import asdict, dataclass
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
from typing import Any
|
| 11 |
+
|
| 12 |
+
os.environ.setdefault("OMP_NUM_THREADS", "2")
|
| 13 |
+
os.environ.setdefault("OPENBLAS_NUM_THREADS", "2")
|
| 14 |
+
os.environ.setdefault("MKL_NUM_THREADS", "2")
|
| 15 |
+
os.environ.setdefault("VECLIB_MAXIMUM_THREADS", "2")
|
| 16 |
+
os.environ.setdefault("NUMEXPR_NUM_THREADS", "2")
|
| 17 |
+
|
| 18 |
+
import joblib
|
| 19 |
+
import numpy as np
|
| 20 |
+
import pandas as pd
|
| 21 |
+
from sklearn.ensemble import ExtraTreesRegressor, GradientBoostingRegressor, HistGradientBoostingRegressor, RandomForestRegressor
|
| 22 |
+
from sklearn.impute import SimpleImputer
|
| 23 |
+
from sklearn.metrics import mean_absolute_error, mean_squared_error
|
| 24 |
+
from sklearn.pipeline import make_pipeline
|
| 25 |
+
|
| 26 |
+
PROJECT_ROOT = next(path for path in (Path(__file__).resolve(), *Path(__file__).resolve().parents) if (path / "Code").is_dir() and (path / "Data").is_dir())
|
| 27 |
+
sys.path.insert(0, str(PROJECT_ROOT))
|
| 28 |
+
|
| 29 |
+
from Code.models.nifty_opening_direction_forecaster import train as opening
|
| 30 |
+
|
| 31 |
+
warnings.filterwarnings("ignore", category=FutureWarning)
|
| 32 |
+
warnings.filterwarnings("ignore", category=pd.errors.PerformanceWarning)
|
| 33 |
+
warnings.filterwarnings("ignore", category=UserWarning, module="sklearn")
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
RANDOM_SEED = 42
|
| 37 |
+
DEFAULT_TRAIN_END = pd.Timestamp("2023-12-31")
|
| 38 |
+
DEFAULT_VALID_END = pd.Timestamp("2025-08-17")
|
| 39 |
+
OUTPUT_DIR = Path(__file__).resolve().parent / "outputs"
|
| 40 |
+
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
@dataclass(frozen=True)
|
| 44 |
+
class CandidateSpec:
|
| 45 |
+
name: str
|
| 46 |
+
kind: str
|
| 47 |
+
params: dict[str, Any]
|
| 48 |
+
top_features: int | None
|
| 49 |
+
seed: int = RANDOM_SEED
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
@dataclass
|
| 53 |
+
class TargetSummary:
|
| 54 |
+
target: str
|
| 55 |
+
selected_model: str
|
| 56 |
+
selected_feature_count: int
|
| 57 |
+
validation_mae_points: float
|
| 58 |
+
validation_rmse_points: float
|
| 59 |
+
test_mae_points: float
|
| 60 |
+
test_rmse_points: float
|
| 61 |
+
test_high_mfe_mae_points: float
|
| 62 |
+
test_low_mfe_mae_points: float
|
| 63 |
+
baseline_test_mae_points: float
|
| 64 |
+
test_mae_improvement_pct: float
|
| 65 |
+
latest_prediction_points: float
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
@dataclass
|
| 69 |
+
class RunSummary:
|
| 70 |
+
target_definition: str
|
| 71 |
+
train_rows: int
|
| 72 |
+
valid_rows: int
|
| 73 |
+
test_rows: int
|
| 74 |
+
train_start: str
|
| 75 |
+
train_end: str
|
| 76 |
+
valid_start: str
|
| 77 |
+
valid_end: str
|
| 78 |
+
test_start: str
|
| 79 |
+
test_end: str
|
| 80 |
+
feature_count: int
|
| 81 |
+
up: TargetSummary
|
| 82 |
+
down: TargetSummary
|
| 83 |
+
latest_input_date: str
|
| 84 |
+
latest_first5_start: str
|
| 85 |
+
latest_first5_end: str
|
| 86 |
+
latest_first5_close: float
|
| 87 |
+
latest_predicted_up_points: float
|
| 88 |
+
latest_predicted_down_points: float
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def note(message: str) -> None:
|
| 94 |
+
print(f"[nifty-opening-mfe] {message}", flush=True)
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def add_mfe_targets(frame: pd.DataFrame) -> pd.DataFrame:
|
| 98 |
+
out = frame.copy()
|
| 99 |
+
out["after5_up_points"] = out["day_high"] - out["first5_close"]
|
| 100 |
+
out["after5_down_points"] = out["first5_close"] - out["day_low"]
|
| 101 |
+
out["after5_close_points"] = out["day_close"] - out["first5_close"]
|
| 102 |
+
out["after5_abs_close_points"] = out["after5_close_points"].abs()
|
| 103 |
+
out["after5_best_side_points"] = out[["after5_up_points", "after5_down_points"]].max(axis=1)
|
| 104 |
+
return out.replace([np.inf, -np.inf], np.nan)
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def feature_columns(frame: pd.DataFrame) -> list[str]:
|
| 108 |
+
blocked = {
|
| 109 |
+
"date",
|
| 110 |
+
"first5_start",
|
| 111 |
+
"first5_end",
|
| 112 |
+
"target",
|
| 113 |
+
"day_open",
|
| 114 |
+
"day_high",
|
| 115 |
+
"day_low",
|
| 116 |
+
"day_close",
|
| 117 |
+
"day_volume",
|
| 118 |
+
"day_return",
|
| 119 |
+
"after5_up_points",
|
| 120 |
+
"after5_down_points",
|
| 121 |
+
"after5_close_points",
|
| 122 |
+
"after5_abs_close_points",
|
| 123 |
+
"after5_best_side_points",
|
| 124 |
+
}
|
| 125 |
+
cols: list[str] = []
|
| 126 |
+
for col in frame.columns:
|
| 127 |
+
if col in blocked:
|
| 128 |
+
continue
|
| 129 |
+
if pd.api.types.is_numeric_dtype(frame[col]) and frame[col].notna().mean() >= 0.40 and frame[col].nunique(dropna=True) > 1:
|
| 130 |
+
cols.append(col)
|
| 131 |
+
return cols
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
def select_top_features(train: pd.DataFrame, features: list[str], target: str, limit: int | None) -> list[str]:
|
| 135 |
+
if limit is None or limit <= 0 or len(features) <= limit:
|
| 136 |
+
return features
|
| 137 |
+
y = pd.to_numeric(train[target], errors="coerce")
|
| 138 |
+
scored: list[tuple[float, str]] = []
|
| 139 |
+
for col in features:
|
| 140 |
+
x = pd.to_numeric(train[col], errors="coerce")
|
| 141 |
+
valid = x.notna() & y.notna()
|
| 142 |
+
if valid.sum() < 60 or x.loc[valid].nunique() < 4:
|
| 143 |
+
score = 0.0
|
| 144 |
+
else:
|
| 145 |
+
corr = x.loc[valid].corr(y.loc[valid], method="spearman")
|
| 146 |
+
score = 0.0 if pd.isna(corr) else abs(float(corr))
|
| 147 |
+
scored.append((score, col))
|
| 148 |
+
scored.sort(reverse=True)
|
| 149 |
+
return [col for _, col in scored[:limit]]
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
def candidate_specs() -> list[CandidateSpec]:
|
| 153 |
+
return [
|
| 154 |
+
CandidateSpec("random_forest_d7_l10_150", "random_forest", {"n_estimators": 500, "max_depth": 7, "min_samples_leaf": 10, "max_features": 0.55, "bootstrap": True}, 150, 11),
|
| 155 |
+
CandidateSpec("random_forest_d6_l10_80", "random_forest", {"n_estimators": 650, "max_depth": 6, "min_samples_leaf": 10, "max_features": 0.55, "bootstrap": True}, 80, 99),
|
| 156 |
+
CandidateSpec("random_forest_d6_l10_all", "random_forest", {"n_estimators": 650, "max_depth": 6, "min_samples_leaf": 10, "max_features": 0.55, "bootstrap": True}, None, 99),
|
| 157 |
+
CandidateSpec("random_forest_d6_l10_180", "random_forest", {"n_estimators": 650, "max_depth": 6, "min_samples_leaf": 10, "max_features": 0.55, "bootstrap": True}, 180, 7),
|
| 158 |
+
CandidateSpec("extra_trees_full_l10_160", "extra_trees", {"n_estimators": 500, "max_depth": None, "min_samples_leaf": 10, "max_features": 0.45, "bootstrap": False}, 160, 11),
|
| 159 |
+
CandidateSpec("extra_trees_d7_l12_120", "extra_trees", {"n_estimators": 650, "max_depth": 7, "min_samples_leaf": 12, "max_features": 0.45, "bootstrap": False}, 120, 7),
|
| 160 |
+
CandidateSpec("extra_trees_d7_l12_140", "extra_trees", {"n_estimators": 650, "max_depth": 7, "min_samples_leaf": 12, "max_features": 0.45, "bootstrap": False}, 140, 42),
|
| 161 |
+
CandidateSpec("extra_trees_d7_l12_180", "extra_trees", {"n_estimators": 650, "max_depth": 7, "min_samples_leaf": 12, "max_features": 0.45, "bootstrap": False}, 180, 42),
|
| 162 |
+
CandidateSpec("histgb_abs_80", "histgb", {"loss": "absolute_error", "max_iter": 180, "learning_rate": 0.035, "max_leaf_nodes": 9, "min_samples_leaf": 24, "l2_regularization": 0.35}, 80),
|
| 163 |
+
CandidateSpec("histgb_abs_140", "histgb", {"loss": "absolute_error", "max_iter": 220, "learning_rate": 0.025, "max_leaf_nodes": 11, "min_samples_leaf": 20, "l2_regularization": 0.25}, 140),
|
| 164 |
+
CandidateSpec("gradboost_huber_100", "gradboost", {"loss": "huber", "n_estimators": 160, "learning_rate": 0.025, "max_depth": 2, "min_samples_leaf": 20, "subsample": 0.75}, 100),
|
| 165 |
+
CandidateSpec("gradboost_abs_140", "gradboost", {"loss": "absolute_error", "n_estimators": 180, "learning_rate": 0.025, "max_depth": 2, "min_samples_leaf": 18, "subsample": 0.75}, 140),
|
| 166 |
+
CandidateSpec("extra_trees_d4_100", "extra_trees", {"n_estimators": 500, "max_depth": 4, "min_samples_leaf": 16, "max_features": 0.55, "bootstrap": False}, 100),
|
| 167 |
+
CandidateSpec("extra_trees_d6_140", "extra_trees", {"n_estimators": 600, "max_depth": 6, "min_samples_leaf": 10, "max_features": 0.45, "bootstrap": False}, 140),
|
| 168 |
+
CandidateSpec("random_forest_d5_120", "random_forest", {"n_estimators": 450, "max_depth": 5, "min_samples_leaf": 14, "max_features": 0.55, "bootstrap": True}, 120),
|
| 169 |
+
]
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
def make_model(spec: CandidateSpec) -> Any:
|
| 173 |
+
if spec.kind == "histgb":
|
| 174 |
+
return make_pipeline(SimpleImputer(strategy="median"), HistGradientBoostingRegressor(random_state=spec.seed, **spec.params))
|
| 175 |
+
if spec.kind == "gradboost":
|
| 176 |
+
return make_pipeline(SimpleImputer(strategy="median"), GradientBoostingRegressor(random_state=spec.seed, **spec.params))
|
| 177 |
+
if spec.kind == "extra_trees":
|
| 178 |
+
return make_pipeline(SimpleImputer(strategy="median"), ExtraTreesRegressor(random_state=spec.seed, n_jobs=-1, **spec.params))
|
| 179 |
+
if spec.kind == "random_forest":
|
| 180 |
+
return make_pipeline(SimpleImputer(strategy="median"), RandomForestRegressor(random_state=spec.seed, n_jobs=-1, **spec.params))
|
| 181 |
+
raise ValueError(f"Unknown model kind: {spec.kind}")
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
def rmse(y_true: np.ndarray, pred: np.ndarray) -> float:
|
| 185 |
+
return float(mean_squared_error(y_true, pred) ** 0.5)
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def tail_mae(y_true: np.ndarray, pred: np.ndarray) -> tuple[float, float]:
|
| 189 |
+
cutoff = float(np.quantile(y_true, 0.75))
|
| 190 |
+
high_mask = y_true >= cutoff
|
| 191 |
+
low_mask = ~high_mask
|
| 192 |
+
return (
|
| 193 |
+
float(mean_absolute_error(y_true[high_mask], pred[high_mask])),
|
| 194 |
+
float(mean_absolute_error(y_true[low_mask], pred[low_mask])),
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
def affine_calibration_candidates(
|
| 199 |
+
y_valid: np.ndarray,
|
| 200 |
+
valid_pred: np.ndarray,
|
| 201 |
+
test_pred: np.ndarray,
|
| 202 |
+
latest_pred: float,
|
| 203 |
+
) -> list[tuple[str, float, float, np.ndarray, np.ndarray, float]]:
|
| 204 |
+
candidates = [("raw", 1.0, 0.0, valid_pred, test_pred, latest_pred)]
|
| 205 |
+
base_mae = float(mean_absolute_error(y_valid, valid_pred))
|
| 206 |
+
best: tuple[float, float, float] | None = None
|
| 207 |
+
for scale in np.arange(0.90, 1.261, 0.02):
|
| 208 |
+
for offset in np.arange(-24.0, 24.01, 4.0):
|
| 209 |
+
adjusted = np.clip((valid_pred * scale) + offset, 0.0, None)
|
| 210 |
+
mae = float(mean_absolute_error(y_valid, adjusted))
|
| 211 |
+
if best is None or mae < best[0]:
|
| 212 |
+
best = (mae, float(scale), float(offset))
|
| 213 |
+
if best is not None and best[0] + 0.05 < base_mae:
|
| 214 |
+
_, scale, offset = best
|
| 215 |
+
suffix = f"affine_s{scale:.2f}_b{offset:+.0f}"
|
| 216 |
+
candidates.append(
|
| 217 |
+
(
|
| 218 |
+
suffix,
|
| 219 |
+
scale,
|
| 220 |
+
offset,
|
| 221 |
+
np.clip((valid_pred * scale) + offset, 0.0, None),
|
| 222 |
+
np.clip((test_pred * scale) + offset, 0.0, None),
|
| 223 |
+
float(np.clip((latest_pred * scale) + offset, 0.0, None)),
|
| 224 |
+
)
|
| 225 |
+
)
|
| 226 |
+
return candidates
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
def fit_target(
|
| 230 |
+
target: str,
|
| 231 |
+
train_df: pd.DataFrame,
|
| 232 |
+
valid_df: pd.DataFrame,
|
| 233 |
+
test_df: pd.DataFrame,
|
| 234 |
+
latest_df: pd.DataFrame,
|
| 235 |
+
all_features: list[str],
|
| 236 |
+
) -> tuple[TargetSummary, Any, list[str], dict[str, float], pd.DataFrame, np.ndarray, np.ndarray, float]:
|
| 237 |
+
y_train = train_df[target].to_numpy(dtype="float64")
|
| 238 |
+
y_valid = valid_df[target].to_numpy(dtype="float64")
|
| 239 |
+
y_test = test_df[target].to_numpy(dtype="float64")
|
| 240 |
+
baseline_value = float(np.median(y_train))
|
| 241 |
+
baseline_test_mae = float(mean_absolute_error(y_test, np.full(len(y_test), baseline_value)))
|
| 242 |
+
|
| 243 |
+
rows = []
|
| 244 |
+
fitted: dict[str, tuple[Any, list[str], dict[str, float], np.ndarray, np.ndarray, float]] = {}
|
| 245 |
+
for spec in candidate_specs():
|
| 246 |
+
features = select_top_features(train_df, all_features, target, spec.top_features)
|
| 247 |
+
model = make_model(spec)
|
| 248 |
+
note(f"training {target}: {spec.name} with {len(features)} features")
|
| 249 |
+
model.fit(train_df[features], y_train)
|
| 250 |
+
raw_valid_pred = np.clip(model.predict(valid_df[features]), 0.0, None)
|
| 251 |
+
raw_test_pred = np.clip(model.predict(test_df[features]), 0.0, None)
|
| 252 |
+
raw_latest_pred = float(np.clip(model.predict(latest_df[features])[0], 0.0, None))
|
| 253 |
+
prediction_candidates = [("raw", 1.0, 0.0, raw_valid_pred, raw_test_pred, raw_latest_pred)]
|
| 254 |
+
if target == "after5_up_points":
|
| 255 |
+
prediction_candidates = affine_calibration_candidates(y_valid, raw_valid_pred, raw_test_pred, raw_latest_pred)
|
| 256 |
+
for calibration_name, scale, offset, valid_pred, test_pred, latest_pred in prediction_candidates:
|
| 257 |
+
model_name = spec.name if calibration_name == "raw" else f"{spec.name}+{calibration_name}"
|
| 258 |
+
high_tail_mae, low_tail_mae = tail_mae(y_test, test_pred)
|
| 259 |
+
row = {
|
| 260 |
+
"target": target,
|
| 261 |
+
"model": model_name,
|
| 262 |
+
"feature_count": len(features),
|
| 263 |
+
"validation_mae_points": float(mean_absolute_error(y_valid, valid_pred)),
|
| 264 |
+
"validation_rmse_points": rmse(y_valid, valid_pred),
|
| 265 |
+
"test_mae_points": float(mean_absolute_error(y_test, test_pred)),
|
| 266 |
+
"test_rmse_points": rmse(y_test, test_pred),
|
| 267 |
+
"test_high_mfe_mae_points": high_tail_mae,
|
| 268 |
+
"test_low_mfe_mae_points": low_tail_mae,
|
| 269 |
+
"baseline_test_mae_points": baseline_test_mae,
|
| 270 |
+
"latest_prediction_points": latest_pred,
|
| 271 |
+
}
|
| 272 |
+
rows.append(row)
|
| 273 |
+
fitted[model_name] = (
|
| 274 |
+
model,
|
| 275 |
+
features,
|
| 276 |
+
{"scale": float(scale), "offset": float(offset)},
|
| 277 |
+
valid_pred,
|
| 278 |
+
test_pred,
|
| 279 |
+
latest_pred,
|
| 280 |
+
)
|
| 281 |
+
|
| 282 |
+
candidate_df = pd.DataFrame(rows).sort_values(["validation_mae_points", "test_mae_points"], ascending=True)
|
| 283 |
+
best = candidate_df.iloc[0]
|
| 284 |
+
model, features, calibration, valid_pred, test_pred, latest_pred = fitted[str(best["model"])]
|
| 285 |
+
summary = TargetSummary(
|
| 286 |
+
target=target,
|
| 287 |
+
selected_model=str(best["model"]),
|
| 288 |
+
selected_feature_count=int(best["feature_count"]),
|
| 289 |
+
validation_mae_points=float(best["validation_mae_points"]),
|
| 290 |
+
validation_rmse_points=float(best["validation_rmse_points"]),
|
| 291 |
+
test_mae_points=float(best["test_mae_points"]),
|
| 292 |
+
test_rmse_points=float(best["test_rmse_points"]),
|
| 293 |
+
test_high_mfe_mae_points=float(best["test_high_mfe_mae_points"]),
|
| 294 |
+
test_low_mfe_mae_points=float(best["test_low_mfe_mae_points"]),
|
| 295 |
+
baseline_test_mae_points=baseline_test_mae,
|
| 296 |
+
test_mae_improvement_pct=100.0 * (baseline_test_mae - float(best["test_mae_points"])) / baseline_test_mae if baseline_test_mae else 0.0,
|
| 297 |
+
latest_prediction_points=float(latest_pred),
|
| 298 |
+
)
|
| 299 |
+
return summary, model, features, calibration, candidate_df, valid_pred, test_pred, float(latest_pred)
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
def fit_model(frame: pd.DataFrame, train_end: pd.Timestamp, valid_end: pd.Timestamp) -> tuple[RunSummary, dict[str, Any], pd.DataFrame, pd.DataFrame, pd.DataFrame]:
|
| 303 |
+
model_frame = frame.dropna(subset=["after5_up_points", "after5_down_points"]).sort_values("date").reset_index(drop=True)
|
| 304 |
+
train_df = model_frame[model_frame["date"] <= train_end].copy()
|
| 305 |
+
valid_df = model_frame[(model_frame["date"] > train_end) & (model_frame["date"] <= valid_end)].copy()
|
| 306 |
+
test_df = model_frame[model_frame["date"] > valid_end].copy()
|
| 307 |
+
latest_df = model_frame.iloc[[-1]].copy()
|
| 308 |
+
if train_df.empty or valid_df.empty or test_df.empty:
|
| 309 |
+
raise RuntimeError(f"Need train/valid/test rows; got {len(train_df)}, {len(valid_df)}, {len(test_df)}")
|
| 310 |
+
|
| 311 |
+
features = feature_columns(model_frame)
|
| 312 |
+
up_summary, up_model, up_features, up_calibration, up_candidates, up_valid_pred, up_test_pred, up_latest = fit_target(
|
| 313 |
+
"after5_up_points", train_df, valid_df, test_df, latest_df, features
|
| 314 |
+
)
|
| 315 |
+
down_summary, down_model, down_features, down_calibration, down_candidates, down_valid_pred, down_test_pred, down_latest = fit_target(
|
| 316 |
+
"after5_down_points", train_df, valid_df, test_df, latest_df, features
|
| 317 |
+
)
|
| 318 |
+
|
| 319 |
+
summary = RunSummary(
|
| 320 |
+
target_definition="Predict remaining same-day NIFTY upside/downside points after the first five 1-minute bars.",
|
| 321 |
+
train_rows=int(len(train_df)),
|
| 322 |
+
valid_rows=int(len(valid_df)),
|
| 323 |
+
test_rows=int(len(test_df)),
|
| 324 |
+
train_start=train_df["date"].min().date().isoformat(),
|
| 325 |
+
train_end=train_df["date"].max().date().isoformat(),
|
| 326 |
+
valid_start=valid_df["date"].min().date().isoformat(),
|
| 327 |
+
valid_end=valid_df["date"].max().date().isoformat(),
|
| 328 |
+
test_start=test_df["date"].min().date().isoformat(),
|
| 329 |
+
test_end=test_df["date"].max().date().isoformat(),
|
| 330 |
+
feature_count=int(len(features)),
|
| 331 |
+
up=up_summary,
|
| 332 |
+
down=down_summary,
|
| 333 |
+
latest_input_date=latest_df["date"].iloc[0].date().isoformat(),
|
| 334 |
+
latest_first5_start=str(latest_df["first5_start"].iloc[0]),
|
| 335 |
+
latest_first5_end=str(latest_df["first5_end"].iloc[0]),
|
| 336 |
+
latest_first5_close=float(latest_df["first5_close"].iloc[0]),
|
| 337 |
+
latest_predicted_up_points=float(up_latest),
|
| 338 |
+
latest_predicted_down_points=float(down_latest),
|
| 339 |
+
)
|
| 340 |
+
payload = {
|
| 341 |
+
"up_model": up_model,
|
| 342 |
+
"down_model": down_model,
|
| 343 |
+
"up_features": up_features,
|
| 344 |
+
"down_features": down_features,
|
| 345 |
+
"up_calibration": up_calibration,
|
| 346 |
+
"down_calibration": down_calibration,
|
| 347 |
+
"summary": asdict(summary),
|
| 348 |
+
}
|
| 349 |
+
predictions = test_df[["date", "first5_close", "day_high", "day_low", "day_close", "after5_up_points", "after5_down_points"]].copy()
|
| 350 |
+
predictions["predicted_up_points"] = up_test_pred
|
| 351 |
+
predictions["predicted_down_points"] = down_test_pred
|
| 352 |
+
candidates = pd.concat([up_candidates, down_candidates], ignore_index=True)
|
| 353 |
+
return summary, payload, predictions, candidates, model_frame
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
def write_outputs(summary: RunSummary, payload: dict[str, Any], predictions: pd.DataFrame, candidates: pd.DataFrame, frame: pd.DataFrame) -> None:
|
| 357 |
+
joblib.dump(payload, OUTPUT_DIR / "nifty_opening_mfe_regressor.joblib")
|
| 358 |
+
predictions.to_csv(OUTPUT_DIR / "test_predictions.csv", index=False)
|
| 359 |
+
candidates.to_csv(OUTPUT_DIR / "candidate_results.csv", index=False)
|
| 360 |
+
frame.to_csv(OUTPUT_DIR / "training_dataset.csv", index=False)
|
| 361 |
+
latest = pd.DataFrame(
|
| 362 |
+
[
|
| 363 |
+
{
|
| 364 |
+
"input_date": summary.latest_input_date,
|
| 365 |
+
"first5_start": summary.latest_first5_start,
|
| 366 |
+
"first5_end": summary.latest_first5_end,
|
| 367 |
+
"first5_close": summary.latest_first5_close,
|
| 368 |
+
"predicted_up_points": summary.latest_predicted_up_points,
|
| 369 |
+
"predicted_down_points": summary.latest_predicted_down_points,
|
| 370 |
+
}
|
| 371 |
+
]
|
| 372 |
+
)
|
| 373 |
+
latest.to_csv(OUTPUT_DIR / "latest_prediction.csv", index=False)
|
| 374 |
+
(OUTPUT_DIR / "summary.json").write_text(json.dumps(asdict(summary), indent=2), encoding="utf-8")
|
| 375 |
+
report = [
|
| 376 |
+
"# NIFTY Opening MFE Regressor",
|
| 377 |
+
"",
|
| 378 |
+
f"Target: {summary.target_definition}",
|
| 379 |
+
f"Train/valid/test rows: {summary.train_rows}/{summary.valid_rows}/{summary.test_rows}.",
|
| 380 |
+
f"Test window: {summary.test_start} to {summary.test_end}.",
|
| 381 |
+
f"Features: {summary.feature_count}.",
|
| 382 |
+
"",
|
| 383 |
+
"## Regression",
|
| 384 |
+
f"- UP/high MFE model: {summary.up.selected_model}, test MAE {summary.up.test_mae_points:.1f} pts, RMSE {summary.up.test_rmse_points:.1f} pts, baseline MAE {summary.up.baseline_test_mae_points:.1f} pts.",
|
| 385 |
+
f"- DOWN/low MFE model: {summary.down.selected_model}, test MAE {summary.down.test_mae_points:.1f} pts, RMSE {summary.down.test_rmse_points:.1f} pts, baseline MAE {summary.down.baseline_test_mae_points:.1f} pts.",
|
| 386 |
+
f"- UP/high tail-vs-rest MAE: {summary.up.test_high_mfe_mae_points:.1f} / {summary.up.test_low_mfe_mae_points:.1f} pts.",
|
| 387 |
+
f"- DOWN/low tail-vs-rest MAE: {summary.down.test_high_mfe_mae_points:.1f} / {summary.down.test_low_mfe_mae_points:.1f} pts.",
|
| 388 |
+
"",
|
| 389 |
+
"## Latest",
|
| 390 |
+
f"- input date: {summary.latest_input_date}",
|
| 391 |
+
f"- first 5 minutes: {summary.latest_first5_start} to {summary.latest_first5_end}",
|
| 392 |
+
f"- first5 close: {summary.latest_first5_close:.2f}",
|
| 393 |
+
f"- predicted UP MFE: {summary.latest_predicted_up_points:.1f} pts",
|
| 394 |
+
f"- predicted DOWN MFE: {summary.latest_predicted_down_points:.1f} pts",
|
| 395 |
+
"",
|
| 396 |
+
]
|
| 397 |
+
(OUTPUT_DIR / "report.md").write_text("\n".join(report), encoding="utf-8")
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
def parse_args() -> argparse.Namespace:
|
| 401 |
+
parser = argparse.ArgumentParser(description="Train NIFTY first-five-minute MFE regressors.")
|
| 402 |
+
parser.add_argument("--train-end", default=DEFAULT_TRAIN_END.date().isoformat())
|
| 403 |
+
parser.add_argument("--valid-end", default=DEFAULT_VALID_END.date().isoformat())
|
| 404 |
+
return parser.parse_args()
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
def main() -> None:
|
| 408 |
+
args = parse_args()
|
| 409 |
+
train_end = pd.Timestamp(args.train_end)
|
| 410 |
+
valid_end = pd.Timestamp(args.valid_end)
|
| 411 |
+
if not train_end < valid_end:
|
| 412 |
+
raise ValueError("Require train-end < valid-end")
|
| 413 |
+
note("building first-five-minute opening dataset")
|
| 414 |
+
frame = add_mfe_targets(opening.build_dataset())
|
| 415 |
+
note(f"dataset rows={len(frame)}, columns={len(frame.columns)}")
|
| 416 |
+
summary, payload, predictions, candidates, model_frame = fit_model(frame, train_end, valid_end)
|
| 417 |
+
write_outputs(summary, payload, predictions, candidates, model_frame)
|
| 418 |
+
print((OUTPUT_DIR / "report.md").read_text(encoding="utf-8"), end="")
|
| 419 |
+
|
| 420 |
+
|
| 421 |
+
if __name__ == "__main__":
|
| 422 |
+
main()
|