> For the complete documentation index, see [llms.txt](https://docs.clickoptions.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clickoptions.ai/api/trading-api-v1-trades.md).

# Trading API v1   Trades

Trade history and management operations

## Get trades

> Retrieve trade history for the authenticated account with optional filtering

```json
{"openapi":"3.1.0","info":{"title":"fintp-public-api","version":"0.0.1"},"tags":[{"name":"Trading API v1 - Trades","description":"Trade history and management operations"}],"servers":[{"url":"https://api.clickoptions.ai/api","description":"Generated server url"}],"paths":{"/v1/trades":{"get":{"tags":["Trading API v1 - Trades"],"summary":"Get trades","description":"Retrieve trade history for the authenticated account with optional filtering","operationId":"getTrades","parameters":[{"name":"symbol","in":"query","description":"Symbol filter","required":false,"schema":{"type":"string"}},{"name":"orderId","in":"query","description":"Order ID filter","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"positionId","in":"query","description":"Position ID filter","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"side","in":"query","description":"Trade side filter (buy, sell)","required":false,"schema":{"type":"string"}},{"name":"startTime","in":"query","description":"Start timestamp (milliseconds)","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"endTime","in":"query","description":"End timestamp (milliseconds)","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"page","in":"query","description":"Page number (1-based)","required":false,"schema":{"type":"integer","format":"int32","default":1}},{"name":"size","in":"query","description":"Page size","required":false,"schema":{"type":"integer","format":"int32","default":20}}],"responses":{"200":{"description":"Trades retrieved successfully","content":{"*/*":{"schema":{"$ref":"#/components/schemas/PagedResponseV1"}}}},"400":{"description":"Invalid request parameters","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiErrorV1"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiErrorV1"}}}}}}}},"components":{"schemas":{"PagedResponseV1":{"type":"object","description":"Generic paged response for v1 API following trading standards","properties":{"total":{"type":"integer","format":"int32","description":"Total number of items"},"page":{"type":"integer","format":"int32","description":"Current page number"},"pageSize":{"type":"integer","format":"int32","description":"Number of items per page"},"items":{"type":"array","description":"List of items for the current page","items":{}}}},"ApiErrorV1":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{"type":"object","additionalProperties":{}}}}}}}
```

## Get trade by ID

> Retrieve a specific trade by its ID

```json
{"openapi":"3.1.0","info":{"title":"fintp-public-api","version":"0.0.1"},"tags":[{"name":"Trading API v1 - Trades","description":"Trade history and management operations"}],"servers":[{"url":"https://api.clickoptions.ai/api","description":"Generated server url"}],"paths":{"/v1/trades/{id}":{"get":{"tags":["Trading API v1 - Trades"],"summary":"Get trade by ID","description":"Retrieve a specific trade by its ID","operationId":"getTrade","parameters":[{"name":"id","in":"path","description":"Trade ID","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Trade retrieved successfully","content":{"*/*":{"schema":{"$ref":"#/components/schemas/TradeResponseV1"}}}},"400":{"description":"Invalid request parameters","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiErrorV1"}}}},"404":{"description":"Trade not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiErrorV1"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiErrorV1"}}}}}}}},"components":{"schemas":{"TradeResponseV1":{"type":"object","properties":{"tradeId":{"type":"integer","format":"int64","description":"Unique trade identifier"},"orderId":{"type":"integer","format":"int64","description":"Order identifier"},"positionId":{"type":"integer","format":"int64","description":"Position identifier"},"asset":{"type":"string","description":"Asset symbol"},"type":{"type":"string","description":"Option type: CALL or PUT"},"fillType":{"type":"string","description":"Fill type: FILL or PARTIAL_FILL"},"expiryDate":{"type":"integer","format":"int64","description":"Expiry date (timestamp)"},"filledSizeUsdt":{"type":"string","description":"Filled size in USDT"},"filledSizeContracts":{"type":"string","description":"Filled size in contracts"},"strikePrice":{"type":"string","description":"Strike price"},"openPrice":{"type":"string","description":"Open price"},"openDate":{"type":"integer","format":"int64","description":"Open date (timestamp)"},"fee":{"type":"string","description":"Trade fee"},"tradeSide":{"type":"string","description":"Trade side: BUY or SELL"},"maker":{"type":"boolean","description":"Is maker trade"}}},"ApiErrorV1":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{"type":"object","additionalProperties":{}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.clickoptions.ai/api/trading-api-v1-trades.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
