POST
/
{protocol}
/
position
/
filter
curl --request POST \
  --url https://api.copin.io/{protocol}/position/filter \
  --header 'Content-Type: application/json' \
  --data '{
  "pagination": {
    "limit": 123,
    "offset": 123
  },
  "sortBy": "<string>",
  "sortType": "<string>",
  "queries": [
    {
      "fieldName": "<string>",
      "value": "<string>"
    }
  ]
}'
{
  "data": [
    {
      "id": "<string>",
      "account": "<string>",
      "key": "<string>",
      "logId": 123,
      "openBlockNumber": 123,
      "openBlockTime": "<string>",
      "closeBlockNumber": 123,
      "closeBlockTime": "<string>",
      "indexToken": "<string>",
      "pair": "<string>",
      "size": 123,
      "fee": 123,
      "collateral": 123,
      "averagePrice": 123,
      "funding": 123,
      "pnl": 123,
      "realisedPnl": 123,
      "roi": 123,
      "realisedRoi": 123,
      "isLong": true,
      "isWin": true,
      "isLiquidate": true,
      "leverage": 123,
      "orderCount": 123,
      "orderIncreaseCount": 123,
      "orderDecreaseCount": 123,
      "durationInSecond": 123,
      "status": "<string>",
      "createdAt": "<string>",
      "protocol": "<string>"
    }
  ],
  "meta": {
    "limit": 123,
    "offset": 123,
    "total": 123,
    "totalPages": 123
  }
}

Path Parameters

protocol
string
required

The protocol to get positions for. Supported values include: GMX, KWENTA, POLYNOMIAL, POLYNOMIAL_L2, GMX_V2_AVAX, GMX_V2, GNS, GNS_POLY, GNS_BASE, GNS_APE, LEVEL_BNB, LEVEL_ARB, MUX_ARB, APOLLOX_BNB, AVANTIS_BASE, EQUATION_ARB, LOGX_BLAST, LOGX_MODE, MYX_ARB, DEXTORO, VELA_ARB, HMX_ARB, SYNTHETIX_V3, SYNTHETIX_V3_ARB, KTX_MANTLE, CYBERDEX, YFX_ARB, KILOEX_OPBNB, KILOEX_BNB, KILOEX_MANTA, KILOEX_BASE, ROLLIE_SCROLL, MUMMY_FANTOM, HYPERLIQUID, SYNFUTURE_BASE, MORPHEX_FANTOM, PERENNIAL_ARB, BSX_BASE, DYDX, UNIDEX_ARB, VERTEX_ARB, HORIZON_BNB, HOLDSTATION_ZKSYNC, ZENO_METIS, LINEHUB_LINEA, BMX_BASE, FOXIFY_ARB, APOLLOX_BASE, GMX_AVAX, SYNTHETIX, DEPERP_BASE, ELFI_ARB

Request Body

pagination
object

Pagination parameters

sortBy
string

Field to sort by. Values: closeBlockTime, openBlockTime, averagePrice, size, leverage, durationInSecond, orderCount, roi, realisedRoi, pnl, realisedPnl

sortType
string
default:"desc"

Sort direction. Values: desc, asc

queries
array

Array of query objects

Request Example

{
  "pagination": {
    "limit": 20,
    "offset": 0
  },
  "queries": [
    {
      "fieldName": "status",
      "value": "CLOSE"
    },
    {
      "fieldName": "account",
      "value": "0x9f431A46149bab70373B9C6867d2dB8C2F45aa11"
    }
  ],
  "sortBy": "closeBlockTime",
  "sortType": "desc"
}

Response

data
array

Array of trader positions

meta
object

Metadata about the response

Response Example

{
  "data": [
    {
      "id": "656bd0e0d8fb813a7046c86a",
      "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
      "key": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C-0x2B3bb4c683BFc5239B029131EEf3B1d214478d93-LONG",
      "logId": 16,
      "openBlockNumber": 112982925,
      "openBlockTime": "2023-12-03T00:50:27.000Z",
      "closeBlockNumber": 113022125,
      "closeBlockTime": "2023-12-03T22:37:07.000Z",
      "indexToken": "0x2B3bb4c683BFc5239B029131EEf3B1d214478d93",
      "pair": "ETH-USDT",
      "size": 150057.1415073778,
      "fee": 126.470238805,
      "collateral": 9907.023471108,
      "averagePrice": 2165.370462136,
      "funding": -158.90564217635142,
      "pnl": 5958.737081751136,
      "realisedPnl": 6244.112962732488,
      "roi": 60.14659296133386,
      "realisedRoi": 63.02713404225081,
      "isLong": true,
      "isWin": true,
      "isLiquidate": false,
      "leverage": 15.146541435476728,
      "orderCount": 2,
      "orderIncreaseCount": 1,
      "orderDecreaseCount": 1,
      "durationInSecond": 78400,
      "status": "CLOSE",
      "createdAt": "2023-12-03T00:50:40.058Z",
      "protocol": "KWENTA"
    }
  ],
  "meta": {
    "limit": 20,
    "offset": 0,
    "total": 56,
    "totalPages": 3
  }
}