Analyzing Tron (TRX) Price Trends Over the Past 24 Hours with Indices-API Time-Series Data
You need to answer a concrete question: Did Tron (TRX) rise or fall over the past 24 hours, and by how much? By the end of this guide you’ll query Indices-API time-series data for TRX, compute the 24-hour return and max drawdown, and know how to integrate it into dashboards or alerts without tripping on caching, update cadence, or date boundaries.
What we’ll analyze: a 24-hour TRX move and risk profile
The job is straightforward:
- Pull a two-day daily time window for TRX so we can approximate the last 24 hours (yesterday vs. the day before).
- Compute 24-hour percentage return from daily closing values.
- Compute maximum drawdown over the same window to profile intraperiod downside (using daily closes for simplicity).
We’ll do this with the /timeseries endpoint and supplement with a quick sanity check from the latest endpoint for context. If you’re unsure about the exact symbol code, confirm it on the Indices-API Supported Symbols page. For this walkthrough, we’ll use TRX.
Endpoints used and date windows
We’ll use two endpoints:
- /timeseries — daily historical rates between start_date and end_date (the backbone for the 24-hour change).
- /latest — a quick sanity check of the most recent rate when you need to show “now” alongside the 24-hour stat.
Time-series data is daily. To represent the last 24 hours for an asset that trades 24/7 (TRX), we compare the two most recent available calendar days. Important: end_date cannot be today. If today is 2026-10-13, set end_date=2026-10-12 and start_date=2026-10-11. That gives you two days of daily data covering the prior 24-hour change.
Authentication is via an access_key query parameter. If you don’t have a key yet, you can Register for free and start testing within minutes.
Call the time-series endpoint for TRX (one complete curl)
This example requests two days of daily data to calculate a 24-hour change. Replace YOUR_API_KEY with your key. The base is USD by default and is what we’ll use here (rates expressed as USD per TRX):
curl "https://indices-api.com/api/timeseries?access_key=YOUR_API_KEY&symbols=TRX&base=USD&start_date=2026-10-11&end_date=2026-10-12"
Notes:
- symbols=TRX requests Tron specifically.
- base=USD keeps all quotes in USD terms. If you need a different base (e.g., RON), see “Base currency and conversion” below and the Documentation for details.
- start_date and end_date are inclusive daily bounds. end_date cannot be today.
Official JSON example and how to read it
Below is a real Indices-API JSON example you can use to validate your parser. It shows how key fields like timestamp, date, base, and rates appear. While this specific payload is not the timeseries format, it uses the same core field semantics that you will also read from /timeseries responses (base and rates are critical for pricing and returns):
{"data":{"success":true,"timestamp":1791852000,"date":"2026-10-13","base":"USD","rates":{"TRX":3.0385900941963e-6,"USD":1,"USDTRX":329099.99999999924}}}
What you’ll use:
- data.success: Indicates the request succeeded.
- data.timestamp: UNIX time for the quote snapshot.
- data.date: The calendar date associated with the snapshot.
- data.base: Base currency for all rates, here “USD”.
- data.rates: A dictionary of symbols to rates.
- data.rates.TRX: Price of 1 TRX in USD (USD per TRX). The small number reflects a sub-dollar price typical for TRX when quoted as USD per unit.
- data.rates.USD: Convenience identity rate.
- data.rates.USDTRX: Inverse pair (USD to TRX), useful for conversions.
For /timeseries, you will receive a similar set of fields at the top level (success, base, start_date, end_date) and a rates object keyed by date. Each date key then contains per-symbol quotes for that day, which you’ll use to compute period returns and drawdowns.
Python: compute 24-hour return and max drawdown from the /timeseries response
The snippet below fetches TRX daily data for a two-day window and computes:
- 24-hour return: (last_close / prev_close) - 1
- Max drawdown (daily-close approximation): maximum observed peak-to-trough decline over the retrieved window
import os
import requests
from datetime import date, timedelta
API_KEY = os.getenv("INDICES_API_KEY", "YOUR_API_KEY")
# Choose a two-day window ending yesterday
today = date(2026, 10, 13) # Pin the example to match this article's timeline
end_date = today - timedelta(days=1) # 2026-10-12
start_date = end_date - timedelta(days=1) # 2026-10-11
params = {
"access_key": API_KEY,
"symbols": "TRX",
"base": "USD",
"start_date": start_date.isoformat(),
"end_date": end_date.isoformat(),
}
url = "https://indices-api.com/api/timeseries"
resp = requests.get(url, params=params, timeout=15)
resp.raise_for_status()
data = resp.json()
# Expected /timeseries shape (fields used below):
# {
# "success": true,
# "timeseries": true,
# "start_date": "YYYY-MM-DD",
# "end_date": "YYYY-MM-DD",
# "base": "USD",
# "rates": {
# "YYYY-MM-DD": {"TRX": <float>},
# "YYYY-MM-DD": {"TRX": <float>}
# }
# }
if not data.get("success"):
raise RuntimeError("API call did not succeed")
base = data.get("base")
if base != "USD":
# This code expects USD per TRX. Adjust math if you change base.
raise ValueError(f"Unexpected base: {base}")
series = data.get("rates", {})
# Extract and order by date
dates = sorted(series.keys())
if len(dates) < 2:
raise ValueError("Not enough data points to compute a 24-hour change")
# Daily closes (assuming the single daily rate represents the daily close)
prices = [series[d]["TRX"] for d in dates]
prev_close, last_close = prices[0], prices[-1]
period_return = (last_close / prev_close) - 1
# Max drawdown using daily closes
max_drawdown = 0.0
peak = prices[0]
for p in prices:
if p > peak:
peak = p
dd = (p / peak) - 1
if dd < max_drawdown:
max_drawdown = dd
print("Window:", dates[0], "to", dates[-1])
print("Prev close (USD per TRX):", prev_close)
print("Last close (USD per TRX):", last_close)
print("24h return:", period_return)
print("Max drawdown (daily-close approx):", max_drawdown)
Implementation notes:
- Indices-API quotes are by default relative to USD (USD per unit). Keep that in mind when interpreting small decimal values for sub-dollar assets like TRX.
- If you change the base currency, be explicit about whether you’re handling price or its inverse.
- /timeseries returns calendar days. For crypto, values should be available on weekends as well; for equity indices, expect missing values on non-trading days.
How time-series data is structured for TRX
For /timeseries responses, the payload you’ll use looks like this structurally:
- success: Boolean indicator.
- timeseries: Boolean indicator confirming timeseries mode.
- start_date and end_date: Boundaries for the returned series (inclusive).
- base: Currency in which all rates are expressed (USD by default).
- rates: Object keyed by ISO date strings. Each date key has symbol-level quotes.
For example, to read the TRX close on 2026-10-12 you would use rates["2026-10-12"]["TRX"]. You can then compute returns, drawdowns, and rolling stats. If you need OHLC candles or intraday intervals, see the OHLC and intraday endpoints in the Documentation.
Optional: sanity-check the “now” price with /latest
While the 24-hour change uses yesterday vs. the day before, it’s common to display a “live” quote alongside it. The /latest endpoint returns the most recent snapshot, updated as frequently as your plan allows (for example, every 60 or every 10 minutes). Use it for context, but do not mix “today” into your end_date because end_date cannot be today for /timeseries.
Parse /latest using the same field semantics demonstrated in the official example payload above (base and rates).
Base currency, units, and conversion
By default, Indices-API quotes are returned with base=USD, so rates.TRX is the USD price per 1 TRX (USD per TRX). Tiny decimals are expected. If you prefer to compute and present returns in a different base (for example, Romanian Leu, RON), you have two options:
- Set base=RON in your /timeseries and /latest requests if supported for the symbol set you need.
- Or keep base=USD and convert end results using the Convert endpoint. This can be useful when you maintain a single USD series and render multi-currency views on demand.
If you’re working in RON because your users settle in Romanian Leu, keep in mind that returns are base-currency invariant when computed from same-currency prices, but absolute levels and notional P&L will differ. Confirm symbol support and base behavior on the Indices-API Supported Symbols page and the Documentation.
Trading days, weekends, and the 24-hour window
TRX trades 24/7. The /timeseries endpoint returns calendar-day quotes, so you shouldn’t see gaps for weekends on TRX. For exchange-traded indices (e.g., equity benchmarks), you will see gaps on non-trading days; the same client code works but you must handle sparse calendars. For daily approximations of a “last 24 hours” change, compare the most recent two available dates in the response rather than assuming every day is present.
Update frequency, caching, and end_date rules
- Update frequency: The /latest endpoint updates as frequently as allowed by your subscription (for example, every 60 or every 10 minutes). Time-series values reflect those daily snapshots.
- Caching: If you cache server responses, include the timestamp in your cache key or eviction logic. Many teams cache /timeseries by date range and /latest by minute stamp to control costs and improve latency.
- end_date cannot be today: Always set end_date to yesterday (or earlier). If you need to display “as of now,” read /latest separately and label it accordingly.
Putting it together in your product
Typical integrations chain these steps:
- Nightly or on-demand: Call /timeseries with start_date=end_date-1d to compute the 24-hour percent move and risk stats (e.g., max drawdown).
- UI refresh loop: Call /latest for TRX to show a near-real-time price next to your computed 24-hour change, making sure your labels distinguish “last close” vs. “live.”
- Alerts: Use the Fluctuation or /timeseries deltas to trigger notifications when 24-hour change exceeds your threshold. For details on fluctuation fields and parameters, see the Documentation.
If you plan to extend beyond daily granularity (e.g., 15-minute candles), consult the intraday and OHLC endpoints in the docs. Start simple with daily /timeseries for correctness, then tighten intervals as your UX requires.
Developer tips that save time
- Explicitly set base=USD (or your desired currency) on all requests to avoid surprises when onboarding teammates or migrating environments.
- Sort timeseries keys lexicographically; ISO dates sort naturally, which makes it easy to compute rolling stats.
- Guard against missing days: Always derive the “last two days” list from what came back, not from arithmetic on dates.
- Use the symbol list to validate inputs at startup and fail fast if a symbol is unavailable: Indices-API Supported Symbols.
- Plan for pagination or batching if you later expand beyond one symbol per call; check the Documentation for request limits and recommended patterns.
Where to go next
- Explore the full reference, parameters, and field definitions: Indices-API Documentation
- Verify TRX and other symbols you might add later: Indices-API Supported Symbols
- Read about MCP integrations if you’re consolidating data pipelines across services: MCP
You can also learn more about Indices-API and start building on indices-api.com. When you’re ready to implement, Register for your API key.
FAQ
How do I represent a true “last 24 hours” for TRX if I need intraday precision?
Daily /timeseries provides day-over-day changes. For intraday 24-hour windows, use intraday candles and compute over the last N hours rolling window. Refer to the intraday/interval endpoints in the Documentation.
Why can’t I set end_date to today on /timeseries?
By design, /timeseries requires end_date to be earlier than today. If you need a fresh snapshot for today, call /latest separately and label it accordingly in the UI.
Are rates returned as USD per TRX or TRX per USD?
By default, base=USD, so rates.TRX is USD per 1 TRX. If you need the inverse, either compute 1/rate or use the provided inverse pair when available (e.g., USDTRX), depending on the endpoint.
What is the update frequency of /latest?
It depends on your plan. The API updates can be every 60 minutes, every 10 minutes, or faster depending on subscription tier. Cache responses accordingly, and rely on timestamps to avoid stale UI states.
Can I fetch TRX in Romanian Leu (RON)?
Yes, if RON is supported for your plan and endpoint, set base=RON or convert from USD using the Convert endpoint. Confirm symbol and base availability on the Symbols page and see conversion details in the Documentation.
Build your 24-hour TRX monitor now. Get your free API key and start integrating: Register. For reference material as you code, keep indices-api.com and the Documentation open in a second tab.