Skip to content

API Reference

Base URLs

  • Testnet: https://api-testnet.leverup.xyz/
  • Mainnet: https://service.leverup.xyz

Get Oracle Updates by Position

Fetches the encoded oracle update data and fees required by openMarketTradeV2 and openLimitOrderV2.

Clients should call this backend endpoint instead of calling Pyth Hermes directly.

Endpoint

POST /v1/oracle/price/updates/by-position

Request Body

NameTypeDescription
pairBasestringPair base address for the trading pair.
collateralstringCollateral token address. Use the wrapped native token address when the user pays with native MON.
blockChainstringBlockchain identifier. Currently MONAD.
options.includeEncodingDatabooleanSet to true to receive encoded update data.
options.includeEncodingDataByOracleIdbooleanSet to false for the standard trade flow.
options.includeFeebooleanSet to true to receive oracle fees.
options.includePricebooleanSet to false unless price snapshots are needed.
options.includePublishTimebooleanSet to false unless publish times are needed.
json
{
  "pairBase": "0xcf5a6076cfa32686c0df13abada2b40dec133f1d",
  "collateral": "0x754704Bc059F8C67012fEd69BC8A327a5aafb603",
  "blockChain": "MONAD",
  "options": {
    "includeEncodingData": true,
    "includeEncodingDataByOracleId": false,
    "includeFee": true,
    "includePrice": false,
    "includePublishTime": false
  }
}

Response

Use pythPriceUpdateData and pythProPriceUpdateData as the OracleUpdateData tuple passed to the V2 contract methods. Send updateFee + verifition_fee as transaction value for ERC20 collateral. For native MON, add the native collateral amount as well.

json
{
  "pythPriceUpdateData": ["0x..."],
  "pythProPriceUpdateData": ["0x..."],
  "updateFee": "123456789",
  "verifition_fee": "0",
  "pythCoreSingleUpdateFeeWei": "123456789",
  "pythCoreTransactionFeeWei": "123456789",
  "pythProVerificationFeeWei": "0"
}

Note: The response field is currently spelled verifition_fee by the backend API.

Get Latest Pair Prices

Fetches latest backend oracle prices for multiple pair base addresses.

Endpoint

POST /v1/oracle/price/pairs/latest

Request Body

json
{
  "pairBases": [
    "0xcf5a6076cfa32686c0df13abada2b40dec133f1d",
    "0xb5a30b0fdc5ea94a52fdc42e3e9760cb8449fb37"
  ],
  "blockChain": "MONAD"
}

Response

prices is keyed by pair base address. Price values are integer strings using 18 decimals.

json
{
  "prices": {
    "0xcf5a6076cfa32686c0df13abada2b40dec133f1d": "100000000000000000000000",
    "0xb5a30b0fdc5ea94a52fdc42e3e9760cb8449fb37": "3000000000000000000000"
  }
}

Get Pair Historical Price

Fetches a backend oracle price point for a pair from 24 hours ago, or a custom number of hours ago.

Endpoints

  • GET /v1/oracle/price/pair-24h-ago
  • GET /v1/oracle/price/pair-hours-ago

Parameters

NameInTypeDescription
pair_baseQuerystringPair base address.
block_chainQuerystringBlockchain identifier. Currently MONAD.
hours_agoQueryintegerNumber of hours ago. Only used by /pair-hours-ago.

Response

json
{
  "pairBase": "0xcf5a6076cfa32686c0df13abada2b40dec133f1d",
  "hoursAgo": 24,
  "blockChain": "MONAD",
  "oracleId": {
    "kind": "PYTH_CORE",
    "id": "0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"
  },
  "pricePoint": {
    "price": "100000000000000000000000",
    "publishTime": 1769586529,
    "capturedAt": 1769586530
  }
}

Get Trading Competitions

Fetches trading competitions, optionally filtered by status, display readiness, and user address.

Endpoint

GET /v1/trading-competition

Parameters

NameInTypeDescription
statusQuerystringOptional competition status: UPCOMING, ONGOING, or ENDED.
isReadyToDisplayQuerybooleanOptional filter for competitions ready to be shown in the UI.
userAddressQuerystringOptional user wallet address. When provided, each item includes whether that user has joined.

Response

json
[
  {
    "id": 1,
    "title": "Trading Competition",
    "description": "Compete by trading volume or PnL.",
    "banner": "https://...",
    "ruleLink": "https://...",
    "ruleId": "DEFAULT",
    "leaderboardType": "TOTAL_VOLUME_BASED",
    "rewardAmount": "10000",
    "rewardTokenAddress": "0x...",
    "rewardType": "TOKEN",
    "rewardDescription": "10,000 USDC rewards",
    "startTime": 1769586529,
    "endTime": 1770186529,
    "currentParticipants": 128,
    "tradingVolume": 2500000,
    "isReadyToDisplay": true,
    "status": "ONGOING",
    "hasJoined": true
  }
]

Enums

  • leaderboardType: DEFAULT, PNL_BASED, TOTAL_VOLUME_BASED, LOW_LEVERAGE_VOLUME_BASED, HIGH_LEVERAGE_VOLUME_BASED
  • rewardType: TOKEN
  • status: UPCOMING, ONGOING, ENDED

Get Trading Competition Leaderboard

Fetches a paginated leaderboard for a specific trading competition. The leaderboard columns are dynamic; use headers to render and sort columns.

Endpoint

GET /v1/trading-competition/{id}/leaderboard

Parameters

NameInTypeDescription
idPathintegerTrading competition ID.
pageQueryintegerPage number, 0-indexed.
limitQueryintegerNumber of rows per page.
orderByQuerystringOptional sort key. Use a headers[].key value returned by this endpoint.
orderDirectionQuerystringOptional sort direction: ASC or DESC.

Response

headers describes the dynamic metric columns. Each leaderboard row stores metric values in stats by header key.

json
{
  "headers": [
    {
      "key": "totalVolume",
      "label": "Total Volume"
    },
    {
      "key": "pnl",
      "label": "PnL"
    }
  ],
  "data": {
    "content": [
      {
        "trader": "0x...",
        "stats": {
          "totalVolume": 125000,
          "pnl": 3200.5
        }
      }
    ],
    "pageNumber": 0,
    "pageSize": 10,
    "totalPages": 5,
    "totalElements": 42
  }
}

Join Trading Competition

Joins a trading competition using an invite code.

Endpoint

POST /v1/trading-competition/join

Request Body

NameTypeDescription
traderstringTrader wallet address.
inviteCodestringCompetition invite code.
json
{
  "trader": "0x...",
  "inviteCode": "ABC123"
}

Response

Returns 204 No Content on success.

Get User Positions

Fetches a paginated list of positions for a specific user.

Endpoint

GET /v1/user/{userAddress}/positions

Parameters

NameInTypeDescription
userAddressPathstringThe user's wallet address (0x...)
sizeQueryintegerNumber of items per page (e.g. 50)
pageQueryintegerPage number (0-indexed)

Response

The response contains a list of positions and pagination metadata.

Note: The closeInfo object is only present if the position status is CLOSED.

json
{
  "content": [
    {
      "positionHash": "0x...",
      "pair": "USD/JPY",
      "pairBase": "0x...",
      "tokenIn": "0x...",
      "marginToken": "0x...",
      "isLong": true,
      "margin": "198610087343796248914",
      "qty": "130027570225",
      "entryPrice": "152705269000000000000",
      "stopLoss": "0",
      "takeProfit": "229073300000000000000",
      "openFee": "1389912656203751086",
      "executionFee": "0",
      "longAccFundingFeePerShare": "0",
      "holdingFeeRate": "317",
      "timestamp": 1769586529,
      "status": "OPEN"
    },
    {
      "positionHash": "0x...",
      "pair": "MON/USD",
      "pairBase": "0x...",
      "tokenIn": "0x...",
      "marginToken": "0x...",
      "isLong": true,
      "margin": "19861095665546146061470",
      "qty": "1981375571697510",
      "entryPrice": "28048519765000000",
      "stopLoss": "0",
      "takeProfit": "42140000000000000",
      "openFee": "138904334453853938530",
      "executionFee": "0",
      "longAccFundingFeePerShare": "0",
      "holdingFeeRate": "3166",
      "timestamp": 1767681382,
      "status": "CLOSED",
      "closeInfo": {
        "closePrice": "27952767860000000",
        "fundingFee": "-1463189752048306575",
        "closeFee": "138488245583797461449",
        "pnl": "-677699989249776266201",
        "holdingFee": "113131466803151515"
      }
    }
  ],
  "pageNumber": 0,
  "pageSize": 50,
  "totalPages": 1,
  "totalElements": 2
}