Skip to main content

dYdX Chain Client

Project description

dYdX Chain Client for Python

Python client for dYdX (v4 API).

The library is currently tested against Python versions 3.9, and 3.11.

Installation

The v4-client-py package is available on PyPI. Install with pip:

pip install v4-client-py

Getting Started

Sample code is located in examples folder

Development Setup - VS Code

Install Microsoft Python extensions

Shift-Command-P: Create Python Environment
Select Venv
Select Python 3.9 as interpreter
Select requirements.txt as the dependencies to install

Install requirements

pip install -r requirements.txt

VS Code will automatically switch to .venv environment when running example code. Or you can manually switch

source ~/<project_dir>/.venv/bin/activate

Set PYTHONPATH

export PYTHONPATH=~/<project_dir>/.venv/lib/<Python version>/site-packages

Troubleshootimg

Cython and Brownie must be installed before cytoolz

If there is any issue with cytoolz, uninstall cytoolz, Brownie and Cython, reinstall Cython, Brownie and cytoolz sequentially.

VS Code may need to be restarted to have Cython functioning correctly

Running examples

Select the file to be debugged Select the debug button on the left Select "Python: Current File"

Running tests

Integration tests uses testnet environment for testing. We use pytest.

To install pytest

pip install pytest

For read-only integration tests, run:

pytest -v

For integration tests with transactions, a subaccount must exist for the specified address. This subaccount may be reset when testnet environment is reset. To create the subaccount, run

examples/faucet_endpoint.py

Wait for a few seconds for the faucet transaction to commit, then run

pytest -v -c pytest_integration.ini 

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

dydx_v4_python-0.0.4.tar.gz (47.2 kB view hashes)

Uploaded Source

Built Distribution

dydx_v4_python-0.0.4-py3-none-any.whl (88.3 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