# Trade History

## Get all trade history

> Retrieve all trade history for the authenticated user with detailed trade information including fees, PnL, and asset-level data

```json
{"openapi":"3.0.3","info":{"title":"Pear Protocol Trading API","version":"3.0.0"},"servers":[{"url":"https://hl-v2.pearprotocol.io","description":"Production (Mainnet)"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"TradeHistoryDataDto":{"type":"object","properties":{"tradeHistoryId":{"type":"string","description":"Trade history ID"},"positionId":{"type":"string","description":"Associated position ID"},"address":{"type":"string","description":"User wallet address"},"externalFeePaid":{"type":"number","description":"Total fee paid to DEX Engine"},"builderFeePaid":{"type":"number","description":"Total fee paid to builder"},"realizedPnl":{"type":"number","description":"Total realized PnL value"},"realizedPnlPercentage":{"type":"number","description":"Total realized PnL percentage"},"totalValue":{"type":"number","description":"Total trade value in USD"},"totalEntryValue":{"type":"number","description":"Total entry value in USD (sum of size * entry price per asset)"},"entryRatio":{"type":"number","description":"Entry ratio for the trade"},"exitRatio":{"type":"number","description":"Exit ratio for the trade"},"closedLongAssets":{"description":"Long assets in the trade","type":"array","items":{"$ref":"#/components/schemas/TradeHistoryAssetDataDto"}},"closedShortAssets":{"description":"Short assets in the trade","type":"array","items":{"$ref":"#/components/schemas/TradeHistoryAssetDataDto"}},"positionLongAssets":{"description":"List of long token symbols from position at time of trade","type":"array","items":{"type":"string"}},"positionShortAssets":{"description":"List of short token symbols from position at time of trade","type":"array","items":{"type":"string"}},"createdAt":{"type":"string","description":"Trade timestamp"}},"required":["tradeHistoryId","positionId","address","externalFeePaid","builderFeePaid","realizedPnl","realizedPnlPercentage","totalValue","totalEntryValue","entryRatio","exitRatio","closedLongAssets","createdAt"]},"TradeHistoryAssetDataDto":{"type":"object","properties":{"coin":{"type":"string","description":"Asset symbol"},"leverage":{"type":"number","description":"Leverage used for this asset"},"entryPrice":{"type":"number","description":"Entry price for this asset"},"entryWeight":{"type":"number","description":"Entry weight for this asset"},"limitPrice":{"type":"number","description":"Limit price for this asset"},"size":{"type":"number","description":"Trade size for this asset"},"externalFeePaid":{"type":"number","description":"Fee paid to DEX Engine"},"builderFeePaid":{"type":"number","description":"Fee paid to builder"},"realizedPnl":{"type":"number","description":"Realized PnL percentage for this asset"}},"required":["coin","leverage","entryPrice","entryWeight","limitPrice","size","externalFeePaid","builderFeePaid","realizedPnl"]}}},"paths":{"/trade-history":{"get":{"description":"Retrieve all trade history for the authenticated user with detailed trade information including fees, PnL, and asset-level data","operationId":"TradeHistoryController_getTradeHistory","parameters":[{"name":"limit","required":false,"in":"query","description":"Maximum number of records to return (for pagination/infinite scroll).","schema":{"type":"number"}},{"name":"startDate","required":false,"in":"query","description":"Filter trades created on/after this time. Accepts ISO string or ms timestamp.","schema":{"type":"string"}},{"name":"endDate","required":false,"in":"query","description":"Filter trades created on/before this time. Accepts ISO string or ms timestamp.","schema":{"type":"string"}}],"responses":{"200":{"description":"Trade history retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TradeHistoryDataDto"}}}}},"404":{"description":"No trade history found"}},"summary":"Get all trade history","tags":["Trade History"]}}}}
```
