maxMarketOrderNtls
Get maximum market order notional values for trading pairs on Hyperliquid, helping traders understand order size limits.
When to Use This Endpoint#
The maxMarketOrderNtls endpoint is essential for:
- Order Validation — Check if order size is within allowed limits
- Trading Strategy — Plan large orders based on market constraints
- Risk Management — Understand maximum position sizes
- Market Impact — Estimate potential market impact of large orders
Request#
Endpoint#
POST https://api-hyperliquid-mainnet-info.n.dwellir.com/info
Headers#
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
X-Api-Key | Your API key | Yes |
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be "maxMarketOrderNtls" |
Example Request#
{
"type": "maxMarketOrderNtls"
}
Response#
Success Response#
Returns maximum market order notional values for trading pairs.
{
"limits": {}
}
Response Fields#
| Field | Type | Description |
|---|---|---|
limits | object | Object mapping trading pairs to their maximum market order notional values |
Code Examples#
- cURL
- JavaScript
- Python
- Go
curl -X POST 'https://api-hyperliquid-mainnet-info.n.dwellir.com/info' \
-H 'X-Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"type":"maxMarketOrderNtls"}'
const ENDPOINT = 'https://api-hyperliquid-mainnet-info.n.dwellir.com/info';
const API_KEY = 'your-api-key-here';
async function getMaxMarketOrderNtls() {
const response = await fetch(ENDPOINT, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': API_KEY
},
body: JSON.stringify({
type: 'maxMarketOrderNtls'
})
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
return await response.json();
}
// Usage
const limits = await getMaxMarketOrderNtls();
console.log('Market order limits loaded');
import requests
from typing import Dict
ENDPOINT = 'https://api-hyperliquid-mainnet-info.n.dwellir.com/info'
API_KEY = 'your-api-key-here'
def get_max_market_order_ntls() -> Dict:
"""Get maximum market order notional values"""
response = requests.post(
ENDPOINT,
json={'type': 'maxMarketOrderNtls'},
headers={
'Content-Type': 'application/json',
'X-Api-Key': API_KEY
},
timeout=10
)
response.raise_for_status()
return response.json()
# Usage
limits = get_max_market_order_ntls()
print("Market order limits loaded")
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
const (
Endpoint = "https://api-hyperliquid-mainnet-info.n.dwellir.com/info"
APIKey = "your-api-key-here"
)
type MaxMarketOrderNtlsRequest struct {
Type string `json:"type"`
}
type MaxMarketOrderNtlsResponse struct {
Limits map[string]interface{} `json:"limits"`
}
func getMaxMarketOrderNtls() (*MaxMarketOrderNtlsResponse, error) {
reqBody, _ := json.Marshal(MaxMarketOrderNtlsRequest{
Type: "maxMarketOrderNtls",
})
req, _ := http.NewRequest("POST", Endpoint, bytes.NewBuffer(reqBody))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", APIKey)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var result MaxMarketOrderNtlsResponse
if err := json.Unmarshal(body, &result); err != nil {
return nil, err
}
return &result, nil
}
func main() {
limits, err := getMaxMarketOrderNtls()
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Println("Market order limits loaded")
}
Common Use Cases#
1. Check Maximum Order Size#
Verify if an order size is within limits:
async function checkOrderSize(asset, orderValue) {
const data = await getMaxMarketOrderNtls();
const maxNotional = data.limits[asset];
if (!maxNotional) {
console.log(`No limit data for ${asset}`);
return null;
}
const isValid = orderValue <= parseFloat(maxNotional);
console.log(`Order size: $${orderValue.toLocaleString()}`);
console.log(`Maximum allowed: $${parseFloat(maxNotional).toLocaleString()}`);
console.log(`Valid: ${isValid ? 'Yes' : 'No - exceeds limit'}`);
return isValid;
}
// Usage
await checkOrderSize('BTC', 50000);
2. Validate Order Before Submission#
Pre-validate orders against limits:
async function validateMarketOrder(asset, orderValue) {
const data = await getMaxMarketOrderNtls();
const maxNotional = parseFloat(data.limits[asset] || 0);
if (orderValue > maxNotional) {
return {
valid: false,
reason: `Order size $${orderValue} exceeds maximum $${maxNotional}`,
maxAllowed: maxNotional
};
}
return {
valid: true,
reason: 'Order size within limits',
maxAllowed: maxNotional
};
}
// Usage
const validation = await validateMarketOrder('ETH', 100000);
if (!validation.valid) {
console.error(`Cannot place order: ${validation.reason}`);
}
3. Calculate Maximum Position Size#
Determine maximum position that can be opened:
async function getMaxPositionSize(asset, currentPrice) {
const data = await getMaxMarketOrderNtls();
const maxNotional = parseFloat(data.limits[asset] || 0);
const maxPositionSize = maxNotional / currentPrice;
return {
asset: asset,
currentPrice: currentPrice,
maxNotionalValue: maxNotional,
maxPositionSize: maxPositionSize,
unit: asset
};
}
// Usage
const maxPosition = await getMaxPositionSize('BTC', 45000);
console.log(`Maximum position: ${maxPosition.maxPositionSize.toFixed(4)} ${maxPosition.unit}`);
console.log(`Notional value: $${maxPosition.maxNotionalValue.toLocaleString()}`);
4. Build Order Size Calculator#
Create an order size calculator with validation:
async function calculateOrderSizes(asset, currentPrice) {
const data = await getMaxMarketOrderNtls();
const maxNotional = parseFloat(data.limits[asset] || 0);
const suggestions = [0.25, 0.5, 0.75, 1.0].map(percent => {
const notionalValue = maxNotional * percent;
const positionSize = notionalValue / currentPrice;
return {
percentage: percent * 100,
notionalValue: notionalValue,
positionSize: positionSize
};
});
console.log(`=== Order Size Suggestions for ${asset} ===\n`);
suggestions.forEach(s => {
console.log(`${s.percentage}% of max: ${s.positionSize.toFixed(4)} ${asset} ($${s.notionalValue.toLocaleString()})`);
});
return suggestions;
}
// Usage
await calculateOrderSizes('BTC', 45000);
5. Monitor Limit Changes#
Track changes in order limits:
class OrderLimitMonitor {
constructor(checkIntervalMs = 300000) {
this.checkIntervalMs = checkIntervalMs; // 5 minutes
this.lastLimits = null;
}
async start() {
const check = async () => {
const data = await getMaxMarketOrderNtls();
if (this.lastLimits) {
for (const [asset, limit] of Object.entries(data.limits)) {
const lastLimit = this.lastLimits[asset];
if (lastLimit && lastLimit !== limit) {
console.log(`Limit changed for ${asset}: ${lastLimit} -> ${limit}`);
}
}
}
this.lastLimits = data.limits;
};
await check();
setInterval(check, this.checkIntervalMs);
}
}
// Usage
const monitor = new OrderLimitMonitor();
monitor.start();
6. Split Large Orders#
Suggest order splitting for sizes exceeding limits:
async function splitLargeOrder(asset, desiredValue) {
const data = await getMaxMarketOrderNtls();
const maxNotional = parseFloat(data.limits[asset] || 0);
if (desiredValue <= maxNotional) {
return {
needsSplit: false,
message: 'Order within limits',
orders: [{ value: desiredValue }]
};
}
const numOrders = Math.ceil(desiredValue / maxNotional);
const orderSize = desiredValue / numOrders;
const orders = Array(numOrders).fill(null).map((_, i) => ({
orderNumber: i + 1,
value: orderSize
}));
return {
needsSplit: true,
message: `Split into ${numOrders} orders`,
totalValue: desiredValue,
maxPerOrder: maxNotional,
orders: orders
};
}
// Usage
const split = await splitLargeOrder('BTC', 200000);
if (split.needsSplit) {
console.log(`Order needs splitting: ${split.message}`);
split.orders.forEach(order => {
console.log(`Order ${order.orderNumber}: $${order.value.toLocaleString()}`);
});
}
Error Handling#
Common Errors#
| Error | Cause | Solution |
|---|---|---|
401 Unauthorized | Invalid API key | Verify your API key is correct |
429 Too Many Requests | Rate limit exceeded | Implement request throttling |
500 Internal Server Error | Server issue | Retry with exponential backoff |
Error Response Example#
{
"error": "Invalid request",
"code": "INVALID_REQUEST"
}
Robust Error Handling#
async function safeGetMaxMarketOrderNtls(maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await getMaxMarketOrderNtls();
} catch (error) {
if (error.response?.status === 429) {
await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
} else if (i === maxRetries - 1) {
throw error;
}
}
}
}
Best Practices#
- Cache limits — Order limits change infrequently, cache for 5-10 minutes
- Validate before submission — Always check limits before placing orders
- Handle missing data — Some assets may not have limit data
- Use buffer — Stay 5-10% below maximum to account for price fluctuations
- Monitor changes — Track limit changes that may affect trading strategies
Performance Tips#
Cached Limit Service#
class CachedOrderLimitService {
constructor(cacheDurationMs = 300000) {
this.cache = null;
this.cacheTime = 0;
this.cacheDurationMs = cacheDurationMs; // 5 minutes
}
async getLimits() {
const now = Date.now();
if (this.cache && (now - this.cacheTime) < this.cacheDurationMs) {
return this.cache;
}
const data = await getMaxMarketOrderNtls();
this.cache = data;
this.cacheTime = now;
return data;
}
async getLimitForAsset(asset) {
const data = await this.getLimits();
return parseFloat(data.limits[asset] || 0);
}
invalidate() {
this.cache = null;
this.cacheTime = 0;
}
}
// Usage
const limitService = new CachedOrderLimitService();
const btcLimit = await limitService.getLimitForAsset('BTC');
Related Endpoints#
- meta — Get trading pair metadata
- openOrders — View current orders
- clearinghouseState — Check account capacity
- maxBuilderFee — Get builder fee limits
Optimize your trading with order limit information from Dwellir's HyperCore Info Endpoint. Get your API key →