SDKs overview
BtcTurk offers a suite of official and community-supported software development kits (SDKs) to enable developers to integrate with its trading platform. These SDKs simplify interaction with the BtcTurk API, providing pre-built functions and objects for common operations like fetching market data, placing orders, and managing user accounts. The API provides both public endpoints for general market information and private, authenticated endpoints for user-specific actions BtcTurk API documentation. Developers can choose an SDK based on their preferred programming language, facilitating faster development and reducing the boilerplate code typically required for direct API calls.
The BtcTurk API adheres to common web API design principles, including RESTful architecture for most endpoints, which uses standard HTTP methods (GET, POST, PUT, DELETE) for resource manipulation. Data is typically exchanged in JSON format, a widely adopted, human-readable data interchange format JSON specification overview. Authentication for private endpoints is typically handled via API keys and secrets, which are passed in request headers following cryptographic signing protocols to ensure secure communication BtcTurk authentication guide.
Official SDKs by language
BtcTurk maintains official SDKs for several popular programming languages. These libraries are designed to provide a robust and well-documented interface for programmatic access to the BtcTurk exchange. Each SDK typically includes client classes, data models, and utility functions to streamline development.
| Language | Package/Repository | Installation Command | Maturity |
|---|---|---|---|
| Python | btcturk-sdk-python |
pip install btcturk-sdk-python |
Stable |
| Java | btcturk-sdk-java |
Maven/Gradle dependency (see docs) | Stable |
| C# | BtcTurk.Net.SDK |
dotnet add package BtcTurk.Net.SDK |
Stable |
| Node.js | btcturk-api-client |
npm install btcturk-api-client |
Stable |
| Go | github.com/btcturk/go-btcturk-sdk |
go get github.com/btcturk/go-btcturk-sdk |
Stable |
For detailed usage and specific class methods, developers should refer to the respective SDK's documentation and the main BtcTurk API reference.
Installation
Installing BtcTurk's official SDKs typically involves using the package manager specific to the programming language. Below are common installation instructions for the primary supported languages.
Python
The Python SDK can be installed via pip, the standard package installer for Python Python package installation guide:
pip install btcturk-sdk-python
Java
For Java projects, the SDK is typically managed using build tools like Maven or Gradle. You would add the dependency to your pom.xml (Maven) or build.gradle (Gradle) file. Consult the BtcTurk Java SDK documentation for the exact dependency coordinates.
Maven Example:
<dependency>
<groupId>com.btcturk</groupId>
<artifactId>btcturk-sdk-java</artifactId>
<version>1.0.0</version> <!-- Use the latest version -->
</dependency>
Gradle Example:
implementation 'com.btcturk:btcturk-sdk-java:1.0.0' // Use the latest version
C#
The C# SDK can be installed using the .NET CLI or NuGet Package Manager:
dotnet add package BtcTurk.Net.SDK
Alternatively, from the NuGet Package Manager Console in Visual Studio:
Install-Package BtcTurk.Net.SDK
Node.js
For Node.js applications, the SDK is available via npm, the default package manager for JavaScript npm install command reference:
npm install btcturk-api-client
Go
The Go SDK can be installed using the go get command:
go get github.com/btcturk/go-btcturk-sdk
Quickstart example
This Python example demonstrates how to use the BtcTurk Python SDK to fetch the latest ticker information for a specific trading pair. Before running, ensure you have installed the btcturk-sdk-python package and, for private endpoints, obtained your API Key and Secret from your BtcTurk account BtcTurk API documentation.
from btcturk_sdk_python.client import BtcTurkClient
# Initialize the client. For public endpoints, API Key/Secret are optional.
# For private endpoints, replace 'YOUR_API_KEY' and 'YOUR_API_SECRET'.
client = BtcTurkClient(api_key='YOUR_API_KEY', api_secret='YOUR_API_SECRET')
# --- Public Endpoints ---
# Get ticker information for all pairs
tickers = client.get_all_tickers()
if tickers and tickers.get('success'):
print("All Tickers:")
for data in tickers['data']:
print(f" Pair: {data['pair']}, Last: {data['last']}, High: {data['high']}, Low: {data['low']}")
else:
print(f"Error fetching all tickers: {tickers.get('message') if tickers else 'Unknown error'}")
# Get ticker for a specific pair, e.g., 'BTCTRY'
pair_ticker = client.get_ticker_by_pair(pair_symbol='BTCTRY')
if pair_ticker and pair_ticker.get('success'):
print(f"\nBTCTRY Ticker: {pair_ticker['data'][0]['last']}")
else:
print(f"Error fetching BTCTRY ticker: {pair_ticker.get('message') if pair_ticker else 'Unknown error'}")
# --- Private Endpoints (requires API Key and Secret) ---
# Example: Get user's balances (requires authenticated client)
# Note: Replace 'YOUR_API_KEY' and 'YOUR_API_SECRET' with actual credentials
# For security, consider using environment variables for credentials.
# try:
# balances = client.get_all_balances()
# if balances and balances.get('success'):
# print("\nYour Balances:")
# for balance_data in balances['data']:
# print(f" Asset: {balance_data['asset']}, Free: {balance_data['balance']}, Locked: {balance_data['locked']}")
# else:
# print(f"Error fetching balances: {balances.get('message') if balances else 'Unknown error'}")
# except Exception as e:
# print(f"An error occurred during balance fetch: {e}")
This example demonstrates how to initialize the client and make a public API call to retrieve ticker data. For private endpoints, such as fetching account balances or placing orders, ensure proper authentication with valid API keys and secrets.
Community libraries
While BtcTurk provides official SDKs, the developer community also contributes various libraries and tools that can interact with the BtcTurk API. These community-driven projects can offer alternative implementations, specialized functionalities, or support for languages not covered by official SDKs. It is important to note that community libraries may vary in terms of maintenance, security, and feature completeness compared to official offerings.
When considering a community library, developers should:
- Check the repository activity: Look for recent commits, active issue tracking, and responsive maintainers.
- Review the documentation: Ensure the library is well-documented with clear examples.
- Examine the codebase: Verify the code quality and adherence to security best practices, especially when handling API keys or sensitive data.
- Understand the license: Be aware of the licensing terms for open-source projects.
Examples of common community contributions often include:
- Unofficial wrappers: Libraries in languages like Ruby, PHP, or additional JavaScript frameworks.
- Trading bots: Open-source projects designed for automated trading strategies utilizing the BtcTurk API.
- Data analysis tools: Scripts or applications for visualizing BtcTurk market data.
Developers are encouraged to explore platforms like GitHub by searching for BtcTurk API or BtcTurk SDK to discover community-maintained projects. Always exercise caution and perform due diligence before incorporating third-party libraries into production environments, especially those handling financial transactions.