Skip to main content
POST
/
trial
/
position
/
statistic
/
search-after
Position Statistic List By Search After
curl --request POST \
  --url https://api.copin.io/trial/position/statistic/search-after \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --data '
{
  "pitId": "<string>",
  "searchAfter": [
    {}
  ],
  "size": 123,
  "queries": [
    {
      "fieldName": "<string>",
      "value": "<string>"
    }
  ]
}
'
{
  "data": [
    {
      "id": "<string>",
      "account": "<string>",
      "totalTrade": 123,
      "totalWin": 123,
      "totalLose": 123,
      "totalGain": 123,
      "realisedTotalGain": 123,
      "totalLoss": 123,
      "realisedTotalLoss": 123,
      "totalVolume": 123,
      "avgVolume": 123,
      "avgRoi": 123,
      "realisedAvgRoi": 123,
      "maxRoi": 123,
      "realisedMaxRoi": 123,
      "pnl": 123,
      "realisedPnl": 123,
      "maxPnl": 123,
      "realisedMaxPnl": 123,
      "realisedMaxDrawdown": 123,
      "realisedMaxDrawdownPnl": 123,
      "winRate": 123,
      "profitRate": 123,
      "realisedProfitRate": 123,
      "orderPositionRatio": 123,
      "profitLossRatio": 123,
      "realisedProfitLossRatio": 123,
      "longRate": 123,
      "gainLossRatio": 123,
      "realisedGainLossRatio": 123,
      "avgDuration": 123,
      "minDuration": 123,
      "maxDuration": 123,
      "avgLeverage": 123,
      "minLeverage": 123,
      "maxLeverage": 123,
      "totalLiquidation": 123,
      "totalLiquidationAmount": 123,
      "runTimeDays": 123,
      "lastTradeAtTs": 123,
      "totalFee": 123,
      "type": "<string>",
      "statisticAt": "<string>",
      "lastTradeAt": "<string>",
      "indexTokens": [
        {}
      ],
      "protocol": "<string>",
      "createdAt": "<string>",
      "isOpenPosition": true
    }
  ],
  "meta": {
    "pitId": "<string>",
    "searchAfter": [
      {}
    ],
    "total": 123,
    "totalPages": 123
  }
}

Authentication

This endpoint requires authentication using api-key in the ‘x-api-key’ header.
x-api-key
string
required
Token in the format: x-api-key {api-key}
pitId
string
Help the results of those requests consistent as changes happening between searches are only visible to the more recent point in time. Time to live is 5 mins. In the first time call API, no need this field.
searchAfter
array
Using to get continuous data after. In the first time call API, no need this field.
size
number
Limit per page. Maximum: 1000
queries
array
Array of query objects

Request Body

Request Example

curl --request POST \
--url "https://api.copin.io/trial/position/statistic/search-after" \
--header 'Content-Type: application/json' \
--header 'x-api-key: v23XPhHKSP4rFsWcMR1NZ2qXLTUjtn' \
--data '{
    "size": 100,
    "sort": [{"id": "asc" }],
    "pitId": "4YyPBAEZY29waW4ucG9zaXRpb25fc3RhdGlzdGljcxZ0Rnk1Y0YxSVF0V0VxdFdIdW9kcWN3ABYtOHMtQnhZdFMwQ2J6bElvRTUwUDl3AAAAAAAAD8e3FjB3Tjh6eGRpU25hSUlZdTM3ODY2cHcAARZ0Rnk1Y0YxSVF0V0VxdFdIdW9kcWN3AAA=",
    "searchAfter": [
        "65a5fc59d2d3d9a9063064f0",
        755184
    ]
}'

Response

The response includes a data array containing position statistic objects and a meta object with pagination information.
data
array
Array of position statistic objects
meta
object
Metadata about the response

Response Example

{
       "data": [
          {
            "id": "65a5ff35d2d3d9a90630c1d0",
            "account": "0x05bB0eCffBA75A93BA324321f899D6EB8E0B9748",
            "totalTrade": 1,
            "totalWin": 0,
            "totalLose": 1,
            "totalGain": 0,
            "realisedTotalGain": 0,
            "totalLoss": -0.0078019965081686975,
            "realisedTotalLoss": -0.004602316508168698,
            "totalVolume": 2.6963,
            "avgVolume": 2.6963,
            "avgRoi": -0.38,
            "realisedAvgRoi": -0.22,
            "maxRoi": 0,
            "realisedMaxRoi": 0,
            "pnl": -0.0078019965081686975,
            "realisedPnl": -0.004602316508168698,
            "maxPnl": 0,
            "realisedMaxPnl": 0,
            "realisedMaxDrawdown": -0.22,
            "maxDrawdownPnl": null,
            "realisedMaxDrawdownPnl": -0.004602316508168698,
            "winRate": 0,
            "profitRate": 0,
            "realisedProfitRate": 0,
            "orderPositionRatio": 2,
            "profitLossRatio": 0,
            "realisedProfitLossRatio": 0,
            "longRate": 0,
            "gainLossRatio": 0,
            "realisedGainLossRatio": 0,
            "avgDuration": 216.33333333333334,
            "minDuration": 216.33333333333334,
            "maxDuration": 216.33333333333334,
            "avgLeverage": 1.3000528671129576,
            "minLeverage": 1.3000528671129576,
            "maxLeverage": 1.3000528671129576,
            "totalLiquidation": 0,
            "totalLiquidationAmount": 0,
            "runTimeDays": 469,
            "lastTradeAtTs": 1695863325000,
            "totalFee": 0.00319968,
            "type": "FULL",
            "statisticAt": "2025-01-08T22:17:26.996Z",
            "lastTradeAt": "2023-09-28T01:08:45.000Z",
            "indexTokens": [
                "0xC25cEf6061Cf5dE5eb761b50E4743c1F5D7E5407"
            ],
            "protocol": "GMX_V2",
            "createdAt": "2024-01-16T03:59:49.293Z"
        }
    ],
    "meta": {
        "total": 178562,
        "totalPages": 179,
        "pitId": "4YyPBAEZY29waW4ucG9zaXRpb25fc3RhdGlzdGljcxZ0Rnk1Y0YxSVF0V0VxdFdIdW9kcWN3ABYtOHMtQnhZdFMwQ2J6bElvRTUwUDl3AAAAAAAAD8e3FjB3Tjh6eGRpU25hSUlZdTM3ODY2cHcAARZ0Rnk1Y0YxSVF0V0VxdFdIdW9kcWN3AAA=",
        "searchAfter": [
            "65a5ff35d2d3d9a90630c1d0",
            756633
        ]
    }
}