Skip to main content

A simple high perf signing lib for BULK txns

Project description

bulk-keychain

A simple high perf signing lib for BULK txns - Python bindings.

Installation

pip install bulk-keychain

Quick Start

from bulk_keychain import Keypair, Signer

# Generate a new keypair
keypair = Keypair()
print(f"Public key: {keypair.pubkey}")

# Or import from base58
# keypair = Keypair.from_base58("your-secret-key...")

# Create a signer
signer = Signer(keypair)

# Sign a limit order
signed = signer.sign_order([{
    "type": "order",
    "symbol": "BTC-USD",
    "is_buy": True,
    "price": 100000.0,
    "size": 0.1,
    "order_type": {"type": "limit", "tif": "GTC"}
}])

# Submit to API
import requests
response = requests.post(
    "https://api.bulk.exchange/api/v1/order",
    json=signed
)

Order Types

Limit Order

{
    "type": "order",
    "symbol": "BTC-USD",
    "is_buy": True,
    "price": 100000.0,
    "size": 0.1,
    "order_type": {"type": "limit", "tif": "GTC"}  # GTC, IOC, or ALO
}

Market Order

{
    "type": "order",
    "symbol": "BTC-USD",
    "is_buy": True,
    "price": 0.0,
    "size": 0.1,
    "order_type": {"type": "market", "is_market": True, "trigger_px": 0.0}
}

Cancel Order

{
    "type": "cancel",
    "symbol": "BTC-USD",
    "order_id": "order-id-base58"
}

Cancel All Orders

{
    "type": "cancel_all",
    "symbols": ["BTC-USD"]  # or [] for all symbols
}

Batch Signing

For high-frequency trading, sign many transactions in parallel:

# Create batches (each inner list becomes one transaction)
batches = [[order] for order in orders]

# Sign all at once - parallelizes automatically when > 10 batches
signed_txs = signer.sign_orders_batch(batches)

API Reference

Keypair

# Generate new keypair
keypair = Keypair()

# Import from base58
keypair = Keypair.from_base58("secret-key-base58")

# Import from bytes (32 or 64 bytes)
keypair = Keypair.from_bytes(bytes_data)

# Properties and methods
keypair.pubkey          # Public key as base58 string
keypair.to_base58()     # Full keypair as base58 (64 bytes)
keypair.to_bytes()      # Full keypair as bytes
keypair.secret_key()    # Secret key as bytes (32 bytes)

Signer

# Create signer
signer = Signer(keypair)
signer = Signer.from_base58("secret-key-base58")

# With nonce management 
signer = Signer.with_nonce_manager(keypair, "timestamp")     # Use timestamp
signer = Signer.with_nonce_manager(keypair, "counter")       # Use counter
signer = Signer.with_nonce_manager(keypair, "high_frequency") # Timestamp + counter

# Sign operations
signed = signer.sign_order(orders, nonce=None)
signed = signer.sign_faucet(nonce=None)
signed = signer.sign_agent_wallet(agent_pubkey, delete=False, nonce=None)
signed = signer.sign_user_settings(max_leverage=[("BTC-USD", 5.0)], nonce=None)
signed_list = signer.sign_orders_batch(batches, base_nonce=None)

Utilities

from bulk_keychain import random_hash, current_timestamp, validate_pubkey, validate_hash

# Generate random hash for client order IDs
client_id = random_hash()

# Get current timestamp in milliseconds
ts = current_timestamp()

# Validate base58 strings
is_valid = validate_pubkey("pubkey-base58")
is_valid = validate_hash("hash-base58")

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

bulk_keychain-0.1.0.tar.gz (31.4 kB view details)

Uploaded Source

Built Distributions

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

bulk_keychain-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (411.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (399.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.0-cp312-cp312-win_amd64.whl (270.6 kB view details)

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (411.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (399.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (356.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl (380.7 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (412.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (401.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (413.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (401.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (413.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (402.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

Details for the file bulk_keychain-0.1.0.tar.gz.

File metadata

  • Download URL: bulk_keychain-0.1.0.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bulk_keychain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c3084a2c75e057c2f4eedce1ed0caf4962d104ec0a85d1a8943d011bd65afda4
MD5 e93b44a373c5c48c2eab08b23c5b6509
BLAKE2b-256 d2832ce50745b91b60f99a42b14de01e23b21b9b53a26cd4fd2e7de81e97a8c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0.tar.gz:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4af4490ad356b0156d816d932e89c6c1aa95af0e8727785c1034a4232c875e2b
MD5 7993efe3af6caf2e948102b8cafe8ab0
BLAKE2b-256 a50720d2e0ebd3c66a9466b02001665bd791f2c8f992fbba07d6281320f5eb68

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ca4eed44e9c4f10c9488e5366ef9d7151be43044db6acee2b011c4aa921fb856
MD5 51bf84b30306b2a1af1988c1a673c117
BLAKE2b-256 90305e67636edd3d38c211f83705a5d78e45fa4a454b068aa150ae5a956231c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3bf0ed45f00f3071cdca8ab0c3c71207f22eb888b50026a4f5f758c085905296
MD5 a11c9317c4316d9e9da02436629b2f5e
BLAKE2b-256 34333f0abf33a55051e243dbc062b9576f8f85a23f4f68153805b79343840a15

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e76eaee86cb7e93e59afee7a1335bbc65603ade4a1f09fa07aea915986fe2df4
MD5 4f2a0c7a7e33f693a7caa649a0f5baeb
BLAKE2b-256 f0d6fa2135db20fa838af13904545a70db99ec1c02291fa06d38164a20d6aeb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f5ee853aac75782f6f03eaf94ee1623082a8fb288f03b56618fe338644ca59ea
MD5 fbaafa168668cb12ffdd91fc4defc5e8
BLAKE2b-256 1f1a80a9fbb8f414ce578d37ed64c6901f4e9448bdeb4bd30c8b90ebddb3cb4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 af06a09f8b76bb32c96d2c0358e557b711ec72b683035bb20e0ce1f8e8e57d04
MD5 23fce5be1e756dcd02d19254e15219ca
BLAKE2b-256 0cc3e988c49cb083a52439c26b1cbf5918a9f838939488b57cf5beda577dd5e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7e76662e4446fe7fa139cc42dec59df6ddd01dc970c1e12cf3c727a08a2a2dd5
MD5 61fe7749db4d22c5432a362135ae9861
BLAKE2b-256 929d370413618742ca1b2000288e7717a8d80a4e1e48c0d407baed4d1220cd78

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e182486ee6a7d0deb28ced88c90c135bf8e2739aa83847b542ecc0f1ea245433
MD5 7f773f340c2391ad518585f76d230270
BLAKE2b-256 886c7fff632f8c23a754ac96ce850d9c3531619f5d92f5a95418ffdcccdf32cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2fe3de522bf4d6a97cba2c5fb67f6ff4dd7bb239233162b53da6d85bcbbd8328
MD5 4ba0ffbb6434731e3f0746a81df3377c
BLAKE2b-256 ed70902bb772fd92001198a6e9f3d4178e12f818d727d35e3ede50d8e9758fe3

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bef1fe025626f84073aabb3ea121af9e4c47715e29bdf8e72e0b1fb4b8ecfe2e
MD5 ddaa5636dd719a7a0fc189cd6c11401c
BLAKE2b-256 31b4e87c6ecb58822511071538695e21dfa611cbe007e2c71a78a2001a7ee7bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fc650b9199249d5adec897af15a4c903b5a3cce15b090fe4b97b931db8478207
MD5 86551ce9e19ea4837da2dc84cae2d53d
BLAKE2b-256 25c556ec267d42e28f410eb8809fdaa6a113e28c929956ead3ea46de82309bc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9c3927a5582de5527cf040238cc17395f41021f4a2abdb5fa252ed6128b191ed
MD5 2532a0c7e41ff2ab3231e4ff73a31c40
BLAKE2b-256 af4301c7fd663aaa5163a725640129a5ff681b02de69c88d3c5d7d8ab445f68a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bulk_keychain-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 674228a38ee6ba215fb944a949fc5ec5718e6248cf462beed088adc0d03592a1
MD5 a7b4055cc3a38e1ac8f6ab0e4e0546c7
BLAKE2b-256 e7f590ecf5f1df3853571c3e4e0d0b1a761c34fbd51b13f0991eb35d465a2101

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on Bulk-trade/bulk-keychain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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