Metadata-Version: 2.1
Name: pqr
Version: 1.0.0a0
Summary: Lightweight library for backtesting factor strategies
Home-page: https://pqr.readthedocs.io
License: MIT
Keywords: factor strategy,backtesting,finance
Author: Andrey Babkin
Author-email: andrey.babkin.ru71@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Dist: numpy (>=1.22.3,<2.0.0)
Requires-Dist: pandas (>=1.4.2,<2.0.0)
Project-URL: Repository, https://github.com/eura17/pqr
Description-Content-Type: text/markdown

# pqr

pqr is a python library for backtesting factor strategies. It is built in top of numpy, so it is 
fast and memory efficient, but provides pandas interface to make usage more convenient and verbose.

## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install pqr.

```bash
pip install pqr
```

## Quickstart

```python
import pandas as pd
import pqr

prices = pd.read_csv("prices.csv", parse_dates=True)

momentum = pqr.compose(
    # picking
    pqr.freeze(pqr.filter, universe=prices > 10),
    pqr.freeze(pqr.look_back, period=12, agg="pct"),
    pqr.freeze(pqr.lag, period=1),
    pqr.freeze(pqr.hold, period=12),
    pqr.freeze(pqr.quantiles, min_q=0.7, max_q=1),
    # allocation
    pqr.ew,
    # evaluation
    pqr.freeze(pqr.calculate, universe_returns=pqr.to_returns(prices)),
)

# returns series of returns of 30% ew momentum 12-1-12 strategy for stocks > 10$
momentum(prices)
```

## Documentation

The official documentation is hosted on readthedocs.org: https://pqr.readthedocs.io/en/latest/

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would 
like to change.

Please make sure to update tests and documentation as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)

