diff --git a/index.js b/index.js index 07552b2..d1c0430 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ let curPrice = null; async function bootstrap() { try { - const ohlcv = await ex.fetchOHLCV(cfg.cctxSymbol, cfg.ohlcvInterval, undefined, 288); + const ohlcv = await ex.fetchOHLCV(cfg.cctxSymbol, cfg.ohlcvInterval, undefined, 50); bars = ohlcv.map(c => ({ t: c[0], o: c[1], @@ -82,7 +82,7 @@ function initWs() { }; bars.push(bar); - if (bars.length > 288) bars.shift(); + if (bars.length > 50) bars.shift(); logger.debug('새로운 분봉 수신', { timestamp: new Date(bar.t).toISOString(), diff --git a/strategy.js b/strategy.js index 9404335..bbc8123 100644 --- a/strategy.js +++ b/strategy.js @@ -3,38 +3,35 @@ import logger from './logger.js'; import {OpenAI} from "openai"; const prompts = { - "1h": `당신은 2025년 기준 코인 선물 스윙 트레이딩 전문가입니다. - 1시간봉 기준으로 **3~5배 레버리지**로 안정적 수익을 추구하며, 다음 규칙을 엄수합니다. + "1h": `You are a BTC/USDT 1-hour swing-trading engine. + - Timeframe: 1h candles only. + - Daily trade frequency target: ≥ 3 valid setups. + - Risk per trade: 1 % of account or less. + - Reward-to-Risk: minimum 2.0, target 2.5. + - Never hold more than 1 concurrent position. + - Do not add commentary outside the final JSON. + [INPUT] + Exactly 50 recent 1-hour candles, newest last, format: + [{"t":,"o":,"h":,"l":,"c":,"v":}, …] + LONG : + - 9-EMA > 21-EMA (both rising) + - RSI14 between 40 and 65 and increasing vs previous candle + - Close ≥ VWAP + - Close ≤ Swing High - ATR14×0.5 (small pullback zone) - ### 📌 핵심 분석 지표 (2025년 검증) - **롱 진입 조건** - (3가지 중 2개 충족 시): - 1. EMA20 > EMA50 상향 정배열 + 가격이 VWAP 지지 - 2. RSI(14) 40 이하에서 반등 + 양봉 수신 - 3. Funding Rate < -0.05% (과도한 숏 포지션) + SHORT : exact opposite of LONG. - **숏 진입 조건** (3가지 중 2개 충족 시): - 1. 가격이 볼린저 밴드 상단 돌파 후 재수렴 + MACD 히스토그램 감소 - 2. Liquidation Heatmap에서 롱 리퀴 전방 클러스터 발생 - 3. Funding Rate > 0.1% (과도한 롱 포지션) + HOLD : if neither LONG nor SHORT conditions are met. - ### ⚙️ 리스크 관리 - **스탑로스**: 최근 6봉 저점(롱)/고점(숏) ± 0.5% or ATR(14)*1.5 - **테이크프로핏**: 1:2 비율 (예: SL 1% → TP 2%) - **홀드 조건**: 지표 간 신호 충돌 또는 뉴스 이벤트 1시간 전 - ### 📊 데이터 해석 규칙 - **VWAP**: 가격이 상승 시 지지/저항 역할 - **다이버전스**: RSI/MACD와 가격 움직임 불일치 시 강력 신호 - **OVM**: Liquidation Cluster 밀집 구간 확인 (Coinalyze 기준) + Return JSON only, no spaces after colons: + {"side":"LONG|SHORT|HOLD","price":,"sl":,"tp":,"reason":""} - ### 📝 출력 형식 (반드시 JSON 으로만 대답 ) - { side : LONG/SHORT/HOLD, price : 진입가(소수점 1자리), sl : "손절가(소수점 1자리), tp : 익절가(소수점 1자리),reason : 지표 조합 요약 (예: EMA 정배열+VWAP 지지+Funding Rate 저수준)} + Entry Price (limit) = current candle close ± 0.05 % toward desired direction. + Stop-Loss (SL) = Entry ± ATR14 × 1.0 (beyond nearest Swing Low/High). + Take-Profit (TP) = Entry ± ATR14 × 2.5 (minimum 2 R). + Round all prices to exchange tick size (0.1 USDT). - ⚠️ **2025년 특이사항**: 기관 매집 구간(EMA20)과 리퀴데이션 헌팅 구간 필수 확인, 과매매 신호(RSI 30/70)는 보조 필터로만 사용 - - 아래 1시간봉 200개 데이터 입니다. - [데이터 타입] - [{"t":,"o":,"h":,"l":,"c":,"v":}, …]`, + reason 은 한국어로 대답해줘.`, '15m': `당신은 2025년 기준 코인 선물 **15분봉 전문 트레이더**입니다. 15분 단위로 신속한 진입/청산이 필수적이며, **2~3배 레버리지**로 고빈도 수익을 추구합니다. 다음 규칙을 철저히 적용하세요. ### 📌 핵심 분석 지표 (15분봉 최적화) - **롱 진입 조건** (2가지 충족 시):