Skip to main content

A client to interact with Futuur public API.

Project description

py-futuur-client

A Python client library for developers and clients of futuur.com to interacting with the public Futuur API. This package provides easy-to-use classes to access market data, categories, user details, and trading endpoints (bets and orders).

🌟 Features

  • Secure Authentication: Handles HMAC-SHA512 signing automatically using your private key.
  • Market Data: Easily fetch lists of available markets, retrieve specific market details, and get real-time order book data.
  • User Information: Retrieve personal account details and statistics using the /me/ endpoint.
  • Category Navigation: Access various category listings (featured, main, root) to organize markets.
  • Trading (Bets & Orders): Supports core trading actions including purchasing/selling positions and placing/cancelling Limit Orders.

🔑 Requirements

  • Python 3.10+
  • A Futuur Public API Key and Private Key (obtainable from your Account Settings in the "API" section).

⚙️ Installation

pip install py-futuur-client==1.0.3

🚀 Quick Start (How to Use)

1. Import and Instantiate the Client

The core Client class handles your API key authentication (HMAC signature) and manages connections to the different API groups.

from py_futuur_client.client import Client

# IMPORTANT: Replace these placeholders with your actual keys
PUBLIC_KEY = 'YOUR_PUBLIC_KEY'
PRIVATE_KEY = 'YOUR_PRIVATE_KEY'

# Instantiate the client
client = Client(public_key=PUBLIC_KEY, private_key=PRIVATE_KEY)

2. Interacting with Endpoint Groups

The client's architecture maps directly to the API documentation's groups, allowing you to access functionalities via simple dot notation (e.g., client.market for all market endpoints).

💰 Trading — Bets (.bet)

Interact wagers (.list, .purchase, .detail, .sell, .get_partial_amount_on_sell, .get_latest_purchase_actions, .get_current_rates, .simulate_purchase).

# GET /api/v1/bets/
# Example: List your 10 most recent active bets (status=purchased)
active_bets = client.bet.list(params={'active': True, 'limit': 10})
print(f"You have {len(active_bets['results'])} active bets.")

🏷️ Categories (.category)

Interact with categories (.list, .get, .list_featured, .list_main, .list_root, .list_root_and_main_children).

# GET /api/v1/categories/root/
# Fetch all top-level categories
root_categories = client.category.list_root()
print("Root Categories:")
for category in root_categories:
    print(f"  - {category['title']}")

📊 Market Data (.market)

Interact with market (.list, .detail, .get_order_book, .get_related_markets, .suggest_market)

# GET /api/v1/markets/
# Example: Fetching the first 5 active markets
markets_list = client.market.list(params={
    'limit': 5,
    'resolved_only': False
})

print(f"Total active markets: {markets_list['pagination']['total']}")
for market in markets_list['results']:
    print(f"- ID {market['id']}: {market['title']}")

👤 User (.user)

Interact we user (.get_datails)

# GET /api/v1/me/
my_details = client.user.get_details()
print(f"Logged in as: {my_details['username']}")
print(f"Play Money Wagers: {my_details['wagers_count_play_money']}")

📜 Trading — Limit Orders (.limit_order)

Interact with orders (.list, .create, .cancel).

# POST /api/v1/orders/
# Place a BUY (bid) Limit Order
payload = {
    'outcome': 123,
    'currency': 'OOM',
    'shares': 0.2,
    'shares_requested': 0.2,
    'side': 'bid',
    'position': 'l'
}

try:
    new_order = client.limit_order.create(payload=payload)
    print(f"Limit Order created: ID {new_order['id']} at price {new_order['price']}")
except Exception as e:
    print(f"Failed to create order. Check payload fields: {e}")

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

py_futuur_client-1.0.3.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

py_futuur_client-1.0.3-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file py_futuur_client-1.0.3.tar.gz.

File metadata

  • Download URL: py_futuur_client-1.0.3.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for py_futuur_client-1.0.3.tar.gz
Algorithm Hash digest
SHA256 084ff05430f2cf5b549a7bd787b2c9ca5436360278ab461128a911d8db2cd800
MD5 b7a5bc23da8e0f6c4308fd5db54fa87c
BLAKE2b-256 1e36b3ef2574f877ee3d8caa883bab1352790a4cb9c598fccfab47aac75abb05

See more details on using hashes here.

File details

Details for the file py_futuur_client-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for py_futuur_client-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 644c81c9937602c4cdd4fd5fa983468d222d86deae955625636900f85de45609
MD5 36c91fb5e7fb5616c88a22e7fd27f112
BLAKE2b-256 83c06198559d1318f163fa3e546c91dc7a49e560de404a27f59c98881dcc1f8c

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