# README
Go API client for nomics
Introduction
Welcome to the Nomics Cryptocurrency & Bitcoin API. To sign up for an API key please go here.
nomics.com is built entirely with the Nomics API. Everything we've done on nomics.com you can do with our API. There are no internal API endpoints.
If you need support, reach out to use at our forums.
General
API Server URL
The Nomics API runs at https://api.nomics.com/v1
. All requests should be prefixed
by the server URL.
JSON and CSV Support
By default, all endpoints serve data as JSON. However, by passing format=csv
in the URL,
some endpoints will return CSV data. This can be used in Google Sheets via the IMPORTDATA
function.
CSV responses will not contain a header row, this is so that data can be easily concatenated from multiple requests. The fields will be rendered in the same order as the JSON fields. See the endpoint's documentation for an example.
Not all endpoints support CSV. Endpoints that support CSV will have the format
parameter in
the parameters section.
Errors
The Nomics API uses standard HTTP status codes to indicate success or failure. 200 represents success, 4xx represents a user error (such as a problem with your key), and 5xx represents a problem with our API.
Versioning
We follow Semantic Versioning. That means our API is versioned as Major.Minor.Patch. For example, Version 1.2.3 has major version 1, minor version 2, and patch version 3.
Major version changes indicate that we have altered the API significantly and it is no longer compatible with a previous version. Major versions are also used as the API URL prefix.
When we update the major version, we will not remove the previous version without notice to API customers and a deprecation period to allow everyone to smoothly update to the new version.
Minor version changes indicate that we have added new functionality without breaking any existing functionality. An API client is compatible with future minor versions. Note that a minor version update may add a new field to an existing API endpoint's response. Your API client must ignore fields it does not understand in order to be compatible with future minor versions.
Patch version changes indicate we fixed a bug or security vulnerability. Patch versions don't add new functionality.
Cross Origin Resource Sharing (CORS)
This API supports Cross Origin Resource Sharing, which allows you to make API requests directly from your user's browser.
To use CORS, you must provide Nomics with the domains on which your application will run so that we can whitelist them for CORS access.
Requests from localhost
, 127.0.0.1
, and 0.0.0.0
will always succeed to aid in development.
Demo Application
A demo application using the Nomics API, CORS, and React is available on Glitch.com. This can help you get started using the Nomics API. Keep in mind it uses the demo key, which is rotated frequently. You should get your own API key before deploying an app to production. Check it out:
Demo Spreadsheet
Here is a demo of using the Nomics API with Google Sheets.
Formulas
- A2:
=IMPORTDATA(\"https://api.nomics.com/v1/prices?key=your-key-here&format=csv\")
- Column F:
=LOOKUP(D2,A:A,B:B)
finds D2 (BTC) in column A and pulls the price from column B - Column G:
=E2*F2
- Column H:
=G2/I$2
- Column I:
=SUM(G:G)
SDKs and Libraries
By Nomics
Community Submissions
- Nomics.com Swift SDK by Nick DiZazzo
- Nomics Node.js Library by mikunimaru
- Nomics Python Wrapper by Taylor Facen
- Python Wrapper for Nomics by Avi Felman
We love watching developers explore new use-cases with our API. Whether you're tinkering on a small side project or building an open-source resource, please share what you're up to in our forums.
Authentication
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 1.0.0
- Package version: 0.1.0
- Build date: 2021-04-26T23:25:43.623260100-07:00[America/Los_Angeles]
- Build package: org.openapitools.codegen.languages.GoClientExperimentalCodegen
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import sw "./nomics"
Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
Select Server Configuration
For using other server than the one defined on index 0 set context value sw.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)
Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
URLs Configuration per Operation
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identifield by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
Documentation for API Endpoints
All URIs are relative to https://api.nomics.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
CandlesApi | GetCandles | Get /candles | Aggregated OHLCV Candles |
CandlesApi | GetExchangeCandles | Get /exchange_candles | Exchange OHLCV Candles |
CandlesApi | GetMarketCandles | Get /markets/candles | Aggregated Pair OHLCV Candles |
CurrenciesApi | GetCurrencies | Get /currencies | Currencies Metadata |
CurrenciesApi | GetCurrenciesSparkline | Get /currencies/sparkline | Currencies Sparkline |
CurrenciesApi | GetCurrenciesTicker | Get /currencies/ticker | Currencies Ticker |
CurrenciesApi | GetSupplyHistory | Get /supplies/history | Supply History |
DeprecatedApi | GetCurrenciesInterval | Get /currencies/interval | Currencies Interval |
DeprecatedApi | GetCurrencyHighs | Get /currencies/highs | All Time Highs |
DeprecatedApi | GetDashboard | Get /dashboard | Dashboard |
DeprecatedApi | GetExchangeMarketInterval | Get /exchange-markets/interval | Exchange Market Interval |
DeprecatedApi | GetExchangeMarketPrices | Get /exchange-markets/prices | Exchange Market Prices |
DeprecatedApi | GetExchangeRatesInterval | Get /exchange-rates/interval | Exchange Rates Interval |
DeprecatedApi | GetMarketCapSparkline | Get /market-cap/sparkline | Market Cap Sparkline |
DeprecatedApi | GetMarketInterval | Get /markets/interval | Market Interval |
DeprecatedApi | GetMarketPrices | Get /markets/prices | Market Prices |
DeprecatedApi | GetPrices | Get /prices | Prices |
DeprecatedApi | GetSparkline | Get /sparkline | Sparkline |
DeprecatedApi | GetSuppliesInterval | Get /supplies/interval | Supplies Interval |
ExchangeRatesApi | GetExchangeRates | Get /exchange-rates | Exchange Rates |
ExchangeRatesApi | GetExchangeRatesHistory | Get /exchange-rates/history | Exchange Rates History |
ExchangesApi | GetExchangeVolumeHistory | Get /exchanges/volume/history | Exchanges Volume History |
ExchangesApi | GetExchanges | Get /exchanges | Exchanges Metadata |
ExchangesApi | GetExchangesTicker | Get /exchanges/ticker | Exchanges Ticker |
GlobalApi | GetGlobalTicker | Get /global-ticker | Global Ticker |
MarketsApi | GetExchangeMarketsTicker | Get /exchange-markets/ticker | Exchange Markets Ticker |
MarketsApi | GetMarketCapHistory | Get /market-cap/history | Market Cap History |
MarketsApi | GetMarkets | Get /markets | Markets |
OrdersApi | GetOrderBookBatches | Get /orders/batches | Order Book Batches |
OrdersApi | GetOrderBookSnapshot | Get /orders/snapshot | Order Book Snapshot |
PredictionsApi | GetCurrenciesPredictionsHistory | Get /currencies/predictions/history | Currency Predictions History |
PredictionsApi | GetCurrenciesPredictionsTicker | Get /currencies/predictions/ticker | Currency Predictions Ticker |
TradesApi | GetTrades | Get /trades | Trades |
VolumeApi | GetVolumeHistory | Get /volume/history | Global Volume History |
Documentation For Models
- CandlesVolumeTransparency
- CurrenciesPredictionsTickerPredictions
- CurrenciesTickerInterval
- Dashboard
- ExchangeMarketsTickerInterval
- ExchangeRate
- ExchangesTickerInterval
- GlobalTickerInterval
- InlineResponse200
- InlineResponse2001
- InlineResponse20010
- InlineResponse20011
- InlineResponse20012
- InlineResponse20013
- InlineResponse20014
- InlineResponse20015
- InlineResponse20016
- InlineResponse20017
- InlineResponse20018
- InlineResponse20019
- InlineResponse2002
- InlineResponse20020
- InlineResponse20021
- InlineResponse20022
- InlineResponse20022Predictions
- InlineResponse20023
- InlineResponse20024
- InlineResponse20025
- InlineResponse20026
- InlineResponse20027
- InlineResponse2003
- InlineResponse2004
- InlineResponse2005
- InlineResponse2006
- InlineResponse2007
- InlineResponse2008
- InlineResponse2009
- MarketCapSparklineRow
- MarketInterval
- Price
- SparklineRow
- Trade
Documentation For Authorization
Key
- Type: API key
- API key parameter name: key
- Location: URL query string
Note, each API key must be added to a map of map[string]APIKey
where the key is: key and passed in as the auth context for each request.
Documentation for Utility Methods
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime