Skip to main content

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({
    "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={
        "actions": signed["actions"],
        "nonce": signed["nonce"],
        "account": signed["account"],
        "signer": signed["signer"],
        "signature": signed["signature"],
    }
)

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
}

Builder Codes

Builder codes are optional commission fees for routed limit and market orders. Python order input uses builder_code; API JSON emits builderCode on orders and abc/rbc approval actions.

Batch Signing

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

# Sign all at once - each order becomes one transaction
signed_txs = signer.sign_all(orders)

For multi-order atomic transactions, batch order_ids are optional:

signer.set_compute_batch_order_ids(True)  # default False for max performance
grouped = signer.sign_group([entry_order, stop_loss, take_profit])
print(grouped.get("order_ids"))

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

# Optional ID computation controls
signer.set_compute_order_id(True)            # default True
signer.set_compute_batch_order_ids(False)    # default False
signer.computes_order_id()
signer.computes_batch_order_ids()

# Sign operations
signed = signer.sign(order, nonce=None)
signed = signer.sign_group([order1, order2], 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 = signer.sign_oracle_prices([(1704067200000000000, "BTC-USD", 102500.0)], nonce=None)
signed = signer.sign_pyth_oracle([(1704067200000000000, 1, 10250000000000, -8)], nonce=None)
signed = signer.sign_whitelist_faucet(target_pubkey, whitelist=True, nonce=None)
signed = signer.sign_approve_builder_code(builder_pubkey, fee=5, nonce=None)
signed = signer.sign_revoke_builder_code(builder_pubkey, nonce=None)
signed_list = signer.sign_all(orders, base_nonce=None)

Tuple formats:

  • sign_oracle_prices: (timestamp, asset, price)
  • sign_pyth_oracle: (timestamp, feed_index, price, exponent)

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")

Compute order ID without a signer/private key:

from bulk_keychain import compute_order_id_from_order

order_id = compute_order_id_from_order(
    {"type": "order", "symbol": "BTC-USD", "is_buy": True, "price": 100000.0, "size": 0.1},
    nonce=1704067200000,
    account="your-account-pubkey",
)

# Compact API order JSON is also supported:
order_id_compact = compute_order_id_from_order(
    {"l": {"c": "BTC-USD", "b": True, "px": 100000.0, "sz": 0.1, "r": False, "tif": "GTC"}},
    nonce=1704067200000,
    account="your-account-pubkey",
)

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.21.tar.gz (60.7 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.21-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (518.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.21-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (499.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.21-cp312-cp312-win_amd64.whl (369.7 kB view details)

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (517.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.21-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (498.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.21-cp312-cp312-macosx_11_0_arm64.whl (451.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.21-cp312-cp312-macosx_10_12_x86_64.whl (491.7 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (519.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.21-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (502.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (519.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.21-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (502.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (520.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.21-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (503.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

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

File metadata

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

File hashes

Hashes for bulk_keychain-0.1.21.tar.gz
Algorithm Hash digest
SHA256 f18105a77e0893a884104f1d3d50d02d73b9fa6061e556d29b76e641ab320308
MD5 2837a31d7f2c2b975225228404eb31fc
BLAKE2b-256 c02cb32726a115b16d7ec8b502390169c3d5e110b0cdfc2857b8181e6fd4794c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b4ec9c582f826774794cc58ce52f332a89a6dc95560bf4a7234d93f052fb48b
MD5 116b55eae2b50aeb2886bb5657499f9a
BLAKE2b-256 675b8d715e7208cd4b0e09050d38fd4c842d907fc64327f524157bbc079f5bcf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8ff8b39304106836b4e352090c5a6436cdc24899cb657d86cb37248ee9ea87b5
MD5 157914e7c99cb41e0ea232ef6f990281
BLAKE2b-256 95096cb94cfa9d8afa93c5cbd621ada457c2d1b7375332c274fa493ab6e8e0c2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 460035333a63e503eb4cd4093eb0dbc30db2d9b4c0c231b7509528c6a7fe603e
MD5 3f868c5e0ff00353834f853d3769bb0f
BLAKE2b-256 01273e8a451170e1d4522fe021ad0c57d41aac8aad57729a445ccd85781da880

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b0103df400eb0b7897d3549b557d86338799477a0c436e4b6ce3007969dd917
MD5 b50f869547d48878bc8a893ea4c3e2aa
BLAKE2b-256 74e304976fd404db551e5d5be1bd3ee0dce8ec107f171ca67c481cb74615d601

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d82773aa365830372a461dec4ad74aa03d69c27c4313242c9959d9935b5bf0dc
MD5 321add73f6aacc7de85bcd0a3a1ada2c
BLAKE2b-256 373f499fe6720b52fa5305a7c763e0c4a78db60f11c086a832b17eb9914dadb8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 97978a58f2f26bc843909bfadfe73dfa515bf7f782acb1b1151379acf833e97d
MD5 325d0fdfd98cdf71d72cfe684292fa59
BLAKE2b-256 cd5de233286b0b52783b33bc97f7fa1ec1c4a7bd7bd9a3543d742f8b4525b270

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b8c7101ca37bfcb62582b686ae94b62c839525d28e40cfdb790fc69e3dc364f9
MD5 bbbdebd73c28616be9355d16a7e91b8d
BLAKE2b-256 cfbf0030a9c6c2c870daf1c7db282d35934a3904910e1206e0319e9396ee8aa8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0b5e6025b4ea0507fe7656d4af4d1dbe1a83dab17cb95b44bd0bdafafd9f2f50
MD5 b134e23e33d1954dc19ab97b6e1fa7f6
BLAKE2b-256 4dd222c2741833497f5c771b9b3d0a61e912bdd5c2c2407fd06cc391291970f2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a8abe4b56b658c5466b9281ddc8b2fbba0b8fe1222a2699e4ceec468f606f17b
MD5 d6207f7fea250cab1ca39a3b65dd2471
BLAKE2b-256 8e4fba40380be20e34b6abfce9a8c75bf5c93d24cbc465e9228d624078960f7a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 238abc75edf4106426e43d27bdf8b08e0fc14be8f56ca7f0cf9f3ccc322f1308
MD5 0e6cc4096ca89551d3004a33be20dee2
BLAKE2b-256 dc1cabe9fce96b525c2e43737ed8e684e1b4490db96e36d7c2644d449ce0628f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a8d5f9c00799afb81fbf41dd5a093f3c6c6933d7868c6e15994975dc807afdca
MD5 ab8c01451906f6216cf37c85719ed324
BLAKE2b-256 cf419d899192dd6fff08aa22816cc224fdf738c84319be195228d9bca6407449

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74f345cfcefa2a51acc5dc7ce842b48d4bc06805dc1ca0bf178c8ae80ccd4331
MD5 073dee9cba8bb2b29077969c1bbbb8fe
BLAKE2b-256 9e3678c004502bec9a2a0a21cf742c4089bef09e16bc056da9bf000d49aff101

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.21-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 515a81d9baa63420c5c0fe5890cc205babd194589b799bd97d582628c1fb888e
MD5 4c1846c4734039490519ad0a930d0771
BLAKE2b-256 350aa7e28e3543f94122c68740f91ee8b77d3bcf1e3cfc333f203645b43023a9

See more details on using hashes here.

Provenance

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

Release history Release notifications | RSS feed

0.1.26

14 files

0.1.25

14 files

0.1.24

14 files

0.1.23

14 files

0.1.22

14 files

This release

0.1.21 This release

14 files

0.1.20

14 files

0.1.19

14 files

0.1.18

14 files

0.1.17

14 files

0.1.16

14 files

0.1.15

14 files

0.1.14

14 files

0.1.13

14 files

0.1.12

14 files

0.1.11

14 files

0.1.10

14 files

0.1.9

14 files

0.1.8

14 files

0.1.7

14 files

0.1.6

14 files

0.1.5

14 files

0.1.4

14 files

0.1.3

14 files

0.1.2

14 files

0.1.0

14 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page