userFees - HyperCore Info Endpoint
Get user-specific fee rates, trading volume history, and referral discounts for any trader on Hyperliquid.
Get fee rates, volume information, and referral discounts for a user on Hyperliquid.
The live response includes dailyUserVlm, feeSchedule, top-level fee fields such as userCrossRate and userAddRate, plus spot fee rates and active discount metadata.
Why Hyperliquid? Build on the trading-focused EVM and HyperCore ecosystem built for onchain perpetuals and market data with HyperCore market structure, sub-second finality, and direct access to trading-focused data services.
Authenticate HyperCore Info requests by sending your Dwellir API key in the x-api-key header to https://api-hyperliquid-mainnet-info.n.dwellir.com/info.
When to Use This Endpoint
The userFees endpoint is essential for traders, trading platforms, and analytics tools who need to:
- Calculate Trading Costs — Estimate fees before placing orders
- Volume Tracking — Monitor daily trading volume
- Fee Optimization — Compare user's fees against standard schedule
- Referral Programs — Track referral discounts and benefits
Common Use Cases
1. Calculate Trading Costs
Estimate fees for a trade:
async function calculateTradingFee(userAddress, orderValue, isMaker = false) {
const fees = await getUserFees(userAddress);
// Use the live top-level fee fields from the response
const feeRate = isMaker
? parseFloat(fees.userAddRate)
: parseFloat(fees.userCrossRate);
// Apply the active referral discount if available
const discount = parseFloat(fees.activeReferralDiscount ?? '0');
const effectiveRate = feeRate * (1 - discount);
const feeAmount = orderValue * effectiveRate;
return {
orderValue: orderValue,
feeRate: feeRate,
discount: discount,
effectiveRate: effectiveRate,
feeAmount: feeAmount,
feeBps: effectiveRate * 10000
};
}
// Usage
const tradeFee = await calculateTradingFee(
'0x63E8c7C149556D5f34F833419A287bb9Ef81487f',
10000, // $10,000 order
true // maker order
);
console.log(`Order Value: $${tradeFee.orderValue}`);
console.log(`Fee Rate: ${tradeFee.feeBps.toFixed(2)} bps`);
console.log(`Estimated Fee: $${tradeFee.feeAmount.toFixed(2)}`);2. Compare Against Standard Fees
Compare user's fees to standard rates:
async function compareFeeRates(userAddress, standardRate = 0.0005) {
const fees = await getUserFees(userAddress);
const userRate = parseFloat(fees.userCrossRate);
const savingsBps = (standardRate - userRate) * 10000;
const savingsPercent = ((standardRate - userRate) / standardRate) * 100;
return {
userRate: userRate,
standardRate: standardRate,
savingsBps: savingsBps,
savingsPercent: savingsPercent,
hasBetterRate: userRate < standardRate
};
}
// Usage
const comparison = await compareFeeRates(
'0x63E8c7C149556D5f34F833419A287bb9Ef81487f',
0.0005 // 5 bps standard
);
if (comparison.hasBetterRate) {
console.log(`You save ${comparison.savingsBps.toFixed(2)} bps (${comparison.savingsPercent.toFixed(1)}%)`);
}3. Estimate Monthly Fee Savings
Calculate potential savings with referral discount:
async function estimateMonthlySavings(userAddress, monthlyVolume) {
const fees = await getUserFees(userAddress);
const baseRate = parseFloat(fees.userCrossRate);
const discount = parseFloat(fees.activeReferralDiscount ?? '0');
const baseFees = monthlyVolume * baseRate;
const discountedFees = baseFees * (1 - discount);
const savings = baseFees - discountedFees;
return {
monthlyVolume: monthlyVolume,
baseRate: baseRate,
discount: discount,
baseFees: baseFees,
discountedFees: discountedFees,
savings: savings,
savingsPercent: discount * 100
};
}
// Usage
const savings = await estimateMonthlySavings(
'0x63E8c7C149556D5f34F833419A287bb9Ef81487f',
1000000 // $1M monthly volume
);
console.log(`Monthly Volume: $${savings.monthlyVolume.toLocaleString()}`);
console.log(`Base Fees: $${savings.baseFees.toFixed(2)}`);
console.log(`With Discount: $${savings.discountedFees.toFixed(2)}`);
console.log(`Monthly Savings: $${savings.savings.toFixed(2)}`);4. Fee Tier Analyzer
Analyze user's fee tier and potential improvements:
async function analyzeFeePosition(userAddress) {
const fees = await getUserFees(userAddress);
const crossRate = parseFloat(fees.userCrossRate);
const addRate = parseFloat(fees.userAddRate);
const discount = parseFloat(fees.activeReferralDiscount ?? '0');
// Example tier thresholds (adjust based on actual schedule)
const tiers = [
{ name: 'Standard', rate: 0.0005, minVolume: 0 },
{ name: 'Tier 1', rate: 0.0004, minVolume: 100000 },
{ name: 'Tier 2', rate: 0.0003, minVolume: 500000 },
{ name: 'Tier 3', rate: 0.0002, minVolume: 2000000 },
];
const currentTier = tiers.findLast(t => t.rate >= crossRate) || tiers[0];
const nextTier = tiers[tiers.indexOf(currentTier) + 1];
console.log('=== Fee Analysis ===\n');
console.log(`Current Cross Rate: ${(crossRate * 10000).toFixed(2)} bps`);
console.log(`Current Add Rate: ${(addRate * 10000).toFixed(2)} bps`);
console.log(`Estimated Tier: ${currentTier.name}`);
if (discount > 0) {
console.log(`Referral Discount: ${(discount * 100).toFixed(1)}%`);
}
if (nextTier) {
const improvement = ((crossRate - nextTier.rate) / crossRate) * 100;
console.log(`\nNext tier saves ${improvement.toFixed(1)}% on fees`);
console.log(`Requires ~$${nextTier.minVolume.toLocaleString()} monthly volume`);
}
}5. Fee Comparison Tool
Compare fees across different order types:
async function compareFeeTypes(userAddress, orderValue) {
const fees = await getUserFees(userAddress);
const makerRate = parseFloat(fees.userAddRate);
const takerRate = parseFloat(fees.userCrossRate);
const discount = parseFloat(fees.activeReferralDiscount ?? '0');
const makerFee = orderValue * makerRate * (1 - discount);
const takerFee = orderValue * takerRate * (1 - discount);
console.log(`Order Value: $${orderValue.toLocaleString()}\n`);
console.log('Maker Order (limit):');
console.log(` Rate: ${(makerRate * 10000).toFixed(2)} bps`);
console.log(` Fee: $${makerFee.toFixed(2)}`);
console.log('\nTaker Order (market):');
console.log(` Rate: ${(takerRate * 10000).toFixed(2)} bps`);
console.log(` Fee: $${takerFee.toFixed(2)}`);
console.log(`\nSavings with maker: $${(takerFee - makerFee).toFixed(2)}`);
}Best Practices
- Cache fee data — Fee rates change infrequently, cache for several minutes
- Always use effective rate — Apply referral discount when calculating costs
- Display fees clearly — Show both basis points and dollar amounts
- Validate addresses — Ensure user addresses are valid Ethereum addresses
- Consider order type — Use correct rate for maker vs taker orders
Related Endpoints
- clearinghouseState — Get account state and trading volume
- openOrders — See orders that will incur fees
- meta — Get trading pair metadata
- spotClearinghouseState — Get spot trading balances
Access real-time Hyperliquid fee information with Dwellir's HyperCore Info Endpoint. Get your API key →