activeAssetData - HyperCore Info Endpoint
Get active asset trading data for a specific user and coin on Hyperliquid. Query leverage settings, maximum trade sizes, available trading amounts, and current mark price.
Get active asset trading data for a specific user and coin, including leverage configuration, maximum trade sizes, available trading amounts, and current mark price.
Authenticate by including your Dwellir API key in the URL path: https://api-hyperliquid-mainnet-info.n.dwellir.com/YOUR_API_KEY/info.
When to Use This Endpoint
The activeAssetData endpoint is essential for:
- Pre-Trade Validation — Check maximum trade sizes before placing orders
- Leverage Monitoring — Query current leverage settings for a user on a specific asset
- Available Capital — Determine how much a user can trade on a given asset
- Price Reference — Get the current mark price for position calculations
Common Use Cases
1. Pre-Trade Size Validation
Validate order size before submitting:
async function validateTradeSize(userAddress, coin, desiredSize, side) {
const data = await getActiveAssetData(userAddress, coin);
const sideIndex = side === 'long' ? 0 : 1;
const maxSize = parseFloat(data.maxTradeSzs[sideIndex]);
const available = parseFloat(data.availableToTrade[sideIndex]);
const isValid = desiredSize <= maxSize && desiredSize <= available;
return {
valid: isValid,
desiredSize: desiredSize,
maxTradeSize: maxSize,
availableToTrade: available,
reason: !isValid
? desiredSize > maxSize
? `Exceeds max trade size ($${maxSize})`
: `Exceeds available capital ($${available})`
: null
};
}
// Usage
const validation = await validateTradeSize(
'0x63E8c7C149556D5f34F833419A287bb9Ef81487f',
'BTC',
25000,
'long'
);
if (!validation.valid) {
console.warn(`Trade rejected: ${validation.reason}`);
}2. Leverage Dashboard
Display leverage and trading capacity for multiple assets:
async function getLeverageDashboard(userAddress, coins) {
const results = await Promise.all(
coins.map(coin => getActiveAssetData(userAddress, coin))
);
console.log('=== Leverage Dashboard ===\n');
results.forEach(data => {
console.log(`${data.coin}:`);
console.log(` Leverage: ${data.leverage.value}x (${data.leverage.type})`);
console.log(` Mark Price: $${data.markPx}`);
console.log(` Max Long: $${data.maxTradeSzs[0]}`);
console.log(` Max Short: $${data.maxTradeSzs[1]}`);
console.log(` Available Long: $${data.availableToTrade[0]}`);
console.log(` Available Short: $${data.availableToTrade[1]}`);
console.log('');
});
return results;
}
// Usage
await getLeverageDashboard(
'0x63E8c7C149556D5f34F833419A287bb9Ef81487f',
['BTC', 'ETH', 'SOL']
);3. Trading Capacity Monitor
Track available trading capacity over time:
class TradingCapacityMonitor {
constructor(userAddress, coin) {
this.userAddress = userAddress;
this.coin = coin;
this.history = [];
}
async snapshot() {
const data = await getActiveAssetData(this.userAddress, this.coin);
const record = {
timestamp: new Date().toISOString(),
availableLong: parseFloat(data.availableToTrade[0]),
availableShort: parseFloat(data.availableToTrade[1]),
markPx: parseFloat(data.markPx),
leverage: data.leverage.value
};
this.history.push(record);
return record;
}
getUtilization() {
if (this.history.length === 0) return null;
const latest = this.history[this.history.length - 1];
const first = this.history[0];
return {
currentAvailableLong: latest.availableLong,
currentAvailableShort: latest.availableShort,
changeLong: latest.availableLong - first.availableLong,
changeShort: latest.availableShort - first.availableShort,
snapshots: this.history.length
};
}
}
// Usage
const monitor = new TradingCapacityMonitor(
'0x63E8c7C149556D5f34F833419A287bb9Ef81487f',
'BTC'
);
await monitor.snapshot();4. Smart Order Sizing
Calculate optimal order size based on available capacity:
async function getOptimalOrderSize(userAddress, coin, side, targetPercent = 0.5) {
const data = await getActiveAssetData(userAddress, coin);
const sideIndex = side === 'long' ? 0 : 1;
const available = parseFloat(data.availableToTrade[sideIndex]);
const maxSize = parseFloat(data.maxTradeSzs[sideIndex]);
const markPrice = parseFloat(data.markPx);
const targetNotional = available * targetPercent;
const clampedNotional = Math.min(targetNotional, maxSize);
const orderSizeInCoin = clampedNotional / markPrice;
return {
coin: coin,
side: side,
orderSizeUsd: clampedNotional.toFixed(2),
orderSizeCoin: orderSizeInCoin.toFixed(6),
markPrice: markPrice,
leverage: data.leverage.value,
percentUsed: ((clampedNotional / available) * 100).toFixed(1)
};
}
// Usage
const order = await getOptimalOrderSize(
'0x63E8c7C149556D5f34F833419A287bb9Ef81487f',
'BTC',
'long',
0.25 // use 25% of available capital
);
console.log(`Order: ${order.orderSizeCoin} ${order.coin} ($${order.orderSizeUsd})`);Best Practices
- Query before trading — Always check available trade sizes before placing orders
- Cache mark prices briefly — Mark prices change frequently, cache for seconds not minutes
- Validate coin symbols — Use the meta endpoint to get valid coin symbols
- Handle both sides —
maxTradeSzsandavailableToTradearrays contain [long, short] values - Monitor leverage changes — Leverage mode affects available capital calculations
Related Endpoints
- clearinghouseState — Get full account state with all positions
- meta — Get trading pair metadata and valid coin symbols
- openOrders — Get user's open orders for the asset
- userAbstraction — Check account abstraction mode
Query real-time trading capacity with Dwellir's HyperCore Info Endpoint. Get your API key →
Info Endpoint Overview
Access comprehensive Hyperliquid exchange data through Dwellir's HyperCore Info Endpoint. Query market metadata, account states, vault information, and more with higher rate limits than public endpoints.
batchClearinghouseStates
Batch query perpetual account states for multiple users in a single request. Custom Dwellir endpoint that fans out clearinghouseState calls concurrently with optional multi-DEX support.