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:

  1. Python Version: Ensure Python 3.97 or higher is installed on your system.

  2. Access Credentials: Obtain an API key for the REST API and ensure your wallet is registered and whitelisted in the 21X platform.

  3. Polygon Wallet: Use a funded wallet on the Polygon network to cover gas fees for smart contract interactions.

  4. 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:

pip install 21x-sdk

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