Chart URLs

Chart images for token pairs

ℹ️

This endpoint is available on Codex Growth and Enterprise Plans

Endpoint: chartUrls

Method: POST

Overview

The chartUrls endpoint takes token pair arguments and returns a URL to a PNG chart image based on those arguments. The urls returned are signed urls, and as such, they are only valid for a given period of time (max 1 day).

Arguments

NameTypeDescription
inputChartInput!

Input required to fetch a pair chart.

Required

NameTypeDescription
pairPairChartInput

The input required to fetch a pair chart.

Response

NameTypeDescription
pairChartUrl!The pair chart url.

NameTypeDescription
urlString!The chart url.

Notes

  • The maximum number of candles is 300. So if you supply a to/from range and a resolution value, then (to - from)/resolution-in-seconds must be less than 300.

Example

Chart Urls Query

Use this query to get a chart url for a given pair

{
  chartUrls(input: {
    pair: {
      chartSettings: {
        pairAddress: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", 
        networkId: 1, 
        theme: DARK, 
        to: 1687197438, 
        from: 1687111038, 
        quoteToken: token0, 
        resolution: "5"
      }, 
      imageOptions: {
        width: 800,
        height: 400,
        expirationSeconds: 300
      }
    }
  }) {
    pair {
      url
    }
  }
}

Chart Url Response
{
  "data": {
    "chartUrls": {
      "pair": {
        "url": "https://chart-images.defined.fi/pair/eth/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640?to=1687197438&from=1687111038&quoteToken=token0&resolution=5&theme=DARK&height=400&width=800&Expires=1687197816&Key-Pair-Id=K2GDH5ACKVTCVS&Signature=G4woxdC1ej3uIc7u~GoM3gp8dvn0tCXJrhbjOenP5l-dBjEsuqeArpQiceWRmNQUugDWWyxF03OdGAY4NMS7kCcxgpGnyZqpy~F9rIF1OhXKhw1tO0Ue7lgiUhyd6IbApDY6-EavpbBVLocv9pYYCZC0z-nY8S4tDgzHav~bmNvxcbxZ6tHwh4wcImWCUeuTWYzdJI3Ynq5gnbGdzrVOtrbFDq02iSGNQlJJEDxF5e6t0EvvwYdWKJ79L49--Wz5tm-liM9L3z4V5gS6HRWdBu4sDihV4k6Bab1CyGOawKCcWZVqDHMYwVz7KWreEpRUsB8qyI83S~Ozz5G9a4dBGA__"
      }
    }
  }
}