None
Project description
torchquantum
TorchQuantum is a backtesting framework that integrates the structure of PyTorch and WorldQuant's Operator for efficient quantitative financial analysis.
Contents
Installation
for Unix:
cd /path/to/your/directory
git clone git@github.com:nymath/torchquantum.git
cd ./torchquantum
Before running examples, you should compile the cython code.
python setup.py build_ext --inplace
Now you can run examples
python ./examples/main.py
If you are not downloading the dataset, then you should
cd ./examples
mkdir largedata
cd ./largedata
wget https://github.com/nymath/torchquantum/releases/download/V0.1/Stocks.pkl.zip
unzip Stocks.pkl.zip
rm Stocks.pkl.zip
cd ../
cd ../
Example
You can easily create an alpha through torchquantum!
import torchqtm.op as op
import torchqtm.op.functional as F
class NeutralizePE(op.Fundamental):
def __init__(self, env):
super().__init__(env)
self.lag = op.Parameter(5, required_optim=False, feasible_region=None)
def forward(self):
self.data = F.divide(1, self.env.PE)
self.data = F.winsorize(self.data, 'std', 4)
self.data = F.normalize(self.data)
self.data = F.group_neutralize(self.data, self.env.Sector)
self.data = F.regression_neut(self.data, self.env.MktVal)
self.data = F.ts_mean(self.data, self.lag)
return self.data
F
is library that contains the operators defined by WorldQuant.op.Fundamental
implies the NeutralizePE belongs to fundamental alpha.self.lag
is the parameter of rolling mean, which can be optimized through grid search.
Features
- High-speed backtesting framework (most of the operators are implemented through cython)
- A revised gplearn library that is compatible with Alpha mining.
- CNN and other state of the art models for mining alphas.
- Event Driven backtesting framework is available.
Contribution
For more information, we refer to Documentation.
Join us
If you are interested in quantitative finance and are committed to devoting your life to alpha mining, you can contact me through WeChat at Ny_math.
Project details
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
File details
Details for the file torchqtm-0.1.0.tar.gz
.
File metadata
- Download URL: torchqtm-0.1.0.tar.gz
- Upload date:
- Size: 258.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cbf9662ce53517069ded2454019506d39e97f0bd36f7fb62cf6d5f164f1e992 |
|
MD5 | 5736a67cb03067d67ddc61aaf2d5da00 |
|
BLAKE2b-256 | 85723f0d97e7d9a0e7ba06e1c95a6e38e4fabae9949a3b7617881d43218a90fe |
File details
Details for the file torchqtm-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: torchqtm-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 278.6 kB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87af4e87dcf4346b410b16ca0775f3aa0a4c89aabefdf2fa5132e2cfdc5950a0 |
|
MD5 | 5a2f85509382465038da43da5ef6cab4 |
|
BLAKE2b-256 | fcc3aa490cbf1cf100d2b304c720a35f4bd7e209c122a48b530d3afc87e68e50 |