Metadata-Version: 2.4
Name: firefin
Version: 0.2.2
Summary: The bundled opensource toolkit for book Navigate through the Factor Zoo: The Science of Factor Investing.
Author-email: Renjie Liao <auderson@qq.com>, Baochen Qiao <baochenqiao@gmail.com>
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE.txt
Requires-Dist: click>=8.1.3
Requires-Dist: pandas>=2.2.1
Requires-Dist: matplotlib>=3.8.3
Requires-Dist: seaborn>=0.13.2
Requires-Dist: statsmodels>=0.14.1
Requires-Dist: scipy>=1.12.0
Requires-Dist: numba>=0.59.0
Requires-Dist: loguru>=0.7.2
Requires-Dist: tqdm>=4.66.4
Requires-Dist: joblib>=1.4.2
Dynamic: license-file

# F.I.R.E. Factor Investment Research Engine

This repo is the bundled opensource toolkit for book _Navigating the Factor Zoo：The Science of Quantitative Investing_.

## Installation

```bash
# for stable version
pip install firefin

# for test and nightly version
pip install -i https://test.pypi.org/simple/ firefin

# Install from source for loacl testing!!!
## replace $ThisRepoURL with the actual repo url
git clone $ThisRepoURL 
## install from source
pip install -e .
```

## Usage

Download the data 
from [here](https://github.com/fire-institute/fire/releases/download/marketdata/AStockData.tar.gz)

run the command and download data put in correct path automatically.

```bash
# We have not released this repo yet, so you need download the data manually!!! See command below!!!
# Auto download data
firefin download
```

If you have already downloaded the data from [here](https://github.com/fire-institute/fire/releases/download/marketdata/AStockData.tar.gz), you can run the command to check the data and put the data in the correct path

```bash
# replace path_to_data.tar.gz with the actual path
firefin load path_to_data.tar.gz
```

## Start to code

```python
import firefin

# get data
data = firefin.fetch_data(["open", "close", "volume"])
open_price = data["open"]


def pv_corr(close, volume):
    # price volume correlation
    return close.rolling(20).corr(volume)


factor = pv_corr(data["close"], data["volume"])

# compute forward returns
fr = firefin.compute_forward_returns(open_price.shift(-1), [1, 5, 10])

# evaluate factor
mng = firefin.Evaluator(factor, fr)
mng.get_ic("pearson")
mng.get_quantile_returns(5)

```

## Features

1. handy functions for fast factor computation
2. various tools for factor evaluation


