Introduction
You've reached the CTX Rates API!
The aim of this project is to provide reliable real-time market data for Dash/Fiat currency pairs by aggregating prices across numerous rate sources.
We've been operating with 99.99% uptime since 2019 serving millions of requests!
Please note that while we aim for maximum site reliability, we don't offer any uptime guarantees.
Endpoints
List Rates
Request
curl "https://rates.ctx.com/rates?source=ctx&symbol=dashusd"
Response
[
{
"baseCurrency": "DASH",
"price": "123.45",
"quoteCurrency": "USD",
"retrieved": "2019-04-22T00:00:00.00000000Z",
"source": "ctx-average",
"symbol": "DASHUSD"
}
]
Lists the rates from various sources combined with our calculated rates in one large response. Use query parameters to filter down to your specific use case. See examples below.
Different sources are weighted differently, which means we can put more trust in exchanges we know to be reliable, or in rates which are more current. Supply the nested
query paramter to see the details on how we're calculating rates.
Query Parameters
Parameter | Description |
---|---|
nested | Request all the data used to calculate each rate. Set to 1 to enable, the default is 0 |
source | A comma separated list of sources to filter down to. Use the name property from sources list. While not in the sources list, you can specify the ctx source to filter to just our calculated rates. |
symbol | A comma separated list of symbols to filter down to. Use the name property from symbol list, without the delimeter. |
Compare Rates Across Exchanges
Request
curl "https://rates.ctx.com/rates?source=bitfinex,bitstamp,localbitcoins,dashcasa,hitbtc,oneforge,dailyfx&symbol=btcusd"
If your intention is to power a rate comparison widget, such as the "where to buy" table on Dash.org you could specify multiple exchanges, and a single currency.
Calculate Wallet Balance
Request
curl "https://rates.ctx.com/rates?source=ctx&symbol=dashusd,btcusd,ltcusd,ethusd"
To show total wallet balance for a multi-coin wallet, you may want to query numerous coins at once:
Recalculate Average
Request
curl "https://rates.ctx.com/rates?symbol=dashcop&nested=1"
Response
[
{
"baseCurrency": "DASH",
"inversed": false,
"price": "391574.4066",
"quoteCurrency": "COP",
"retrieved": "2019-04-22T00:00:00.00000000Z",
"source": "dashcasa",
"symbol": "DASHCOP",
"weight": 100
},
{
"baseCurrency": "DASH",
"inversed": false,
"nested": [
{
"baseCurrency": "DASH",
"inversed": false,
"nested": [
{
"baseCurrency": "DASH",
"inversed": true,
"nested": [
{
"baseCurrency": "BTC",
"inversed": false,
"price": "44.32000000",
"quoteCurrency": "DASH",
"retrieved": "2019-04-22T00:00:00.00000000Z",
"source": "localbitcoins",
"symbol": "BTCDASH",
"weight": 100
},
{
"baseCurrency": "BTC",
"inversed": false,
"price": "43.15013226",
"quoteCurrency": "DASH",
"retrieved": "2019-04-22T00:00:00.00000000Z",
"source": "poloniex",
"symbol": "BTCDASH",
"weight": 100
}
],
"price": "0.02286495",
"quoteCurrency": "BTC",
"retrieved": "2019-04-22T00:00:00.00000000Z",
"source": "ctx-average",
"symbol": "DASHBTC",
"weight": 100
},
{
"baseCurrency": "BTC",
"inversed": false,
"price": "15809501.8300",
"quoteCurrency": "COP",
"retrieved": "2019-04-22T00:00:00.00000000Z",
"source": "localbitcoins",
"symbol": "BTCCOP",
"weight": 100
}
],
"price": "361483.4326",
"quoteCurrency": "COP",
"retrieved": "2019-04-22T00:00:00.00000000Z",
"source": "ctx-composite",
"symbol": "DASHCOP",
"weight": 100
},
{
"baseCurrency": "DASH",
"inversed": false,
"price": "391574.4066",
"quoteCurrency": "COP",
"retrieved": "2019-04-22T00:00:00.00000000Z",
"source": "dashcasa",
"symbol": "DASHCOP",
"weight": 100
}
],
"price": "376528.9196",
"quoteCurrency": "COP",
"retrieved": "2019-04-22T00:00:00.00000000Z",
"source": "ctx-average",
"symbol": "DASHCOP",
"weight": 100
}
]
Perhaps you don't trust an exchange at all, and want to recalculate our average rate for a currency pair without including that exchange:
It may look a bit much, but the following response is showing two rates. The first is a direct rate from dashcasa, and the second was calculated as follows:
• Getting the DASH/BTC rate by averaging localbitcoins and poloniex.
• Getting the BTC/COP rate from localbitcoins.
• Combining the above rates into a composite for DASH/COP i.e. DASH/BTC => BTC/COP
• Getting the DASH/COP rate from dashcasa.
• Averaging the dashcasa and the composite DASH/COP rates.
Supplying the nested=1
parameter gives you the ability to follow the above steps, making modifications to the calculation to suit your use-case.
List Sources
Request
curl "https://rates.ctx.com/sources"
Response
[
{
"active": true,
"connection": "stream",
"name": "binance",
"weight": 100
},
{
"active": true,
"connection": "stream",
"name": "bitfinex",
"weight": 100
}
]
List the current rate sources and the connection status for each one.
Response Fields
Parameter | Description |
---|---|
active | Returns true when the connection is healthy and data is being retrieved. |
connection | Will be stream for persistent connections and poll otherwise. |
name | Our key for the source, to be used as a filter when using the list rates endpoint. |
weight | The default weight for rates from this source. |
Disconnection
Sources can disconnect for a number of reasons including network connection errors, outages, compatability breaks, or if different rate-limits are enforced. We automatically retry connections when they fail, and are immediately notified if any drop out. In the event of a disconnection, rates are calculated using the remaining sources.
List Symbols
Request
curl "https://rates.ctx.com/symbols"
Response
[
"BTC/DASH",
"DASH/CAD",
"DASH/COP",
"DASH/EUR",
"DASH/GBP",
"DASH/USD",
"DASH/VES"
]
List the currently supported symbols.