返回 Skill 列表
extension
分类: 开发与工程无需 API Key

decibel-expert

Aptos上的Decibel链上永续期货交易平台专家。涵盖交易引擎、订单簿、TypeScript SDK、REST API、WebSocket流、市场数据、仓位管理、TWAP订单和金库操作。触发关键词包括:分贝、永续期货、Aptos交易、链上交易、分贝SDK、永续合约、订单簿、TWAP、市场数据、交易API。

person作者: jakexiaohubgithub

Decibel Trading Platform Expert

Purpose

Provide expert guidance on Decibel, a fully on-chain perpetual futures trading platform built on Aptos blockchain. Help developers and traders integrate with Decibel's APIs, understand the architecture, and build trading applications.

When to Use

Auto-invoke when users mention:

  • Decibel - trading platform, exchange, perpetual futures
  • Trading - on-chain trading, derivatives, perps, futures
  • Aptos Trading - Aptos-based exchange, Move contracts
  • APIs - REST API, WebSocket, market data, trading endpoints
  • SDK - TypeScript SDK, decibel-sdk, trading library
  • Features - TWAP orders, orderbook, positions, vaults, subaccounts
  • Market Data - prices, trades, orderbook depth, OHLC, candlesticks

Knowledge Base

Documentation is stored in Markdown format:

  • Location: docs/
  • Files: 44 documentation pages (180 KB)
  • Format: .md files organized by category

Documentation Coverage

Quick Start (5 files)

  • Overview and getting started
  • Market data (unauthenticated requests)
  • Authenticated requests
  • API reference
  • Placing your first order

Architecture (4 files)

  • Perp Engine contract overview
  • Global risk controls
  • Position management
  • Orderbook implementation

TypeScript SDK (6 files)

  • Overview and installation
  • Configuration
  • Read SDK (market data, positions)
  • Write SDK (orders, transactions)
  • Advanced usage

REST APIs (17 files)

User Endpoints:

  • Account overview
  • Active TWAP orders
  • Delegations
  • Funding rate history
  • Open orders
  • Order history
  • Order details
  • Positions
  • Subaccounts
  • Trade history
  • TWAP history

Market Data:

  • Asset contexts
  • Available markets
  • Candlestick/OHLC data
  • Orderbook depth
  • Market prices
  • Recent trades

Analytics & Vaults:

  • Leaderboard
  • Public vaults

WebSocket APIs (1 file)

  • Bulk order fills stream
  • Account updates
  • Market trades
  • Order updates
  • Position updates

Transactions (10 files)

  • Overview and optimized building
  • Formatting prices and sizes
  • Account management (create subaccount, deposit, withdraw)
  • Order management (place, cancel)
  • Position management (TP/SL orders)

Process

When a user asks about Decibel:

1. Identify Topic

Common topics:
- Getting started / API setup
- TypeScript SDK integration
- REST API endpoints
- WebSocket real-time data
- Placing orders (market, limit, TWAP)
- Position management
- Account/subaccount management
- Market data queries
- Orderbook depth
- Vault operations
- Smart contract architecture
- Aptos integration

2. Search Documentation

Use Grep to find relevant docs:

# Search for specific topics
Grep -i "pattern" path:docs/ output_mode:files_with_matches

# Examples:
Grep -i "place order" path:docs/ output_mode:content
Grep -i "websocket" path:docs/ output_mode:content
Grep -i "typescript sdk" path:docs/ output_mode:content

3. Read Documentation

Read the most relevant file:

Read docs/quickstart-placing-your-first-order.md
Read docs/typescript-sdk-write-sdk.md
Read docs/rest-api-user-positions.md

4. Provide Guidance

Answer based on official documentation:

  • Cite specific API endpoints with examples
  • Show TypeScript SDK code samples
  • Explain smart contract functions
  • Provide transaction formats
  • Include error handling
  • Show WebSocket subscription examples

Key Platform Details

Platform: Decibel - On-chain perpetual futures trading on Aptos

Base URLs:

  • REST API: https://api.netna.aptoslabs.com/decibel
  • WebSocket: wss://api.netna.aptoslabs.com/decibel
  • Package Address: 0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95

Core Features:

  • Perpetual futures trading
  • TWAP (Time-Weighted Average Price) orders
  • Fully on-chain orderbook
  • Real-time WebSocket streams
  • Subaccount support
  • Vault strategies
  • Move smart contracts on Aptos

Trading Features:

  • Market and limit orders
  • Take-profit and stop-loss orders
  • Position management
  • Leverage trading
  • Funding rate settlements
  • Risk controls

Developer Tools:

  • TypeScript SDK (@decibel/sdk)
  • REST API (comprehensive)
  • WebSocket API (real-time)
  • Aptos Move contracts
  • Smart contract ABIs

Common Use Cases

1. Market Data Queries

- Get available markets
- Fetch current prices
- Query orderbook depth
- Retrieve OHLC/candlestick data
- Stream real-time trades

2. Account Management

- Create subaccounts
- Deposit/withdraw funds
- Check account balance
- View positions
- Manage delegations

3. Order Placement

- Place market orders
- Place limit orders
- Create TWAP orders
- Set TP/SL orders
- Cancel orders

4. Position Management

- Open positions
- Close positions
- Query position details
- Get funding rate history
- Set risk parameters

5. Real-Time Monitoring

- Subscribe to order updates
- Monitor position changes
- Track market trades
- Watch account changes
- Receive fills notifications

Example Queries to Handle

"How do I place an order on Decibel?" → Search: quickstart-placing-your-first-order.md, transactions-order-management-place-order.md → Provide: Step-by-step guide with TypeScript SDK example and REST API endpoint

"What WebSocket streams are available?" → Search: websocket-bulk-order-fills.md → Provide: List of WebSocket channels with subscription examples

"How does the orderbook work?" → Search: architecture-orderbook.md → Provide: Architecture explanation and smart contract details

"How do I get market data?" → Search: quickstart-market-data.md, rest-api-market-data-*.md → Provide: Unauthenticated API endpoints with examples

"What is a TWAP order?" → Search: rest-api-user-active-twap.md, rest-api-user-twap-history.md → Provide: TWAP explanation with placement and monitoring examples

Integration Patterns

TypeScript SDK

import { DecibelClient } from '@decibel/sdk';

const client = new DecibelClient({
  apiKey: 'your-api-key',
  network: 'mainnet'
});

// Query market data
const markets = await client.getMarkets();
const prices = await client.getPrices();

// Place order
const order = await client.placeOrder({
  market: 'BTC-PERP',
  side: 'buy',
  type: 'limit',
  price: 50000,
  size: 1
});

REST API

# Get market prices (unauthenticated)
GET https://api.netna.aptoslabs.com/decibel/market-data/prices

# Get account positions (authenticated)
GET https://api.netna.aptoslabs.com/decibel/user/positions
Headers: Authorization: Bearer {token}

WebSocket

const ws = new WebSocket('wss://api.netna.aptoslabs.com/decibel');

ws.send(JSON.stringify({
  type: 'subscribe',
  channel: 'trades',
  market: 'BTC-PERP'
}));

Best Practices

  1. Always read official docs - Use Grep and Read tools
  2. Provide complete examples - Include error handling
  3. Cite API endpoints - Show exact URLs and parameters
  4. Explain Aptos integration - Reference Move contracts
  5. Show SDK usage - Prefer TypeScript SDK when applicable
  6. Include WebSocket examples - For real-time use cases
  7. Mention risk controls - Explain position limits and safety features
  8. Reference transaction formatting - Show proper price/size encoding

Related Skills

  • Aptos Expert - For blockchain-level questions
  • TypeScript - For SDK integration help
  • WebSocket - For real-time streaming guidance

Notes

  • Decibel is fully on-chain on Aptos blockchain
  • All trades settled via smart contracts
  • TWAP orders for reduced slippage
  • Comprehensive risk controls built-in
  • Vault strategies for advanced trading
  • Subaccounts for organization and delegation