Join our
Discord!
LogoLogo
SupraScan ExplorerStarKey WalletDiscord
  • Network
  • Oracles
  • Automation
  • SupraNova
  • AI Agents
  • Overview
  • Decentralized VRF (dVRF)
    • Developer Guide
    • Migration to dVRF 3.0
    • VRF Subscription FAQ
    • Available Networks
  • Data Feeds
    • Data Feeds Index
    • Pull Oracle
      • Data Pair Conversion
      • Available Networks
    • Push Oracle
      • Available Networks
  • APIs - Real time and Historical data
    • Rest API
    • WebSocket API
    • Price Widgets
  • Indices
    • Creating a new on-chain index
    • Read on-chain Indices
Powered by GitBook

Links

  • Whitepapers
  • Bug Bounty
  • Security Audits

‎

  • Supra Dev Hub
  • Supra Labs Github
  • Entropy Foundation Github
On this page
  • Endpoint: Get Historical Price Data for Trading Pair
  • Query Parameters
  • Endpoint: Get Latest Price Data for Trading Pair
Edit on GitHub
  1. APIs - Real time and Historical data

Rest API

PreviousAPIs - Real time and Historical dataNextWebSocket API

Last updated 1 month ago

Rest API enables users to request the latest price update for multiple data pairs or historical prices up to 1 month for a single data pair. We will enable historical data going back up to 6 months in the near future. History data response will contain OHLC data (Open price, High price, Low price, Close price) for the requested time resolution which will facilitate building candlestick charts.

Important: Please make sure you read and understand before start using Supra products and services.

Base URL

https://prod-kline-rest.supra.com/history

Endpoint: Get Historical Price Data for Trading Pair

Request URL

GET/history

Headers

Header
Value

x-api-key

Query Parameters

Parameter
Type
Description
Example

trading_pair

String

The trading pair for which to retrieve historical data. Example: btc_usd, eth_usd, etc.

btc_usd

startDate

Integer

The starting timestamp for the data range in Unix milliseconds (UTC). This determines the beginning of the data range.

1732014893723

endDate

Integer

The ending timestamp for the data range in Unix milliseconds (UTC). This determines the end of the data range.

1732014910000

Resolution

Integer

The time interval between data points in seconds. Typical intervals could be 15, 30, 60, 3600(1 hour)

86400 ( for 24H resolution)

Example Request

GET https://prod-kline-rest.supra.com/history?
trading_pair=btc_usd&startDate=1732014893723&endDate=1732014910000&int
erval=5

Response

The response contains historical price data for the given trading pair in the specified time range and interval. The response is typically in JSON format.

{
  "status": "success",
  "data": [
	{
  	"timestamp": 1732014893723,
  	"open": 20000.5,
  	"high": 20100.0,
  	"low": 19950.0,
  	"close": 20050.0,
  	"volume": 15.2
	},
	{
  	"timestamp": 1732014898723,
  	"open": 20050.0,
  	"high": 20150.0,
  	"low": 20000.0,
  	"close": 20100.0,
  	"volume": 18.1
	},
	...
  ]
}

Endpoint: Get Latest Price Data for Trading Pair

Request URL

GET /latest

Parameters

Parameter
Type
Description
Example

trading_pair

String

The trading pair for which to retrieve latest price data

btc_usdt

Example Request

GET https://prod-kline-rest.supra.com/latest?trading_pair=btc_usdt

Response

{
    "currentPage": 1,
    "totalPages": 1,
    "totalRecords": 1,
    "pageSize": 10,
    "instruments": [
        {
            "time": "1732175999048",
            "timestamp": "2024-11-21 07:59:59",
            "currentPrice": "96913.07250000001",
            "24h_high": "97849.9",
            "24h_low": "92720",
            "24h_change": "5.5326790336496980",
            "tradingPair": "btc_usdt"
        }
    ]
}

Status Codes

  • 200 OK: The request was successful, and data is returned.

  • 400 Bad Request: The request was invalid or improperly formatted.

  • 404 Not Found: The requested trading pair or data could not be found.

  • 500 Internal Server Error: A server error occurred while processing the request. \

Your Key ( Please request your key )

Terms of Use
here