diff --git a/access-sentio-via-apis/data-api.md b/access-sentio-via-apis/data-api.md index 3984a55..ca4862f 100644 --- a/access-sentio-via-apis/data-api.md +++ b/access-sentio-via-apis/data-api.md @@ -75,8 +75,48 @@ curl -L -X POST 'https://app.sentio.xyz/api/v1/metrics/sentio/coinbase/query_ran "samplesLimit": 20 }' ``` + +### Time Range Configuration Guide +When configuring a time range, you can specify the `start` and `end` times, as well as the `step` interval and `timezone`. Below are the details on how to set these parameters: +1. **Start and End Time**: + - **"now"**: Represents the current time, usually used in the `end` field. + - **"now-x[dmsy]"**: Represents the time range starting from the last specified period until now. For example, `now-30d` means the last 30 days from now. The units can be: + - "s" for seconds + - "m" for minutes + - "d" for days + - "w" for weeks + - "mo" for months + - "y" for years + - **Milliseconds since January 1, 1970, UTC**: You can specify a precise time using the number of milliseconds since the Unix epoch (January 1, 1970, UTC). For example, `1716430188709`. + +2. **Step**: + - The interval time of data in seconds. This controls how frequently data points should appear in your range. For example, if you set `step` to `3600`, data points will appear at one-hour intervals. Please note that the actual step may be adjusted if the interval is short but the date range is long. Typically, the total number of data points should not exceed 1000. + +3. **Timezone**: + - Specify the timezone using the tz database name. You can find the appropriate timezone from this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For example, `America/New_York` or `Asia/Tokyo`. + +#### Example Configuration + +Here’s an example configuration that uses these parameters: + +```json +{ + "start": "now-30d", + "end": "now", + "step": 3600, + "timezone": "America/New_York" +} +``` + +- **Start**: The range starts from 30 days ago. +- **End**: The range ends at the current time. +- **Step**: Data points are provided every hour. +- **Timezone**: The times are adjusted to the Eastern Time Zone (America/New_York). + +This configuration ensures that you get hourly data points for the last 30 days, adjusted to the specified timezone. + ## SQL API