-
Notifications
You must be signed in to change notification settings - Fork 156
Open
Description
Description
The historicalPnl
endpoint exhibits two distinct issues:
- Inconsistent Timestamps: The
createdAt
timestamps for hourly snapshots are not synchronized across different user addresses, making accurate time-aligned comparisons impossible. - Incorrect
limit
Behavior: Thelimit
query parameter does not function as expected, often returning fewer records than requested even when more data is available.
Evidence / Analysis
1. Timestamp Inconsistency
Comparing API responses for two addresses reveals significant time drift in what should be aligned hourly snapshots.

- Address A (
dydx1rpy...
): Snapshot for the 03:00 hour is at...T03:00:28.931Z
.
{"historicalPnl":[{"equity":"184.651541","totalPnl":"-337.682642","netTransfers":"0.000000","createdAt":"2025-07-11T03:00:28.931Z","blockHeight":"49741564","blockTime":"2025-07-11T03:00:26.947Z"},{"equity":"184.651541","totalPnl":"-337.682642","netTransfers":"0.000000","createdAt":"2025-07-11T02:01:17.314Z","blockHeight":"49737902","blockTime":"2025-07-11T02:01:16.087Z"},{"equity":"184.651541","totalPnl":"-337.682642","netTransfers":"0.000000","createdAt":"2025-07-11T01:01:17.509Z","blockHeight":"49734196","blockTime":"2025-07-11T01:01:15.303Z"},{"equity":"184.651541","totalPnl":"-337.682642","netTransfers":"0.000000","createdAt":"2025-07-11T00:00:34.509Z","blockHeight":"49730563","blockTime":"2025-07-11T00:00:32.824Z"},{"equity":"184.651541","totalPnl":"-337.682642","netTransfers":"0.000000","createdAt":"2025-07-10T23:01:22.938Z","blockHeight":"49726893","blockTime":"2025-07-10T23:01:21.798Z"},{"equity":"184.651541","totalPnl":"-337.682642","netTransfers":"0.000000","createdAt":"2025-07-10T22:00:29.869Z","blockHeight":"49723136","blockTime":"2025-07-10T22:00:27.880Z"},{"equity":"184.651541","totalPnl":"-337.682642","netTransfers":"0.000000","createdAt":"2025-07-10T21:00:32.923Z","blockHeight":"49719535","blockTime":"2025-07-10T21:00:30.541Z"},{"equity":"184.651541","totalPnl":"-337.682642","netTransfers":"0.000000","createdAt":"2025-07-10T20:01:29.067Z","blockHeight":"49715816","blockTime":"2025-07-10T20:01:27.135Z"},{"equity":"184.651541","totalPnl":"-337.682642","netTransfers":"0.000000","createdAt":"2025-07-10T19:01:04.641Z","blockHeight":"49712032","blockTime":"2025-07-10T19:01:02.975Z"},{"equity":"184.651541","totalPnl":"-337.682642","netTransfers":"0.000000","createdAt":"2025-07-10T18:01:29.955Z","blockHeight":"49708447","blockTime":"2025-07-10T18:01:28.123Z"}]}
- Address B (
dydx1pjy...
): Snapshot for the same 03:00 hour is at...T03:10:14.878Z
.

{"historicalPnl":[{"equity":"3246.211214","totalPnl":"-457.71615599999996","netTransfers":"0","createdAt":"2025-07-11T03:10:14.878Z","blockHeight":"49742164","blockTime":"2025-07-11T03:10:13.845Z"},{"equity":"3171.190217","totalPnl":"-532.737153","netTransfers":"0","createdAt":"2025-07-11T02:15:21.404Z","blockHeight":"49738762","blockTime":"2025-07-11T02:15:19.489Z"},{"equity":"3064.33825","totalPnl":"-639.5891200000001","netTransfers":"0","createdAt":"2025-07-11T01:14:39.369Z","blockHeight":"49735020","blockTime":"2025-07-11T01:14:37.653Z"},{"equity":"3083.518468","totalPnl":"-620.4089019999999","netTransfers":"0","createdAt":"2025-07-11T00:16:11.254Z","blockHeight":"49731527","blockTime":"2025-07-11T00:16:09.550Z"},{"equity":"3198.342149","totalPnl":"-505.58522100000005","netTransfers":"0","createdAt":"2025-07-10T23:15:28.116Z","blockHeight":"49727768","blockTime":"2025-07-10T23:15:25.992Z"},{"equity":"3248.128391","totalPnl":"-455.7989789999999","netTransfers":"0","createdAt":"2025-07-10T22:10:12.549Z","blockHeight":"49723728","blockTime":"2025-07-10T22:10:10.350Z"},{"equity":"2901.842498","totalPnl":"-802.0848719999999","netTransfers":"0","createdAt":"2025-07-10T21:13:51.729Z","blockHeight":"49720355","blockTime":"2025-07-10T21:13:50.121Z"},{"equity":"2866.318527","totalPnl":"-837.608843","netTransfers":"0","createdAt":"2025-07-10T20:16:55.686Z","blockHeight":"49716793","blockTime":"2025-07-10T20:16:51.626Z"},{"equity":"2867.179359","totalPnl":"-836.748011","netTransfers":"0","createdAt":"2025-07-10T19:17:52.501Z","blockHeight":"49713083","blockTime":"2025-07-10T19:17:50.408Z"},{"equity":"2883.145263","totalPnl":"-820.782107","netTransfers":"0","createdAt":"2025-07-10T18:18:56.508Z","blockHeight":"49709473","blockTime":"2025-07-10T18:18:55.169Z"}]}
This shows a ~10-minute gap between snapshots that should be aligned.
2. Incorrect limit
Behavior
An API call for Address B with limit=30
only returned 10 records, despite more historical data being available.
- Request URL:
https://indexer.dydx.trade/v4/historical-pnl/0?address=dydx1pjyrn3yw3phq7xf3p99rv52z2yfuwzfjq43n4x&limit=30
- Result: The response contained only 10
historicalPnl
objects.
Expected Behavior
createdAt
timestamps should be standardized across all accounts (e.g.,YYYY-MM-DDTHH:00:00.000Z
).- The
limit
parameter should return the specified number of records up to the maximum allowed, if available.
Impact
- Prevents reliable cross-account performance analysis and comparison.
- Reduces the API's reliability and predictability for data consumers.
- Forces consumers to implement complex workarounds for data alignment and pagination.
Recommendation
- Investigate the snapshotting process to ensure timestamps are synchronized.
- Fix the
limit
parameter handling to respect the requested value.
Metadata
Metadata
Assignees
Labels
No labels