Skip to main content

Python SDK for DeltaDeFi protocol.

Project description

DeltaDeFi Python SDK

The DeltaDeFi Python SDK provides a convenient way to interact with the DeltaDeFi API. This SDK allows developers to easily integrate DeltaDeFi's features into their Python applications.

Installation

To install the SDK, use pip:

pip install deltadefi

Requirements

  • Python 3.11 or higher

Usage

Initialization

To use the SDK, you need to initialize the ApiClient with your API configuration and wallet.

from deltadefi.clients import ApiClient
from sidan_gin import HDWallet

# Initialize API configuration
network="preprod",
api_key="your_api_key",

# Initialize HDWallet
wallet = HDWallet("your_wallet_mnemonic")

# Initialize ApiClient
api = ApiClient(network=network, api_key=api_key, wallet=wallet)

Accounts

The Accounts client allows you to interact with account-related endpoints.

# Get account balance
account_balance = api.accounts.get_account_balance()
print(account_balance)

Market

The Market client allows you to interact with market-related endpoints.

# Get market depth
market_depth = api.market.get_depth("ADAUSDX")
print(market_depth_response)

# Get market price
market_price_response = api.market.get_market_price("ADAUSDX")
print(market_price_response)

Order

The Order client allows you to interact with order-related endpoints.

# Build place order transaction
place_order_request = BuildPlaceOrderTransactionRequest(pair="BTC/USD", amount=1, price=50000)
place_order_response = api.order.build_place_order_transaction(symbol="ADAUSDX", amount=50, price=0.75, type="limit")
print(place_order_response)

# Submit place order transaction
submit_order_response = api.order.submit_place_order_transaction(signed_tx="<signed_tx>", order_id="<order_id>")
print(submit_order_response)

Development

Tests

Testing sdk:

DELTADEFI_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx make test

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

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

deltadefi-0.0.7.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

deltadefi-0.0.7-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file deltadefi-0.0.7.tar.gz.

File metadata

  • Download URL: deltadefi-0.0.7.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.3 Linux/6.8.0-1021-azure

File hashes

Hashes for deltadefi-0.0.7.tar.gz
Algorithm Hash digest
SHA256 728b25ddf8e50e95e5ae7168bea2111d2c4d7250ea65621cd5f9cc186cb91749
MD5 cac8a5125701a57027b9ef9e5a25d36f
BLAKE2b-256 dc3c2ad475125ad8e5e64f6ff0c73e970f620f3d2b057508aa9cf316d6088500

See more details on using hashes here.

File details

Details for the file deltadefi-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: deltadefi-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.3 Linux/6.8.0-1021-azure

File hashes

Hashes for deltadefi-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7f5cdb57841a8f45944af3d6b06314cc3fce59432fb8483638f2ddc3d26fbf82
MD5 b4dc628bd953c7890a4c180b4ce1737f
BLAKE2b-256 276135c336744438c591b924b379561903be588b5b29781d10d909577f90f012

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