← 返回
未分类

Poke Perps

Trade perpetual futures on Pokemon TCG card prices via the PokePerps DEX on Solana. Search cards, analyze prices, simulate trades, open/close leveraged long/...
在 Solana 上通过 PokePerps DEX 交易宝可梦卡牌价格的永续期货,搜索卡牌、分析价格、模拟交易、开仓/平仓杠杆多头/...
ankushkun
未分类 clawhub v1.0.0 1 版本 99576.3 Key: 无需
★ 0
Stars
📥 235
下载
💾 0
安装
1
版本
#latest

概述

PokePerps AI Agent Skill

> Platform: PokePerps — Decentralized Perpetual Futures Exchange for Pokemon TCG Card Prices

> Blockchain: Solana (mainnet-beta)

> Backend API: https://backend.pokeperps.fun

> WebSocket: wss://backend.pokeperps.fun/ws/trading

> Program ID: 8hH5CWo14R5QhaFUuXpxJytchS6NgrhRLHASyVeriEvN

> Collateral: USDC (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v)

PokePerps lets you trade perpetual futures contracts on real Pokemon Trading Card Game card prices. Prices are sourced from TCGPlayer marketplace in real-time and published on-chain via an Ed25519-signed oracle.

MCP Server (Recommended)

The easiest way for AI agents to interact with PokePerps is via the Model Context Protocol (MCP) server.

Read-only mode (no wallet required):

{
  "mcpServers": {
    "pokeperps": {
      "command": "npx",
      "args": ["@pokeperps/mcp"]
    }
  }
}

With trade execution (requires Solana keypair):

{
  "mcpServers": {
    "pokeperps": {
      "command": "npx",
      "args": ["@pokeperps/mcp"],
      "env": {
        "POKEPERPS_KEYPAIR": "/path/to/your/keypair.json"
      }
    }
  }
}

MCP Environment Variables

VariableDescriptionDefault
---------
POKEPERPS_KEYPAIRPath to Solana keypair JSON(none - read-only mode)
POKEPERPS_API_URLBackend API URLhttps://backend.pokeperps.fun
POKEPERPS_RPC_URLSolana RPC URLhttps://api.mainnet-beta.solana.com

MCP Tools

Read-only tools (always available):

ToolDescription
------
get_market_moversTop gainers, losers, and most volatile cards
get_portfolioComplete portfolio with computed PnL for a wallet
get_trading_signalsPre-computed trading signals and recommendations
prepare_tradeValidate a trade before opening (margin, fees, risks)
simulate_tradeSimulate PnL scenarios at different price levels
search_cardsSearch Pokemon cards by name
get_card_detailsFull card info with listings, sales, history
batch_get_cardsFetch up to 50 cards in one request
get_tradable_productsList all product IDs with active markets
get_trading_configTrading parameters (leverage, fees, etc.)

Execution tools (require POKEPERPS_KEYPAIR):

ToolDescription
------
open_positionOpen a new long/short position
close_positionClose an existing position to realize PnL
depositDeposit USDC into trading account
withdrawWithdraw USDC from trading account
get_wallet_statusCheck wallet balance and execution status

MCP Resources

  • pokeperps://docs/trading-guide — Trading guide and risk parameters
  • pokeperps://docs/api-reference — Full OpenAPI specification

Trading Parameters

ParameterValue
------
Max leverage50x
Min position size$1 USDC
Max position per user$100,000 USDC
Trading fee0.05% (5 bps) on open and close
Maintenance margin1% (100 bps)
Liquidation fee0.5% to liquidator + 0.5% to insurance
Funding interval8 hours
Funding rate cap±0.05% per interval
Oracle price max age15 seconds
CollateralUSDC (SPL Token)

What you can do:

  • Go long (bet price goes up) or short (bet price goes down)
  • Use 1x–50x leverage
  • Positions have no expiry (perpetual)
  • Close anytime to realize PnL
  • Prices track real TCGPlayer marketplace prices

Architecture

Agent (you)
  │
  ├── REST API (https://backend.pokeperps.fun/api/...)
  │     ├── Read-only: card data, prices, markets, positions
  │     └── Transaction builders: returns params for Solana transactions
  │
  ├── WebSocket (wss://backend.pokeperps.fun/ws/trading)
  │     └── Real-time price updates, position events
  │
  └── Solana RPC (https://api.mainnet-beta.solana.com)
        └── Sign & send transactions built from API params

The backend does NOT sign or submit transactions. It provides instruction data and account addresses. You build, sign, and submit transactions client-side.

Key API Endpoints

Base URL: https://backend.pokeperps.fun

Card Discovery

MethodPathDescription
---------
GET/api/cards/search?q={query}&limit={1-50}Search cards by name
GET/api/dashboard?limit={1-200}Top tradable cards + biggest mover
GET/api/cards/{product_id}Full card details
GET/api/cards/{product_id}/bundleAll card data in one call
GET/api/cards/{product_id}/history?range=monthPrice history
GET/api/cards/{product_id}/signalsTrading signals & recommendations
POST/api/cards/batchFetch up to 50 cards at once

Trading

MethodPathDescription
---------
GET/api/trading/tradableAll tradable product IDs
GET/api/trading/configTrading parameters
GET/api/trading/exchangeExchange state
GET/api/trading/market/{product_id}Market state
GET/api/trading/market/{product_id}/statsMarket statistics
GET/api/trading/account/{wallet}User account
GET/api/trading/account/{wallet}/positionsUser positions
GET/api/trading/portfolio/{wallet}Full portfolio with computed PnL
GET/api/trading/prepare-trade/{id}?wallet=X&side=Y&size=Z&leverage=WPre-trade validation
POST/api/trading/simulateTrade simulation with scenarios
GET/api/trading/analytics/movers?limit={1-50}Top gainers, losers, volatile

Transaction Builders

MethodPathDescription
---------
POST/api/trading/tx/create-accountCreate trading account
POST/api/trading/tx/depositDeposit USDC
POST/api/trading/tx/withdrawWithdraw USDC
POST/api/trading/tx/open-positionOpen long/short position
POST/api/trading/tx/close-positionClose position
POST/api/trading/tx/add-marginAdd margin to position

Oracle

MethodPathDescription
---------
GET/api/oracle/pricesAll current oracle prices
GET/api/oracle/router/pricesBest available prices
GET/api/trading/oracle/{product_id}Single product price
POST/api/trading/oracle/pricesBatch oracle prices

See references/API.md for full request/response schemas.

Optimized Trading Flow

1. GET /api/trading/analytics/movers       → Find opportunities
2. POST /api/cards/batch                   → Fetch details for candidates
3. GET /api/cards/{id}/signals             → Get trading recommendation
4. GET /api/trading/prepare-trade/{id}     → Validate trade
5. POST /api/trading/tx/open-position      → Execute trade
6. GET /api/trading/portfolio/{wallet}     → Monitor positions

This uses 6 API calls instead of 15+ in the traditional flow.

PnL Calculation

margin = size / leverage
fee = size * 0.0005  (0.05% on open, same on close)

For long:
  unrealized_pnl = size * (current_price - entry_price) / entry_price
  liquidation_price = entry_price * (1 - (margin - maintenance_margin) / size)

For short:
  unrealized_pnl = size * (entry_price - current_price) / entry_price
  liquidation_price = entry_price * (1 + (margin - maintenance_margin) / size)

Maintenance margin = size * 0.01 (1%)

Decision-Making Signals

Use /api/cards/{id}/signals for pre-computed analysis:

Bullish (go long):

  • Positive change_24h with high activity_score
  • Recent sales trending above market_price
  • Decreasing listing count (supply shrinking)
  • High short OI relative to long (potential short squeeze)

Bearish (go short):

  • Negative change_24h and change_30d
  • Recent sales trending below market_price
  • Increasing listing count (supply growing)
  • High long OI relative to short (potential long squeeze)

WebSocket

Connect to wss://backend.pokeperps.fun/ws/trading:

{ "type": "subscribe", "products": [123456], "accounts": ["YourWallet"] }
{ "type": "ping" }

Events: price_update, position_opened, position_closed, market_stats, account_update

Rate Limits

LimitValue
------
Global API rate limit300 requests/min per IP
Oracle price signing2 per 10 seconds per IP per product
WebSocket connections25 per IP, 1000 total
Max batch product IDs200 per request

Error Codes

CodeNameMeaning
---------
6012InvalidAmountZero or negative amount
6013InsufficientBalanceNot enough USDC
6014ExchangePausedExchange is paused
6015InvalidLeverageOutside 1-50 range
6016PositionTooSmallBelow $1 minimum
6018MarketInactiveMarket disabled
6019MaxOpenInterestExceededOI at capacity
6030OraclePriceStalePrice older than 15s
6031PositionTooLargeAbove $100k max
6035InvalidEd25519InstructionEd25519 precompile malformed

See references/API.md for full error reference.

Agent Best Practices

Minimize API Calls

Instead of...Use...
------
GET /account + GET /positions + oracle callsGET /api/trading/portfolio/{wallet} (1 call)
Multiple GET /api/cards/{id} callsPOST /api/cards/batch (1 call for up to 50)
5+ calls to validate a tradeGET /api/trading/prepare-trade/{id} (1 call)
Scanning all cards for moversGET /api/trading/analytics/movers (1 call)

Position Management

  1. Check riskStatus before opening new positions — avoid if warning or danger
  2. Use distanceToLiquidation for stop-loss (conservative: close if <10%, moderate: <5%)
  3. Monitor fundingDirection — avoid positions that pay funding
  4. Check wouldExceedOI before large trades

Security

  • Always verify PDAs client-side before signing transactions
  • Never expose private keys in API calls
  • Validate oracleAge < 15 seconds before trading
  • Check canTrade from prepare-trade before proceeding

Additional References

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-12 06:02 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,963
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,072 📥 805,185
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,371 📥 319,708