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.2.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.2-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.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (399.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (411.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (399.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.2-cp312-cp312-macosx_11_0_arm64.whl (356.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl (381.0 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.2-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.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (401.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (413.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (402.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (413.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (402.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: bulk_keychain-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 ff39129c2847b204a244bbedba9c9289d71fce225dbcc1c24e5988449c8ccc89
MD5 69ba57fc64e9e203b97b4b95a79db9e5
BLAKE2b-256 82457f7dc7081f6fe09be60bffd69ed4cf38ecb455735732432cfef5c3e09411

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2.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.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74411d146194ec1d4ae385e06bc07035a5db83c81e149ecb721809488a5e84a5
MD5 a75e4e2b673cf771f03b9c47fe0df52c
BLAKE2b-256 7ea5c70e3ca6715e8f349b9a5f08dd749c06829b02607b5eb0791af1c6aea012

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bf84e3b2515eb837c12cd87acb71b7b356aa5a7d2f5f15a4c6580003359c05d0
MD5 a99389fc28ff2d14bfa91011d058743c
BLAKE2b-256 539291ea6f0c7078b7668c7a8e789181cdca15dbebc7f64d887ea2894764b32f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e82be1eb3fede6781386e7c8de163ec638d1ba60109e57f440279ac9d6c8462a
MD5 52753a28e3963666699bcfab28e6bb57
BLAKE2b-256 a2acd5483d93ca6a85aaa006b0dad3b6177344c0a54194754e7e4e3c8e189e67

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f133107922e40b7a0fa7540a0f146f26a6e5268721c0bc7b4986f211a1af9757
MD5 dafa0f675df60577b73d2136299f5fb7
BLAKE2b-256 f7cd0ceefe634a13c950f28660b549b7e911a53df73903baa6f338de9ff7bbe0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ee24976073ed625779de84dd9f86bc1c19a8e7d1ecb42310b68195163e929a90
MD5 8273a66c8ca8ad1aee0ccdc497d6728d
BLAKE2b-256 385776a671e1179850c836c71ea0a8077e0a5efd713639f6ad1452dbe75f84c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 707e5d32c8f3672e2e6c4dd4a08debf6647b04b1836e7b950fc28b8802a803ec
MD5 3c0fb6556972e212e33a494b704fcc4a
BLAKE2b-256 1f9b932fd7bb4712817a3990b3bf6e07182c18050a7850a816002b03cd080ab8

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8299800267be70646e89114b8d5c631b8711935e8ce8ad9895a95ca948221bd4
MD5 95f0cb1aa6ca4c78fc9552726c789089
BLAKE2b-256 37b0e1b7f02ad0f8030f4595679074ed1fc28d002b7cbb6cdbb1e81ce9e48ecf

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 308ef625871701926021c1c9f4e43f7c078d3fcb3090beec37d91799707a5fd1
MD5 4b8de3733ee62966a783c71f2a95d12a
BLAKE2b-256 4ab3f6a950351506d7107cf23c4d712fe35330e937524ca3daa06c2b7fd70e7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d0c62e76a224f3bb84a4c00e0712b65261f1ea306dd3e184030a51d756c92e26
MD5 7397b4291f90a206240c68f63dd56e28
BLAKE2b-256 c4f230d34c9b0e8ba9ed93d45530e2e23f5cc3729983441d982dcc67a2aa7246

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2c06b6b1872323717165bd5a18eb99a736b89d6314fb07fe6ed9966fb321ab16
MD5 e0f3e17a7bf8849cfb5500d9a0f26feb
BLAKE2b-256 e00e8d0106dd7f23cc7db72e307e4ef189163e0011f5d787864fc05b45cbcf29

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a18185066b2ca3f77ff2dd0cc5f9cf9a6aa54a2c1fa25c3844ea5af1e68f0306
MD5 f88d99b884879084954918850a86462d
BLAKE2b-256 c56a6497d02e62fcc2e64464c614b898ef182aff2d27691c4eac70f6509807b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 401a677859a69dc5e7f5fa5f65f3dd64a06b7df1df6e7b89cef0faa8035035ad
MD5 629b6637b67e362a3e7d2f1412cf3087
BLAKE2b-256 ba1da4e323db739db3da7d1ba4373be9aab0b33fdae40a24ba1d5d21df1d070e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bulk_keychain-0.1.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0b46ceb3ad5766f80d13ae43ada65165b3a05f03a66d2ed07cf147d4a2ef49ee
MD5 8c058a9f4f129a31819e0a77728fb3b4
BLAKE2b-256 81b32b667090aa32c483206d41e0b1fdaa6bdf169906fd13d6413dae839bb8f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for bulk_keychain-0.1.2-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