| name | upbit |
| description | Upbit 암호화폐 거래소 CLI. TRIGGER when: 암호화폐 시세 조회, 코인 거래, "upbit", "코인 가격", "호가", "비트코인 시세", 잔고 확인, BTC/ETH/XRP 등 코인 매수/매도, 캔들 데이터 조회, 실시간 시세 확인 요청이 있을 때. DO NOT TRIGGER when: 일반 금융/주식 거래, 해외 거래소(Binance, Coinbase 등), 블록체인 개발, 스마트 컨트랙트. |
upbit — Upbit 암호화폐 거래소 CLI
설치 확인
which upbit || echo "설치 필요"
upbit --version 2>/dev/null || echo "버전 확인 불가"
설치가 안 되어 있으면:
curl -sSL https://kyungw00k.dev/upbit/install.sh | sh
brew install kyungw00k/cli/upbit
인증 설정
시세 조회 명령어는 인증 없이 사용할 수 있습니다.
거래, 잔고 조회, 입출금, 실시간 개인 스트림은 인증이 필요합니다.
export UPBIT_ACCESS_KEY=your_access_key
export UPBIT_SECRET_KEY=your_secret_key
API 키는 환경변수에서만 읽으며 디스크에 저장되지 않습니다.
Upbit API 키는 Upbit 개발자 센터에서 발급받을 수 있습니다.
인증 필요 여부 요약
| 카테고리 | 인증 필요 여부 |
|---|
시세 (ticker, candle, orderbook, trades, market) | 불필요 |
거래 (buy, sell, balance, order) | 필요 |
입출금 (wallet, deposit, withdraw) | 필요 |
실시간 공개 (watch ticker/orderbook/trade/candle) | 불필요 |
실시간 개인 (watch my-order, watch my-asset) | 필요 |
핵심 명령어
시세 조회 (인증 불필요)
upbit ticker KRW-BTC
upbit ticker KRW-BTC KRW-ETH KRW-XRP
upbit candle KRW-BTC
upbit candle KRW-BTC -i 1d --from 2025-01-01
upbit candle KRW-BTC -i 1m
upbit orderbook KRW-BTC
upbit trades KRW-BTC
upbit market
upbit tick-size KRW-BTC
거래 (인증 필요)
upbit balance
upbit buy KRW-BTC -p 100000000 -V 0.001
upbit buy KRW-BTC -p now -V 0.001
upbit buy KRW-BTC -p now -V 50%
upbit sell KRW-BTC -V 100%
upbit sell KRW-BTC -V 50%
upbit sell KRW-BTC -p 120000000 -V 0.001
주문 관리 (인증 필요)
upbit order list
upbit order show <uuid>
upbit order cancel <uuid>
upbit order replace <uuid> -p 110000000
입출금 (인증 필요)
upbit wallet
upbit deposit list
upbit deposit show <uuid>
upbit deposit address BTC
upbit withdraw list
upbit withdraw show <uuid>
upbit withdraw request BTC --amount 0.01 --address <address>
실시간 TUI
upbit watch ticker KRW-BTC
upbit watch ticker KRW-BTC KRW-ETH KRW-XRP
upbit watch orderbook KRW-BTC
upbit watch trade KRW-BTC
upbit watch candle KRW-BTC -i 1m
upbit watch my-order
upbit watch my-asset
유틸리티
upbit tool-schema
upbit tool-schema buy
upbit cache
upbit cache --clear
upbit update
upbit update --check
시나리오별 사용법
1. 특정 코인의 현재가를 알고 싶을 때
upbit ticker KRW-BTC
upbit ticker KRW-BTC KRW-ETH KRW-XRP
upbit ticker KRW-BTC | jq '.[] | {market, trade_price, change_rate}'
출력 예시:
MARKET PRICE CHANGE CHANGE_RATE VOLUME
KRW-BTC 142,000,000 ▲ +1.23% 1234.5678
2. 비트코인을 시장가로 매수할 때
upbit buy KRW-BTC -p now -t 100000
upbit buy KRW-BTC -p now -V 100%
upbit buy KRW-BTC -p now -V 30%
-p now — 현재 시장가 사용 (내부적으로 최유리 지정가 주문)
-V — 코인 수량 (절대값 또는 잔고 퍼센트)
-t — KRW 금액 기준 주문
3. 잔고를 확인할 때
upbit balance
upbit balance | jq '.[] | {currency, balance, avg_buy_price}'
출력 예시:
CURRENCY BALANCE AVG_BUY_PRICE CURRENT_PRICE P&L
KRW 500,000 - - -
BTC 0.00100000 142,000,000 145,000,000 +2.11%
4. 호가창을 실시간으로 볼 때 (TUI)
upbit watch orderbook KRW-BTC
q 또는 Ctrl+C로 종료
- 매수(초록) / 매도(빨강) 호가가 스프레드 중심으로 표시됨
호가 스냅샷만 필요한 경우:
upbit orderbook KRW-BTC
upbit orderbook KRW-BTC | jq '.[] | .orderbook_units[:5]'
5. 캔들 데이터를 JSON으로 추출할 때
upbit candle KRW-BTC --from 2025-01-01 | jq .
upbit candle KRW-BTC -i 1m | jq .
upbit candle KRW-BTC -i 1d --from 2025-01-01 -o csv > btc_daily.csv
upbit candle KRW-BTC | jq '.[] | {timestamp: .candle_date_time_kst, open: .opening_price, close: .trade_price}'
캔들 인터벌 옵션 (-i):
- 분봉:
1m, 3m, 5m, 10m, 15m, 30m
- 시봉:
1h, 4h
- 일봉:
1d (기본값)
- 주봉:
1w
- 월봉:
1M
캐시 관련:
upbit candle KRW-BTC --from 2025-01-01 --no-cache
upbit cache
upbit cache --clear
6. 퍼센트 기반 주문 (전체 잔고의 50% 매수)
upbit buy KRW-ETH -p now -V 50%
upbit sell KRW-BTC -V 30%
upbit sell KRW-BTC -V 100%
가격 키워드 (-p 옵션):
| 키워드 | 의미 |
|---|
now | 현재 시장가 (최유리 지정가) |
open | 당일 시가 |
low | 당일 저가 |
high | 당일 고가 |
| 숫자 | 지정가 (KRW) |
7. 지정가 주문
upbit buy KRW-BTC -p 150000000 -V 0.001
upbit buy KRW-BTC -p 130000000 -V 0.001 --watch
출력 형식
auto 모드 동작
| 실행 환경 | 출력 형식 |
|---|
| 터미널 직접 실행 | table (사람이 읽기 좋은 형식) |
| 파이프로 연결 | json (compact) |
출력 형식 강제 지정:
upbit ticker KRW-BTC
upbit ticker KRW-BTC | jq .
upbit ticker KRW-BTC -o csv
upbit ticker KRW-BTC -o jsonl
upbit ticker KRW-BTC -o json
upbit ticker KRW-BTC -o table
필드 선택:
upbit ticker KRW-BTC --json price
주요 JSON 필드 (ticker)
| 필드 | 설명 |
|---|
market | 마켓 코드 (예: KRW-BTC) |
trade_price | 현재가 |
opening_price | 당일 시가 |
high_price | 당일 고가 |
low_price | 당일 저가 |
acc_trade_volume_24h | 24시간 거래량 |
signed_change_rate | 전일 대비 변동률 |
change | 변동 방향 (RISE/FALL/EVEN) |
주의사항
- 호가 단위 자동 보정: 주문 가격은 Upbit 호가 단위에 맞게 자동 반올림됩니다.
upbit tick-size KRW-BTC로 단위 확인 가능.
- 퍼센트 주문 계산:
-V 50%는 현재 잔고 기준. 수수료(0.05%)를 고려한 실제 체결 금액은 약간 다를 수 있습니다.
- 실시간 TUI 종료:
q, Esc, 또는 Ctrl+C로 종료.
- 복수 마켓 TUI:
watch ticker 등에서 여러 마켓 지정 시 Tab 또는 ←/→ 키로 전환.
- 캔들 캐시: SQLite 캐시 사용. 경로는
$XDG_CACHE_HOME/upbit/ 또는 ~/.cache/upbit/. --no-cache 플래그로 비활성화.
- 인증 없이 거래 명령어 실행 시: 환경변수 미설정 시 에러 반환.
echo $UPBIT_ACCESS_KEY로 설정 확인.
- API Rate Limit: Upbit REST API 분당 제한이 있음. 대량 조회 시 에러 발생 가능.
- Non-TTY 환경: 파이프/CI 환경에서는 자동으로 JSON 출력. AI 에이전트 파이프라인에 최적화됨.