Pine Script-style trading library built on top of pyqqq
Project description
PyQQQ Script
"우리는 누구나 자신의 투자 아이디어를 현실로 만들 수 있다고 믿습니다."
사전 준비
먼저 PyQQQ 플랫폼에 회원가입 후 API Key를 발급받아야 합니다. 자세한 절차는 공식 가이드를 https://docs.pyqqq.net/getting_started/install.html 참고하세요.
발급받은 API Key는 환경 변수로 설정해 사용합니다.
export PYQQQ_API_KEY="발급받은_API_KEY"
설치
pip install pyqqq-script
Quick Start
아래는 PyQQQ Script의 기본 사용 흐름을 보여주는 간단한 예제입니다. Strategy를 상속받아 next()에서 매매 로직을 작성하고, Backtest로 실행한 뒤 결과를 출력하는 흐름입니다.
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/디렉터리를 참고하세요.
실행:
python examples/mean_reversion_rsi_bb.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyqqq_script-0.0.1.tar.gz.
File metadata
- Download URL: pyqqq_script-0.0.1.tar.gz
- Upload date:
- Size: 36.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.7 Linux/6.12.68+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d7571981585024dded513d84160051dd1eda0678382b90b9d96ebf779600fc7
|
|
| MD5 |
5cbf2d623f92c053c3115eb2f90b72cb
|
|
| BLAKE2b-256 |
105ed5059af658279eb970525f9c443b3d122b6fa58884b9ff1f45201d7fed46
|
File details
Details for the file pyqqq_script-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pyqqq_script-0.0.1-py3-none-any.whl
- Upload date:
- Size: 53.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.7 Linux/6.12.68+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a057b282a358478a02c4feb46777d425f9b27da6b1ef350dc6ab0c044363e21e
|
|
| MD5 |
90b857cdaa2256d322bfb1a673b559cd
|
|
| BLAKE2b-256 |
403ea80695eb6343485ce0107068e7f3226f9d67264dcb9454baec49c8a97879
|