A package for fetching historical and prediction data
Project description
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
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
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 predictoor_data-0.1.5.tar.gz.
File metadata
- Download URL: predictoor_data-0.1.5.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
337fde50bf2c2b6109cdb3baed22aa28f57c809be0af10eea65f6f9d9a12d6f6
|
|
| MD5 |
5b4c877d6fd848a166537693b6069dc8
|
|
| BLAKE2b-256 |
8845f52641e83ebab7a34b60bc02cad9cbe48222b7bcc9ec1c798a3ab31485f7
|
File details
Details for the file predictoor_data-0.1.5-py3-none-any.whl.
File metadata
- Download URL: predictoor_data-0.1.5-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a126d822fe2c5dfcc95fb7971155f6cf873ef67db16f9968d7daaa0e0ac4088c
|
|
| MD5 |
f95f782f0f2ef35343e351455e1ea4f8
|
|
| BLAKE2b-256 |
00e0befd8ef162f85607c1219df619b354f3f86f923a3e1a18145b0dfc286ddb
|