# Trade

User trade history operations

## Get user trades

> Get trades of a specific user by wallet address. Only returns filled (successful) trades. Results are sorted by creation time (descending).

```json
{"openapi":"3.0.3","info":{"title":"OPINION Prediction Market OpenAPI","version":"1.0.0"},"tags":[{"name":"Trade","description":"User trade history operations"}],"servers":[{"url":"https://openapi.opinion.trade/openapi","description":"Production server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication"}},"schemas":{"APIBaseResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response code (0 for success)"},"msg":{"type":"string","description":"Response message"},"result":{"type":"object","description":"Response data"}}},"UserTradeListResponse":{"type":"object","properties":{"total":{"type":"integer","format":"int64","description":"Total number of trades"},"list":{"type":"array","items":{"$ref":"#/components/schemas/UserTradeData"}}}},"UserTradeData":{"type":"object","description":"Trade data for querying other users' trades (orderNo and tradeNo are hidden for privacy)","properties":{"txHash":{"type":"string","description":"Transaction hash"},"marketId":{"type":"integer","format":"int64","description":"Market ID"},"marketTitle":{"type":"string","description":"Market title"},"rootMarketId":{"type":"integer","format":"int64","description":"Root market ID (for categorical markets)"},"rootMarketTitle":{"type":"string","description":"Root market title"},"side":{"type":"string","description":"Trade side (BUY/SELL)"},"outcome":{"type":"string","description":"Outcome label"},"outcomeSide":{"type":"integer","description":"Outcome side: 1=Yes, 2=No","enum":[1,2]},"outcomeSideEnum":{"type":"string","description":"Human-readable outcome side","enum":["Yes","No"]},"price":{"type":"string","description":"Trade price"},"shares":{"type":"string","description":"Number of shares traded"},"amount":{"type":"string","description":"Trade amount in quote token"},"fee":{"type":"string","description":"Fee amount (human-readable format)"},"profit":{"type":"string","description":"Profit/loss"},"quoteToken":{"type":"string","description":"Quote token address"},"quoteTokenUsdPrice":{"type":"string","description":"USD price of quote token"},"usdAmount":{"type":"string","description":"Total USD value of this trade"},"status":{"type":"integer","description":"Trade status: 1=Pending, 2=Filled, 3=Canceled, 4=Expired, 5=Failed"},"statusEnum":{"type":"string","description":"Human-readable status","enum":["Pending","Filled","Canceled","Expired","Failed"]},"chainId":{"type":"string","description":"Chain ID"},"createdAt":{"type":"integer","format":"int64","description":"Creation timestamp"}}}},"responses":{"BadRequestError":{"description":"Bad request - invalid parameters","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/APIBaseResponse"},{"type":"object","properties":{"code":{},"msg":{}}}]}}}}}},"paths":{"/trade/user/{walletAddress}":{"get":{"tags":["Trade"],"summary":"Get user trades","description":"Get trades of a specific user by wallet address. Only returns filled (successful) trades. Results are sorted by creation time (descending).","operationId":"getUserTrades","parameters":[{"name":"walletAddress","in":"path","required":true,"description":"Target user's wallet address","schema":{"type":"string"}},{"name":"page","in":"query","description":"Page number","schema":{"type":"integer","default":1,"minimum":1}},{"name":"limit","in":"query","description":"Number of items per page (max 20)","schema":{"type":"integer","default":10,"maximum":20}},{"name":"marketId","in":"query","description":"Market ID filter","schema":{"type":"integer","format":"int64"}},{"name":"chainId","in":"query","description":"Chain ID filter","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/APIBaseResponse"},{"type":"object","properties":{"result":{"$ref":"#/components/schemas/UserTradeListResponse"}}}]}}}},"400":{"$ref":"#/components/responses/BadRequestError"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.opinion.trade/developer-guide/opinion-open-api/trade.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
