forked from chiki2bum2/SniperGold_ML
25 lines
1 KiB
Python
25 lines
1 KiB
Python
# -*- coding: utf-8 -*-
| |||
"""Cek level harga XAUUSD per tahun — deteksi diskontinuitas feed."""
| |||
import os
| |||
import numpy as np
| |||
import datetime as dt
| |||
| |||
BASE = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
| |||
"..", "..", "..", "Files", "AlgoForge", "Data"))
| |||
for name in ("M15", "D1"):
| |||
z = np.load(os.path.join(BASE, f"XAUUSD_{name}.npz"))
| |||
t = z["time"].astype(np.int64)
| |||
c = z["close"].astype(np.float64)
| |||
yrs = np.array([dt.datetime.utcfromtimestamp(int(x)).year for x in t])
| |||
print(f"=== {name} ===")
| |||
for y in range(int(yrs.min()), int(yrs.max()) + 1):
| |||
m = yrs == y
| |||
cc = c[m]
| |||
if len(cc) == 0:
| |||
continue
| |||
# lompatan max antar bar berurutan dalam tahun itu
| |||
rr = np.diff(cc) / np.maximum(cc[:-1], 1e-12)
| |||
jmp = float(np.max(np.abs(rr))) if len(rr) else 0.0
| |||
print(f" {y}: n={len(cc):6d} close min={cc.min():10.2f} "
| |||
f"max={cc.max():10.2f} max|lompat|={jmp*100:6.2f}%")
| |||
print()
|