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.4.tar.gz (40.0 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.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (438.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (422.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.4-cp312-cp312-win_amd64.whl (295.1 kB view details)

Uploaded CPython 3.12Windows x86-64

bulk_keychain-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (438.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (422.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.4-cp312-cp312-macosx_11_0_arm64.whl (379.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bulk_keychain-0.1.4-cp312-cp312-macosx_10_12_x86_64.whl (406.9 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

bulk_keychain-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (439.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (423.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (439.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (424.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

bulk_keychain-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (439.9 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bulk_keychain-0.1.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (424.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: bulk_keychain-0.1.4.tar.gz
  • Upload date:
  • Size: 40.0 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.4.tar.gz
Algorithm Hash digest
SHA256 52734475e13e488258c87d516b4651c81562c5647d24c680df26077022849e13
MD5 008f50568b79ddbd76820928b801a6f9
BLAKE2b-256 e34a28186460e95d84a8efabc3f51690628fb0a0ea8e5c27092652b05fabdb47

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef4caadae84c77be295242bcf8ee30e976aa735d9f95666645834fd4253286b9
MD5 1339d6bc3f62270be223cc4eb97085ee
BLAKE2b-256 15e1190b6a65a64bb9d7e693aefb1d6bd44e3ab370a8d721904163182d702fd0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7ec0b0484e217e4a8c1db173d325ba5c014450872735fd959506dc7f35c3a7bf
MD5 c7ac4c33442f0c568828136c0494b0d8
BLAKE2b-256 d6292c8ed96ad4ba705dfdf376d0fedd4d8ebc67070e3c066294a8e5ad71f578

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d401d408ba3c5b68bd332760adda6d07d9f73f74dfad8fdbb7770cd2bf1671b9
MD5 1abc67116b38ba24248d9a7ceca28fda
BLAKE2b-256 c4aec02e1fab7613143e86658c2554037ad1d9fd3f35c771dac27421e6152ac5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 455bea89d80da25318e286a38d1d69a9e6b50cd73bf4e9ed2095689992ae8d46
MD5 5edcae3e6e9d07c418185114181fb3f2
BLAKE2b-256 2e8d5fb1e8f27b207f1900564a1dee14bd8cef975e6a28d01261dfc789049c74

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8b380cf0f9ba48e3eb93e983630def62288c40ef336649af014be076deb7db5b
MD5 a1b476465c61e62c78281148a8ab1b5d
BLAKE2b-256 b94d58ff22996754e82008685b30a6fdae366d29f3bf04c5bdfb93c2a5fe94c5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8eb7d89e70d8b1b718137e3460c706cc66a73f119deda412d47f2d4c4dc2fd76
MD5 3d72b76413aaefe269fae823cd8b8662
BLAKE2b-256 981c91e808628eebc16eab4e5877e438d775ddb9b888d56338391f12ab7b060b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a98e7a61abd885cade292d9facc848ce90ccedce0aad3ef8b3eb4ac32c9574e8
MD5 e338b66b764419067422f1e6af3e71fe
BLAKE2b-256 b35a9d2360ebba7a05f13d0e3911640593af1548b31982649f9dd59f2e4e18f8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae712bcff441b4cb2266215fac7c49f186c8305341a032e0a1a57a0616b6fa29
MD5 a1a213f607fd22a84c87d4cd2b2a8a82
BLAKE2b-256 a582f6139ac61056ac6a8c54445c948c1c2e0a5e6fbe83cadf8367128fd33284

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c74344a687546010ca69bbdbf04b8ef3472aa5e12a4bf39de97cefbb28dff39f
MD5 643cf1e141b93996d47ade1532e5e482
BLAKE2b-256 4ade6c2f1c77e3c6a2eeb008484497e3c2ce7551f7188a11e46f637d50fe33b2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 15038b1d7ec40d661cc549b61ba1d5a12929c2653db1eaaa1a91c19a496d090d
MD5 a183c2d74d2900a0735c1a0f476cde22
BLAKE2b-256 049788e9a7e6c33a3f3e0f4e2892b5efbce6a2cdc7643bc42f8826cd45952382

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 60bfe42460df88feab1e93122711e9b3fe2c8ca77993fdb2dc24561cd1f27307
MD5 71a6c2df455fd979c421e09aad0b88e5
BLAKE2b-256 c583a9a76fb9c5d6e3a6808323dcf36dcbe3ae9b28ec3da51508ca83da491636

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f5c22a9ea06fa8ea100389076058729b57339dd0a705fdcd57e366b084c94e2
MD5 64eb9248bbab391761af2063c824a967
BLAKE2b-256 02a5549e05746389f2cd3202dd1aa14f85256e07e9b779a646d4e5ad18cffcee

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for bulk_keychain-0.1.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 851b1176dc341924c7dc472b6da95e91c90a07f003085d7e3875af679cb5660d
MD5 e2116aa623efc64c4ce3483efedfa9ba
BLAKE2b-256 17ecd6e1431f394ced81ab9c2dd62ccc46b118c23c7df81ff594ef32c3a76ef2

See more details on using hashes here.

Provenance

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