Aperiodic Factors Client
A Python client library for the Aperiodic Factors API, providing convenient wrappers for cross-sectional crypto factor data, portfolio weights/returns and risk signals.
Installation
pip install aperiodic-factors
Features
- Portfolio Data: Access historical and live portfolio weights
- Cross-section Factors: Access cross-sectional factors as raw data
- Risk Signals: Retrieve normalized risk factor series for cryptocurrencies
- Easy Integration: Simple API calls with pandas DataFrame/Series returns
Quick Start
import aperiodic_factors
# Set your API key
api_key = "your-api-key-here"
# Get historical portfolio weights
historical_weights = aperiodic_factors.get_portfolio_historical_weights(
id="your-portfolio-id",
api_key=api_key,
start_date="2024-01-01",
end_date="2024-12-31",
)
# Get current portfolio weights
live_weights = aperiodic_factors.get_live_weights(
id="your-portfolio-id",
api_key=api_key,
)
# Get portfolio returns
returns = aperiodic_factors.get_portfolio_returns(
id="your-portfolio-id",
api_key=api_key,
start_date="2024-01-01",
)
# Get portfolio tickers
tickers = aperiodic_factors.get_tickers(
id="momentum", # Portfolio factor identifier without universe specifier
api_key=api_key,
universe_size="full",
)
# Get historical factors
factors = aperiodic_factors.get_portfolio_factors_historical(
id="momentum",
tickers=["BTC", "ETH"],
api_key=api_key,
)
# Get live factors (latest factor data)
live_factors = aperiodic_factors.get_portfolio_factors_live(
id="momentum",
tickers=["BTC", "ETH"],
api_key=api_key,
)
# Get historical universe
universe = aperiodic_factors.get_historical_universe(
size="full",
start_date="2024-01-01",
end_date="2024-12-31",
api_key=api_key,
)
Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
APERIODIC_API_KEY |
yes | — | Your Aperiodic Factors API key |
APERIODIC_BASE_URL |
no | https://factors.aperiodic.io |
Override the API base URL |
CF_ACCESS_CLIENT_ID |
no | — | Cloudflare Access service-token id (protected environments) |
CF_ACCESS_CLIENT_SECRET |
no | — | Cloudflare Access service-token secret |
Requirements
- Python 3.9+
- pandas >= 2.0.0
- numpy >= 1.3.0
- requests >= 2.25.0
Testing
The test suite exercises the live API, so it needs a valid API key. Tests that
require it are skipped automatically when APERIODIC_API_KEY is not set.
# Install with test dependencies
pip install -e ".[tests]"
# Run all tests
export APERIODIC_API_KEY="your_api_key_here"
pytest tests/ -v
License
MIT License
Metadata
Release files for aperiodic-factors 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aperiodic_factors-0.1.1.tar.gz | 11.4 kB | Without provenance | Details for aperiodic_factors-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aperiodic_factors-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for aperiodic_factors-0.1.1-py3-none-any.whl |
Total release size: 24.6 kB
Release files / aperiodic_factors-0.1.1.tar.gz
| Download URL | aperiodic_factors-0.1.1.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e331ebaf340c811da9a0fd1a2c40e89155304f46f046eeb8035120e3fb27584
|
|
BLAKE2b-256 checksum How to use checksums |
f740d8a6fcdd09b5d39ad6b272bd7305788e1bdcb1691b1ab73113611143f766
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.12.13"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.13","system":{"name":"Linux","release":"6.17.0-1018-azure"}} HTTPX2/2.7.0
|
Release files / aperiodic_factors-0.1.1-py3-none-any.whl
| Download URL | aperiodic_factors-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
104ad65787176e58079b9c8899aeabc70dd1601a3edd7ade1cfc0d79afd236ff
|
|
BLAKE2b-256 checksum How to use checksums |
8ebb8a65065d666f6508cd58aa8dc6cd3245091cb343bfcb8ed74dc62479feac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.12.13"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.13","system":{"name":"Linux","release":"6.17.0-1018-azure"}} HTTPX2/2.7.0
|
Security for aperiodic-factors 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.