Skip to main content

M.AI.UPbit

PyPI version Python License Tests

AI-powered cryptocurrency analysis engine for Korean exchanges

UPbit API 키 없이도 시세 조회·기술 지표·AI 분석을 즉시 사용할 수 있는 Python 패키지


Features

기능 설명
📊 기술 지표 SMA, EMA, RSI, MACD, Bollinger Bands, Stochastic (pandas-ta 기반)
🤖 LSTM 예측 TensorFlow/Keras 사전 학습 모델로 단기 가격 방향 예측
🧠 GPT-4o 분석 OpenAI API로 시장 상황 종합 분석 → buy / sell / hold 판단
📰 뉴스 감성 분석 Google RSS + BeautifulSoup으로 실시간 뉴스 감성 스코어링
🔁 백테스팅 전략 성과를 과거 데이터로 시뮬레이션
⚡ CLI maiupbit analyze KRW-BTC — 터미널에서 즉시 분석

인증 불필요: 시세 조회·기술 분석·AI 분석은 UPbit API 키 없이 동작합니다. 포트폴리오 조회 및 매매 실행만 API 키가 필요합니다.


Quick Start

pip install maiupbit
from maiupbit.exchange.upbit import UPbitExchange
from maiupbit.analysis.technical import TechnicalAnalyzer

exchange = UPbitExchange()                     # API 키 불필요
analyzer = TechnicalAnalyzer(exchange)
result   = analyzer.analyze("KRW-BTC")        # 기술 지표 + 매매 신호
print(result["recommendation"])               # → "buy" / "sell" / "hold"

LSTM + GPT-4o 분석까지 원한다면:

from maiupbit.analysis.llm import LLMAnalyzer

llm = LLMAnalyzer()                            # OPENAI_API_KEY 환경 변수 필요
report = llm.analyze("KRW-BTC", result)
print(report["summary"])

CLI Usage

# 코인 분석 (API 키 불필요)
maiupbit analyze KRW-BTC
maiupbit analyze KRW-ETH --days 60 --format json

# 포트폴리오 조회 (API 키 필요)
maiupbit portfolio
maiupbit portfolio --format json

# 매매 실행 (API 키 필요 + --confirm 필수)
maiupbit trade buy  KRW-BTC 50000             # ⚠️ 미리보기만 출력
maiupbit trade buy  KRW-BTC 50000 --confirm   # ✅ 실제 매수 실행
maiupbit trade sell KRW-ETH 0.1   --confirm   # ✅ 실제 매도 실행

# 종목 추천 (API 키 불필요)
maiupbit recommend --method performance --top 5 --format json
maiupbit recommend --method trend --top 3

⚠️ 안전 규칙: trade 커맨드는 --confirm 플래그 없이 절대 매매를 실행하지 않습니다. 미리보기를 확인한 뒤 명시적으로 --confirm을 추가하세요.


OpenClaw / MAIBOT Integration

scripts/ 는 MAIBOT(OpenClaw)이 exec로 직접 호출하는 래퍼 스크립트입니다. 패키지 설치 없이 python scripts/*.py 형태로 바로 사용할 수 있습니다.

# 비트코인 분석 (인증 불필요)
python scripts/analyze.py KRW-BTC

# 시장 모니터링 — 5개 코인 급등/급락/RSI 이상 감지 (인증 불필요)
python scripts/monitor.py

# 일일 리포트 생성 (인증 불필요, 포트폴리오는 키 필요)
python scripts/daily_report.py

# 포트폴리오 조회 (API 키 필요)
python scripts/portfolio.py

# 매매 미리보기 → 확인 후 실행 (API 키 필요)
python scripts/trade.py buy KRW-BTC 50000
python scripts/trade.py buy KRW-BTC 50000 --confirm

# LSTM 모델 학습 (GPU 권장)
python scripts/train_model.py KRW-BTC

전체 아키텍처:

👤 사용자
  └─▶ 📱 MAIBOTALKS (앱)
        └─▶ 🦞 MAIBOT (OpenClaw 에이전트)
              └─▶ 📦 maiupbit (분석 엔진)
                    └─▶ 🏦 UPbit API

MAIBOT은 분석 결과를 자연어로 해석해 MAIBOTALKS를 통해 사용자에게 전달합니다. 별도 웹 서버나 UI 없이 MAI Universe 인프라를 그대로 활용합니다.


Architecture

M.AI.UPbit/
├── maiupbit/                  # PyPI 패키지 (핵심 엔진)
│   ├── exchange/
│   │   ├── base.py            # 거래소 추상 인터페이스
│   │   └── upbit.py           # UPbit API 래퍼 (pyupbit)
│   ├── indicators/
│   │   ├── trend.py           # SMA, EMA, MACD
│   │   ├── momentum.py        # RSI, Stochastic
│   │   ├── volatility.py      # Bollinger Bands, ATR
│   │   └── signals.py         # 복합 매매 신호
│   ├── analysis/
│   │   ├── technical.py       # 기술적 분석 종합 + 추천
│   │   ├── llm.py             # GPT-4o 시장 분석
│   │   └── sentiment.py       # 뉴스 감성 분석
│   ├── models/
│   │   ├── lstm.py            # LSTM 가격 예측 모델
│   │   └── ensemble.py        # 앙상블 (LSTM + 기술 지표)
│   ├── backtest/
│   │   └── engine.py          # 백테스팅 프레임워크
│   ├── utils/
│   │   ├── data.py            # 데이터 전처리 유틸
│   │   └── report.py          # PDF 리포트 생성 (reportlab)
│   └── cli.py                 # CLI 진입점 (maiupbit 커맨드)
├── scripts/                   # MAIBOT exec 래퍼
│   ├── analyze.py
│   ├── monitor.py
│   ├── daily_report.py
│   ├── portfolio.py
│   ├── trade.py
│   └── train_model.py
├── models/                    # 학습된 모델 파일 (.h5 / .keras)
├── tests/
│   └── unit/
│       └── test_indicators.py
├── docs/
│   └── PRD-v2.md
└── pyproject.toml

환경 설정

.env.example을 복사해 .env를 생성하세요:

cp .env.example .env
# 시세 조회·분석에는 불필요 — 포트폴리오·매매에만 사용
UPBIT_ACCESS_KEY=your_upbit_access_key
UPBIT_SECRET_KEY=your_upbit_secret_key

# GPT-4o 분석에 필요
OPENAI_API_KEY=your_openai_api_key

.env 파일은 절대 git에 커밋하지 마세요.


Contributing

  1. 이 저장소를 fork 합니다.
  2. feature 브랜치를 생성합니다: git checkout -b feat/your-feature
  3. 변경 후 테스트를 실행합니다:
pip install -e ".[dev]"
pytest --cov=maiupbit tests/
  1. PR을 생성합니다. 커버리지가 70% 미만이면 CI가 실패합니다.

코드 스타일: ruff check . && ruff format .


License

Apache License 2.0 — LICENSE 참고



Powered by MAIBOT · Part of the MAI Universe ecosystem

Metadata

Release files for maiupbit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maiupbit 0.1.0
File Size Uploaded
maiupbit-0.1.0.tar.gz 34.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for maiupbit 0.1.0
File Interpreter ABI Platform
maiupbit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 82.4 kB

Release files / maiupbit-0.1.0.tar.gz

Download URL maiupbit-0.1.0.tar.gz
Size 34.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f152f5c0e8aee03113ff205379896f50c945037af8bf5b14db4dfe3c9ac6ea5c
BLAKE2b-256 checksum
How to use checksums
efe41718c17999428e68a5416d57ad6e913971c229032d3aed2d60c4161800b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / maiupbit-0.1.0-py3-none-any.whl

Download URL maiupbit-0.1.0-py3-none-any.whl
Size 47.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a93e23bca82f1952709e8da69e361239ab111c14ea933cbfbc58d113f199d907
BLAKE2b-256 checksum
How to use checksums
abe661c1710130d78184b1a941f4324944f227f559520c6fa03dd7e710c32757
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page