SDKs overview

Nomics offers Software Development Kits (SDKs) and community-contributed libraries to simplify interaction with its cryptocurrency market data API. These SDKs abstract the underlying HTTP requests, authentication mechanisms, and JSON parsing, allowing developers to focus on integrating market data into their applications rather than managing API specifics. The Nomics API provides access to a range of data points, including real-time prices, historical data, exchange rates, and market capitalization for a wide array of cryptocurrencies and exchanges. The SDKs are designed to facilitate rapid development for common use cases such as building portfolio trackers, creating trading bots, or performing historical market analysis.

The core functionality exposed through the SDKs mirrors the capabilities detailed in the Nomics API documentation, encompassing endpoints for current prices, trade volumes, market cap data, and specific currency details. By using an SDK, developers can reduce boilerplate code and ensure adherence to API best practices, such as proper rate limiting and error handling. This approach is consistent with common API integration patterns observed across various platforms, including financial APIs like those from Stripe Payments and communication platforms such as Twilio's messaging services, which also provide SDKs for simplified access.

Official SDKs by language

Nomics maintains official SDKs for several popular programming languages, ensuring direct support and compatibility with the latest API versions. These SDKs are typically the recommended method for integration due to their active maintenance and direct alignment with Nomics's development roadmap. Each official SDK provides a language-idiomatic interface to the API's endpoints, making it easier for developers to work within their preferred programming environment. The table below outlines the officially supported SDKs, their typical package names, and installation commands.

Language Package/Module Name Install Command Maturity
Python nomics-python pip install nomics-python Stable
Node.js nomics-api npm install nomics-api Stable
Ruby nomics-ruby gem install nomics-ruby Stable
Go github.com/nomics/go-nomics go get github.com/nomics/go-nomics Stable
PHP nomics/php-nomics composer require nomics/php-nomics Stable
Java com.nomics:nomics-java Refer to Maven/Gradle setup in Nomics Java SDK documentation Stable

Each SDK is designed to handle common API tasks, including request serialization, response deserialization, and error handling, reducing the amount of custom code developers need to write. For detailed usage instructions and specific method signatures, refer to the individual SDK documentation pages linked from the main Nomics API documentation portal.

Installation

Installing Nomics SDKs typically follows the standard package management practices for each respective programming language. Below are general installation instructions for the most commonly used official SDKs. Ensure you have the corresponding package manager installed and configured in your development environment.

Python SDK

The Python SDK is available via PyPI. Open your terminal or command prompt and execute:

pip install nomics-python

After installation, you can import the library and begin making API calls. Python environments often benefit from virtual environments to manage dependencies; consider using venv or conda for project isolation.

Node.js SDK

For Node.js projects, the SDK is published on npm. Navigate to your project directory in the terminal and run:

npm install nomics-api

This command adds nomics-api to your project's node_modules folder and updates your package.json file. You can then require or import the module in your JavaScript or TypeScript files.

Ruby SDK

The Ruby SDK is distributed as a Gem. Install it using the RubyGems package manager:

gem install nomics-ruby

Once installed, you can require the gem in your Ruby scripts or applications. For Ruby on Rails projects, add gem 'nomics-ruby' to your Gemfile and run bundle install.

Go SDK

Go modules are used for the Go SDK. To add it to your project, use the go get command:

go get github.com/nomics/go-nomics

Then, import the package in your Go source files. Go's module system manages dependencies automatically, ensuring correct versioning.

PHP SDK

The PHP SDK is managed via Composer. If you have Composer installed, navigate to your project directory and run:

composer require nomics/php-nomics

Composer will download the package and set up an autoloader, allowing you to use the SDK classes in your PHP application.

Java SDK

For Java developers, the Nomics SDK is typically integrated using Maven or Gradle. You would add the dependency to your pom.xml (Maven) or build.gradle (Gradle) file. Refer to the specific Nomics Java SDK documentation for the exact dependency coordinates and version numbers, as these can change. An example Maven dependency might look like:

<dependency>
    <groupId>com.nomics</groupId>
    <artifactId>nomics-java</artifactId>
    <version>1.0.0</version> <!-- Replace with actual version -->
</dependency>

Quickstart example

This quickstart demonstrates fetching the current prices for Bitcoin (BTC) and Ethereum (ETH) using the Nomics Python SDK. Before running, ensure you have installed the nomics-python package and have your Nomics API key ready. You can obtain an API key by signing up for a Nomics Developer Plan.

Python Quickstart

First, set your Nomics API key as an environment variable or replace 'YOUR_API_KEY' with your actual key.

import nomics
import os

# It's recommended to store your API key securely, e.g., in an environment variable
# For this example, we'll use a placeholder. Replace with your actual key.
api_key = os.getenv('NOMICS_API_KEY', 'YOUR_API_KEY') 

if api_key == 'YOUR_API_KEY':
    print("WARNING: Please replace 'YOUR_API_KEY' or set the NOMICS_API_KEY environment variable.")
    exit()

# Initialize the Nomics API client
nomics_client = nomics.Nomics(api_key)

try:
    # Fetch current prices for specific currencies (e.g., BTC, ETH)
    # The 'ids' parameter takes a comma-separated string of currency IDs
    currency_info = nomics_client.Currencies.get_currencies(ids='BTC,ETH', attributes='id,name,price')

    print("Current Cryptocurrency Prices:")
    for currency in currency_info:
        currency_id = currency.get('id')
        currency_name = currency.get('name')
        currency_price = currency.get('price')
        print(f"  {currency_name} ({currency_id}): ${currency_price}")

    # Example: Fetch global market cap
    global_metrics = nomics_client.GlobalMetrics.get_global_metrics()
    if global_metrics:
        print(f"\nGlobal Market Cap: ${global_metrics[0].get('market_cap')}")

except nomics.NomicsAPIError as e:
    print(f"Nomics API Error: {e.status_code} - {e.message}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

This Python script initializes the Nomics client with your API key, then uses the Currencies.get_currencies method to retrieve price information for Bitcoin and Ethereum. It also includes an example of fetching global market metrics. The output will display the current price for each requested cryptocurrency and the overall market capitalization.

For more advanced queries, such as historical data, exchange rates, or specific market details, consult the Nomics API reference documentation and the respective SDK's detailed usage guides.

Community libraries

In addition to the official SDKs, the Nomics ecosystem benefits from various community-contributed libraries and integrations. These libraries, often developed by individual developers or open-source contributors, can extend functionality, provide bindings for languages not officially supported, or offer alternative architectural patterns. While not officially supported by Nomics, these community efforts can be valuable resources for specific project requirements or for exploring different approaches to API integration.

When considering a community library, it is advisable to check its maintenance status, documentation quality, and community support. Key considerations include:

  • Active Development: Is the library regularly updated to keep pace with API changes?
  • Documentation: Is there clear and comprehensive documentation for installation and usage?
  • Community Support: Are there active forums, GitHub issues, or other channels for support?
  • License: Is the library released under an open-source license compatible with your project?
  • Security: For critical applications, review the library's code for potential security vulnerabilities.

Examples of where to find community contributions often include GitHub, package managers for less common languages (e.g., Elixir's Hex or Rust's Crates.io), or developer forums. Searching for "Nomics API client [language]" on GitHub or relevant package registries can yield available community options. Always verify compatibility with the current Nomics API version before integrating a community library into a production environment.