GRVT Python SDK
Project description
GRVT Python SDK
Table of Contents
What's in the library
GRVT Python SDK library provides Python classes and utility methods for easy access to GRVT API endpoints across all environments.
Environments
prod- Production environment.testnet- Testnet environment.staging- Development Integration environment.dev- Development environment.
SDK Library provides two types of classes:
- Raw - thin wrapper classes around Rest API.
- Ccxt-compatible - classes with ccxt-like methods. Provide access to both Rest API and WebSockets.
Files
Raw access:
grvt_raw_base.py- base classes for Rest API access.grvt_raw_env.py- definitions of environments for raw access.grvt_raw_signing.py- utility methods for signing orders.grvt_raw_sync.py- class for raw synchronous calls to Rest API.grvt_raw_async.py- class for raw asynchronous calls to Rest API.
CCXT-compatible access:
grvt_ccxt_utils.py- utility methods for signing orders.grvt_ccxt_env.py- definitions of environments for ccxt-like access.grvt_ccxt_base.py- base class for Rest API access.grvt_ccxt.py- class for synchronous calls to Rest API.grvt_ccxt_pro.py- class for asynchronous calls to Rest API.grvt_ccxt_ws.py- class for WebSocket calls.
Installation via pip
pip install grvt-pysdk
Configuration
Setup these environment variables:
export GRVT_PRIVATE_KEY="`Secret Private Key` in API setup"
export GRVT_API_KEY="`API Key` in API setup"
export GRVT_TRADING_ACCOUNT_ID=<`Trading account ID` in API>
export GRVT_ENV="testnet"
export GRVT_END_POINT_VERSION="v1"
export GRVT_WS_STREAM_VERSION="v1"
Usage
Examples of how to use various methods to connect to GRVT API:
- GRVT CCXT - Example of usage of CCXT-compatible Python class
GrvtCcxtwithsynchronousRest API calls. - GRVT CCXT Pro - Example of usage of CCXT.PRO-compatible Python class
GrvtCcxtProwithasynchronousRest API calls. - GRVT CCXT WS - Example of usage of CCXT.PRO-compatible Python class
GrvtCcxtWSwithasynchronousRest API calls + Web Socket subscriptions + JSON RPC calls over Web Sockets. - GRVT API Sync - Synchronous API client for GRVT
- GRVT API Async - Asynchronous API client for GRVT
Contributor's guide
Prerequisites
- Python >=3.10.0 < 3.13 (tested with 3.10.15)
- pre-commit
- uv >=0.3.3 (tested with 0.4.0)
- docker (optional)
Installation of a source code
-
Clone the git repository
git clone https://github.com/grvt-technologies/grvt-pysdk.git
-
Go into the project directory
cd grvt-pysdk/
-
Checkout working branch
git checkout <branch>
-
Install dependencies
make install -
Enable pre-commit hooks
pre-commit install
Manually run example files
Example files run extensive testing of the SDK API classes and log details about details of using GRVT API.
-
Change to tests folder
cd tests/pysdk
-
Run example of using synchronous CCXT-compatible calls to
Rest APIviagrvt_ccxt.py, classGrvtCcxtuv run python3 test_grvt_ccxt.py
-
Run example of using asynchronous CCXT-compatible calls to
Rest APIviagrvt_ccxt_pro.py, classGrvtCcxtProuv run python3 test_grvt_ccxt_pro.py
-
Run example of using WebSockets subscriptions and JSON RPC calls via
grvt_ccxt_ws.py, classGrvtCcxtWSuv run python3 test_grvt_ccxt_ws.py
What's in the box ?
uv
uv is an extremely fast Python package and project manager, written in Rust.
pyproject.toml file (pyproject.toml): orchestrate your project and its dependencies
uv.lock file (uv.lock): ensure that the package versions are consistent for everyone
working on your project
For more configuration options and details, see the configuration docs.
pre-commit
pre-commit is a framework for managing and maintaining multi-language pre-commit hooks.
.pre-commit-config.yaml file (.pre-commit-config.yaml): describes what repositories and
hooks are installed
For more configuration options and details, see the configuration docs.
ruff
ruff is an extremely fast Python linter, written in Rust.
Rules are defined in the pyproject.toml.
For more configuration options and details, see the configuration docs.
mypy
mypy is an optional static type checker for Python that aims to combine the benefits of dynamic (or "duck") typing and static typing.
Rules are defined in the pyproject.toml.
For more configuration options and details, see the configuration docs.
bandit
bandit is a tool designed to find common security issues in Python code.
Rules are defined in the pyproject.toml.
For more configuration options and details, see the configuration docs.
docformatter
docformatter is a tool designed to format docstrings to follow PEP 257.
Options are defined in the .pre-commit-config.yaml.
Testing
We are using pytest & pytest-cov to write tests.
To run tests with coverage:
make test
Name Stmts Miss Cover
-------------------------------------------------------------
src/pysdk/__init__.py 0 0 100%
src/pysdk/grvt_ccxt.py 238 21 91%
src/pysdk/grvt_ccxt_base.py 196 57 71%
src/pysdk/grvt_ccxt_env.py 48 12 75%
src/pysdk/grvt_ccxt_logging_selector.py 15 7 53%
src/pysdk/grvt_ccxt_pro.py 245 69 72%
src/pysdk/grvt_ccxt_test_utils.py 30 4 87%
src/pysdk/grvt_ccxt_types.py 41 0 100%
src/pysdk/grvt_ccxt_utils.py 237 89 62%
src/pysdk/grvt_ccxt_ws.py 275 238 13%
src/pysdk/grvt_raw_async.py 149 109 27%
src/pysdk/grvt_raw_base.py 154 69 55%
src/pysdk/grvt_raw_env.py 27 5 81%
src/pysdk/grvt_raw_signing.py 33 17 48%
src/pysdk/grvt_raw_sync.py 149 109 27%
src/pysdk/grvt_raw_types.py 1031 0 100%
-------------------------------------------------------------
TOTAL 2868 806 72%
=================================================================================================== 8 passed in 58.20s ====================================================================================================
Makefile
We are using Makefile to manage the project.
To see the list of commands:
make
➜ grvt-pysdk git:(main) ✗ make
help Show this help
run Run the project
test Run the tests
precommit Run the pre-commit hooks
lint Run the linter
format Run the formatter
typecheck Run the type checker
security Run the security checker
clean Clean the project
install Install the project
build Build the project
publish Publish the project
Changelog
Changelog
Version [0.1.28] - 2025-06-02
Changed
- Renamed currency name
AI_16_ZintoAI16Zin the raw code to match the exchange currency name.
Version [0.1.27] - 2025-05-19
Changed
-
GrvtCcxtandGrvtCcxtProclasses:- renamed method
fetch_balances()tofetch_balance()as defined in ccxt.
- renamed method
Version [0.1.26] - 2025-05-15
Added
-
GrvtCcxtandGrvtCcxtProclasses:- new method
describe()- returns a list of public method names - new method
fetch_balances()- returns dict with balances in ccxt format. - constructor parameter
order_book_ccxt_format: bool = False. If = True then order book snapshots fromfetch_order_book()are in ccxt format.
- new method
Fixed
- Issues with typing and lynting errors
Version [0.1.25] - 2025-04-25
Fixed
- Issues with typing and lynting errors
- Fixed bug in test_grvt_ccxt.py
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
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 grvt_pysdk-0.1.28.tar.gz.
File metadata
- Download URL: grvt_pysdk-0.1.28.tar.gz
- Upload date:
- Size: 224.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aeb291bb9463053df9495293e9f8e35a376baa981abdd04cc9abcf5b39f4eeac
|
|
| MD5 |
123ec95a1cbb645619ba8a17f95e8bd6
|
|
| BLAKE2b-256 |
89520cb33f5acea9425580432a74f5887a920f08e40c1fa5c66c47b9352ea3a9
|
File details
Details for the file grvt_pysdk-0.1.28-py3-none-any.whl.
File metadata
- Download URL: grvt_pysdk-0.1.28-py3-none-any.whl
- Upload date:
- Size: 71.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6885375ddb728c1132bfecd7e3dbb2e189cc78d066315a39ab7dfb23fcb9b714
|
|
| MD5 |
d0d572344b5580881cdc8f5bd542ac6d
|
|
| BLAKE2b-256 |
c8ad657163da6879224d37b2a325b8307088861fc7bf8d9e6dd87745d6d02e75
|