Nibiru Python SDK
Project description
Nibiru Python SDK
Interact with the Nibiru protocol using Python.
The nibiru-py allows you to connect and trade with the Nibiru Protocol. It provides quick access to market data for storage, analysis, visualization, indicator development, algorithmic trading, strategy backtesting, bot programming, and related software engineering.
It is intended to be used by coders, developers, technically-skilled traders, data-scientists and financial analysts for building trading algorithms.
README Contents
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
Quick Start
Installation
pip install nibiru-py
Usage Instructions
The examples directory contains runnable examples that showcase how to use the package.
- Requires Python 3.9+
- Requires a running instance of the Nibiru blockchain
$ pipenv shell
$ pipenv install
# connecting to Nibiru Exchange API and create a new pool
$ python examples/chain_client/dex/create_pool.py
# sending a msg with bank transfer signs and posts a transaction to the Nibiru Chain
$ python examples/chain_client/msg_send.py
Upgrade pip
to the latest version, if you see these warnings:
WARNING: Value for scheme.platlib does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
WARNING: Additional context: user = True home = None root = None prefix = None
Development Guidelines
Python dependencies
1 (option A). Install the nibiru-py
package from source
pipenv shell
pipenv install --dev
Set up a .env
file to set environment variables for the tests.
# Example configuration for the Nibiry Python SDK
HOST="..."
VALIDATOR_MNEMONIC="..."
CHAIN_ID="..."
There's currently a "devnet" running in GCP that the CI workflows use. You can find these secrets at this notion page if you have access to it or contact @Unique-Divine or @matthiasmatt. This is useful so that you can run every part of the package code without needing to visit other repositories.
1 (option B). Install the nibiru-py
package with pip
# from local
# build and install
pip install .
# from local build
pip uninstall nibiru-py
pip install nibiru-py --no-index --find-links /path/to/nibiru/nibiru-py/dist
# from pypi
pip uninstall nibiru-py
pip install nibiru-py
Running the tests
Package tests are written pytest
. To run and edit them, follow the instructions for installation from source and use pipenv run pytest
.
Other dependencies
To run shell scripts and commands in the Makefile
, you'll need to install the following tools depending on your operating system.
- Ubuntu
sudo apt install python3.X-dev autoconf automake build-essential libffi-dev libtool pkg-config
- macOS
brew install autoconf automake libtool
- Fedora
sudo dnf install python3-devel autoconf automake gcc gcc-c++ libffi-devel libtool make pkgconfig
Generate proto binding & build
make proto-gen
python -m build # Run `pip install build` in case this fails
Linting
Enable git hook which will perform linting before each commit:
pre-commit install
This will keep your code clean.
Project details
Release history Release notifications | RSS feed
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
Hashes for nibiru_py-0.0.14a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6fa3f395214d09e3e800e5f39481a9608d245351f8699c7e963669de184b0e5 |
|
MD5 | 6b01f589220132f6dcadcfbd44adcc29 |
|
BLAKE2b-256 | 3ac135e15423f8feacc98157a0e06f5b4f16b1399bc64b28084a85927ee3df84 |