GET
/
{protocol}
/
position
/
{txHash}
curl --request GET \
  --url https://api.copin.io/{protocol}/position/{txHash}
{
  "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>",
  "orders": [
    {
      "id": "<string>",
      "account": "<string>",
      "txHash": "<string>",
      "logId": 123,
      "blockNumber": 123,
      "blockTime": "<string>",
      "key": "<string>",
      "indexToken": "<string>",
      "pair": "<string>",
      "sizeDeltaNumber": 123,
      "sizeNumber": 123,
      "collateralDeltaNumber": 123,
      "priceNumber": 123,
      "feeNumber": 123,
      "fundingRateNumber": 123,
      "fundingNumber": 123,
      "leverage": 123,
      "isLong": true,
      "isOpen": true,
      "isClose": true,
      "type": "<string>",
      "createdAt": "<string>"
    }
  ]
}

Path Parameters

protocol
string
required

The protocol to get position details 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

txHash
string
required

The open order transaction hash

Request Parameters

logId
string

The open order log id. Goes with the transaction hash

account
string

Trader’s account address. Goes with the transaction hash

isLong
boolean

Whether the position is long. Goes with the transaction hash

Request Example

curl -X GET "https://api.copin.io/KWENTA/position/0xb6c1d05806205893e33e2248fb67a7701931126777d3e706d91d7503dd83b34e?logId=11&account=0x852610C4BD327C9c7fd93e06505173092f29a39c&isLong=true" \
  -H "X-COPIN_API_KEY: YOUR_COPIN_API_KEY"

Response:

id
string

Unique identifier for the position

account
string

Trader’s account address

key
string

Unique key for the position

logId
number

Log ID

openBlockNumber
number

Block number when position was opened

openBlockTime
string

Timestamp when position was opened

closeBlockNumber
number

Block number when position was closed

closeBlockTime
string

Timestamp when position was closed

indexToken
string

Token address

pair
string

Trading pair

size
number

Position size

fee
number

Fee paid

collateral
number

Collateral amount

averagePrice
number

Average entry price

funding
number

Funding amount

pnl
number

Profit and loss including fee

realisedPnl
number

Profit and loss without fee

roi
number

Return on investment including fee

realisedRoi
number

Return on investment without fee

isLong
boolean

Whether position is long

isWin
boolean

Whether position is winning

isLiquidate
boolean

Whether position was liquidated

leverage
number

Leverage used

orderCount
number

Number of orders

orderIncreaseCount
number

Number of increase orders

orderDecreaseCount
number

Number of decrease orders

durationInSecond
number

Duration in seconds

status
string

Position status (OPEN, CLOSE)

createdAt
string

Timestamp when record was created

protocol
string

Protocol name

orders
array

Array of orders for this position

Response Example

[
  {
    "id": "656444f14350fb0b69bd6402",
    "synthetixPositionId": "48503",
    "reverseIndex": 0,
    "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
    "key": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C-0x2B3bb4c683BFc5239B029131EEf3B1d214478d93-LONG",
    "logId": 11,
    "openBlockNumber": 112735639,
    "openBlockTime": "2023-11-27T07:27:35.000Z",
    "closeBlockNumber": 112797988,
    "closeBlockTime": "2023-11-28T18:05:53.000Z",
    "indexToken": "0x2B3bb4c683BFc5239B029131EEf3B1d214478d93",
    "size": 299791.2220018517,
    "fee": 228.62124740700003,
    "collateral": 16215.501363168,
    "averagePrice": 2022.9018492877242,
    "funding": -112.83324162360957,
    "pnl": 3993.0761273536705,
    "realisedPnl": 4334.53061638428,
    "roi": 24.625054988577602,
    "realisedRoi": 26.730783830278366,
    "isLong": true,
    "isWin": true,
    "isLiquidate": false,
    "leverage": 18.487940353346062,
    "orderCount": 6,
    "orderIncreaseCount": 3,
    "orderDecreaseCount": 3,
    "durationInSecond": 124698,
    "status": "CLOSE",
    "createdAt": "2023-11-27T07:27:45.029Z",
    "protocol": "KWENTA",
    "orders": [
      {
        "id": "656444f1c6583cc67b6985b6",
        "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
        "txHash": "0xb6c1d05806205893e33e2248fb67a7701931126777d3e706d91d7503dd83b34e",
        "logId": 11,
        "blockNumber": 112735639,
        "blockTime": "2023-11-27T07:27:35.000Z",
        "key": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C-0x2B3bb4c683BFc5239B029131EEf3B1d214478d93-LONG",
        "indexToken": "0x2B3bb4c683BFc5239B029131EEf3B1d214478d93",
        "sizeDeltaNumber": 149884.05160703347,
        "sizeNumber": 73.5244,
        "collateralDeltaNumber": 9967.858290134,
        "priceNumber": 2038.562050245,
        "fundingRateNumber": 0.000209485,
        "fundingNumber": -194.18719593,
        "leverage": 15.036735800646957,
        "isLong": true,
        "isOpen": true,
        "type": "OPEN",
        "createdAt": "2023-11-27T07:27:45.026Z"
      },
      {
        "id": "65662c12c6583cc67b6b55d1",
        "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
        "txHash": "0x267f696c7e751ea6e39eeb576988f069f9535714331117954fb9c61838d637b6",
        "logId": 12,
        "blockNumber": 112797988,
        "blockTime": "2023-11-28T18:05:53.000Z",
        "key": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C-0x2B3bb4c683BFc5239B029131EEf3B1d214478d93-LONG",
        "indexToken": "0x2B3bb4c683BFc5239B029131EEf3B1d214478d93",
        "sizeDeltaNumber": 153118.087865516,
        "sizeNumber": 74.1986,
        "collateralDeltaNumber": 363.81130071199914,
        "priceNumber": 2063.625026153,
        "feeNumber": 228.62124740700003,
        "fundingRateNumber": 0,
        "fundingNumber": -195.163117027,
        "leverage": 18.487940353346062,
        "isLong": true,
        "isClose": true,
        "type": "CLOSE",
        "createdAt": "2023-11-28T18:06:10.036Z"
      }
    ]
  }
]