SDKs overview
EXMO provides Software Development Kits (SDKs) and client libraries to facilitate programmatic interaction with its cryptocurrency exchange platform. These tools enable developers to build custom applications, trading bots, and analytical systems that can access real-time market data, execute trades, manage user accounts, and retrieve historical information directly from the EXMO API. The use of SDKs can simplify the development process by handling tasks such as API key authentication, request signing, and data parsing, which are typically required for direct API interactions. The core EXMO API is a RESTful interface, supporting common HTTP methods for various operations.
Developers can choose between official SDKs maintained by EXMO and community-contributed libraries. Official SDKs typically offer direct support and are updated in parallel with API changes, ensuring compatibility and access to the latest features. Community libraries, while potentially offering broader language support or unique features, may vary in their maintenance frequency and adherence to the latest API specifications. Both types of libraries aim to abstract the underlying HTTP requests and JSON responses, providing language-specific methods and data structures for easier integration. The EXMO API documentation details the available endpoints and required parameters for direct calls, which the SDKs encapsulate.
Official SDKs by language
EXMO maintains official SDKs for several popular programming languages, designed to offer stable and supported interfaces to their API. These SDKs are developed and maintained by the EXMO team, ensuring they are kept up-to-date with API changes and best practices. Developers are generally recommended to use official SDKs for critical applications due to their direct support.
| Language | Package/Repository | Installation Command | Maturity |
|---|---|---|---|
| Python | exmo-api-python |
pip install exmo-api-python |
Stable |
| JavaScript (Node.js) | exmo-api-js |
npm install exmo-api-js |
Stable |
| PHP | exmo-api-php |
composer require exmo/php-api |
Stable |
Each official SDK typically provides methods for both public API calls (e.g., getting market data, order books) which do not require authentication, and private API calls (e.g., placing orders, checking balances) which require an API key and secret for HMAC-SHA512 signature generation. For specific details on each SDK's functionality and usage, developers should consult the respective EXMO developer documentation.
Installation
The installation process for EXMO's official SDKs follows standard package manager procedures for each respective language.
Python SDK Installation
The Python SDK can be installed using pip, the Python package installer. This command retrieves the latest version of the exmo-api-python package from PyPI.
pip install exmo-api-python
JavaScript (Node.js) SDK Installation
For Node.js environments, the JavaScript SDK is available via npm (Node Package Manager). The installation command adds the exmo-api-js package to your project's dependencies.
npm install exmo-api-js
PHP SDK Installation
The PHP SDK is distributed via Composer, the dependency manager for PHP. Use the following command in your project directory to include the exmo/php-api package.
composer require exmo/php-api
After installation, developers can import the SDK into their project and begin making API calls. For private API calls, developers will need to generate API keys and secrets from their EXMO account settings. These credentials should be stored securely and not hardcoded directly into applications, following security best practices as outlined by groups like the Internet Engineering Task Force in OAuth 2.0 security considerations.
Quickstart example
This section provides a basic quickstart example using the EXMO Python SDK to retrieve public market data (e.g., the last trades for a specific currency pair). This example does not require API keys.
Python Quickstart: Get Ticker Data
To retrieve the latest ticker information for all currency pairs, you can use the get_ticker method. This demonstrates a public API call.
from exmo_api.client import ExmoClient
# Initialize the client without API key/secret for public calls
client = ExmoClient()
try:
# Get ticker data for all currency pairs
ticker_data = client.get_ticker()
# Print ticker information for a specific pair, e.g., 'BTC_USDT'
if 'BTC_USDT' in ticker_data:
btc_usdt_ticker = ticker_data['BTC_USDT']
print(f"BTC/USDT Last Price: {btc_usdt_ticker['last_trade']}")
print(f"BTC/USDT Bid Price: {btc_usdt_ticker['buy_price']}")
print(f"BTC/USDT Ask Price: {btc_usdt_ticker['sell_price']}")
print(f"BTC/USDT 24h Volume: {btc_usdt_ticker['vol']}")
else:
print("BTC_USDT pair not found in ticker data.")
except Exception as e:
print(f"An error occurred: {e}")
This example initializes the ExmoClient and then calls the get_ticker() method. The response is a dictionary containing ticker information for various trading pairs, from which specific data points like the last traded price, bid, ask, and 24-hour volume can be extracted. For comprehensive details on available methods and their parameters, refer to the EXMO API reference documentation.
Python Quickstart: Private API Call (Account Info)
For private API calls, such as retrieving account information, you will need your EXMO API key and secret. This example demonstrates how to set up the client for authenticated requests and fetch user balances.
from exmo_api.client import ExmoClient
import os
# It is recommended to store API key and secret as environment variables
API_KEY = os.getenv('EXMO_API_KEY')
API_SECRET = os.getenv('EXMO_API_SECRET')
if not API_KEY or not API_SECRET:
print("Error: EXMO_API_KEY and EXMO_API_SECRET environment variables must be set.")
else:
try:
# Initialize the client with API key and secret for private calls
client = ExmoClient(api_key=API_KEY, api_secret=API_SECRET)
# Get user info, which includes balances
user_info = client.get_user_info()
print("Account Balances:")
for currency, balance in user_info['balances'].items():
if float(balance) > 0:
print(f" {currency}: {balance}")
except Exception as e:
print(f"An error occurred: {e}")
In this private API example, the API key and secret are loaded from environment variables for security. The ExmoClient is then instantiated with these credentials. The get_user_info() method makes an authenticated call to retrieve the user's balances and other account-specific data. This approach is standard for interacting with private API endpoints that require user authorization.
Community libraries
Beyond the official offerings, the EXMO API has inspired various community-developed libraries and wrappers. These libraries can extend language support or provide alternative interfaces to the API, sometimes incorporating features not present in the official SDKs. For instance, developers might create libraries in languages like Go, Ruby, or Java, depending on community demand and contributions.
When considering a community library, it is important to evaluate its maintenance status, documentation quality, and active development. Developers should verify compatibility with the latest EXMO API version and review the source code for security implications, especially for libraries handling API keys and secrets. Resources like GitHub are common platforms where such projects are hosted. Although not officially supported by EXMO, these contributions can sometimes offer specialized functionality or cater to niche development needs. Developers should always cross-reference community library behavior with the official EXMO API specifications to ensure correct implementation.
One example of a common pattern in cryptocurrency API integrations for which community libraries often exist is the implementation of WebSockets for real-time data streaming. While EXMO's primary API is RESTful, a WebSocket interface might be provided for push notifications of market updates or trade executions. Community libraries might specialize in consuming these WebSocket feeds. The Mozilla Developer Network's documentation on the WebSockets API provides a general overview of this protocol for developers exploring real-time data solutions.