chore: add WF/shadow/momentum analysis simulation scripts

Scripts used to analyze and validate strategy changes:
- wf_cmp.py: WF window size comparison on 42 real trades
- wf_cmp2.py: WF comparison extended with price_history simulation
- shadow_sim.py: shadow rehabilitation sim without strategy filters
- shadow_sim2.py: post-rehabilitation performance simulation
- shadow_sim3.py: shadow rehabilitation sim with full strategy filters
- momentum_cmp.py: momentum filter A/B comparison
- trend_check.py: 2h price gain distribution analysis per ticker

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
joungmin
2026-03-01 23:58:42 +09:00
parent 29d48f0fe9
commit 54ce327c50
7 changed files with 1210 additions and 0 deletions

42
trend_check.py Normal file
View File

@@ -0,0 +1,42 @@
import os
from dotenv import load_dotenv
load_dotenv()
import oracledb
conn = oracledb.connect(user=os.getenv('ORACLE_USER'), password=os.getenv('ORACLE_PASSWORD'),
dsn=os.getenv('ORACLE_DSN'), config_dir=os.getenv('ORACLE_WALLET'))
cur = conn.cursor()
for ticker in ['KRW-DKA', 'KRW-LAYER', 'KRW-SIGN']:
cur.execute("""
SELECT price, recorded_at FROM price_history
WHERE ticker = :t AND recorded_at >= TIMESTAMP '2026-02-28 20:00:00'
ORDER BY recorded_at
""", t=ticker)
rows = cur.fetchall()
lookback = 12 # 10분봉 * 12 = 2h
gains = []
for i in range(lookback, len(rows)):
curr = rows[i][0]
past = rows[i - lookback][0]
if past > 0:
gains.append((curr - past) / past * 100)
if not gains:
continue
above_5 = sum(1 for g in gains if g >= 5.0)
above_3 = sum(1 for g in gains if g >= 3.0)
above_0 = sum(1 for g in gains if g >= 0.0)
negative = sum(1 for g in gains if g < 0.0)
print(f"[{ticker}] 2h 등락률 분포 ({len(gains)}개 틱)")
print(f" 평균={sum(gains)/len(gains):+.2f}% 최고={max(gains):+.2f}% 최저={min(gains):+.2f}%")
print(f" +5% 이상(신호): {above_5}건 ({above_5/len(gains)*100:.0f}%)")
print(f" +3%~+5%: {above_3-above_5}건 ({(above_3-above_5)/len(gains)*100:.0f}%)")
print(f" 0%~+3%: {above_0-above_3}건 ({(above_0-above_3)/len(gains)*100:.0f}%)")
print(f" 음전(하락): {negative}건 ({negative/len(gains)*100:.0f}%)")
print()
conn.close()