drift
Complete Drift Protocol SDK for building perpetual futures, spot trading, and DeFi applications on Solana. Use when building trading bots, integrating Drift markets, managing positions, or working with vaults.
npx skills add majiayu000/claude-skill-registry --skill drift-sendaifun-skills-2 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Guides development with the Drift Protocol SDK for Solana, detailing installation for JS/TS and Python, and providing concrete code examples for initializing DriftClient, subscribing to updates, and creating user accounts. It defines core concepts like precision, market types, and order types, and demonstrates trading operations (placing perp and spot orders, multi-order placement, order management), deposits/withdrawals, position management, market data access, events, and Jupiter swaps.
How it works
Presents structured usage steps and code blocks that the agent should reproduce when building applications with the Drift SDK. It includes setup steps (connection, wallet, DriftClient initialization, account subscription), conversion helpers for BN-based precision, and sample flows for placing orders (perp and spot), managing orders, and querying positions and market data. It also shows deposits, withdrawals, transfers, and PnL calculations, plus event subscriptions and oracle/market data utilities.
When to use it
Use when constructing Solana-based trading applications that interact with Drift markets, manage positions, or build vault-related functionality. It also applies when integrating Drift with other services (e.g., Jupiter for swaps) and when requiring concrete code templates for common operations like deposits, withdrawals, order management, and market data access.
What it can touch
References tools and libraries explicitly: "@drift-labs/sdk", "@solana/web3.js", "@coral-xyz/anchor". It shows usage of DriftClient, various methods (subscribe, initializeUserAccount, placePerpOrder, placeSpotOrder, getUser, getPerpMarketAccount, getSpotMarketAccount, etc.), and external integration via JupiterClient. File interactions are code snippets only; no filesystem actions are described beyond code usage.
Caveats
No explicit licensing or risk notes beyond the MIT license declared in the surrounding metadata. The content presents example code and API usage; actual behavior depends on runtime Solana network conditions and Drift SDK state.
# Drift Protocol SDK Development Guide A comprehensive guide for building Solana applications with the Drift Protocol SDK - the leading perpetual futures and spot trading protocol on Solana. ## Overview Drift Protocol is a decentralized exchange on Solana offering: - **Perpetual Futures**: Up to 20x leverage on crypto assets - **Spot Trading**: Borrow/lend and margin trading - **Cross-Collateral**: Use multiple assets as collateral - **Vaults**: Delegated trading pools - **Jupiter Integration**: Direct spot swaps ## Quick Start ### Installation ```bash npm install @drift-labs/sdk @solana/web3.js @coral-xyz/anchor ``` For Python: ```bash pip install driftpy ``` ### Basic Setup (TypeScript) ```typescript import { Connection, Keypair } from '@solana/web3.js'; import { Wallet } from '@coral-xyz/anchor'; import { DriftClient, initialize, DriftEnv, BulkAccountLoader } from '@drift-labs/sdk'; // 1. Setup connection and wallet const connection = new Connection('https://api.mainnet-beta.solana.com'); const keypair = Keypair.fromSecretKey(/* your secret key */); const wallet = new Wallet(keypair); // 2. Initialize SDK const sdkConfig = initialize({ env: 'mainnet-beta' as DriftEnv }); // 3. C
- Overview
- Quick Start
- Installation
- Basic Setup (TypeScript)
- Basic Setup (Python)
- Core Concepts
- 1. Precision and BN (BigNumber)
- 2. Market Types
- 3. Order Types
- 4. Post-Only Parameters
- Trading Operations
- Placing Perpetual Orders
- Placing Spot Orders
- Multiple Orders
npm install @drift-labs/sdk @solana/web3.js @coral-xyz/anchor pip install driftpy
What does the drift skill do?
Complete Drift Protocol SDK for building perpetual futures, spot trading, and DeFi applications on Solana. Use when building trading bots, integrating Drift markets, managing positions, or working with vaults.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill drift-sendaifun-skills-2 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
