vol_breakout 멀티종목 tick, vol_live HTML 모니터, 마감 봉만 저장하는 캔들 다운로드, 텔레그램 체결 알림, cron/watch 감시 스크립트 및 테스트를 포함한다. Co-authored-by: Cursor <cursoragent@cursor.com>
168 lines
6.8 KiB
Plaintext
168 lines
6.8 KiB
Plaintext
# Bithumb — .env.example (비밀값 없음). 복사: cp .env.example .env
|
|
|
|
# --- 빗썸 API (캔들 수집은 Public API, 키 선택) ---
|
|
BITHUMB_ACCESS_KEY=
|
|
BITHUMB_SECRET_KEY=
|
|
BITHUMB_API_URL=https://api.bithumb.com
|
|
BITHUMB_API_CANDLE_COUNT=200
|
|
BITHUMB_MINUTE_INTERVALS=1,3,5,10,15,30,60,240
|
|
HTS_API_RETRY_SLEEP_SEC=0.5
|
|
|
|
# --- 텔레그램 (매매 체결 알림) ---
|
|
COIN_TELEGRAM_BOT_TOKEN=
|
|
COIN_TELEGRAM_CHAT_ID=
|
|
# 토큰·chat_id 설정 시 자동 on. 명시 off: OPS_TELEGRAM_ENABLED=false
|
|
# OPS_TELEGRAM_ENABLED=true
|
|
|
|
# --- 거래 대상 ---
|
|
SYMBOL=BTC
|
|
COIN_NAME=비트코인
|
|
# 캔들 수집 대상 (쉼표 구분). 비우면 SYMBOL만 수집
|
|
DOWNLOAD_SYMBOLS=TRX,NEAR,WLD
|
|
|
|
# --- 공통: 캔들 DB (현물·선물 공유) ---
|
|
DB_PATH=data/common/coins.db
|
|
DOWNLOAD_DAYS=3650
|
|
DOWNLOAD_INTERVALS=1,3,5,10,15,30,60,240,1440,10080,43200
|
|
API_REQUEST_SLEEP_SEC=0.35
|
|
API_REQUEST_RETRIES=3
|
|
|
|
# --- 0단계: GT 타점 (현물·선물 공통 파라미터) ---
|
|
GT_INTERVAL_MIN=3
|
|
GT_LOOKBACK_DAYS=3650
|
|
GT_INITIAL_CASH_KRW=200000
|
|
GT_TRADING_FEE_RATE=0.0005
|
|
GT_ZIGZAG_REVERSAL_PCT=5.0
|
|
GT_MIN_LEG_PCT=3.0
|
|
GT_PULLBACK_MIN_PCT=1.5
|
|
GT_PULLBACK_LOCAL_ORDER=10
|
|
GT_BREAKOUT_BUFFER_PCT=0.1
|
|
GT_BREAKOUT_CONSOLIDATION_BARS=200
|
|
GT_BREAKOUT_MIN_RALLY_PCT=2.0
|
|
GT_DIV_LOCAL_ORDER=20
|
|
GT_DIV_MIN_BARS_BETWEEN=1500
|
|
GT_DIV_MIN_RSI_DIFF=5.0
|
|
GT_DIV_MIN_FUTURE_MOVE_PCT=4.0
|
|
GT_SIM_LOOKBACK_DAYS=1095
|
|
GT_ALIGN_TOLERANCE_BARS=480
|
|
|
|
# --- 0단계: 현물 GT ---
|
|
GROUND_TRUTH_FILE=data/spot/ground_truth/ground_truth_trades_v3.json
|
|
GROUND_TRUTH_V1_FILE=data/spot/ground_truth/ground_truth_trades_v1.json
|
|
GROUND_TRUTH_V2_FILE=data/spot/ground_truth/ground_truth_trades_v2.json
|
|
GROUND_TRUTH_CHART_V1_FILE=docs/spot/0_ground_truth/ground_truth_chart_v1.html
|
|
GROUND_TRUTH_CHART_V2_FILE=docs/spot/0_ground_truth/ground_truth_chart_v2.html
|
|
GROUND_TRUTH_CHART_V3_FILE=docs/spot/0_ground_truth/ground_truth_chart_v3.html
|
|
|
|
# --- 현물 1단계: GT sim ---
|
|
GROUND_TRUTH_CHART_SIM_V1_FILE=docs/spot/1_simulation/ground_truth_chart_sim_v1.html
|
|
GROUND_TRUTH_CHART_SIM_V2_FILE=docs/spot/1_simulation/ground_truth_chart_sim_v2.html
|
|
GROUND_TRUTH_CHART_SIM_V3_FILE=docs/spot/1_simulation/ground_truth_chart_sim_v3.html
|
|
|
|
# --- 현물 2단계: 인과 기법 GT 정합 ---
|
|
TECHNIQUES_DIR=data/spot/techniques
|
|
ANALYSIS_REPORT_JSON=docs/spot/2_analysis/comparison_report.json
|
|
ANALYSIS_REPORT_HTML=docs/spot/2_analysis/comparison_report.html
|
|
SIGNAL_TYPE_REPORT_JSON=docs/spot/2_analysis/signal_type_report.json
|
|
SIGNAL_TYPE_REPORT_HTML=docs/spot/2_analysis/signal_type_report.html
|
|
MTF_REPORT_JSON=docs/spot/2_analysis/mtf_correlation_report.json
|
|
MTF_REPORT_HTML=docs/spot/2_analysis/mtf_correlation_report.html
|
|
MTF_RULES_JSON=data/spot/mtf/mtf_rules_v3.json
|
|
CAUSAL_SIM_REPORT_JSON=docs/spot/2_analysis/causal_sim_report.json
|
|
CAUSAL_SIM_REPORT_HTML=docs/spot/2_analysis/causal_sim_report.html
|
|
|
|
# --- 현물 3단계: 운영 (기본 paper) ---
|
|
# live 전환: OPS_MODE=live → bash scripts/3_run_fractal_live.sh
|
|
OPS_MODE=paper
|
|
OPS_TECHNIQUE_ID=fractal_swing
|
|
OPS_MTF_ENABLED=false
|
|
OPS_TREND_GATE_ENABLED=false
|
|
OPS_DAILY_MAX_TRADES=10000
|
|
OPS_MIN_ORDER_KRW=5000
|
|
# fallback 비율. fractal live: data/spot/operations/sizing_rules.json(100%)이 우선 적용
|
|
OPS_BUY_CASH_PCT=1.0
|
|
OPS_SELL_COIN_PCT=1.0
|
|
OPS_SLIPPAGE_RATE=0.0005
|
|
# 빗썸 시장가 매수: 주문금액+예약수수료 lock (insufficient_funds 방지)
|
|
OPS_EXCHANGE_FEE_LOCK_RATE=0.0025
|
|
# live 매수 상한: floor(가용/(1+lock)) - N원 — N=최소 잔여 현금(수수료 lock 별도)
|
|
OPS_BUY_SAFETY_BUFFER_KRW=5000
|
|
OPS_ORDER_INTERVAL_SEC=0.35
|
|
OPS_SYNC_CANDLES=true
|
|
# 비우면 DOWNLOAD_INTERVALS 전체 증분 sync
|
|
# OPS_SYNC_INTERVALS=
|
|
OPS_SIGNAL_TAIL_BARS=800
|
|
# live 2층 방어: 최근 N봉(3분봉) 미체결 신호 재시도 (480=24시간)
|
|
OPS_CATCHUP_BARS=480
|
|
# trade_history 원장 기반 pending 스캔 lookback (일)
|
|
OPS_LEDGER_LOOKBACK_DAYS=1
|
|
# live API 체결 허용: 신호 시각 기준 N분 초과 backlog는 스킵 정산만
|
|
OPS_LEDGER_EXECUTE_MAX_AGE_MINUTES=45
|
|
# tick당 backlog 처리 상한 (재시작·누적 신호 폭주 방지)
|
|
OPS_MAX_BACKLOG_PER_TICK=20
|
|
# live tick마다 tail 신호 강제 재계산 (stale 캐시 방지)
|
|
OPS_LIVE_FORCE_TAIL_REFRESH=true
|
|
# last_tick_completed_at 갱신 없음 알림 (초, 0=비활성)
|
|
OPS_WATCHDOG_STALE_SEC=600
|
|
# tick 소요 시간 경고 (초)
|
|
OPS_TICK_WARN_SEC=120
|
|
# 운영 tick 로그 (append)
|
|
OPS_LOG_JSON=data/spot/operations/live_run.log
|
|
# live: 거래소 체결과 미정산 신호 대조 (재주문 방지)
|
|
OPS_EXCHANGE_RECONCILE=true
|
|
OPS_EXCHANGE_ORDER_LOOKBACK_HOURS=48
|
|
OPS_EXCHANGE_MATCH_WINDOW_MIN=720
|
|
# loop·watch tick 공유 lock (중복 체결 방지)
|
|
OPS_TICK_LOCK_PATH=data/spot/operations/ops.tick.lock
|
|
OPS_LOOP_PID_FILE=data/spot/operations/ops_loop.pid
|
|
# read-only 감시 (cron 5분): bash scripts/3_run_watch_cron.sh
|
|
OPS_WATCH_SIGNAL_GRACE_MIN=5
|
|
OPS_WATCH_TICK_STALE_MIN=12
|
|
OPS_WATCH_LOOKBACK_MIN=30
|
|
OPS_WATCH_AUTO_REMEDIATE=true
|
|
# vol_breakout(cron 1분) 사용 시 fractal loop 재시작 끄기
|
|
OPS_WATCH_AUTO_RESTART=false
|
|
# fractal loop 커스텀 기동 (OPS_WATCH_AUTO_RESTART=true 일 때)
|
|
# OPS_WATCH_LOOP_START_CMD=
|
|
# OPS_PERSIST_SIGNAL_CACHE=false
|
|
OPS_STATE_JSON=data/spot/operations/fractal_ops_state.json
|
|
OPS_REPORT_JSON=docs/spot/3_operations/fractal_ops_report.json
|
|
OPS_FILTERED_BACKTEST_JSON=docs/spot/3_operations/fractal_filtered_backtest_report.json
|
|
# 1_tune_order_sizing.py 학습 결과 (sim/live/backtest 공통)
|
|
OPS_SIZING_RULES_JSON=data/spot/operations/sizing_rules.json
|
|
# composite_v3 운영 시: OPS_TECHNIQUE_ID=composite_v3, OPS_MIN_SCORE=2.5, OPS_MTF_ENABLED=true
|
|
|
|
# --- vol_breakout 현물 롱 (Binance 15m ATR 이식, BTC 제외) ---
|
|
# fractal_swing(3분)과 별도 프로세스 — 동시 live 시 KRW 경합 주의
|
|
OPS_SYMBOLS=TRX,NEAR,WLD
|
|
VOL_STATE_JSON=data/spot/operations/vol_breakout_state.json
|
|
VOL_LOOKBACK=14
|
|
VOL_ATR_MULT=2.0
|
|
VOL_LOOKBACK_DAYS=60
|
|
# VOL_BUY_SPLIT=0: 미보유 슬롯 수로 동적 (3→1/3, 2→1/2, 1→100%)
|
|
VOL_BUY_SPLIT=0
|
|
VOL_WALLET_PCT=0.30
|
|
VOL_MAX_BARS_PER_TICK=5
|
|
# 순수 15m flip (trail/stop off). 청산은 하향 돌파(-1) flip만
|
|
VOL_EXIT_ENABLED=false
|
|
# trail/stop 사용 시 VOL_EXIT_ENABLED=true 및 아래 값
|
|
# VOL_TRAIL_ACTIVATE_PCT=1.5
|
|
# VOL_TRAIL_PCT=0.0025
|
|
# VOL_TRAIL_ATR_MULT=0.5
|
|
# VOL_STOP_PCT=-12.0
|
|
VOL_TICK_LOCK_PATH=data/spot/operations/vol.tick.lock
|
|
# touch data/spot/operations/vol.kill → 신규 매수 차단
|
|
# VOL_KILL_SWITCH_PATH=data/spot/operations/vol.kill
|
|
|
|
# 라이브 모니터 (Binance vol_live_monitor 유사, 기본 포트 8766)
|
|
VOL_MONITOR_JSON=docs/spot/3_operations/vol_live_chart.json
|
|
VOL_MONITOR_HTML=docs/spot/3_operations/vol_live_monitor.html
|
|
VOL_MONITOR_DAYS=14
|
|
|
|
# cron (vol_breakout): bash scripts/install_crontab.sh --apply
|
|
# BITHUMB_PYTHON=/Users/dsyoon/opt/anaconda3/envs/coin/bin/python3
|
|
|
|
# 폴더 구조: data|docs / {common, spot}
|
|
# common — coins.db 등 공유 리소스
|
|
# spot — 현물 GT·기법·분석·운영
|