Skip to main content

Kaziro API Client

Project description

Kaziro Python API Client

Kaziro is a Python client for interacting with the Kaziro API. It provides a simple and intuitive interface for accessing various endpoints related to users, markets, orders, positions, and wallets.

Quick Start

Installation

Install the Kaziro package using pip:

pip install kaziro

Basic Usage

import os
from kaziro import Kaziro

# Initialize the Kaziro client
api_key = os.environ.get("KAZIRO_API_KEY")
kaziro = Kaziro(api_key=api_key)

# Retrieve user profile
user_profile = kaziro.user.retrieve()
print(f"User profile: {user_profile}")

# Retrieve markets
markets = kaziro.market.retrieve()
print(f"Markets: {markets}")

# Place an order
orders = [{"request_id": "some_id", "probability": 0.7}]
placed_orders = kaziro.order.create(orders)
print(f"Placed orders: {placed_orders}")

# Connect to WebSocket
kaziro.connect_websocket()
kaziro.subscribe_websocket("public:all")
print("WebSocket connected and subscribed to 'public:all'")

Features

  • User management (retrieve)
  • Market operations (create, retrieve)
  • Order management (create, retrieve, accept)
  • Position tracking (open positions, history)
  • Wallet information retrieval
  • WebSocket support for real-time updates
  • Bot templates for automated trading

Detailed Usage

User Operations

# Retrieve user profile
user_profile = kaziro.user.retrieve()

Market Operations

# Create a new market
market_details = [{"detail": "Market description", "size": 100}]
created_markets = kaziro.market.create(market_details)

# Retrieve markets
all_markets = kaziro.market.retrieve()
specific_markets = kaziro.market.retrieve(market_ids=["market_id_1", "market_id_2"])
open_markets = kaziro.market.retrieve(status="OPEN")

Order Operations

# Create orders
orders = [
    {"request_id": "id_1", "probability": 0.7},
    {"request_id": "id_2", "probability": 0.3}
]
placed_orders = kaziro.order.create(orders)

# Retrieve open orders
all_open_orders = kaziro.order.retrieve()
user_open_orders = kaziro.order.retrieve(filter_user=True)

# Accept orders
accepted_orders = kaziro.order.accept(["order_id_1", "order_id_2"])

# Request default replies
default_replies = kaziro.order.request_default_replies(["order_id_1", "order_id_2"])

Position Operations

# Get open positions
open_positions = kaziro.position.retrieve(status="ACTIVE")

# Get position history
position_history = kaziro.position.retrieve(status="CLOSED")

Wallet Operations

# Retrieve wallet information
wallet_info = kaziro.wallet.retrieve()

WebSocket Usage

# Connect to WebSocket
kaziro.connect_websocket()

# Subscribe to a channel
kaziro.subscribe_websocket("public:all")

Bot Templates

# Use the base market maker bot
kaziro.template.base_market_maker()

Configuration

The Kaziro client can be configured with custom API and WebSocket URLs:

kaziro = Kaziro(api_key="your_api_key")

Development

To set up the development environment:

  1. Clone the repository:

    git clone https://github.com/kazirocom/package.git
    cd package
    
  2. Install development dependencies:

    pip install -e ".[dev]"
    
  3. Run tests:

    pytest tests/
    

Contributing

We welcome contributions to the Kaziro package. Please feel free to submit issues, fork the repository and send pull requests!

License

This project is licensed under the terms of the license specified in the project repository.

Support

For support, please contact the Kaziro team at support@kaziro.xyz or open an issue on the GitHub repository.

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

kaziro-1.0.4.tar.gz (57.1 kB view details)

Uploaded Source

Built Distribution

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

kaziro-1.0.4-py3-none-any.whl (135.5 kB view details)

Uploaded Python 3

File details

Details for the file kaziro-1.0.4.tar.gz.

File metadata

  • Download URL: kaziro-1.0.4.tar.gz
  • Upload date:
  • Size: 57.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for kaziro-1.0.4.tar.gz
Algorithm Hash digest
SHA256 63a87b3704aa97eb4e9c04345b24352a15b6802799f7c1fc7fd9730460566b2d
MD5 18badfd661bd51ef0af7077274d6db54
BLAKE2b-256 6f0ab443037d2456f17a19fb5684fd778e79fef5f3abf4ba62cc77be018984e3

See more details on using hashes here.

File details

Details for the file kaziro-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: kaziro-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 135.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for kaziro-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4abf6e4bc5646ae12ab06ac38f6ed54aefd3d377f6c50b296f15c719de50bdad
MD5 891e6b7b66a53684fd3361b75803b081
BLAKE2b-256 c0b8a1c71e178c1e9693475d44c0e299216d8633f7703d21797ca90f2fb6a227

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