Getting Started
This section will guide you through the initial steps to set up and begin using the 21X SDK.
Prerequisites
Before you start, ensure you have the following:
Python Version: Ensure Python 3.97 or higher is installed on your system.
Access Credentials: Obtain an API key for the REST API and ensure your wallet is registered and whitelisted in the 21X platform.
Polygon Wallet: Use a funded wallet on the Polygon network to cover gas fees for smart contract interactions.
Polygon RPC Provider: Access a Polygon-compatible RPC endpoint (e.g., Infura, Alchemy, or a self-hosted node) for blockchain communication.
Installation
Install the SDK using pip:
Basic Setup
1. Initialize the REST API Client
The REST API client is used to interact with platform features like fetching open orders and price information.
Alternatively, you can make use the following environment variables, to auto configure the clients.
2. Example: Fetch Available Trading Pairs
Use the REST API client to list all trading pairs:
3. Initialize the OrderBook Class
The OrderBook
class is your entry point for interacting with the EVM-based smart contract.
4. Example: Check Token Balances
Here’s how you can check the token balances for a trading pair:
Last updated