Bitquery Protobuf Kafka Package
A Python library containing pb2 files to simplify parsing blockchain data (Solana, EVM, Tron, TON, UTXO, Hyperliquid) and market/trading data from Bitquery Kafka Streams using Protobuf messages.
Read more on Bitquery onchain data streams here
Installation
Install easily via pip:
pip install bitquery-pb2-kafka-package
Usage
You can import and use the protobuf-generated Python classes like this:
▶️ Price Index / Market
Read about the new price index stream here
from market import price_index_pb2, trades_pb2, marketdata_pb2
# Price index updates (currency, token, and pair price updates)
price_feed = price_index_pb2.PriceIndexMessage()
# Trades stream
trades_msg = trades_pb2.TradesMessage()
▶️ Solana
from solana import block_message_pb2
# Create a Solana BlockMessage instance
block_message = block_message_pb2.BlockMessage()
# Set fields
block_message.field_name = "value"
# Serialize to bytes
serialized = block_message.SerializeToString()
# Deserialize from bytes
msg = block_message_pb2.BlockMessage()
msg.ParseFromString(serialized)
print(msg)
▶️ EVM
from evm import block_message_pb2
# Create an EVM BlockMessage instance
evm_block = block_message_pb2.BlockMessage()
# Set fields
evm_block.field_name = "value"
# Serialize and Deserialize
data = evm_block.SerializeToString()
decoded = block_message_pb2.BlockMessage()
decoded.ParseFromString(data)
print(decoded)
▶️ Tron
from tron import block_message_pb2
# Create a Tron BlockMessage instance
tron_block = block_message_pb2.BlockMessage()
# Set fields
tron_block.field_name = "value"
# Serialize and Deserialize
data = tron_block.SerializeToString()
decoded = block_message_pb2.BlockMessage()
decoded.ParseFromString(data)
print(decoded)
▶️ Hyperliquid
from hyperliquid import hyperliquid_block_message_pb2
# One message per HyperCore block: trades, orders, funding, liquidations,
# TWAPs, book updates, oracle prices, leverage changes, and signed actions
msg = hyperliquid_block_message_pb2.HyperliquidCoreBlockMessage()
msg.ParseFromString(serialized)
for trade in msg.Trades:
print(trade)
Available Protobuf Messages
Price Index / Market
price_index_pb2.PriceIndexMessage— top-level message withCurrencyUpdates,TokenUpdates, andPairUpdatesprice_index_pb2.PairUpdate— pair-level price update with market, currency, token, and price dataprice_index_pb2.CurrencyUpdate— currency-level price updateprice_index_pb2.TokenUpdate— token-level price update with rankingtrades_pb2.TradesMessage— stream of trades with pair, amounts, price, trader, and transaction infotrades_pb2.Trade— individual trade withSide(Buy/Sell),Price,PriceInUsd, and amountsmarketdata_pb2.MarketdataMessage— currency price buckets from external sources (e.g. CryptoRank)
Solana
block_message_pb2.BlockMessagedex_block_message_pb2.DexBlockMessageohlc_message_pb2.OhlcMessageparsed_idl_block_message_pb2.ParsedIdlBlockMessagetoken_block_message_pb2.TokenBlockMessageperpetual_block_message_pb2.PerpetualBlockMessage— perpetual DEX activity (ParsedPerpetualTransaction,PerpetualAsset,PerpetualAmount)prediction_market_block_message_pb2.PredictionMarketBlockMessage— prediction market activity (ParsedPredictionTransaction,OutcomeTrade,OutcomeSettlement)solana.corecast— CoreCast gRPC stream definitions (corecast_pb2,request_pb2,stream_message_pb2)
EVM
block_message_pb2.BlockMessagedex_block_message_pb2.DexBlockMessageparsed_abi_block_message_pb2.ParsedAbiBlockMessagetoken_block_message_pb2.TokenBlockMessagedex_pool_block_message_pb2.DexPoolBlockMessageprediction_market_block_message_pb2.PredictionMarketBlockMessage
Tron
block_message_pb2.BlockMessagedex_block_message_pb2.DexBlockMessageparsed_abi_block_message_pb2.ParsedAbiBlockMessagetoken_block_message_pb2.TokenBlockMessage
TON
block_message_pb2.BlockMessagedex_block_message_pb2.DexBlockMessageevent_message_pb2.EventMessagetoken_block_message_pb2.TokenBlockMessagetrace_message_pb2— transaction trace messages
UTXO (Bitcoin-like chains)
block_message_pb2.BlockMessageparsed_block_message_pb2.ParsedBlockMessage
Hyperliquid (HyperCore)
hyperliquid_block_message_pb2.HyperliquidCoreBlockMessage— one message per HyperCore block, covering all market kinds (perp, HIP-3, spot, outcome) with fieldsTrades,Orders,Funding,Liquidations,Twaps,BookUpdates,Prices,LeverageChanges, andSignedActionsfills_pb2— trade fillsorder_statuses_pb2— order status updatestwap_statuses_pb2— TWAP order statusesraw_book_diffs_pb2— raw order book diffsoracle_updates_pb2— oracle price updatescore_writer_actions_pb2— core writer actionsmisc_events_pb2— funding, liquidations, and other misc eventstransactions_pb2— consensus-stream transactions (leverage changes, signed actions)hypercore_pb2,candles_pb2— supporting HyperCore types and candles
Offchain
entities_pb2— offchain entity definitions (addresses, chains, groups)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bitquery_pb2_kafka_package-0.2.33.tar.gz.
File metadata
- Download URL: bitquery_pb2_kafka_package-0.2.33.tar.gz
- Upload date:
- Size: 37.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f9bdbe607f47c9d7344fad312e1cd4ea83d732cdb1069dd74b0b51c20646d90
|
|
| MD5 |
53bcc94cc2724c36b3241e1a393d858c
|
|
| BLAKE2b-256 |
b84da133ca82332a583be002d69969fd3ae5d06304e7d5bf92ea8dbcb2f36e2a
|
File details
Details for the file bitquery_pb2_kafka_package-0.2.33-py3-none-any.whl.
File metadata
- Download URL: bitquery_pb2_kafka_package-0.2.33-py3-none-any.whl
- Upload date:
- Size: 74.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c3ad90f90aeb16abaa27a8af9f5b10fa11737f5d26bc6c17460c16b04194e9b
|
|
| MD5 |
f8a19b0724d9eeda774ed48d94e1ca5d
|
|
| BLAKE2b-256 |
49101f737f9fada7294b6dcf0e63d67e0dce18e0b4e6c8117fdf484e75d6b7cc
|