datacaptain
Official Python SDK for the DataCaptain US ETF Data API.
Install
pip install datacaptain
For local development from this repo:
pip install -e packages/datacaptain-python
Quick start
from datacaptain import DataCaptain
dc = DataCaptain(api_key="sdata_your_key_here")
# ETF screener
screen = dc.etf_screener(return_min=10, dividend_yield_min=2, period="1y")
print(screen["data"][:5])
# Heatmap
heatmap = dc.etf_heatmap(basket="broad", period="1y")
# Backtest
bt = dc.backtest_buy_and_hold(
symbol="SPY",
start_date="2015-01-01",
end_date="2025-01-01",
investment=10000,
)
# Portfolio rebalance
rebalance = dc.portfolio_rebalance(
holdings=[{"symbol": "VOO", "shares": 63}, {"symbol": "QQQ", "shares": 37}],
target=[{"symbol": "VOO", "weight": 60}, {"symbol": "QQQ", "weight": 40}],
drift_threshold=2,
)
Get your API key at datacaptain.in.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
datacaptain-0.1.0.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datacaptain-0.1.0.tar.gz.
File metadata
- Download URL: datacaptain-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb05dc0a8e8a32ddb208d3c77478607068d79cea72183ac14b03ff6359857505
|
|
| MD5 |
009112b35f7722fdecab93f2d7f56f53
|
|
| BLAKE2b-256 |
fbc9718f4776010c0782b3917f7e0fe3a981e219ae56bd364845aa9b72b06b3b
|
File details
Details for the file datacaptain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: datacaptain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecf36f5ee55af8b2ed77ce7958faf3eb9555bd068726f120fa3b81e66a0514ce
|
|
| MD5 |
3ae4ef99008c3a95c45ee86c205b92b7
|
|
| BLAKE2b-256 |
57b3ad422f69c972590cb50ea64a7b763fdc3f6476b0afad160b920f4f46a28c
|