---
updatedAt: 2025-09-22T22:29:39.000Z
agentTools:
  projectIndex: https://bluefin-exchange.readme.io/v2.0.1/llms.txt
---

# /userTradesHistory

Retrieves user completed trades.

## Client Library

```typescript Bluefin TypeScript Client
import { BluefinClient, Networks, MARKET_SYMBOLS } from "@bluefin-exchange/bluefin-v2-client";

async function main() {
  const dummyAccountKey =
    "trigger swim reunion gate hen black real deer light nature trial dust";
  const client = new BluefinClient(
    true,
    Networks.TESTNET_SUI,
    dummyAccountKey,
    "ED25519"
  );
  await client.init();

  // fetch only BTC-PERP trades history of user
  const resp = await client.getUserTradesHistory({
      symbol: MARKET_SYMBOLS.BTC,
      parentAddress: "0xFEa83f912CF21d884CDfb66640CfAB6029D940aF",
    });
  console.log(resp.data);
}

main().then().catch(console.warn);
```
```python Bluefin Python Client
from pprint import pprint
import asyncio
from config import TEST_ACCT_KEY, TEST_NETWORK
from bluefin_v2_client import BluefinClient, Networks, MARKET_SYMBOLS


async def main():
    client = BluefinClient(
        True,  # agree to terms and conditions
        Networks[TEST_NETWORK],  # network to connect with
        TEST_ACCT_KEY,  # seed phrase of the wallet
    )

    # initialize the client
    # on boards user on Bluefin. Must be set to true for first time use
    await client.init(True)

    # trade history 
    history = await client.getUserTradesHistory()
    pprint(history)

    await client.close_connections()


if __name__ == "__main__":
    loop = asyncio.new_event_loop()
    loop.run_until_complete(main())
    loop.close()

```

## HTTPs

Alternatively, if you have obtained your auth token, call the GET /userTradesHistory endpoint using the integrated editor on the right or locally from any language supporting HTTPs network calls.

## Request & Response

# OpenAPI definition

```json
{
  "components": {
    "schemas": {
      "Record_string.any_": {
        "properties": {},
        "type": "object",
        "description": "Construct a type with a set of properties K of type T"
      },
      "ErrorResponse": {
        "properties": {
          "error": {
            "properties": {
              "data": {
                "anyOf": [
                  {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  {
                    "$ref": "#/components/schemas/Record_string.any_"
                  }
                ]
              },
              "message": {
                "type": "string"
              },
              "code": {
                "type": "number",
                "format": "double"
              }
            },
            "required": [
              "message",
              "code"
            ],
            "type": "object"
          }
        },
        "required": [
          "error"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "OrderType": {
        "enum": [
          "LIMIT",
          "MARKET",
          "STOP_LIMIT",
          "STOP_MARKET"
        ],
        "type": "string"
      },
      "TradeType": {
        "enum": [
          "Order",
          "Liquidator",
          "Liquidatee",
          "Deleveraged"
        ],
        "type": "string"
      },
      "IUserTradeView": {
        "description": "User's completed trades.",
        "properties": {
          "id": {
            "type": "number",
            "format": "double",
            "description": "Id of the trade"
          },
          "symbol": {
            "type": "string",
            "description": "Market symbol"
          },
          "commission": {
            "type": "string",
            "description": "Commission/fee charged by the protocol on trade"
          },
          "orderHash": {
            "type": "string",
            "description": "Unique hash of the order"
          },
          "commissionAsset": {
            "type": "string",
            "description": "Asset class in which fee is charged; for now, it's only USDC"
          },
          "maker": {
            "type": "boolean",
            "description": "If the caller/user was the maker of the trade"
          },
          "side": {
            "type": "string",
            "description": "If the order was BUY or SELL"
          },
          "price": {
            "type": "string",
            "description": "Price at which order was executed in base x 10^18 format"
          },
          "quantity": {
            "type": "string",
            "description": "Quantity of the order in base x 10^18 format"
          },
          "quoteQty": {
            "type": "string",
            "description": "Original ordered volume"
          },
          "clientId": {
            "type": "string",
            "description": "User-passed string or client identifier"
          },
          "orderId": {
            "type": "number",
            "format": "double",
            "description": "Unique id of the order"
          },
          "realizedPnl": {
            "type": "string",
            "description": "Amount of PNL realized on the trade"
          },
          "tradeType": {
            "$ref": "#/components/schemas/TradeType",
            "description": "Whether trade was `Order` or `Liquidation`"
          },
          "time": {
            "type": "number",
            "format": "double",
            "description": "Response time"
          },
          "networkGasFee": {
            "type": "string"
          },
          "txHash": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "symbol",
          "commission",
          "orderHash",
          "commissionAsset",
          "maker",
          "side",
          "price",
          "quantity",
          "quoteQty",
          "clientId",
          "orderId",
          "realizedPnl",
          "tradeType",
          "time",
          "networkGasFee",
          "txHash"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "ListingWithCursor_IUserTradeView_": {
        "properties": {
          "isMoreDataAvailable": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": "number",
            "format": "double"
          },
          "data": {
            "items": {
              "$ref": "#/components/schemas/IUserTradeView"
            },
            "type": "array"
          }
        },
        "required": [
          "isMoreDataAvailable",
          "nextCursor",
          "data"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "auth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "info": {
    "title": "dAPI",
    "version": "2.0.0",
    "contact": {}
  },
  "openapi": "3.0.0",
  "paths": {
    "/userTradesHistory": {
      "get": {
        "operationId": "GetUserTradeHistory",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ListingWithCursor_IUserTradeView_"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": ""
          }
        },
        "description": "Retrieves user completed trades.",
        "tags": [
          "History"
        ],
        "security": [
          {
            "auth": [
              "user",
              "readonly"
            ]
          }
        ],
        "parameters": [
          {
            "description": "Market symbol for which the user wishes to get its trades",
            "in": "query",
            "name": "symbol",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "if TRUE, then will fetch trades having the user as the maker",
            "in": "query",
            "name": "maker",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "description": "Order type could be Market or Limit",
            "in": "query",
            "name": "orderType",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/OrderType"
            }
          },
          {
            "description": "Provide if trading as a subaccount",
            "in": "query",
            "name": "parentAddress",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Each trade is given an incremental id; provide the id to get trades after the provided id",
            "in": "query",
            "name": "fromId",
            "required": false,
            "schema": {
              "format": "double",
              "type": "number"
            }
          },
          {
            "description": "The time after which trades will be fetched from",
            "in": "query",
            "name": "startTime",
            "required": false,
            "schema": {
              "format": "double",
              "type": "number"
            }
          },
          {
            "description": "The time before which all trades will be returned",
            "in": "query",
            "name": "endTime",
            "required": false,
            "schema": {
              "format": "double",
              "type": "number"
            }
          },
          {
            "description": "Provide a total number of records to get. Max allowed value is 50",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "format": "double",
              "type": "number"
            }
          },
          {
            "description": "The particular page number to be fetched",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "double",
              "type": "number"
            }
          }
        ]
      }
    }
  },
  "servers": [
    {
      "url": "dapi.api.sui-prod.bluefin.io"
    }
  ],
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```