Public API docs

1. Get trader statistics

URL

https://api.copin.io/public/:PROTOCOL/position/statistic/filter

PROTOCOL: KWENTA GMX POLYNOMIAL

Method

POST

Body

  • pagination:

    • limit: number of records

    • offset: number of skipped records

  • sortBy: supported all fieldName in ranges

  • sortType: desc, asc

  • queries: array of

    • fieldName: type account

    • value:

      • type: D7, D15, D30, D60

      • account: EVM address

  • ranges: array of

    • fieldName:

      • lastTradeAtTsTimestamp of last trade

      • runTimeDays Number of days since the first trade

      • pnl PnL including fee

      • realisedPnlPnL without fee

      • avgRoi Average ROI including fee

      • realisedAvgRoiAverage ROI without fee

      • totalGain Total gain including fee

      • realisedTotalGain Total gain without fee

      • totalLoss Total loss including fee

      • realisedTotalLoss Total loss without fee

      • totalFeeTotal fee

      • totalVolume Total volume

      • avgVolumeAverage volume

      • maxRoi Maximum ROI including fee

      • realisedMaxRoi Maximum ROI without fee

      • maxDrawdown Max drawdown including fee

      • realisedMaxDrawdown Max drawdown without fee

      • totalTrade Total trades

      • totalWin Total wins

      • totalLose Total loses

      • totalLiquidation Total liquidations

      • winRate Win Rate -- percent

      • profitRate Total gain / (Total gain + Total loss) -- percent, including fee

      • realisedProfitRateTotal gain / (Total gain + Total loss) -- percent, without fee

      • longRateLong Positions / Total Positions -- percent

      • orderPositionRatio Total Orders / Total Positions

      • profitLossRatio (Total gain / Total win) / (Total loss / Total lose) -- including fee

      • realisedProfitLossRatio(Total gain / Total win) / (Total loss / Total lose) -- without fee

      • gainLossRatio Total gain / Total loss -- including fee

      • realisedGainLossRatio Total gain / Total loss -- without fee

      • avgLeverageAverage leverage

      • maxLeverage Maximum leverage

      • minLeverage Minimum leverage

      • avgDuration Average duration in seconds

      • minDurationMinimum duration in seconds

      • maxDuration Maximum duration in seconds

    • gte: numeric value

    • lte: numeric value

Example request

{"pagination":{"limit":20,"offset":0},"queries":[{"fieldName":"type","value":"D30"}],"ranges":[{"fieldName":"realisedPnl","gte":1000},{"fieldName":"lastTradeAtTs","gte":1696240506809},{"fieldName":"totalWin","gte":5},{"fieldName":"realisedAvgRoi","gte":20},{"fieldName":"winRate","gte":80},{"fieldName":"realisedMaxDrawdown","gte":-30}],"sortBy":"realisedPnl","sortType":"desc"}

Example response

{
    "data": [
        {
            "id": "656291e14350fb0b6981e6ce",
            "account": "0x9f431A46149bab70373B9C6867d2dB8C2F45aa11",
            "totalTrade": 10,
            "totalWin": 10,
            "totalLose": 0,
            "totalGain": 57060.90483687067,
            "realisedTotalGain": 53926.13225839167,
            "totalLoss": 0,
            "realisedTotalLoss": 0,
            "totalVolume": 3504221.760537487,
            "avgVolume": 350422.1760537487,
            "avgRoi": 33.43488693937744,
            "realisedAvgRoi": 37.47677597570163,
            "maxRoi": 104.1059947215304,
            "realisedMaxRoi": 109.65725913031952,
            "pnl": 53926.13225839167,
            "realisedPnl": 57060.90483687067,
            "maxPnl": 16673.619290696948,
            "realisedMaxPnl": 17269.147842961316,
            "maxDrawdown": 0,
            "realisedMaxDrawdown": 0,
            "maxDrawdownPnl": 0,
            "realisedMaxDrawdownPnl": 0,
            "winRate": 100,
            "profitRate": 100,
            "realisedProfitRate": 100,
            "orderPositionRatio": 2.1,
            "profitLossRatio": 0,
            "realisedProfitLossRatio": 0,
            "longRate": 100,
            "gainLossRatio": 57060.90483687067,
            "realisedGainLossRatio": 53926.13225839167,
            "avgDuration": 68629,
            "minDuration": 11976,
            "maxDuration": 206986,
            "avgLeverage": 20.210503401712398,
            "minLeverage": 5.020509333784338,
            "maxLeverage": 30.179561022789816,
            "totalLiquidation": 0,
            "totalLiquidationAmount": 0,
            "runTimeDays": 139,
            "lastTradeAtTs": 1701696239000,
            "totalFee": 3134.772578479,
            "type": "D30",
            "statisticAt": "2023-12-05T00:05:59.524Z",
            "lastTradeAt": "2023-12-04T13:23:59.000Z",
            "createdAt": "2023-11-26T00:31:28.532Z",
            "isOpenPosition": true,
            "protocol": "KWENTA"
        },
        ...
    ],
    "meta": {
        "limit": 20,
        "offset": 0,
        "total": 15,
        "totalPages": 1
    }
}

2. Get trader positions

URL

https://api.copin.io/:PROTOCOL/position/filter

PROTOCOL: KWENTA GMX POLYNOMIAL

Method

POST

Body

  • pagination:

    • limit: number of records

    • offset: number of skipped records

  • sortBy: closeBlockTime openBlockTime averagePrice size leverage durationInSecond orderCount roi realisedRoi pnl realisedPnl

  • sortType: desc, asc

  • queries: array of

    • fieldName: account status

    • value:

      • status: CLOSE OPEN

      • account: EVM address

Example request

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

Example response

{
    "data": [
        {
            "id": "656bd0e0d8fb813a7046c86a",
            "synthetixPositionId": "49170", // only Kwenta, Polynomial
            "reverseIndex": 0,// only Kwenta, Polynomial
            "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
            "smartAccount": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C",  // only Kwenta, Polynomial
            "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",
            "lastSizeNumber": 0, // only Kwenta, Polynomial
            "size": 150057.1415073778,
            "fee": 126.470238805,
            "lastCollateral": 12987.245139121, // only Kwenta, Polynomial
            "collateral": 9907.023471108,
            "averagePrice": 2165.370462136,
            "lastFunding": -202.30654613, // only Kwenta, Polynomial
            "funding": -158.90564217635142,
            "lastPriceNumber": 2212.595384719, // only Kwenta, Polynomial
            "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
    }
}

3. Get position details

URL

https://api.copin.io/:PROTOCOL/position/detail/:positionId

PROTOCOL: KWENTA GMX POLYNOMIAL

Method

GET

Example request

https://api.copin.io/KWENTA/position/detail/656444f14350fb0b69bd6402

Example response

{
    "id": "656444f14350fb0b69bd6402",
    "synthetixPositionId": "48503", // only Kwenta, Polynomial
    "reverseIndex": 0, // only Kwenta, Polynomial
    "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
    "smartAccount": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C", // only Kwenta, Polynomial
    "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",
    "lastSizeNumber": 0, // only Kwenta, Polynomial
    "size": 299791.2220018517,
    "fee": 228.62124740700003,
    "lastCollateral": 13993.076127358, // only Kwenta, Polynomial
    "collateral": 16215.501363168,
    "averagePrice": 2022.9018492877242,
    "lastFunding": -195.163117027, // only Kwenta, Polynomial
    "funding": -112.83324162360957,
    "lastPriceNumber": 2063.625026153, // only Kwenta, Polynomial
    "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",
            "synthetixPositionId": "48503", // only Kwenta, Polynomial
            "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
            "smartAccount": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C", // only Kwenta, Polynomial
            "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": "6564c9d5c6583cc67b6a0a38",
            "synthetixPositionId": "48503", // only Kwenta, Polynomial
            "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
            "smartAccount": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C", // only Kwenta, Polynomial
            "txHash": "0x2a555f29a93ecb9a99c849f25ff798edc69fb099d04e6dd586cb46db35f91f00",
            "logId": 22,
            "blockNumber": 112752648,
            "blockTime": "2023-11-27T16:54:33.000Z",
            "key": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C-0x2B3bb4c683BFc5239B029131EEf3B1d214478d93-LONG",
            "indexToken": "0x2B3bb4c683BFc5239B029131EEf3B1d214478d93",
            "sizeDeltaNumber": 0,
            "sizeNumber": 0,
            "collateralDeltaNumber": 3218.916340476,
            "priceNumber": 0,
            "fundingRateNumber": 0,
            "fundingNumber": 0,
            "leverage": 0,
            "isLong": true,
            "isOpen": false,
            "type": "MARGIN_TRANSFERRED",
            "createdAt": "2023-11-27T16:54:45.331Z"
        },
        {
            "id": "6564c9dac6583cc67b6a0a43",
            "synthetixPositionId": "48503", // only Kwenta, Polynomial
            "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
            "smartAccount": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C", // only Kwenta, Polynomial
            "txHash": "0xd1749c1b3319fe2ea0e3da6aa7ea9633bc265dd5c1a0ec9ec7bb0a591b690dfb",
            "logId": 12,
            "blockNumber": 112752650,
            "blockTime": "2023-11-27T16:54:37.000Z",
            "key": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C-0x2B3bb4c683BFc5239B029131EEf3B1d214478d93-LONG",
            "indexToken": "0x2B3bb4c683BFc5239B029131EEf3B1d214478d93",
            "sizeDeltaNumber": 74977.61596141392,
            "sizeNumber": 37.1775,
            "collateralDeltaNumber": 159.73717763400055,
            "priceNumber": 2016.747117515,
            "feeNumber": 49.943313331,
            "fundingRateNumber": 0,
            "fundingNumber": -194.181960095,
            "leverage": 16.72779681583392,
            "isLong": true,
            "isClose": false,
            "type": "INCREASE",
            "createdAt": "2023-11-27T16:54:50.322Z"
        },
        ...,
        {
            "id": "6565d90bc6583cc67b6b0131",
            "synthetixPositionId": "48503", // only Kwenta, Polynomial
            "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
            "smartAccount": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C", // only Kwenta, Polynomial
            "txHash": "0xa4ca3a4a5467868b31412e4b2c1f49ec920a599f686c0f2d6142edde51b0bda7",
            "logId": 8,
            "blockNumber": 112787364,
            "blockTime": "2023-11-28T12:11:45.000Z",
            "key": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C-0x2B3bb4c683BFc5239B029131EEf3B1d214478d93-LONG",
            "indexToken": "0x2B3bb4c683BFc5239B029131EEf3B1d214478d93",
            "sizeDeltaNumber": 74898.679078195,
            "sizeNumber": 37,
            "collateralDeltaNumber": 3813.289160432001,
            "priceNumber": 2024.288623735,
            "feeNumber": 84.28932395400001,
            "fundingRateNumber": 0,
            "fundingNumber": -194.971449737,
            "leverage": 11.238724609457813,
            "isLong": true,
            "isClose": false,
            "type": "DECREASE",
            "createdAt": "2023-11-28T12:11:55.022Z"
        },
        ...,
        {
            "id": "65662c12c6583cc67b6b55d1",
            "synthetixPositionId": "48503", // only Kwenta, Polynomial
            "account": "0x852610C4BD327C9c7fd93e06505173092f29a39c",
            "smartAccount": "0x375fa2B494208b0F4f3f5f0b85121844a929AE6C", // only Kwenta, Polynomial
            "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"
        }
    ]
}

4. Leaderboards

URL

https://api.copin.io/leaderboards/page

Method

GET

Query

  • protocol: KWENTA GMX POLYNOMIAL

  • queryDate: Date in timestamp

  • statisticType: MONTH WEEK

  • limit: number of records

  • offset: number of skipped records

  • sort_by: ranking totalPnl totalRealisedPnl totalVolume totalFee totalTrade totalWin totalLose totalLiquidation totalLiquidationAmount

  • sort_type: asc desc

Example query

https://api.copin.io/leaderboards/page?protocol=KWENTA&queryDate=1701835880676&statisticType=MONTH&limit=20&offset=0&sort_by=ranking&sort_type=asc

Example response

{
    "data": [
        {
            "id": "656fb9897fdc207f19e4ef1f",
            "account": "0x92812499fF2c040f93121Aab684680a6e603C4A7",
            "protocol": "KWENTA",
            "statisticType": "MONTH",
            "rankingAt": "2023-12-06T00:00:08.841Z",
            "ranking": 1,
            "lastRanking": 1,
            "totalPnl": 2124229.3913290403,
            "totalRealisedPnl": 2137944.463823661,
            "totalVolume": 11012185.066084206,
            "totalFee": 13715.072494621,
            "totalTrade": 1,
            "totalWin": 1,
            "totalLose": 0,
            "totalLiquidation": 0,
            "totalLiquidationAmount": 0,
            "createdAt": "2023-12-06T00:00:09.748Z"
        },
        ...
    ],
     "meta": {
        "limit": 20,
        "offset": 0,
        "total": 728,
        "totalPages": 37
    }
}

5. Open Interest

URL

https://api.copin.io/:PROTOCOL/top-positions/opening

PROTOCOL: KWENTA GMX POLYNOMIAL

Method

POST

Body

  • pagination:

    • limit: number of records

    • offset: number of skipped records

  • sortBy: openBlockTime size pnl realisedPnl

  • sortType: desc

Example request

{"pagination":{"limit":100,"offset":0},"sortBy":"openBlockTime","sortType":"desc"}

Example response

{
    "data": [
         {
            "id": "6594c3cbd8fb813a7075e685",
            "account": "0x70bEca4393FFB22C3eeC3C5888e4f2cb39304Dd2",
            "key": "0x3a8b0adb391eb05bc8816dffdb7a40e4296246a05a531b461e5c9f39faf19491",
            "indexToken": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
            "collateral": 29978.3187,
            "size": 146248.6183,
            "averagePrice": 45256.2,
            "fee": 146.2486,
            "realisedPnl": 52.99776251917983,
            "realisedRoi": 0.00036238128698395933,
            "roi": -0.00045297660872989365,
            "pnl": -66.24720314896666,
            "isLong": true,
            "leverage": 4.878479669375188,
            "openBlockNumber": 166512160,
            "isLiquidate": false,
            "status": "OPEN",
            "openBlockTime": "2024-01-03T02:17:45.000Z",
            "protocol": "GMX",
            "createdAt": "2024-01-03T02:17:47.183Z"
        },
        ...
    ],
    "meta": {
        "limit": 100,
        "offset": 0,
        "total": 829,
        "totalPages": 9
    }
}

Last updated