Skip to main content
The xChangeAPI returns data in two primary structures depending on the type of request: Live Data (current exchange rates) and Historical Data (past market data). This guide details the properties and schema for both response types to help you parse and utilize the data effectively.
This guide primarily focuses on the JSON response structure. For details on CSV and XML formats, please refer to the Response Formatting guide.

Live Data Structure

Endpoints that provide real-time or latest exchange rates return a JSON object representing the current state of a currency pair.

Example Response

{
    "name": "EURUSD",
    "ask": "1.38488",
    "bid": "1.38477",
    "time": "1398420924.000"
}

Property Definitions

PropertyTypeDescription
namestringThe currency pair symbol (e.g., “EURUSD”).
askstringThe current lowest price a seller is willing to accept.
bidstringThe current highest price a buyer is willing to pay.
timestringUnix timestamp (in seconds) indicating when the quote was generated.
Prices are returned as strings to preserve decimal precision. Ensure you parse them as floats or decimals in your application logic as needed.

Historical Data Structure

Endpoints providing historical market data (such as OHLC candlesticks) return a dictionary where keys are timestamps and values are arrays containing price data for that period.

Example Response

{
    "1396267200": [
        1.3775,
        1.38071,
        1.37837,
        1.37989,
        1.37738,
        1.38055,
        1.37827,
        1.37976
    ],
    "1396274400": [
        1.37716,
        1.38071,
        1.37789,
        1.37758,
        1.37706,
        1.38059,
        1.37777,
        1.37747
    ]
}

Structure Breakdown

The response is a dictionary object:
  • Key: A Unix timestamp (string) representing the start of the time period.
  • Value: An array of 8 floating-point numbers representing the OHLC (Open, High, Low, Close) values for both Ask and Bid prices.
The interval between timestamps corresponds to the requested data resolution (e.g., 1 hour, 1 day).

Array Index Mapping

For JSON responses, the values in the array map to the following properties by index. XML and CSV responses explicitly use these property names as tags or headers.
IndexPropertyDescription
0min_askLowest ask price during the period.
1max_askHighest ask price during the period.
2open_askAsk price at the beginning of the period.
3close_askAsk price at the end of the period.
4min_bidLowest bid price during the period.
5max_bidHighest bid price during the period.
6open_bidBid price at the beginning of the period.
7close_bidBid price at the end of the period.