Skip to content

Developers

REST API reference

Read instruments, historical bars and ticks, and currency rates. Every endpoint accepts GET only, is served over HTTPS (plain HTTP is redirected), and spends API credits from your plan.

Base URL: https://price.cloud9trader.com/v1

Authentication: send your API key in the x-c9t-key header. Create a key in API Access in your account settings. The REST API does not need the secret. See Authentication and keys.

Credits: each endpoint states its cost. See Credits and limits.

Errors that any endpoint can return. Error bodies are plain text. See Errors.

Status Meaning
401 The x-c9t-key header is missing, or the key is wrong or revoked.
429 Not enough credits left in your 24-hour or 30-day allowance. Wait for credits to free up, or upgrade your plan.
500 Something failed on the server. Retry after a short wait.
Endpoint Method and path Credits
List instruments GET /instruments 1 credit.
Get historical prices GET /historical 1 credit per 1,000 bars returned, or 1 credit per 12 hours of ticks requested.
List currencies GET /currencies 1 credit.
List top currencies GET /currencies/top 1 credit per currency requested.
Get currency rates GET /currency/{symbol} 1 credit per quote currency returned.
Get historical currency rates GET /currency/{symbol}/historical 1 credit per 1,000 bars returned.
GET https://price.cloud9trader.com/v1/instruments

Every instrument you can trade, across all brokers and exchanges, with its trading settings.

Credits: 1 credit.

curl
curl -H "x-c9t-key: $C9T_API_KEY" "https://price.cloud9trader.com/v1/instruments"
TypeScript
const url = new URL("https://price.cloud9trader.com/v1/instruments")
const response = await fetch(url, { headers: { "x-c9t-key": process.env.C9T_API_KEY! } })
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`)
const data = await response.json()
Python
import os, requests
response = requests.get(
"https://price.cloud9trader.com/v1/instruments",
headers={"x-c9t-key": os.environ["C9T_API_KEY"]},
)
response.raise_for_status()
data = response.json()
Status Meaning
200 The instruments.
401 The x-c9t-key header is missing, or the key is wrong or revoked.
429 Not enough credits left in your 24-hour or 30-day allowance. Wait for credits to free up, or upgrade your plan.
500 Something failed on the server. Retry after a short wait.

Example 200 response:

[
{
"id": "EUR_USD:OANDA",
"broker": "OANDA",
"symbol": "EUR_USD",
"displaySymbol": "EUR/USD",
"displayName": "EUR/USD",
"product": "Forex",
"productId": 1,
"dealt": "EUR",
"quote": "USD",
"precision": 5,
"pip": "0.0001",
"pipSize": 0.0001,
"pipPrecision": 1,
"maxTradeUnits": 10000000,
"maxQuantity": 10000000,
"minTrailingStop": 5,
"maxTrailingStop": 10000,
"marginRate": 0.05,
"contractMultiplier": 1,
"factor": 1,
"lotSize": 1
}
]
GET https://price.cloud9trader.com/v1/historical

Bid and ask bars for an instrument at an interval, or raw ticks. Bars are returned as arrays to keep responses small.

Credits: 1 credit per 1,000 bars returned, or 1 credit per 12 hours of ticks requested.

Limits:

  • A request returns at most 2,500 bars. A longer range is shortened to the 2,500 bars that end at end.
  • A tick request covers at most 1 day.
  • Sub-minute bar intervals (S5, S15, S30) are not available.
  • If start is before the first price held for that instrument and interval, the bars start at the first price held.
Name In Required Type Description Example
instrumentId query Yes string The instrument id, from List instruments. EUR_USD:OANDA
interval query Yes Tick, M1, M2, M5, M10, M15, M30, H1, H2, H4, H8, H12, D1 The bar interval, or Tick for raw ticks. M15
start query Yes string, date-time Start of the range, ISO 8601. 2024-04-02T00:00:00.000Z
end query No string, date-time End of the range, ISO 8601. Defaults to now. 2024-04-03T00:00:00.000Z
curl
curl -H "x-c9t-key: $C9T_API_KEY" "https://price.cloud9trader.com/v1/historical?instrumentId=EUR_USD%3AOANDA&interval=M15&start=2024-04-02T00%3A00%3A00.000Z"
TypeScript
const url = new URL("https://price.cloud9trader.com/v1/historical")
url.searchParams.set("instrumentId", "EUR_USD:OANDA")
url.searchParams.set("interval", "M15")
url.searchParams.set("start", "2024-04-02T00:00:00.000Z")
const response = await fetch(url, { headers: { "x-c9t-key": process.env.C9T_API_KEY! } })
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`)
const data = await response.json()
Python
import os, requests
response = requests.get(
"https://price.cloud9trader.com/v1/historical",
params={"instrumentId": "EUR_USD:OANDA", "interval": "M15", "start": "2024-04-02T00:00:00.000Z"},
headers={"x-c9t-key": os.environ["C9T_API_KEY"]},
)
response.raise_for_status()
data = response.json()
Status Meaning
200 Bars, oldest first, each [time, bid open, bid high, bid low, bid close, ask open, ask high, ask low, ask close, volume]. For Tick, ticks, each [time, bid, ask].
400 The request is invalid. The plain-text body says why, for example a missing parameter, an unknown interval, an end before the start, a sub-minute interval, a tick range over 1 day, or no prices held for that instrument and interval.
401 The x-c9t-key header is missing, or the key is wrong or revoked.
429 Not enough credits left in your 24-hour or 30-day allowance. Wait for credits to free up, or upgrade your plan.
500 Something failed on the server. Retry after a short wait.

Example 200 response:

[
[
"2024-04-02T00:00:00.000Z",
1.07412,
1.07431,
1.07398,
1.0742,
1.07425,
1.07444,
1.07411,
1.07433,
1123
],
[
"2024-04-02T00:15:00.000Z",
1.0742,
1.07427,
1.07402,
1.07409,
1.07433,
1.0744,
1.07415,
1.07422,
987
]
]
GET https://price.cloud9trader.com/v1/currencies

Every currency with rates, by symbol and name.

Credits: 1 credit.

curl
curl -H "x-c9t-key: $C9T_API_KEY" "https://price.cloud9trader.com/v1/currencies"
TypeScript
const url = new URL("https://price.cloud9trader.com/v1/currencies")
const response = await fetch(url, { headers: { "x-c9t-key": process.env.C9T_API_KEY! } })
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`)
const data = await response.json()
Python
import os, requests
response = requests.get(
"https://price.cloud9trader.com/v1/currencies",
headers={"x-c9t-key": os.environ["C9T_API_KEY"]},
)
response.raise_for_status()
data = response.json()
Status Meaning
200 The currencies, sorted by symbol.
401 The x-c9t-key header is missing, or the key is wrong or revoked.
429 Not enough credits left in your 24-hour or 30-day allowance. Wait for credits to free up, or upgrade your plan.
500 Something failed on the server. Retry after a short wait.

Example 200 response:

[
{
"symbol": "BTC",
"name": "Bitcoin"
},
{
"symbol": "EUR",
"name": "Euro"
},
{
"symbol": "USD",
"name": "US Dollars"
}
]
GET https://price.cloud9trader.com/v1/currencies/top

The currencies with rates, with their current rates in US dollars, major currencies first.

Credits: 1 credit per currency requested.

Name In Required Type Description Example
count query No integer How many currencies to return, from 1 to 5,000. Defaults to 100. 20
curl
curl -H "x-c9t-key: $C9T_API_KEY" "https://price.cloud9trader.com/v1/currencies/top"
TypeScript
const url = new URL("https://price.cloud9trader.com/v1/currencies/top")
const response = await fetch(url, { headers: { "x-c9t-key": process.env.C9T_API_KEY! } })
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`)
const data = await response.json()
Python
import os, requests
response = requests.get(
"https://price.cloud9trader.com/v1/currencies/top",
headers={"x-c9t-key": os.environ["C9T_API_KEY"]},
)
response.raise_for_status()
data = response.json()
Status Meaning
200 The currencies, major currencies first.
400 count is not a whole number from 1 to 5,000. The plain-text body says why.
401 The x-c9t-key header is missing, or the key is wrong or revoked.
429 Not enough credits left in your 24-hour or 30-day allowance. Wait for credits to free up, or upgrade your plan.
500 Something failed on the server. Retry after a short wait.
GET https://price.cloud9trader.com/v1/currency/{symbol}

The current rate of one currency against others, with its 24-hour change.

Credits: 1 credit per quote currency returned.

Name In Required Type Description Example
symbol path Yes string The currency symbol, from List currencies. BTC
quote query No string Comma-separated currencies to quote it in. Defaults to USD. USD,EUR
curl
curl -H "x-c9t-key: $C9T_API_KEY" "https://price.cloud9trader.com/v1/currency/BTC"
TypeScript
const url = new URL("https://price.cloud9trader.com/v1/currency/BTC")
const response = await fetch(url, { headers: { "x-c9t-key": process.env.C9T_API_KEY! } })
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`)
const data = await response.json()
Python
import os, requests
response = requests.get(
"https://price.cloud9trader.com/v1/currency/BTC",
headers={"x-c9t-key": os.environ["C9T_API_KEY"]},
)
response.raise_for_status()
data = response.json()
Status Meaning
200 The currency and its quotes.
401 The x-c9t-key header is missing, or the key is wrong or revoked.
404 No currency has that symbol. The body is empty.
429 Not enough credits left in your 24-hour or 30-day allowance. Wait for credits to free up, or upgrade your plan.
500 Something failed on the server. Retry after a short wait.

Example 200 response:

{
"currency": "BTC",
"name": "Bitcoin",
"quotes": {
"USD": {
"price": 66159.73,
"percentChange24h": 1.593,
"updated": "2024-04-02T13:59:59.874Z"
},
"EUR": {
"price": 61308.21,
"percentChange24h": 0.8295,
"updated": "2024-04-02T13:59:59.060Z"
}
}
}
GET https://price.cloud9trader.com/v1/currency/{symbol}/historical

Bars of a currency’s US dollar rate, averaged across the exchanges Cloud9Trader takes prices from. History is kept for those currencies only: any other symbol returns an empty list.

Credits: 1 credit per 1,000 bars returned.

Limits:

  • A request returns at most 2,500 bars. A longer range is shortened to the 2,500 bars that end at end.
  • Tick and sub-minute intervals are not available.
Name In Required Type Description Example
symbol path Yes string The currency symbol, from List currencies. BTC
interval query Yes M1, M2, M5, M10, M15, M30, H1, H2, H4, H8, H12, D1 The bar interval. H1
start query Yes string, date-time Start of the range, ISO 8601. 2024-04-01T00:00:00.000Z
end query No string, date-time End of the range, ISO 8601. Defaults to now. 2024-04-02T00:00:00.000Z
curl
curl -H "x-c9t-key: $C9T_API_KEY" "https://price.cloud9trader.com/v1/currency/BTC/historical?interval=H1&start=2024-04-01T00%3A00%3A00.000Z"
TypeScript
const url = new URL("https://price.cloud9trader.com/v1/currency/BTC/historical")
url.searchParams.set("interval", "H1")
url.searchParams.set("start", "2024-04-01T00:00:00.000Z")
const response = await fetch(url, { headers: { "x-c9t-key": process.env.C9T_API_KEY! } })
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`)
const data = await response.json()
Python
import os, requests
response = requests.get(
"https://price.cloud9trader.com/v1/currency/BTC/historical",
params={"interval": "H1", "start": "2024-04-01T00:00:00.000Z"},
headers={"x-c9t-key": os.environ["C9T_API_KEY"]},
)
response.raise_for_status()
data = response.json()
Status Meaning
200 Bars, oldest first.
400 The request is invalid. The plain-text body says why.
401 The x-c9t-key header is missing, or the key is wrong or revoked.
429 Not enough credits left in your 24-hour or 30-day allowance. Wait for credits to free up, or upgrade your plan.
500 Something failed on the server. Retry after a short wait.

Example 200 response:

[
{
"time": "2024-04-01T00:00:00.000Z",
"open": 69702.31,
"high": 69810.02,
"low": 69611.45,
"close": 69750.88
}
]