Overview

Pokeliquid is the first on-chain perpetual futures DEX for Pokémon TCG products. Built on Solana using the Anchor framework, it offers 67+ markets letting traders go long or short on sealed products and single cards with up to 25x leverage. Prices are sourced from TCGPlayer market data via an automated Playwright scraper with adaptive EWMA smoothing.

Live on Solana Mainnet with real USDC.

Current Markets

MarketCardSetCard #Live
PL500-PERPPL500 IndexIndex—Yes
PRISMATIC-ETB-PERPPrismatic Evolutions ETBSealed Product—Yes
CHARIZARD-125/094-PFL-PERPMega Charizard X exPhantasmal Flames125/094Yes
CHARMANDER-038-MEP-PERPCharmanderMega Evolution Promo038Yes
PIKACHU-276/217-AH-PERPPikachu exAscended Heroes276/217Yes
GRENINJA-116/086-CR-PERPMega Greninja exChaos Rising116/086Yes
ASCENDED-HEROES-ETB-PERPAscended Heroes ETBSealed Product—Yes
PSYDUCK-226/217-AH-PERPPsyduckAscended Heroes226/217Yes
MEOWTH-106/094-PFL-PERPMeowthPhantasmal Flames106/094Yes
BLACK-BOLT-ETB-PERPBlack Bolt ETBSealed Product—Yes
MAGNETON-159-PROMO-PERPMagnetonSV Promo159Yes
CHARIZARD-199/165-151-PERPCharizard exSV 151199/165Yes
MISTYS-PSYDUCK-193/182-DR-PERPMisty's PsyduckDestined Rivals193/182Yes
UMBREON-161/131-PE-PERPUmbreon exPrismatic Evolutions161/131Yes
MEW-232/091-PF-PERPMew exPaldean Fates232/091Yes
PIKACHU-238/191-SS-PERPPikachu exSurging Sparks238/191Yes
GIRATINA-GG69/GG70-CZ-PERPGiratina VSTARCrown ZenithGG69/GG70Yes
CHAOS-RISING-BB-PERPChaos Rising Booster BoxSealed Product—Yes
KABUTO-FOSSIL-1E-PERPKabutoFossil 1st Edition—Yes
GENGAR-284/217-AH-PERPMega Gengar exAscended Heroes284/217Yes
DRAGONITE-290/217-AH-PERPMega Dragonite exAscended Heroes290/217Yes
CLEFAIRY-094/088-PO-PERPClefairyPerfect Order094/088Yes

Network

Solana Mainnet. All addresses are mainnet PDAs derived from the program.

Getting Started

1. Visit the app

Go to pokeliquid.xyz.

2. Create an account

Click “Start Trading” on the landing page. You can create an account with email and password, or continue as a guest with no account.

3. Session Wallet

No browser wallet extension (Phantom, Solflare) is required. Pokeliquid automatically generates a Solana keypair stored in your browser’s localStorage. This “session wallet” signs all transactions locally. If you create an account, your encrypted private key is stored server-side for email recovery (AES-256-GCM encryption).

4. Deposit Collateral

Click “DEPOSIT/WITHDRAW” and deposit USDC into your margin account. Your margin account is a PDA derived from your wallet address with the seed margin.

5. Open a Position

Select a market, choose Long or Short, set your collateral amount and leverage (1-25x), optionally set Stop Loss and Take Profit prices, then click to open your position.

6. Password Reset

If you forget your password, click “Forgot password?” on the login screen. Enter your email and you’ll receive a reset link via email. The link expires in 1 hour and is single-use.

Trading

Opening a Position

The open_position instruction accepts:

ParameterTypeDescription
directionLong | ShortTrade direction
collateralu64USDC collateral amount (6 decimals, e.g. 10_000_000 = $10)
leverageu8Leverage multiplier (1–25)
sl_priceOption<u64>Optional stop-loss price (6 decimal scale)
tp_priceOption<u64>Optional take-profit price (6 decimal scale)

Notional value = collateral \u00D7 leverage. A 0.5% fee (50 bps) is deducted from collateral on open. The position is stored in your MarginAccount which supports up to 5 simultaneous positions.

Order Types

Currently only Market orders are supported on-chain. The frontend also shows Limit and Stop order UI, but these are executed as market orders when the price condition is met by the keeper.

Closing a Position

Call close_position with the position slot index (0\u20134). PnL is calculated as:

Long PnL  = notional * (exit_price - entry_price) / entry_price
Short PnL = notional * (entry_price - exit_price) / entry_price

A 0.5% close fee is deducted. There is no profit cap — winning positions pay their full PnL. The settlement amount (collateral + PnL - fees) is transferred from/to the fee vault. There is no collateral cap per position — size is only bounded by the per-market OI limit.

FIFO Payout Queue

If a winning trade exceeds the LP vault's available balance, the trader still closes their position. They receive whatever USDC the LP vault can cover immediately, and the remaining amount is logged on-chain as a shortfall. A permissionless process_payouts instruction processes the queue in FIFO order as fees and liquidations replenish the LP vault. Traders always get paid — the only variable is timing.

Stop Loss / Take Profit

Set SL/TP on any open position via set_sl_tp. The keeper monitors prices and calls execute_sl_tp permissionlessly when conditions are met. The executor receives a 0.1% reward (10 bps of position collateral) for executing the order.

Multiple Positions

Each MarginAccount supports up to 5 simultaneous positions across any market. Positions are stored in a fixed-size array. MarginAccount size = 546 bytes.

Fees & Costs

FeeRateNotes
Open Fee0.5% (50 bps)Deducted from collateral when opening
Close Fee0.5% (50 bps)Deducted from settlement when closing
Profit CapNone (uncapped)Full PnL paid out
Min Position Size$1.00 (1,000,000 raw)Minimum collateral

Trading Fee Distribution

Trading fees collected on open and close are distributed:

DestinationShareDescription
LP Pool50% (5,000 bps)Distributed to liquidity providers
Insurance Fund25% (2,500 bps)Bad debt coverage
Platform25%Protocol revenue (stays in fee vault)

Funding Rate

Funding is calculated per-second and settled by the keeper via settle_funding (permissionless crank). Funding accrues continuously based on elapsed seconds, not in discrete hourly increments. Only the majority side pays funding — the minority side pays nothing. The funding rate has two components:

Base Rate:  30 / 100,000 per hour = 0.03%/hr = 0.72%/day
Skew Rate: skew_factor * (long_OI - short_OI) / (long_OI + short_OI)
           where skew_factor = 1,000 / 100,000 = 1%

Majority side pays: base_rate + skew_rate (per hour)
Minority side pays: 0 (benefits from being on the less crowded side)

Funding Fee Distribution

Funding fees collected from the majority side are distributed:

DestinationShareDescription
LP Pool70% (7,000 bps)Distributed to liquidity providers
Insurance Fund20% (2,000 bps)Bad debt coverage
Platform10%Protocol revenue (stays in fee vault)

Risk Management

Liquidation

A position is liquidatable when its margin ratio falls below 5% (500 bps).

Margin Ratio = (collateral + unrealized_PnL) / notional

Liquidation Price (Long):
  entry_price * (1 - (collateral - notional * 0.05) / notional)

Liquidation Price (Short):
  entry_price * (1 + (collateral - notional * 0.05) / notional)

Liquidation is permissionless — anyone can call liquidate. The keeper checks every 10 seconds and liquidates undercollateralized positions.

Liquidation Distribution

RecipientShareDescription
Liquidator2% (200 bps)Reward for calling liquidate
LP Pool44% (4,400 bps)Distributed to liquidity providers
Insurance Fund44% (4,400 bps)Bad debt reserve
Platform10%Protocol revenue (stays in fee vault)

Add / Remove Margin

Use add_margin to move free collateral into a position (lowering liquidation price). Use remove_margin to withdraw margin back to free collateral (health-checked — cannot reduce margin ratio below the liquidation threshold).

Oracle

Price Source

Prices are scraped from TCGPlayer product pages using Playwright (headless Chromium). The keeper runs a browser instance, navigates to each product page, and extracts the current market price. All 22 live markets are scraped in parallel.

Each market has its own oracle PDA. See the Protocol section below for key addresses. All oracle PDAs are derived from seeds ["oracle", market_id].

Update Frequency

The oracle updates every 5 minutes (300,000ms). Each market has its own on-chain oracle account (PDA seeded with ["oracle", market_id]).

Adaptive EWMA Smoothing

Raw scraped prices are smoothed using an Adaptive Exponential Weighted Moving Average (EWMA) with 4 tiers based on price deviation from the current EWMA:

DeviationAlphaModeBehavior
< 3%1.0DirectPrice passes through unchanged
3–5%0.3ModerateModerate smoothing applied
5–15%0.1HeavyHeavy smoothing, slow convergence
> 15%0.01SpikeNear-total rejection, spike protection
EWMA formula: new_ewma = alpha * raw_price + (1 - alpha) * prev_ewma

Price floor protection: if candidate < floor, update is rejected entirely.
Each market has a configurable price floor to reject invalid data.

Staleness Protection

On-chain, the oracle has a staleness threshold of 30 minutes (1,800 seconds). Anyone can call check_and_pause (permissionless) to automatically pause the protocol if the oracle is stale beyond the auto-pause threshold of 1 hour.

Secondary Authority

The oracle accepts updates from either the admin wallet or a secondary authority keypair. The keeper automatically fails over to the secondary keypair after 3 consecutive primary failures, and sends Telegram alerts when failover occurs.

Liquidity Pool

How It Works

Liquidity providers deposit USDC into the pool via lp_deposit and receive LP shares. Shares represent proportional ownership of the pool. The share price = total_usdc / total_shares.

Earning Fees

LPs earn fees from three sources:

SourceLP ShareDescription
Trading Fees50%From position open and close fees
Funding Fees70%From majority-side funding payments
Liquidations44%From liquidated position collateral

All LP fees accumulate in the fee vault and are claimable proportionally via claim_fees at any time.

Withdrawing

Call lp_withdraw with the number of shares to burn. USDC is returned proportionally. There is no lockup period — withdraw anytime.

Referral Program

Pokeliquid has an on-chain referral system. Register a unique username, share your referral link, and earn a percentage of trading fees from users who sign up through your link.

How It Works

1. Go to the Referral page and register a username (stored on-chain as a ReferralAccount PDA).

2. Share your link: pokeliquid.xyz/ref/your-username

3. When someone signs up through your link, their trades attribute fees to your referral account.

4. Claim accumulated referral fees anytime from the Referral page.

Protocol

Program Details

PropertyValue
Program ID5C1cz4kCA8DcD2zjhBphuK86vAjdoCnichK1kdLHPMt6
NetworkSolana Mainnet
FrameworkAnchor 1.0.2
Frontendpokeliquid.xyz

Deployed Addresses

ProtocolState
Global protocol configuration PDA
Oracle (ETB)
PRISMATIC-ETB-PERP price feed
Oracle (Charizard)
CHARIZARD-125/094-PFL-PERP price feed
Oracle (Charmander)
CHARMANDER-038-MEP-PERP price feed
Oracle (Pikachu)
PIKACHU-276/217-AH-PERP price feed
Fee Vault
Protocol revenue vault
Insurance Fund
Bad debt coverage fund
Liquidity Pool
LP pool state

All Instructions

InstructionAuthDescription
initializeAdminOne-time protocol setup, creates all PDAs
initialize_poolAdminOne-time LP pool setup
deposit_collateralUserDeposit USDC into margin account
withdraw_collateralUserWithdraw free collateral
close_margin_accountUserClose margin account, return rent
realloc_marginUserResize margin account (migration helper)
open_positionUserOpen a leveraged perpetual position
close_positionUserClose a position, settle PnL
add_marginUserAdd collateral to an open position
remove_marginUserRemove margin (health-checked)
set_sl_tpUserSet stop-loss / take-profit prices
execute_sl_tpPermissionlessExecute triggered SL/TP orders
liquidatePermissionlessLiquidate undercollateralized position
settle_fundingPermissionlessSettle accrued funding on all positions (seconds-based)
check_and_pausePermissionlessPause protocol if oracle stale > 1hr
lp_depositUserDeposit USDC into LP pool for shares
lp_withdrawUserBurn shares to withdraw USDC
claim_feesUserClaim accumulated LP fee share
update_oracleAdmin/SecondaryPush price to default oracle
init_market_oracleAdminCreate a market-specific oracle PDA
init_market_stateAdminCreate per-market OI tracking state
update_market_oracleAdmin/SecondaryPush price to market oracle
update_paramsAdminUpdate protocol parameters
withdraw_feesAdminWithdraw from fee vault
withdraw_insuranceAdminWithdraw from insurance fund
register_referralUserRegister a referral username (on-chain)
claim_referralUserClaim accumulated referral fees

API Reference

The keeper exposes an HTTP API on port 3001. On the frontend, endpoints are proxied via Vercel rewrites at /api/keeper/*.

GET /ping

Health check. Returns {"ok":true,"timestamp":"..."}

GET /health

Comprehensive system health including oracle status, liquidation stats, funding stats, Solana RPC health, and per-market oracle data.

GET /prices

Historical price data for charting.

ParamTypeDefaultDescription
marketstringETBMarket ID (e.g. ETB, CHARIZARD-X, GRENINJA, UMBREON — see /prices endpoint)
limitnumber50Number of rows (max 500)
fromnumber—Unix timestamp range start
tonumber—Unix timestamp range end
Response: [
  { "id": 1, "timestamp": 1717401600, "raw_price": 161.5, "ewma": 161.6, "deviation": 0.001, "alpha": 1, "tx_signature": "..." },
  ...
]

GET /candles

OHLC candle data aggregated from raw 5-minute price records. Used for charting.

ParamTypeDefaultDescription
marketstringETBMarket ID (ETB, CHARIZARD-X, CHARMANDER, PIKACHU)
resolutionstring1hCandle resolution: 1h (hourly) or 1d (daily)
limitnumber100Max candles returned
Response: [
  { "time": 1717401600, "open": 161.5, "high": 162.0, "low": 160.8, "close": 161.9 },
  ...
]

GET /trades/recent

Recent trades across all users.

ParamTypeDefaultDescription
limitnumber50Number of trades (max 200)
Response: {
  "trades": [
    { "id": 1, "timestamp": ..., "user_pubkey": "...", "direction": "long", "notional": 100, "entry_price": 156.19, ... },
    ...
  ]
}

GET /trades

Trades for a specific user. Requires user parameter.

GET /stats

Protocol statistics (24h/7d volume, trades, liquidations, fees, unique traders).

FAQ