Skip to main content

A Python SDK for accessing the Historical Market Data API of Bjarkan

Project description

Bjarkan Market Data SDK

A Python SDK for accessing the Historical Market Data API of Bjarkan.

Installation

You can install the Bjarkan Market Data SDK using pip:

pip install bjarkan-sdk

Usage

Here's a quick example of how to use the SDK:

from bjarkan_client import BjarkanClient
from datetime import datetime

# Initialize the client
client = BjarkanClient("https://api.bjarkan.io")

# Authenticate
client.authenticate("your_username", "your_password")

# Get available tables
tables = client.get_tables()
print("Available tables:", tables)

# Get history for a specific table
result = client.get_history(
    table_name="example_table",
    start_time=datetime(2024, 10, 5, 15, 30, 00),
    end_time=datetime(2024, 10, 5, 15, 40, 00),
    exchange='binance',
    symbol="BTC/USDT",
    bucket_period="100ms",
    sort_descending=False
)
print("Data:", result['data'][:5])  # Print first 5 entries
print(f"Query performance: {result['query_performance_seconds']:.4f} seconds")

API Reference

BjarkanClient

__init__(base_url: str)

Initialize the client with the base URL of the Bjarkan Market Data API.

authenticate(username: str, password: str)

Authenticate with the API using your username and password.

get_tables() -> List[Dict[str, any]]

Get a list of available tables and their configurations.

get_history(table_name: str, start_time: datetime, end_time: datetime, exchange: str = None, symbol: str = None, sort_descending: bool = False, bucket_period: str = None, limit: int = None, offset: int = None) -> Dict[str, any]

Retrieve historical data for a specific table.

Returns a dictionary containing:

  • data: List of historical data entries
  • query_performance_seconds: Time taken to execute the query in seconds

get_paginated_history(table_name: str, start_time: datetime, end_time: datetime, exchange: str = None, symbol: str = None, sort_descending: bool = False, bucket_period: str = None, page_size: int = 1000) -> Iterator[Dict[str, any]]

Retrieve historical data in pages. Each iteration returns a dictionary containing:

  • data: List of historical data entries for the current page
  • query_performance_seconds: Time taken to execute the query for the current page in seconds

validate_bucket_period(bucket_period: str) -> bool

Validate if the given bucket period is valid.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

bjarkan_sdk-0.1.13.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

bjarkan_sdk-0.1.13-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file bjarkan_sdk-0.1.13.tar.gz.

File metadata

  • Download URL: bjarkan_sdk-0.1.13.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for bjarkan_sdk-0.1.13.tar.gz
Algorithm Hash digest
SHA256 036dcbb8d64cc728e95121dd2fa267037d3787e427bf96e9c60b8b7600b977eb
MD5 7b822bffe0a74c0cc7293c7fe2d1d016
BLAKE2b-256 d75186dbe6c896f61f9b7ea7080b45d4953ee810b537f74b0bb0a069e2fc8510

See more details on using hashes here.

File details

Details for the file bjarkan_sdk-0.1.13-py3-none-any.whl.

File metadata

File hashes

Hashes for bjarkan_sdk-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 5e12db45979eb6814b6540ae7bcd232298c2631663e01c4669b51a2779b54cb6
MD5 c5c8dc915c724553e2af6b6b7d37844c
BLAKE2b-256 8fcd057a3befb943b6c5fccd50bfdfebd4dc1695e1c9a6cf34b3bd01157be0cd

See more details on using hashes here.

Supported by

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