predictoor-data
Python client for accessing Predictoor data and predictions on Ocean Protocol.
Installation
Install via pip:
pip install predictoor-data
Or install from source:
git clone https://github.com/oceanprotocol/predictoor-data
cd predictoor-data
pip install -e .
Quick Start
from predictoor_data import PredictoorClient
from datetime import datetime
# Initialize client
# private key can also be set using PREDICTOOR_PRIVATE_KEY env var
client = PredictoorClient(private_key="your-private-key") # private_key is optional
# Get current prediction
stake_up, stake_down = client.get_prediction("BTC/USDT", "5m")
print(f"Up stake: {stake_up/1e18} OCEAN")
print(f"Down stake: {stake_down/1e18} OCEAN")
# Fetch historical data
historical_data = client.fetch_historical(
datetime(2024, 9, 1),
datetime(2024, 9, 30),
"BTC/USDT",
"5m"
)
API Reference
PredictoorClient
Constructor
client = PredictoorClient(private_key=None)
private_key: Optional. Your private key for authentication. Can also be set viaPREDICTOOR_PRIVATE_KEYenvironment variable.
Methods
get_prediction(pair: str, timeframe: str) -> Tuple[int, int]
Get current prediction for a trading pair. If the subscription doesn't exist raises an error.
stake_up, stake_down = client.get_prediction("BTC/USDT", "5m")
pair: Trading pair (e.g., "BTC/USDT", "ETH/USDT")timeframe: Time interval ("5m", "1h")- Returns: Tuple of (stake_up, stake_down) in wei
subscribe_and_get_prediction(pair: str, timeframe: str) -> Tuple[int, int]
If the subscription doesn't exist, subscribes to a trading pair and get current prediction.
stake_up, stake_down = client.subscribe_and_get_prediction("BTC/USDT", "5m")
fetch_historical(start_date: datetime, end_date: datetime, pair: str, timeframe: str) -> pd.DataFrame
Fetch historical prediction data.
df = client.fetch_historical(
datetime(2023, 1, 1),
datetime(2023, 1, 31),
"BTC/USDT",
"5m"
)
Returns DataFrame with columns:
slot_start: Start time of prediction slotslot_target: Target time for predictionstake_up: Amount staked on price going upstake_down: Amount staked on price going down
Supported Trading Pairs
Check predictoor.ai
Metadata
Release files for predictoor-data 0.1.7
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 |
|---|---|---|---|---|
| predictoor_data-0.1.7.tar.gz | 17.7 kB | Without provenance | Details for predictoor_data-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| predictoor_data-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for predictoor_data-0.1.7-py3-none-any.whl |
Total release size: 39.0 kB
Release files / predictoor_data-0.1.7.tar.gz
| Download URL | predictoor_data-0.1.7.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad4ed056fae4365b77c1e30c35681cedb95c25a7fec6910eb6171b8e2199ddcb
|
|
BLAKE2b-256 checksum How to use checksums |
c29e5954835c066722470d7da592996f09ff3062acade2357f88910de577991f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / predictoor_data-0.1.7-py3-none-any.whl
| Download URL | predictoor_data-0.1.7-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3732f18d1b8d122ef4b0aa37f3b5affe82ee07b21b9b1af3459d8cf616d14b3
|
|
BLAKE2b-256 checksum How to use checksums |
90e0d7d84238af75e206a8035438d6f1540b610afd6d4f48796d69fc19285315
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for predictoor-data 0.1.7
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.