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-python-sdk

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.api_resources.api_config import ApiConfig
from deltadefi.clients.clients import ApiClient
from sidan_gin import HDWallet

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

# Initialize HDWallet
wallet = HDWallet("your_wallet_mnemonic")

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

Accounts

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

from deltadefi.clients.accounts import Accounts

accounts_client = api_client.accounts

# Sign in
sign_in_request = SignInRequest(auth_key="your_auth_key", wallet_address="your_wallet_address")
sign_in_response = accounts_client.sign_in(sign_in_request)
print(sign_in_response)

# Get account balance
account_balance = accounts_client.get_account_balance()
print(account_balance)

Markets

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

from deltadefi.clients.markets import Markets

markets_client = api_client.markets

# Get market depth
market_depth_request = GetMarketDepthRequest(pair="BTC/USD")
market_depth_response = markets_client.getDepth(market_depth_request)
print(market_depth_response)

# Get market price
market_price_request = GetMarketPriceRequest(pair="BTC/USD")
market_price_response = markets_client.getMarketPrice(market_price_request)
print(market_price_response)

Orders

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

from deltadefi.clients.orders import Orders

orders_client = api_client.orders

# Build place order transaction
place_order_request = BuildPlaceOrderTransactionRequest(pair="BTC/USD", amount=1, price=50000)
place_order_response = orders_client.build_place_order_transaction(place_order_request)
print(place_order_response)

# Submit place order transaction
submit_order_request = SubmitPlaceOrderTransactionRequest(order_id="order_id")
submit_order_response = orders_client.submit_place_order_transaction(submit_order_request)
print(submit_order_response)

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.1.tar.gz (7.4 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.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deltadefi-0.0.1.tar.gz
  • Upload date:
  • Size: 7.4 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.1.tar.gz
Algorithm Hash digest
SHA256 c67aea6d424e1222089bfa4fb59f13be52f1a4c3ce2024116dc66938d79ee19a
MD5 8022166c7b4719b8e953212a2c91956a
BLAKE2b-256 0371496cf88d4cb20b2cb950fb233b1c3f0c0bcd0d5fa49d566af5df7dd1e965

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deltadefi-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54a5a33dec1308f4f89e814bbad701ab96369663bdd34c2214c06b8ea08e51dc
MD5 fcdb47eb45d96b66cd684ebe790f8bf3
BLAKE2b-256 9d7bd8eea8c08ea80046c1339c95ce151b8bd55e8d97f269972ea759e079fa27

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