Skip to main content

AI-powered digital asset analysis engine for Korean exchanges

Project description

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 참고


Links


Powered by MAIBOT · Part of the MAI Universe ecosystem

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maiupbit-0.1.0.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maiupbit-0.1.0-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

File details

Details for the file maiupbit-0.1.0.tar.gz.

File metadata

  • Download URL: maiupbit-0.1.0.tar.gz
  • Upload date:
  • Size: 34.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for maiupbit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f152f5c0e8aee03113ff205379896f50c945037af8bf5b14db4dfe3c9ac6ea5c
MD5 3d7493c59581a980e9d4be205d30ad2e
BLAKE2b-256 efe41718c17999428e68a5416d57ad6e913971c229032d3aed2d60c4161800b9

See more details on using hashes here.

File details

Details for the file maiupbit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: maiupbit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 47.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for maiupbit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a93e23bca82f1952709e8da69e361239ab111c14ea933cbfbc58d113f199d907
MD5 caa674ef2c12ae330c5213add3bc56d5
BLAKE2b-256 abe661c1710130d78184b1a941f4324944f227f559520c6fa03dd7e710c32757

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page