Metadata-Version: 2.1
Name: pyqqq-script
Version: 0.0.2
Summary: Pine Script-style trading library built on top of pyqqq
License: MIT
Author: PyQQQ team
Author-email: pyqqq.cs@gmail.com
Requires-Python: >=3.11,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: numpy (>=1.24)
Requires-Dist: pandas (>=2.0)
Requires-Dist: pymongo (>=4.6)
Requires-Dist: pyqqq (>=0.12.233)
Project-URL: Documentation, https://docs.pyqqq.net
Description-Content-Type: text/markdown


# PyQQQ Script

**"우리는 누구나 자신의 투자 아이디어를 현실로 만들 수 있다고 믿습니다."**


## 환경설정

### 1.1 설치

```bash
pip install pyqqq-script
```

### 1.2 API Key 발급

[PyQQQ](pyqqq.net)는 금융 데이터 분석과 자동화된 거래 전략을 제공하는 플랫폼입니다. 회원가입 후 API Key 를 발급받아 환경변수를 설정합니다. 보다 자세한 안내는 [공식 가이드](https://docs.pyqqq.net/getting_started/install.html) 문서를 참고하세요.

```bash
export PYQQQ_API_KEY="발급받은_API_KEY"
```

## Quick Start

몇 줄의 코드로 동작하는 백테스트 코드를 보여드리겠습니다.

```python
from pyqqq3 import Backtest, Strategy, ta
from pyqqq3.infra.presentation import print_result


class Simple(Strategy):

    def next(self):
        sma5 = ta.sma(self.close, 5)
        sma20 = ta.sma(self.close, 20)

        if sma5 > sma20 and self.position.size == 0:
            self.buy(amount=1_000_000)
        elif sma5 < sma20 and self.position.size > 0:
            self.sell()


bt = Backtest(strategy=Simple, symbol="005930", start="2026-04-01", end="2026-04-07")
print_result(bt.run())
```


