Metadata-Version: 2.1
Name: pyqqq-script
Version: 0.0.1
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

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


## 사전 준비

먼저 PyQQQ 플랫폼에 회원가입 후 API Key를 발급받아야 합니다. 자세한 절차는 공식 가이드를 https://docs.pyqqq.net/getting_started/install.html 참고하세요.

발급받은 API Key는 환경 변수로 설정해 사용합니다.

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


## 설치

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


## Quick Start

아래는 PyQQQ Script의 기본 사용 흐름을 보여주는 간단한 예제입니다. `Strategy`를 상속받아 `next()`에서 매매 로직을 작성하고, `Backtest`로 실행한 뒤 결과를 출력하는 흐름입니다.

```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())
```

> 실제로 동작하는 전략들은 `examples/` 디렉터리를 참고하세요.

실행:

```bash
python examples/mean_reversion_rsi_bb.py
```

