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

# 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 builder-code fees for routed limit and market orders. Python order input uses builder_code; API JSON emits builderCode on orders and abc/rbc approval actions. When builder_code is absent, it contributes no signing bytes.

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, "devnet")
signer = Signer.from_base58("secret-key-base58", "devnet")

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

# 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 the current Unix timestamp in nanoseconds
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.24.tar.gz (63.8 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.24-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (520.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.24-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (502.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.24-cp312-cp312-win_amd64.whl (372.5 kB view details)

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.24-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (519.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.24-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (501.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.24-cp312-cp312-macosx_11_0_arm64.whl (453.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.24-cp312-cp312-macosx_10_12_x86_64.whl (495.5 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.24-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (521.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.24-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (505.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.24-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.24-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (505.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.24-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.24-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (506.9 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

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

File metadata

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

File hashes

Hashes for bulk_keychain-0.1.24.tar.gz
Algorithm Hash digest
SHA256 ef06214229ec73c390ee56dbda08d3062d1a575025c6677b4eb299da1543f564
MD5 587fcaf2b1e2369ffd87c2a9769e38ab
BLAKE2b-256 4fd4b6d293669230e270ec959be5ea1500f3c341121b64284644fbfbbc7dae93

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e0a64963ed5312740c42535bfed5b599e2b2b2a0837e34f63a9f8e4b35909650
MD5 e196a593996250ebaa1c915743f2c7a9
BLAKE2b-256 81429011179a0005ceeadb3acd3bd206aeb4582ce9b504104206a3d93378b7c8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f2de474e5cf0b6ec96a89ea471c80daa2c012dd0d6ae95428f438cbbf9b6b30b
MD5 a3e251f03eb0ef562061e9a80e589563
BLAKE2b-256 e90a371a2e5c165caf59246684762a972ec4f1b2164ce2a93d829904c055dd1b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f75b6c9f322938e716f1a3c33fd55ce4f66bf9c81996b55724b3bfd6d1eb7852
MD5 a91c8ab2c6bddd832afb8017307ba838
BLAKE2b-256 dbdb89310c79dba03485304a9e7d19196fbfa303a5b6e8f7c2f26335898ebcd2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b4d541aadd30d43c8e4713eb3d043ce0600972acc5e4868389126e37b5bfe8a
MD5 289244c9cc8afe7f747bef7a0c69d724
BLAKE2b-256 d5322df1ca962ccb1257a1e18012c0e0da0514dbc291c38c1e037a2abc7d1f22

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 29d615009b636b0cf16192443e83e530552d609c529f0970f524bd5bd362cd1a
MD5 49d15aa889ee108b2041029f046e1061
BLAKE2b-256 10a5964dafdeef27865575c647af82faba338ded0737713553ccb24b1a582b43

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1aa1a680d582955451b525e593fc53120ddb4c931becd494403dc17672b86e3f
MD5 053aeb2fac1e3829d36c57045be642ec
BLAKE2b-256 24285a3802780ae8864cb5a992eba84c64751c0908f3fada5482065f41d53e7c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 13b69d461bbffb3f335aa0d8d6418c5397a196fc8490e2c41642a5d502391961
MD5 8588e50b41ef5f1e409f76a5cb4b4bb8
BLAKE2b-256 729959032a4a5b8ba21397380000d7724e33eb21bbeef0b54387563f6a6bbfa7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3550b659ac11c90617c13dadb5463a13d65964483601b478bb685455b55fe08
MD5 f66f4281dd54deba5fed70d46bc69676
BLAKE2b-256 199078174e50cb25e61aaf91908cddb7fbd3bc6f412c46323f8d78e95fbf3b16

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f053994cd9630ceee2e5d00186340e5b8725d8c8b2642db7f545d0c0a4482568
MD5 d9855f5fa954250da21af4dedf44e31d
BLAKE2b-256 9b285192b308c1e70d978c62126df7d3f89ae62b5c2fd4a57f396ded0eac54ee

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 32f84ed042514e45d2c5e28aad3dbf907ca88c1717c08be187ae173ea0f1e0de
MD5 cad9f49170a865120184ce5ad25d91ff
BLAKE2b-256 137e34922ff8c2cbbecd547a8c92e16f32b32469c218d13c0ba4d19aad9a7147

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1b6e06c32c417b5ecf7a1cfe99f8832054d9c292c75ab75c9b74559b414b9aa8
MD5 52299d46b75ffddfd2f9700fb390c6ef
BLAKE2b-256 7630924dc7d018ea6839e3ed39f6c592cc9b29883a4dbbb0f77a82bc4727c111

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa2e8f98ee7e2c708b270f02255633da6e3eefb8cbe237fa3f0b0240356e61e7
MD5 0cf400641d9f47eca94675f9dedfe513
BLAKE2b-256 dd6a15f34edc8dc5a735797a1b6ad14f483b4780cc5ba3feba0a79c4e0fd5d6d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.24-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1a1bb9685a8ef0bc6da1824ddfdf89e13bd0da3778742b6d9b6c358138a2d18a
MD5 25ee6a3c5afe8518fd36773027002976
BLAKE2b-256 6c5bf42ed795c046b2a1448a08306af7a52bfc4847eea977e8bdd55ef023ab0e

See more details on using hashes here.

Provenance

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

This release

0.1.24 This release

14 files

0.1.23

14 files

0.1.22

14 files

0.1.21

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