Perpetual Positions
Perpetual Positions: Agent Java SDK v0.3.0 integration, examples, parameters and response semantics.
This guide targets Agent Java SDK v0.3.0, Java 8+, and the tagged public contract. Examples run in a partner backend after initializing client in Quick Start.
Example prerequisites
The Java snippets share these imports. Initialize client using Quick Start and obtain platformUserId from the saved binding. Example user/order IDs must be replaced with your own persisted values.
listCurrentPerpetualPositions
Request model: CurrentPerpetualPositionsRequest.
Request fields
The example reads one page. For required fields, player scope, filter semantics, limit, cursor and bounded retries, follow Query overview. Keep all filters unchanged while paging; do not interpret an error as an empty result.
listPerpetualPositionHistory
Request model: PerpetualPositionHistoryRequest.
Request fields
The example reads one page. For required fields, player scope, filter semantics, limit, cursor and bounded retries, follow Query overview. Keep all filters unchanged while paging; do not interpret an error as an empty result.
Positions: Current and Historical
The calculation caliber of history roe is pnl / (entryPrice × maxQuantity / leverage), and the interface directly returns the saved proportion value. When displaying the percentage, use decimal operation and multiply by 100, then add %; the denominator uses the nominal margin of the historical position record, not the account wallet balance. When the opening price or maximum position quantity is 0, the leverage is invalid, etc. and cannot be calculated, the source is saved as 0. Therefore, it cannot be inferred that the profit or loss is 0 just based on roe=0.
The current position does not have real-time mark price, real-time floating profit and loss, real-time ROE or real-time liquidation price. It reflects the stored position status and cannot use the update time and margin fields to claim the current real-time risk control results.
Example response envelope
This is an illustrative empty page, not a sample of a completed trade. Resource-specific field tables above describe populated items[].data.