> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.6mm.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.6mm.com/_mcp/server.

# Perpetual Orders

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](/sdk/agent-sdk/java/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.

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

## `listCurrentPerpetualOrders`

Request model: `CurrentPerpetualOrdersRequest`.

```java
import com.sixmm.agent.model.CurrentPerpetualOrdersRequest;
import com.sixmm.agent.model.PerpetualResponse;
import java.util.Collections;

CurrentPerpetualOrdersRequest request = new CurrentPerpetualOrdersRequest();
request.platformUserIds = Collections.singletonList("1188041528");
request.limit = 100;
request.orderCategory = "NORMAL";
request.symbol = "BTCUSDT";
PerpetualResponse response = client.listCurrentPerpetualOrders(request);
System.out.println(response.data.items.size());
System.out.println(response.data.hasMore);
System.out.println(response.data.nextCursor);
```

### Request fields

| Field             | Java type                | Required    | Meaning                                                                                                                                |
| ----------------- | ------------------------ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `orderCategory`   | `String`                 | Yes         | NORMAL or CONDITIONAL; conditional queries require explicit users.                                                                     |
| `platformUserIds` | `java.util.List<String>` | Conditional | 1–100 unique public IDs; required for fills and conditional orders. Omit on supported queries for direct-player scope; \[] is invalid. |
| `symbol`          | `String`                 | No          | Optional trading-pair filter.                                                                                                          |
| `limit`           | `Integer`                | No          | Default 500; 1–1000.                                                                                                                   |
| `cursor`          | `String`                 | No          | Use 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](/sdk/agent-sdk/java/perpetual-queries). Keep all filters unchanged while paging; do not interpret an error as an empty result.

## `listPerpetualOrderHistory`

Request model: `PerpetualOrderHistoryRequest`.

```java
import com.sixmm.agent.model.PerpetualOrderHistoryRequest;
import com.sixmm.agent.model.PerpetualResponse;
import java.util.Collections;

PerpetualOrderHistoryRequest request = new PerpetualOrderHistoryRequest();
request.platformUserIds = Collections.singletonList("1188041528");
request.limit = 100;
request.orderCategory = "NORMAL";
request.symbol = "BTCUSDT";
request.endTime = System.currentTimeMillis();
request.startTime = request.endTime - 3_600_000L;
PerpetualResponse response = client.listPerpetualOrderHistory(request);
System.out.println(response.data.items.size());
System.out.println(response.data.hasMore);
System.out.println(response.data.nextCursor);
```

### Request fields

| Field             | Java type                | Required    | Meaning                                                                                                                                |
| ----------------- | ------------------------ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `orderCategory`   | `String`                 | Yes         | NORMAL or CONDITIONAL; conditional queries require explicit users.                                                                     |
| `platformUserIds` | `java.util.List<String>` | Conditional | 1–100 unique public IDs; required for fills and conditional orders. Omit on supported queries for direct-player scope; \[] is invalid. |
| `symbol`          | `String`                 | No          | Optional trading-pair filter.                                                                                                          |
| `orderId`         | `String`                 | No          | Ordinary order ID; not a partner transfer order number.                                                                                |
| `conditionId`     | `String`                 | No          | Conditional order ID; do not mix with orderId.                                                                                         |
| `clientOrderId`   | `String`                 | No          | Trading client order reference, not agentOrderNo.                                                                                      |
| `side`            | `String`                 | No          | BUY / SELL filter.                                                                                                                     |
| `status`          | `String`                 | No          | Resource-specific status; see the status reference.                                                                                    |
| `startTime`       | `Long`                   | No          | Inclusive Unix milliseconds; use a fixed UTC history window.                                                                           |
| `endTime`         | `Long`                   | No          | Exclusive Unix milliseconds.                                                                                                           |
| `limit`           | `Integer`                | No          | Default 500; 1–1000.                                                                                                                   |
| `cursor`          | `String`                 | No          | Use 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](/sdk/agent-sdk/java/perpetual-queries). Keep all filters unchanged while paging; do not interpret an error as an empty result.

## Ordinary orders: current and history

Current: `orders/current` + `orderCategory=NORMAL`; History: `orders/history` + `orderCategory=NORMAL`.

| `data` field        | type    | Meaning and scope of application                                                                                                                      |
| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `symbol`            | string  | Trading pair, such as BTCUSDT                                                                                                                         |
| `orderId`           | string  | Platform ordinary order ID                                                                                                                            |
| `orderCategory`     | string  | Fixed NORMAL                                                                                                                                          |
| `clientOrderId`     | string  | Client order number provided by the transaction order source; not the same field as merchant fund transfer agentOrderNo                               |
| `orderType`         | string  | Delegate type, such as LIMIT, MARKET; the actual enumeration value shall prevail                                                                      |
| `side`              | string  | Buying and selling direction BUY / SELL                                                                                                               |
| `status`            | string  | Ordinary order status, see the query overview                                                                                                         |
| `timeInForce`       | string  | Validity period/deal execution strategy, such as GTC, IOC, FOK; interpreted according to actual values                                                |
| `price`             | string  | Entrusted price; it may be omitted when no price is provided, and the market transaction price will not be supplemented by oneself.                   |
| `quantity`          | string  | Original order quantity                                                                                                                               |
| `filledQuantity`    | string  | Transaction quantity                                                                                                                                  |
| `remainingQuantity` | string  | Untransacted quantity; the current query takes quantity − filledQuantity, and the historical query takes the historical record value                  |
| `avgFilledPrice`    | string  | The average transaction price of the completed part; there may be no value when it is not completed                                                   |
| `reduceOnly`        | boolean | Whether to only reduce positions                                                                                                                      |
| `closeOnly`         | boolean | Whether it is only used to close positions                                                                                                            |
| `makerOnly`         | boolean | Whether to execute only as Maker                                                                                                                      |
| `leverage`          | integer | Leverage multiple; **Historical ordinary order** has a source, and the current ordinary order does not create this value                              |
| `marginMode`        | string  | Margin mode; **Historical ordinary order** currently returns a numerical enumeration string, such as "1", "2"; current ordinary order is not provided |
| `createdAt`         | integer | Order creation time, milliseconds; use this field to filter historical order time                                                                     |
| `updatedAt`         | integer | Delegate record update time, milliseconds                                                                                                             |

The order history includes terminated ordinary orders. Each record cannot be regarded as fully completed based on the interface name alone. The current order page is a current status query, not a order event stream.

## Conditional orders: current and history

Current: `orders/current` + `orderCategory=CONDITIONAL`; History: `orders/history` + `orderCategory=CONDITIONAL`. Both require explicit platformUserIds.

| `data` field       | type    | meaning                                                                                                                    |
| ------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------- |
| `symbol`           | string  | trading pair                                                                                                               |
| `conditionId`      | string  | Conditional orders ID, independent from ordinary orderId                                                                   |
| `orderCategory`    | string  | Fixed CONDITIONAL                                                                                                          |
| `generatedOrderId` | string  | Ordinary order ID generated after triggering; may be omitted if not generated                                              |
| `clientOrderId`    | string  | The client order number of conditional orders, output when it exists                                                       |
| `side`             | string  | BUY / SELL                                                                                                                 |
| `orderType`        | string  | Post-trigger order type, interpreted according to actual value                                                             |
| `triggerType`      | string  | Trigger rule type, explained by actual source enumeration                                                                  |
| `workingType`      | string  | Job type/price source that triggers price, interpreted as actual enumeration                                               |
| `timeInForce`      | string  | Validity period/execution strategy of the order after triggering                                                           |
| `price`            | string  | The order price after triggering, output when the source has value                                                         |
| `quantity`         | string  | Conditional order quantity                                                                                                 |
| `triggerPrice`     | string  | trigger price                                                                                                              |
| `reduceOnly`       | boolean | Whether to only reduce positions                                                                                           |
| `closePosition`    | boolean | Whether to use full position closing semantics, cannot be confused with closeOnly as the same field                        |
| `leverage`         | integer | Leverage multiple, output when non-zero                                                                                    |
| `marginMode`       | string  | This class returns CROSS / ISOLATED, which is a numeric string that is different from ordinary historical orders/positions |
| `status`           | string  | Conditional single trigger state, see the query overview                                                                   |
| `triggerStatus`    | string  | The current implementation uses the same conditional status value as status                                                |
| `createdAt`        | integer | Conditional order creation time, milliseconds; historical conditions are filtered by this time                             |
| `updatedAt`        | integer | Update time, output when there is a value, milliseconds                                                                    |
| `deletedAt`        | integer | Delete mark time, output when there is a value, milliseconds; it is not a unified transaction/cancellation time field      |

Conditional orders do not provide filledQuantity, remainingQuantity, avgFilledPrice for ordinary orders. If you need the transaction status of ordinary orders after triggering, query ordinary orders/transactions through generatedOrderId, and do not infer the transaction volume from the conditional order status.

## 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`.

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

## Source and related guides

* [Official v0.3.0 source](https://github.com/6mm-com/agent-java-sdk/tree/54aa3c1)
* [Query overview and pagination](/sdk/agent-sdk/java/perpetual-queries)
* [Funding wallet](/sdk/agent-sdk/java/funding-wallet)
* [Upgrade guide](/sdk/agent-sdk/java/upgrade)