crypto_empyrical is a fork of Quantopian's Empyrical package modified to work for 24/7 markets of cryptocurrency
Project description
crypto_empyrical
crypto_empyrical is a fork of Quantopian's Empyrical package modified by Jesse to work for 24/7 markets of cryptocurrency.
Table of Contents
Installation
pip install crypto_empyrical
Usage
Simple Statistics
import numpy as np
from crypto_empyrical import max_drawdown, alpha_beta
returns = np.array([.01, .02, .03, -.4, -.06, -.02])
benchmark_returns = np.array([.02, .02, .03, -.35, -.05, -.01])
# calculate the max drawdown
max_drawdown(returns)
# calculate alpha and beta
alpha, beta = alpha_beta(returns, benchmark_returns)
Rolling Measures
import numpy as np
from crypto_empyrical import roll_max_drawdown
returns = np.array([.01, .02, .03, -.4, -.06, -.02])
# calculate the rolling max drawdown
roll_max_drawdown(returns, window=3)
Pandas Support
import pandas as pd
from crypto_empyrical import roll_up_capture, capture
returns = pd.Series([.01, .02, .03, -.4, -.06, -.02])
# calculate a capture ratio
capture(returns)
# calculate capture for up markets on a rolling 60 day basis
roll_up_capture(returns, window=60)
Testing
- install requirements
- "nose>=1.3.7",
- "parameterized>=0.6.1"
./runtests.py
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
crypto_empyrical-1.0.3.tar.gz
(58.7 kB
view hashes)
Built Distribution
Close
Hashes for crypto_empyrical-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 996f6f72b456ce75ac05dbd5de791b6757892b8f7e2ea4dd765b100515f22ab4 |
|
MD5 | bec680242f670163d528ffb983b18697 |
|
BLAKE2b-256 | f7897e31c1f5d3d9711beb44260865ede220dca1720baf789c002487cdea173b |