Skip to content

설정

ArBot의 모든 설정은 configs/ 디렉토리의 YAML 파일로 관리됩니다.

설정 파일 구조

configs/
├── default.yaml       # 기본 시스템 설정
├── exchanges.yaml     # 거래소별 설정 (수수료, Rate Limit, WebSocket)
└── strategies.yaml    # 전략 파라미터

default.yaml 상세 설명

system - 시스템 기본 설정

yaml
system:
  execution_mode: paper    # backtest | paper | live
  log_level: INFO          # DEBUG | INFO | WARNING | ERROR
  timezone: UTC
항목설명기본값
execution_mode실행 모드. backtest(백테스팅), paper(가상 매매), live(실전 매매)paper
log_level로그 레벨INFO
timezone시스템 타임존UTC

exchanges - 활성 거래소 목록

yaml
exchanges:
  enabled:
    - binance
    - okx
    - bybit
    - upbit
    - kucoin

연결할 거래소를 리스트로 지정합니다. 각 거래소의 상세 설정은 exchanges.yaml에서 관리됩니다.

symbols - 모니터링 대상 심볼

yaml
symbols:
  - BTC/USDT
  - ETH/USDT

차익거래 기회를 모니터링할 거래 쌍 목록입니다. CCXT 표준 심볼 형식(BASE/QUOTE)을 사용합니다.

detector - 차익거래 탐지 설정

Spatial Arbitrage (거래소 간 가격차 차익)

yaml
detector:
  spatial:
    enabled: true
    min_spread_pct: 0.25     # 최소 스프레드 (%)
    min_depth_usd: 1000      # 최소 유동성 ($)
    max_latency_ms: 500      # 최대 허용 레이턴시 (ms)
항목설명기본값
enabledSpatial 전략 활성화true
min_spread_pct수수료 차감 후 최소 스프레드. 이 값 이상이어야 시그널 발생0.25
min_depth_usd해당 가격대의 최소 오더북 유동성 (USD)1000
max_latency_ms데이터 수신 지연이 이 값을 초과하면 기회 무시500

Triangular Arbitrage (삼각 차익)

yaml
detector:
  triangular:
    enabled: true
    min_profit_pct: 0.15
    paths:
      - [BTC/USDT, ETH/BTC, ETH/USDT]
항목설명기본값
enabledTriangular 전략 활성화true
min_profit_pct최소 순이익률 (%)0.15
paths삼각 차익 경로 (3개 거래 쌍 조합)BTC-ETH

Statistical Arbitrage (통계적 차익)

yaml
detector:
  statistical:
    enabled: false             # Phase 2에서 활성화
    lookback_periods: 60       # Z-Score 계산 회고 기간
    entry_zscore: 2.0          # 진입 Z-Score 임계값
    exit_zscore: 0.5           # 청산 Z-Score 임계값
    p_value_threshold: 0.05    # 공적분 검정 p-value 임계값
항목설명기본값
enabledStatistical 전략 활성화false
lookback_periodsZ-Score 계산 시 사용할 과거 데이터 수60
entry_zscore이 Z-Score 이상이면 포지션 진입2.0
exit_zscore이 Z-Score 이하이면 포지션 청산0.5
p_value_thresholdEngle-Granger 공적분 검정의 유의 수준0.05

risk - 리스크 관리 설정

yaml
risk:
  max_position_per_coin_usd: 10000
  max_position_per_exchange_usd: 50000
  max_total_exposure_usd: 100000
  max_daily_loss_usd: 500
  max_daily_loss_pct: 1.0
  max_drawdown_pct: 5.0
  price_deviation_threshold_pct: 10.0
  max_spread_pct: 5.0
  consecutive_loss_limit: 10
  cooldown_minutes: 30
  flash_crash_pct: 10.0
  spread_std_threshold: 3.0
  stale_threshold_seconds: 30.0
  warning_threshold_pct: 70.0
항목설명기본값
max_position_per_coin_usd코인당 최대 포지션 (USD)10,000
max_position_per_exchange_usd거래소당 최대 포지션 (USD)50,000
max_total_exposure_usd전체 최대 노출 (USD)100,000
max_daily_loss_usd일일 최대 허용 손실 (USD)500
max_daily_loss_pct일일 최대 허용 손실률 (%)1.0
max_drawdown_pct최대 드로다운 (%)5.0
price_deviation_threshold_pct이상 가격 감지 임계값 (%)10.0
max_spread_pct비정상 스프레드 임계값 (%)5.0
consecutive_loss_limit연속 손실 횟수 제한 (초과 시 서킷 브레이커 작동)10
cooldown_minutes서킷 브레이커 작동 후 대기 시간 (분)30
flash_crash_pctFlash Crash 감지 임계값 (%)10.0
spread_std_threshold스프레드 표준편차 임계값3.0
stale_threshold_seconds데이터 유효성 만료 시간 (초)30.0
warning_threshold_pct리스크 한도 경고 임계값 (%)70.0

rebalancer - 리밸런싱 설정

yaml
rebalancer:
  check_interval_minutes: 60
  imbalance_threshold_pct: 30
  min_transfer_usd: 100
  target_allocation: {}
  preferred_networks:
    USDT: [TRC20, SOL, Arbitrum]
    BTC: [Lightning, Bitcoin]
항목설명기본값
check_interval_minutes잔고 체크 주기 (분)60
imbalance_threshold_pct편중도가 이 값을 초과하면 리밸런싱 트리거 (%)30
min_transfer_usd최소 전송 금액 (USD)100
target_allocation거래소별 목표 배분 비율. 비어있으면 균등 분배{}
preferred_networks자산별 선호 전송 네트워크 (속도/수수료 기준 정렬)USDT: TRC20, BTC: Lightning

alerts - 알림 설정

yaml
alerts:
  telegram:
    enabled: true
    chat_id: ""
    bot_token: ""
  discord:
    enabled: false
    bot_token: ""
    guild_id: 0
    channel_id: 0
  thresholds:
    opportunity_min_pct: 0.5
    daily_pnl_alert: true
    error_alert: true
항목설명기본값
telegram.enabledTelegram 알림 활성화true
telegram.chat_idTelegram 채팅 ID(환경 변수에서 설정)
telegram.bot_tokenTelegram 봇 토큰(환경 변수에서 설정)
discord.enabledDiscord 알림 활성화false
thresholds.opportunity_min_pct알림을 보낼 최소 기회 스프레드 (%)0.5
thresholds.daily_pnl_alert일일 PnL 요약 알림true
thresholds.error_alert에러 발생 시 알림true

database - 데이터베이스 설정

yaml
database:
  postgres:
    host: localhost
    port: 5432
    database: arbot
    user: arbot
    password: ""           # .env에서 로딩

  clickhouse:
    host: localhost
    port: 9000
    database: arbot

  redis:
    host: localhost
    port: 6379
    db: 0

TIP

데이터베이스 비밀번호는 보안을 위해 .env 파일의 환경 변수(POSTGRES_PASSWORD, REDIS_PASSWORD)를 통해 설정하는 것을 권장합니다.

exchanges.yaml 상세 설명

각 거래소의 수수료, Rate Limit, WebSocket 설정을 관리합니다.

거래소 설정 구조

yaml
exchanges:
  binance:
    tier: 1                          # 거래소 등급 (1: 핵심, 2: 보조)
    maker_fee_pct: 0.10              # Maker 수수료 (%)
    taker_fee_pct: 0.10              # Taker 수수료 (%)
    rate_limit:
      type: weight                   # Rate Limit 방식
      limit: 1200                    # 제한 값
      window: 60                     # 윈도우 (초)
    websocket:
      orderbook_depth: 10            # 오더북 수신 깊이
      reconnect_delay_s: 5           # 재연결 대기 시간 (초)
      max_reconnect_attempts: 10     # 최대 재연결 시도 횟수

거래소별 설정 요약

거래소TierMakerTakerRate Limit 방식제한
Binance10.10%0.10%weight1200/60s
OKX10.08%0.10%per_endpoint20/2s
Bybit10.10%0.10%count600/5s
Upbit20.25%0.25%count10/1s
KuCoin20.10%0.10%count30/3s
Bithumb20.25%0.25%count20/1s
Gate.io20.20%0.20%count300/10s
Bitget20.10%0.10%count20/1s

Rate Limit 방식

방식설명사용 거래소
weight엔드포인트별 가중치 합산. 전체 가중치가 제한 초과 시 차단Binance
per_endpoint엔드포인트별 독립 제한OKX
count단순 호출 횟수 제한Bybit, Upbit, KuCoin, Bithumb, Gate.io, Bitget

WebSocket 공통 설정

모든 거래소에 동일하게 적용되는 WebSocket 기본 설정:

항목설명기본값
orderbook_depth수신할 오더북 레벨 수 (bid/ask 각각)10
reconnect_delay_s연결 끊김 후 재연결 대기 시간 (초)5
max_reconnect_attempts최대 재연결 시도 횟수. 초과 시 에러 알림10

환경 변수 오버라이드

YAML 설정 값은 환경 변수로 오버라이드할 수 있습니다. .env 파일 또는 시스템 환경 변수를 통해 설정합니다.

주요 환경 변수

bash
# 마스터 암호화 키
ARBOT_MASTER_KEY=your-secure-key

# 거래소 API 키
BINANCE_API_KEY=your-key
BINANCE_API_SECRET=your-secret
OKX_API_KEY=your-key
OKX_API_SECRET=your-secret
OKX_PASSPHRASE=your-passphrase
BYBIT_API_KEY=your-key
BYBIT_API_SECRET=your-secret
UPBIT_API_KEY=your-key
UPBIT_API_SECRET=your-secret
KUCOIN_API_KEY=your-key
KUCOIN_API_SECRET=your-secret
KUCOIN_PASSPHRASE=your-passphrase

# 데이터베이스
POSTGRES_PASSWORD=your-db-password
REDIS_PASSWORD=your-redis-password

# 알림
TELEGRAM_BOT_TOKEN=your-bot-token
TELEGRAM_CHAT_ID=your-chat-id

WARNING

환경 변수는 YAML 설정보다 우선합니다. 프로덕션 환경에서는 민감한 정보(API 키, 비밀번호)를 반드시 환경 변수로 관리하세요.