Skip to main content

Python SDK for interacting with Nibiru.

Project description

Python SDK - Nibiru Chain

Python-based client for interacting with the Nibiru blockchain.

Nibiru Test workflow Examples tests PyPI Version MIT license

The nibiru package allows you to index, query, and send transactions on Nibiru Chain using Python. It provides access to market data for analysis, visualization, indicator development, algorithmic trading, strategy backtesting, bot programming, and related software engineering.

The package is intended to be used by coders, developers, technically-skilled traders and data-scientists for building trading algorithms.

Try running nibiru sdk online

Open the google collab link below to try running Niburu code online:

Or go to the examples folder to see the codes and run Jupyter notebooks locally.


pip install nibiru  # requires Python 3.8+


Querying the chain

import json
from nibiru import Network, ChainClient

client = ChainClient(Network.testnet(2))

# Query perp markets
print(json.dumps(, indent=4))

# Query trader's positions

Submitting transactions to the chain

To send a tx you need to authenticate using your wallet mnemonic or private key.

To create a new wallet, generate a mnemonic key using any service or using SDK call.

import json
import nibiru
from nibiru import Network, ChainClient, Msg, PrivateKey

mnemonic, private_key = PrivateKey.generate()
# Example OUTPUT:
# enlist satisfy inspire hobby romance caught great neither kitchen unfair cage awesome update fade object eagle sun ordinary again journey spell gown tiger spin

# Your wallet address
# Example OUTPUT:
# nibi1efsh4dq3ve58dgu68rxp8cfe4mgf89el0qfucm

Store your mnemonic key in a safe place and use it going forward.

Use faucet to get some test tokens into your wallet:

Сreate your chain client and authenticate with the mnemoniс generated

mnemonic = "put your mnemonic here..."
client = ChainClient(network=Network.testnet(2))

Check your bank balances. If the faucet succeded - your wallet should not be empty.


Send tx

output = client.tx.execute_msgs(

You can broadcast any available transaction by passing its corresponding Msg to the client.tx.execute_msgs function.

Documentation Website

Documentation can be found here: Nibiru-py documentation

  • Learn more about opening and managing your spot and perp positions here
  • Learn about querying the chain using the Sdk here


Please read HACKING.MD for developer environment setup.

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

nibiru-0.21.12.tar.gz (394.7 kB view hashes)

Uploaded Source

Built Distribution

nibiru-0.21.12-py3-none-any.whl (683.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page