Skip to main content

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 via PREDICTOOR_PRIVATE_KEY environment 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 slot
  • slot_target: Target time for prediction
  • stake_up: Amount staked on price going up
  • stake_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

predictoor_data-0.1.4.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

predictoor_data-0.1.4-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file predictoor_data-0.1.4.tar.gz.

File metadata

  • Download URL: predictoor_data-0.1.4.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

Hashes for predictoor_data-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3a62748ede68490742f9486224a886949a0796bfc746264188f76e6caf12fb1a
MD5 d1d365cdcf70e5464c0510c7a6e8eb6e
BLAKE2b-256 0ccb5f95214a7fe7fa3c7284d5f9c0edf0987430878cd427a13ee22209e52790

See more details on using hashes here.

File details

Details for the file predictoor_data-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for predictoor_data-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3bf08a6cc5b3a6ae60f64351d6ed847307b97e71ebfb9f90af28948675e9a6c3
MD5 9e040cd785b3ba729bc0c2b4af6d704e
BLAKE2b-256 4bff5036cddb2c43d38e7509fdeeefad8ef7acdbd4fb730f144dfdfaa4bc3f5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page