Skip to main content

No project description provided

Project description

Derive.xyz Python Client.

This repo provides a unified interface for the Derive Exchange.

Please checkout the examples directory for usage.

Here is a quick demonstration of the cli functionality.

alt text

Preparing Keys for the Client

To use the client, you will need to generate an API key from the Derive Exchange.

The process involves linking your local signer to the account you want to use programmatically.

Here are the steps:

  1. Generate a local signer using your preferred method. For example, you can use the Open Aea Ledger Ethereum Cli.

    aea generate-key ethereum
    

    This will generate a new private key in the ethereum_private_key.txt file.

  2. Go to the Derive Exchange and create an account.

  3. Go to the API section and create a new API key.

  4. Register a new Session key with the Public Address of the account your signer generated in step 0.

Once you have the API key, you can use it to interact with the Derive Exchange.

You need;

DERIVE_WALLET - The programtic wallet generated upon account creation. It can be found in the Developer section of the Derive Exchange. SIGNER_PRIVATE_KEY - The private key generated in step 0. SUBACCOOUNT_ID - The subaccount id you want to use for the API key.

derive_client = DeriveClient(
    private_key=TEST_PRIVATE_KEY, 
    env=Environment.TEST, # or Environment.PROD
    wallet=TEST_WALLET,
    subaccount_id = 123456
    )

Install

pip install derive-client

Dev

Formatting

make fmt

Linting

make lint

Tests

make tests

For convience, all commands can be run with:

make all

Releasing

We can use tbump to automatically bump our versions in preparation of a release.

export new_version=0.1.5
tbump $new_version

The release workflow will then detect that a branch with a v prefix exists and create a release from it.

Additionally, the package will be published to PyPI.

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

derive_client-0.2.18.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

derive_client-0.2.18-py3-none-any.whl (56.9 kB view details)

Uploaded Python 3

File details

Details for the file derive_client-0.2.18.tar.gz.

File metadata

  • Download URL: derive_client-0.2.18.tar.gz
  • Upload date:
  • Size: 46.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for derive_client-0.2.18.tar.gz
Algorithm Hash digest
SHA256 1adb51e46063032f663f4034003ff2feae3e5d2b6a1a04a410ef5a5aecdb9675
MD5 80359b4b91248a54e894667a76e4e8ed
BLAKE2b-256 f635d82ae8cc579ebb313878db71d1631b33a2f0e90bdb0316e66a13286cbf41

See more details on using hashes here.

File details

Details for the file derive_client-0.2.18-py3-none-any.whl.

File metadata

  • Download URL: derive_client-0.2.18-py3-none-any.whl
  • Upload date:
  • Size: 56.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for derive_client-0.2.18-py3-none-any.whl
Algorithm Hash digest
SHA256 ef1b912162ebf2fac6dd3d9a569adab1138993877b447ff2d3ab9b54dcda2b0d
MD5 dddde6a11010d24b9e071bab342bf5cd
BLAKE2b-256 b6af24f94cec48a627ede7a6a94ac706725bc78e443ea7143c3b3d7be8eb45db

See more details on using hashes here.

Supported by

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