drift

Builds Solana trading applications using the Drift Protocol SDK for perpetual futures and spot markets.

Updated Jul 10, 2026
One-click install
npx skills add https://github.com/Kaleb-Rupe/aurora --skill drift-kaleb-rupe
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drift
Source: https://github.com/Kaleb-Rupe/aurora/tree/main/system/aurora-bridge/.claude/skills/drift
Command: npx skills add https://github.com/Kaleb-Rupe/aurora --skill drift-kaleb-rupe

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building trading bots, market makers, or DeFi integrations on Drift Protocol requires navigating complex SDK APIs, BigNumber precision handling, order types, margin calculations, and vault mechanics, which is error-prone without a structured reference. ## Core Features & Use Cases - Complete SDK Reference: Covers DriftClient and User class APIs, order placement (market, limit, trigger, oracle), deposits, withdrawals, sub-accounts, and position management in TypeScript and Python. - Precision & Types Guidance: Documents all BN precision constants (QUOTE, BASE, PRICE) and TypeScript enums to prevent costly unit conversion errors. - Production Templates & Guides: Includes a ready-to-customize trading bot template, market making strategies (JIT, floating maker), vault documentation, and a troubleshooting guide for common errors like InsufficientCollateral and OrderWouldCrossMaker. - Use Case: A developer wants to build a market making bot on Drift. The Skill provides the client setup code, post-only order patterns, oracle-based quoting logic, risk limit checks, and a full bot template to adapt. ## Quick Start Use the drift skill to help me initialize a DriftClient on mainnet and place a post-only limit order on SOL-PERP.

Frequently Asked Questions about drift

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I place a limit order on Drift Protocol with TypeScript?

Use driftClient.placePerpOrder with OrderType.LIMIT, specifying marketIndex, direction, baseAssetAmount via convertToPerpPrecision, and price via convertToPricePrecision. Add PostOnlyParams.MUST_POST_ONLY to guarantee maker status.

How do I set up the Drift SDK DriftClient on Solana?

Create a Connection and Anchor Wallet, call initialize with the env, then instantiate DriftClient with a polling or websocket accountSubscription and call subscribe. Initialize a user account with initializeUserAccount if one does not exist.

Does the Drift SDK support Python for trading bots?

Yes, the driftpy package provides a Python DriftClient with async setup via AsyncClient and AnchorPy Wallet. It supports the same core flows: subscribe, initialize user accounts, and place orders.

Why does my Drift order fail with InsufficientCollateral?

The account lacks free collateral for the trade's margin requirement. Check user.getFreeCollateral and compare it against user.getMarginUSDCRequiredForTrade before placing the order, then deposit more collateral or reduce size.

What precision should I use for Drift amounts and prices?

Drift uses BN integers with fixed precision: QUOTE_PRECISION 10^6 for USDC, BASE_PRECISION 10^9 for perp sizes, and PRICE_PRECISION 10^6 for prices. Use convertToPerpPrecision, convertToSpotPrecision, and convertToPricePrecision helpers.

How do Drift vault withdrawals work for depositors?

Depositors call requestWithdraw with a share amount, wait for the vault's redeemPeriod to elapse, then call withdraw to receive funds. Managers cannot bypass the redeem period or withdraw user funds directly.