index/classes/ChartService.md
Chart Service Class
Provides methods for fetching historical chart data.
Example
const chartService = new ChartService(httpClient);
// Get hourly chart data for last 24 hours
const now = Math.floor(Date.now() / 1000);
const oneDayAgo = now - (24 * 60 * 60);
const chart = await chartService.getChart({
tokenName: 'mytoken',
from: oneDayAgo,
to: now,
resolution: 3600
});
Extends
BaseService
base service
Constructors
Constructor
new ChartService(
http,debugMode?):ChartService
Parameters
| Parameter | Type |
|---|---|
http | HttpClient |
debugMode? | boolean |
Returns
ChartService
Overrides
BaseService.constructor
debug mode chart service http client base
Methods
getChart()
getChart(
options):Promise<ChartResult>
Get historical chart data
Retrieve OHLC (Open, High, Low, Close) candlestick data for token price history. Data is aggregated at the specified resolution interval.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | GetChartOptions | Chart fetch options |
Returns
Promise<ChartResult>
Promise resolving to chart data with candlesticks
Example
// Get hourly data for last 24 hours
const now = Math.floor(Date.now() / 1000);
const oneDayAgo = now - (24 * 60 * 60);
const chart = await chartService.getChart({
tokenName: 'anime',
from: oneDayAgo,
to: now,
resolution: 3600
});
console.log(`Got ${chart.dataPoints.length} candlesticks`);
// Get minute-level data for 1 hour
const oneHourAgo = now - 3600;
const minuteChart = await chartService.getChart({
tokenName: 'anime',
from: oneHourAgo,
to: now,
resolution: 60
});
get chart result options
setJwtAuth()
setJwtAuth(
jwtAuth):void
Set the JWT authentication manager. Allows dynamic configuration of JWT auth after service creation.
Parameters
| Parameter | Type | Description |
|---|---|---|
jwtAuth | JwtAuth | JWT auth manager instance |
Returns
void
Inherited from
BaseService.setJwtAuth
set jwt auth base service