Skip to navigation

Perpetual Trade Fills

Perpetual Trade Fills: Agent Java SDK v0.3.0 integration, examples, parameters and response semantics.

View as Markdown

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.

import com.sixmm.agent.*;
import com.sixmm.agent.model.*;
import java.util.*;

listPerpetualTrades

Request model: PerpetualTradesRequest.

import com.sixmm.agent.model.PerpetualTradesRequest;
import com.sixmm.agent.model.PerpetualResponse;
import java.util.Collections;
PerpetualTradesRequest request = new PerpetualTradesRequest();
request.platformUserIds = Collections.singletonList("1188041528");
request.limit = 100;
request.symbol = "BTCUSDT";
request.endTime = System.currentTimeMillis();
request.startTime = request.endTime - 3_600_000L;
PerpetualResponse response = client.listPerpetualTrades(request);
System.out.println(response.data.items.size());
System.out.println(response.data.hasMore);
System.out.println(response.data.nextCursor);

Request fields

FieldJava typeRequiredMeaning
platformUserIdsjava.util.List<String>YesExplicitly supply 1–100 unique public platform user IDs belonging to the current partner; omission and an empty array are invalid.
symbolStringNoOptional trading-pair filter.
orderIdStringNoOrdinary order ID; not a partner transfer order number.
startTimeLongNoInclusive Unix milliseconds; use a fixed UTC history window.
endTimeLongNoExclusive Unix milliseconds.
limitIntegerNoDefault 500; 1–1000.
cursorStringNoUse the returned nextCursor with unchanged filters; stop when hasMore is false.

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.

Trade fill details

Interface: trades. Requires explicit platformUserIds.

data fieldtypemeaning
fillIdstringTrade fill details ID, corresponding to this record entityId
tradeIdstringThe matching transaction ID associated with the transaction; does not replace the detailed ID
orderIdstringThe general order ID to which this detail belongs
positionIdstringAssociated position ID
symbolstringtrading pair
sidestringThis player’s buying and selling direction BUY / SELL
roleTypestringThis player’s transaction character MAKER / TAKER
positionSidestringPosition direction, explained according to actual value LONG / SHORT / BOTH etc.
pricestringThis transaction price
quantitystringThe quantity of this transaction is not the total quantity of the original order.
tradeValuestringThe nominal value of this transaction comes from the transaction notional
handlingFeestringThe transaction fee for this transaction retains the source symbol and accuracy, and does not take the absolute value by itself.
realizedPnlstringThe realized profit and loss corresponding to this transaction; not the real-time floating profit and loss of the current position
tradedAtintegerTransaction time, milliseconds; use this field for time filtering

An order may have multiple fills, which should be saved in detail. Do not merge records of different players/fill roles by tradeId and then discard their record identities.

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.

{"code":0,"message":"success","data":{"items":[],"nextCursor":"","hasMore":false}}