maiupbit 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
maiupbit-0.1.0/LICENSE ADDED
@@ -0,0 +1,191 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2024-2026 jini92
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: maiupbit
3
+ Version: 0.1.0
4
+ Summary: AI-powered digital asset analysis engine for Korean exchanges
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: crypto,trading,ai,upbit,analysis
8
+ Author: jini92
9
+ Requires-Python: >=3.10
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Financial and Insurance Industry
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Office/Business :: Financial :: Investment
18
+ Provides-Extra: all
19
+ Provides-Extra: dev
20
+ Provides-Extra: lstm
21
+ Provides-Extra: ml
22
+ Provides-Extra: transformer
23
+ Requires-Dist: beautifulsoup4 (>=4.12)
24
+ Requires-Dist: feedparser (>=6.0)
25
+ Requires-Dist: keras (>=3.0) ; extra == "lstm"
26
+ Requires-Dist: lxml (>=4.9)
27
+ Requires-Dist: maiupbit[dev,ml] ; extra == "all"
28
+ Requires-Dist: maiupbit[lstm,transformer] ; extra == "ml"
29
+ Requires-Dist: numpy (>=1.24)
30
+ Requires-Dist: openai (>=1.0)
31
+ Requires-Dist: pandas (>=2.0)
32
+ Requires-Dist: pandas-ta (>=0.3.14b1)
33
+ Requires-Dist: pytest (>=7.0) ; extra == "dev"
34
+ Requires-Dist: pytest-cov (>=4.0) ; extra == "dev"
35
+ Requires-Dist: pytest-mock (>=3.10) ; extra == "dev"
36
+ Requires-Dist: python-dotenv (>=1.0)
37
+ Requires-Dist: pyupbit (>=0.2.33)
38
+ Requires-Dist: reportlab (>=4.0)
39
+ Requires-Dist: ruff (>=0.1) ; extra == "dev"
40
+ Requires-Dist: scikit-learn (>=1.3)
41
+ Requires-Dist: tensorflow (>=2.15) ; extra == "lstm"
42
+ Requires-Dist: torch (>=2.0) ; extra == "transformer"
43
+ Project-URL: Documentation, https://github.com/jini92/M.AI.UPbit#readme
44
+ Project-URL: Homepage, https://github.com/jini92/M.AI.UPbit
45
+ Project-URL: Issues, https://github.com/jini92/M.AI.UPbit/issues
46
+ Project-URL: Repository, https://github.com/jini92/M.AI.UPbit
47
+ Description-Content-Type: text/markdown
48
+
49
+ # M.AI.UPbit
50
+
51
+ [![PyPI version](https://img.shields.io/pypi/v/maiupbit.svg)](https://pypi.org/project/maiupbit/)
52
+ [![Python](https://img.shields.io/pypi/pyversions/maiupbit.svg)](https://pypi.org/project/maiupbit/)
53
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
54
+ [![Tests](https://img.shields.io/badge/coverage-70%25%2B-brightgreen.svg)](tests/)
55
+
56
+ > **AI-powered cryptocurrency analysis engine for Korean exchanges**
57
+ >
58
+ > UPbit API 키 없이도 시세 조회·기술 지표·AI 분석을 즉시 사용할 수 있는 Python 패키지
59
+
60
+ ---
61
+
62
+ ## Features
63
+
64
+ | 기능 | 설명 |
65
+ |------|------|
66
+ | 📊 **기술 지표** | SMA, EMA, RSI, MACD, Bollinger Bands, Stochastic (pandas-ta 기반) |
67
+ | 🤖 **LSTM 예측** | TensorFlow/Keras 사전 학습 모델로 단기 가격 방향 예측 |
68
+ | 🧠 **GPT-4o 분석** | OpenAI API로 시장 상황 종합 분석 → buy / sell / hold 판단 |
69
+ | 📰 **뉴스 감성 분석** | Google RSS + BeautifulSoup으로 실시간 뉴스 감성 스코어링 |
70
+ | 🔁 **백테스팅** | 전략 성과를 과거 데이터로 시뮬레이션 |
71
+ | ⚡ **CLI** | `maiupbit analyze KRW-BTC` — 터미널에서 즉시 분석 |
72
+
73
+ > **인증 불필요:** 시세 조회·기술 분석·AI 분석은 UPbit API 키 없이 동작합니다.
74
+ > 포트폴리오 조회 및 매매 실행만 API 키가 필요합니다.
75
+
76
+ ---
77
+
78
+ ## Quick Start
79
+
80
+ ```bash
81
+ pip install maiupbit
82
+ ```
83
+
84
+ ```python
85
+ from maiupbit.exchange.upbit import UPbitExchange
86
+ from maiupbit.analysis.technical import TechnicalAnalyzer
87
+
88
+ exchange = UPbitExchange() # API 키 불필요
89
+ analyzer = TechnicalAnalyzer(exchange)
90
+ result = analyzer.analyze("KRW-BTC") # 기술 지표 + 매매 신호
91
+ print(result["recommendation"]) # → "buy" / "sell" / "hold"
92
+ ```
93
+
94
+ LSTM + GPT-4o 분석까지 원한다면:
95
+
96
+ ```python
97
+ from maiupbit.analysis.llm import LLMAnalyzer
98
+
99
+ llm = LLMAnalyzer() # OPENAI_API_KEY 환경 변수 필요
100
+ report = llm.analyze("KRW-BTC", result)
101
+ print(report["summary"])
102
+ ```
103
+
104
+ ---
105
+
106
+ ## CLI Usage
107
+
108
+ ```bash
109
+ # 코인 분석 (API 키 불필요)
110
+ maiupbit analyze KRW-BTC
111
+ maiupbit analyze KRW-ETH --days 60 --format json
112
+
113
+ # 포트폴리오 조회 (API 키 필요)
114
+ maiupbit portfolio
115
+ maiupbit portfolio --format json
116
+
117
+ # 매매 실행 (API 키 필요 + --confirm 필수)
118
+ maiupbit trade buy KRW-BTC 50000 # ⚠️ 미리보기만 출력
119
+ maiupbit trade buy KRW-BTC 50000 --confirm # ✅ 실제 매수 실행
120
+ maiupbit trade sell KRW-ETH 0.1 --confirm # ✅ 실제 매도 실행
121
+
122
+ # 종목 추천 (API 키 불필요)
123
+ maiupbit recommend --method performance --top 5 --format json
124
+ maiupbit recommend --method trend --top 3
125
+ ```
126
+
127
+ > **⚠️ 안전 규칙:** `trade` 커맨드는 `--confirm` 플래그 없이 절대 매매를 실행하지 않습니다.
128
+ > 미리보기를 확인한 뒤 명시적으로 `--confirm`을 추가하세요.
129
+
130
+ ---
131
+
132
+ ## OpenClaw / MAIBOT Integration
133
+
134
+ `scripts/` 는 MAIBOT(OpenClaw)이 `exec`로 직접 호출하는 래퍼 스크립트입니다.
135
+ 패키지 설치 없이 `python scripts/*.py` 형태로 바로 사용할 수 있습니다.
136
+
137
+ ```bash
138
+ # 비트코인 분석 (인증 불필요)
139
+ python scripts/analyze.py KRW-BTC
140
+
141
+ # 시장 모니터링 — 5개 코인 급등/급락/RSI 이상 감지 (인증 불필요)
142
+ python scripts/monitor.py
143
+
144
+ # 일일 리포트 생성 (인증 불필요, 포트폴리오는 키 필요)
145
+ python scripts/daily_report.py
146
+
147
+ # 포트폴리오 조회 (API 키 필요)
148
+ python scripts/portfolio.py
149
+
150
+ # 매매 미리보기 → 확인 후 실행 (API 키 필요)
151
+ python scripts/trade.py buy KRW-BTC 50000
152
+ python scripts/trade.py buy KRW-BTC 50000 --confirm
153
+
154
+ # LSTM 모델 학습 (GPU 권장)
155
+ python scripts/train_model.py KRW-BTC
156
+ ```
157
+
158
+ 전체 아키텍처:
159
+
160
+ ```
161
+ 👤 사용자
162
+ └─▶ 📱 MAIBOTALKS (앱)
163
+ └─▶ 🦞 MAIBOT (OpenClaw 에이전트)
164
+ └─▶ 📦 maiupbit (분석 엔진)
165
+ └─▶ 🏦 UPbit API
166
+ ```
167
+
168
+ MAIBOT은 분석 결과를 자연어로 해석해 MAIBOTALKS를 통해 사용자에게 전달합니다.
169
+ 별도 웹 서버나 UI 없이 MAI Universe 인프라를 그대로 활용합니다.
170
+
171
+ ---
172
+
173
+ ## Architecture
174
+
175
+ ```
176
+ M.AI.UPbit/
177
+ ├── maiupbit/ # PyPI 패키지 (핵심 엔진)
178
+ │ ├── exchange/
179
+ │ │ ├── base.py # 거래소 추상 인터페이스
180
+ │ │ └── upbit.py # UPbit API 래퍼 (pyupbit)
181
+ │ ├── indicators/
182
+ │ │ ├── trend.py # SMA, EMA, MACD
183
+ │ │ ├── momentum.py # RSI, Stochastic
184
+ │ │ ├── volatility.py # Bollinger Bands, ATR
185
+ │ │ └── signals.py # 복합 매매 신호
186
+ │ ├── analysis/
187
+ │ │ ├── technical.py # 기술적 분석 종합 + 추천
188
+ │ │ ├── llm.py # GPT-4o 시장 분석
189
+ │ │ └── sentiment.py # 뉴스 감성 분석
190
+ │ ├── models/
191
+ │ │ ├── lstm.py # LSTM 가격 예측 모델
192
+ │ │ └── ensemble.py # 앙상블 (LSTM + 기술 지표)
193
+ │ ├── backtest/
194
+ │ │ └── engine.py # 백테스팅 프레임워크
195
+ │ ├── utils/
196
+ │ │ ├── data.py # 데이터 전처리 유틸
197
+ │ │ └── report.py # PDF 리포트 생성 (reportlab)
198
+ │ └── cli.py # CLI 진입점 (maiupbit 커맨드)
199
+ ├── scripts/ # MAIBOT exec 래퍼
200
+ │ ├── analyze.py
201
+ │ ├── monitor.py
202
+ │ ├── daily_report.py
203
+ │ ├── portfolio.py
204
+ │ ├── trade.py
205
+ │ └── train_model.py
206
+ ├── models/ # 학습된 모델 파일 (.h5 / .keras)
207
+ ├── tests/
208
+ │ └── unit/
209
+ │ └── test_indicators.py
210
+ ├── docs/
211
+ │ └── PRD-v2.md
212
+ └── pyproject.toml
213
+ ```
214
+
215
+ ---
216
+
217
+ ## 환경 설정
218
+
219
+ `.env.example`을 복사해 `.env`를 생성하세요:
220
+
221
+ ```bash
222
+ cp .env.example .env
223
+ ```
224
+
225
+ ```env
226
+ # 시세 조회·분석에는 불필요 — 포트폴리오·매매에만 사용
227
+ UPBIT_ACCESS_KEY=your_upbit_access_key
228
+ UPBIT_SECRET_KEY=your_upbit_secret_key
229
+
230
+ # GPT-4o 분석에 필요
231
+ OPENAI_API_KEY=your_openai_api_key
232
+ ```
233
+
234
+ > `.env` 파일은 절대 git에 커밋하지 마세요.
235
+
236
+ ---
237
+
238
+ ## Contributing
239
+
240
+ 1. 이 저장소를 fork 합니다.
241
+ 2. feature 브랜치를 생성합니다: `git checkout -b feat/your-feature`
242
+ 3. 변경 후 테스트를 실행합니다:
243
+
244
+ ```bash
245
+ pip install -e ".[dev]"
246
+ pytest --cov=maiupbit tests/
247
+ ```
248
+
249
+ 4. PR을 생성합니다. 커버리지가 70% 미만이면 CI가 실패합니다.
250
+
251
+ 코드 스타일: `ruff check . && ruff format .`
252
+
253
+ ---
254
+
255
+ ## License
256
+
257
+ Apache License 2.0 — [LICENSE](LICENSE) 참고
258
+
259
+ ---
260
+
261
+ ## Links
262
+
263
+ - **GitHub**: https://github.com/jini92/M.AI.UPbit
264
+ - **Issues**: https://github.com/jini92/M.AI.UPbit/issues
265
+ - **PyPI**: https://pypi.org/project/maiupbit/
266
+ - **UPbit Open API**: https://docs.upbit.com/
267
+
268
+ ---
269
+
270
+ *Powered by [MAIBOT](https://github.com/jini92) · Part of the MAI Universe ecosystem*
271
+
@@ -0,0 +1,222 @@
1
+ # M.AI.UPbit
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/maiupbit.svg)](https://pypi.org/project/maiupbit/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/maiupbit.svg)](https://pypi.org/project/maiupbit/)
5
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
6
+ [![Tests](https://img.shields.io/badge/coverage-70%25%2B-brightgreen.svg)](tests/)
7
+
8
+ > **AI-powered cryptocurrency analysis engine for Korean exchanges**
9
+ >
10
+ > UPbit API 키 없이도 시세 조회·기술 지표·AI 분석을 즉시 사용할 수 있는 Python 패키지
11
+
12
+ ---
13
+
14
+ ## Features
15
+
16
+ | 기능 | 설명 |
17
+ |------|------|
18
+ | 📊 **기술 지표** | SMA, EMA, RSI, MACD, Bollinger Bands, Stochastic (pandas-ta 기반) |
19
+ | 🤖 **LSTM 예측** | TensorFlow/Keras 사전 학습 모델로 단기 가격 방향 예측 |
20
+ | 🧠 **GPT-4o 분석** | OpenAI API로 시장 상황 종합 분석 → buy / sell / hold 판단 |
21
+ | 📰 **뉴스 감성 분석** | Google RSS + BeautifulSoup으로 실시간 뉴스 감성 스코어링 |
22
+ | 🔁 **백테스팅** | 전략 성과를 과거 데이터로 시뮬레이션 |
23
+ | ⚡ **CLI** | `maiupbit analyze KRW-BTC` — 터미널에서 즉시 분석 |
24
+
25
+ > **인증 불필요:** 시세 조회·기술 분석·AI 분석은 UPbit API 키 없이 동작합니다.
26
+ > 포트폴리오 조회 및 매매 실행만 API 키가 필요합니다.
27
+
28
+ ---
29
+
30
+ ## Quick Start
31
+
32
+ ```bash
33
+ pip install maiupbit
34
+ ```
35
+
36
+ ```python
37
+ from maiupbit.exchange.upbit import UPbitExchange
38
+ from maiupbit.analysis.technical import TechnicalAnalyzer
39
+
40
+ exchange = UPbitExchange() # API 키 불필요
41
+ analyzer = TechnicalAnalyzer(exchange)
42
+ result = analyzer.analyze("KRW-BTC") # 기술 지표 + 매매 신호
43
+ print(result["recommendation"]) # → "buy" / "sell" / "hold"
44
+ ```
45
+
46
+ LSTM + GPT-4o 분석까지 원한다면:
47
+
48
+ ```python
49
+ from maiupbit.analysis.llm import LLMAnalyzer
50
+
51
+ llm = LLMAnalyzer() # OPENAI_API_KEY 환경 변수 필요
52
+ report = llm.analyze("KRW-BTC", result)
53
+ print(report["summary"])
54
+ ```
55
+
56
+ ---
57
+
58
+ ## CLI Usage
59
+
60
+ ```bash
61
+ # 코인 분석 (API 키 불필요)
62
+ maiupbit analyze KRW-BTC
63
+ maiupbit analyze KRW-ETH --days 60 --format json
64
+
65
+ # 포트폴리오 조회 (API 키 필요)
66
+ maiupbit portfolio
67
+ maiupbit portfolio --format json
68
+
69
+ # 매매 실행 (API 키 필요 + --confirm 필수)
70
+ maiupbit trade buy KRW-BTC 50000 # ⚠️ 미리보기만 출력
71
+ maiupbit trade buy KRW-BTC 50000 --confirm # ✅ 실제 매수 실행
72
+ maiupbit trade sell KRW-ETH 0.1 --confirm # ✅ 실제 매도 실행
73
+
74
+ # 종목 추천 (API 키 불필요)
75
+ maiupbit recommend --method performance --top 5 --format json
76
+ maiupbit recommend --method trend --top 3
77
+ ```
78
+
79
+ > **⚠️ 안전 규칙:** `trade` 커맨드는 `--confirm` 플래그 없이 절대 매매를 실행하지 않습니다.
80
+ > 미리보기를 확인한 뒤 명시적으로 `--confirm`을 추가하세요.
81
+
82
+ ---
83
+
84
+ ## OpenClaw / MAIBOT Integration
85
+
86
+ `scripts/` 는 MAIBOT(OpenClaw)이 `exec`로 직접 호출하는 래퍼 스크립트입니다.
87
+ 패키지 설치 없이 `python scripts/*.py` 형태로 바로 사용할 수 있습니다.
88
+
89
+ ```bash
90
+ # 비트코인 분석 (인증 불필요)
91
+ python scripts/analyze.py KRW-BTC
92
+
93
+ # 시장 모니터링 — 5개 코인 급등/급락/RSI 이상 감지 (인증 불필요)
94
+ python scripts/monitor.py
95
+
96
+ # 일일 리포트 생성 (인증 불필요, 포트폴리오는 키 필요)
97
+ python scripts/daily_report.py
98
+
99
+ # 포트폴리오 조회 (API 키 필요)
100
+ python scripts/portfolio.py
101
+
102
+ # 매매 미리보기 → 확인 후 실행 (API 키 필요)
103
+ python scripts/trade.py buy KRW-BTC 50000
104
+ python scripts/trade.py buy KRW-BTC 50000 --confirm
105
+
106
+ # LSTM 모델 학습 (GPU 권장)
107
+ python scripts/train_model.py KRW-BTC
108
+ ```
109
+
110
+ 전체 아키텍처:
111
+
112
+ ```
113
+ 👤 사용자
114
+ └─▶ 📱 MAIBOTALKS (앱)
115
+ └─▶ 🦞 MAIBOT (OpenClaw 에이전트)
116
+ └─▶ 📦 maiupbit (분석 엔진)
117
+ └─▶ 🏦 UPbit API
118
+ ```
119
+
120
+ MAIBOT은 분석 결과를 자연어로 해석해 MAIBOTALKS를 통해 사용자에게 전달합니다.
121
+ 별도 웹 서버나 UI 없이 MAI Universe 인프라를 그대로 활용합니다.
122
+
123
+ ---
124
+
125
+ ## Architecture
126
+
127
+ ```
128
+ M.AI.UPbit/
129
+ ├── maiupbit/ # PyPI 패키지 (핵심 엔진)
130
+ │ ├── exchange/
131
+ │ │ ├── base.py # 거래소 추상 인터페이스
132
+ │ │ └── upbit.py # UPbit API 래퍼 (pyupbit)
133
+ │ ├── indicators/
134
+ │ │ ├── trend.py # SMA, EMA, MACD
135
+ │ │ ├── momentum.py # RSI, Stochastic
136
+ │ │ ├── volatility.py # Bollinger Bands, ATR
137
+ │ │ └── signals.py # 복합 매매 신호
138
+ │ ├── analysis/
139
+ │ │ ├── technical.py # 기술적 분석 종합 + 추천
140
+ │ │ ├── llm.py # GPT-4o 시장 분석
141
+ │ │ └── sentiment.py # 뉴스 감성 분석
142
+ │ ├── models/
143
+ │ │ ├── lstm.py # LSTM 가격 예측 모델
144
+ │ │ └── ensemble.py # 앙상블 (LSTM + 기술 지표)
145
+ │ ├── backtest/
146
+ │ │ └── engine.py # 백테스팅 프레임워크
147
+ │ ├── utils/
148
+ │ │ ├── data.py # 데이터 전처리 유틸
149
+ │ │ └── report.py # PDF 리포트 생성 (reportlab)
150
+ │ └── cli.py # CLI 진입점 (maiupbit 커맨드)
151
+ ├── scripts/ # MAIBOT exec 래퍼
152
+ │ ├── analyze.py
153
+ │ ├── monitor.py
154
+ │ ├── daily_report.py
155
+ │ ├── portfolio.py
156
+ │ ├── trade.py
157
+ │ └── train_model.py
158
+ ├── models/ # 학습된 모델 파일 (.h5 / .keras)
159
+ ├── tests/
160
+ │ └── unit/
161
+ │ └── test_indicators.py
162
+ ├── docs/
163
+ │ └── PRD-v2.md
164
+ └── pyproject.toml
165
+ ```
166
+
167
+ ---
168
+
169
+ ## 환경 설정
170
+
171
+ `.env.example`을 복사해 `.env`를 생성하세요:
172
+
173
+ ```bash
174
+ cp .env.example .env
175
+ ```
176
+
177
+ ```env
178
+ # 시세 조회·분석에는 불필요 — 포트폴리오·매매에만 사용
179
+ UPBIT_ACCESS_KEY=your_upbit_access_key
180
+ UPBIT_SECRET_KEY=your_upbit_secret_key
181
+
182
+ # GPT-4o 분석에 필요
183
+ OPENAI_API_KEY=your_openai_api_key
184
+ ```
185
+
186
+ > `.env` 파일은 절대 git에 커밋하지 마세요.
187
+
188
+ ---
189
+
190
+ ## Contributing
191
+
192
+ 1. 이 저장소를 fork 합니다.
193
+ 2. feature 브랜치를 생성합니다: `git checkout -b feat/your-feature`
194
+ 3. 변경 후 테스트를 실행합니다:
195
+
196
+ ```bash
197
+ pip install -e ".[dev]"
198
+ pytest --cov=maiupbit tests/
199
+ ```
200
+
201
+ 4. PR을 생성합니다. 커버리지가 70% 미만이면 CI가 실패합니다.
202
+
203
+ 코드 스타일: `ruff check . && ruff format .`
204
+
205
+ ---
206
+
207
+ ## License
208
+
209
+ Apache License 2.0 — [LICENSE](LICENSE) 참고
210
+
211
+ ---
212
+
213
+ ## Links
214
+
215
+ - **GitHub**: https://github.com/jini92/M.AI.UPbit
216
+ - **Issues**: https://github.com/jini92/M.AI.UPbit/issues
217
+ - **PyPI**: https://pypi.org/project/maiupbit/
218
+ - **UPbit Open API**: https://docs.upbit.com/
219
+
220
+ ---
221
+
222
+ *Powered by [MAIBOT](https://github.com/jini92) · Part of the MAI Universe ecosystem*
@@ -0,0 +1,3 @@
1
+ """M.AI.UPbit — AI 디지털 자산 분석 엔진"""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ """python -m maiupbit 실행 지원"""
2
+ from maiupbit.cli import main
3
+
4
+ if __name__ == "__main__":
5
+ main()