SDK Documentation
This SDK is designed to simplify integration with 21X, the future of trading and settlement for security tokens and crypto assets. As a regulated platform under the EU DLT Regime, 21X ensures compliance, security, and transparency, providing a seamless gateway to the fast-growing market of digital assets.
Key Features
The 21X SDK is designed to streamline interactions with the platform, particularly for managing trades and interacting with the smart contract. Below is an overview of its core capabilities:
1. Smart Contract Interaction
The OrderBook
class serves as the gateway for interacting with the platform's EVM-based smart contract. It abstracts the complexities of contract operations, enabling seamless integration. Its key features include:
Trading Pair Configuration: Query trading pair configurations, including checking if your wallet is whitelisted to trade on a specific pair and retrieving other important contract-level details.
Balance Insights: Access real-time balance information for trading pairs, including the base token (tokenized asset) and the quote token (e-money token).
Token Allowances: Easily set allowances for base and quote tokens, ensuring the smart contract is authorized to interact with your tokens for trading.
Order Placement: Place buy and sell limit orders directly through the smart contract with support for automatic scaling of price and quantity values.
Order Cancellation: Cancel active orders efficiently using a straightforward method.
This class simplifies complex on-chain operations, allowing developers to focus on building functionality rather than managing low-level blockchain interactions.
2. REST API Integration
The built-in REST API client supports a range of essential operations to monitor and manage trading activities:
Market Data:
List all available trading pairs and their associated contracts.
Retrieve real-time price information for trading pairs.
Order Tracking:
Fetch all open orders on the platform.
View active orders and trades associated with your wallet.
These features enable users to fully leverage the platform's capabilities, whether by interacting with the smart contract for direct transactions or querying the REST API for trading insights and order management.
Prerequisites
To use this SDK effectively, you’ll need:
Python 3.9 or higher installed on your system.
Access credentials for the 21X platform.
Basic familiarity with REST API and Ethereum smart contract interactions.
Installation
Get started by installing the SDK via pip:
Quick Start Example
Here’s a quick example of how to initialize the SDK and interact with the platform:
Last updated