PINE LIBRARY
delta_leverage_lib

🚀 Delta Leverage Library - Exchange Max Leverage Data
Comprehensive Pine v6 library providing maximum leverage data for USDT perpetual contracts across major exchanges. Recently optimized with exchange-specific functions for better performance.
📊 Coverage & Stats
• 2,357 symbols across 6 exchanges
• BINANCE: 533 symbols (BTC/ETH: 125x)
• BITGET: 551 symbols (BTC: 125x, ETH: 100x)
• BYBIT: 441 symbols (BTC/ETH: 100x)
• KUCOIN: 478 symbols (ETH: 100x)
• OKX: 244 symbols (BTC/ETH: 100x)
• BITMEX: 110 symbols (BTC/ETH: 100x)
⚡ Core Functions
• get_max_leverage(exchangePrefix, tvTicker) - Main lookup function
• get_max_leverage_for_chart() - Current chart leverage
• get_max_leverage_or_default(exchange, ticker, defaultLev) - With fallback
💡 Usage Examples
// Get leverage for current chart
leverage = get_max_leverage_for_chart()
// Get specific exchange/ticker
binanceBTC = get_max_leverage("BINANCE", "BTCUSDT.P")
// With fallback default
leverage = get_max_leverage_or_default("BYBIT", "ETHUSDT.P", 50)
🔧 Technical Details
• Auto-generated from live exchange APIs
• Exchange-specific functions for optimal performance
• Switch-based dispatcher for efficient lookups
• Supports only USDT perpetuals (.P suffix)
• Realistic leverage tiers based on market categories
📈 Data Sources
• Binance: Realistic tiers (Major coins 125x, memes 10x)
• Bybit/Bitget/KuCoin/OKX: Live API leverage filters
• BitMEX: Conservative defaults for USDT contracts
⚙️ Maintenance
Data refreshes via Python generator script with exchange API polling. Some exchanges use tiered leverage - we return maximum available at minimum notional size.
Recent Updates
• Fixed Pine Script compilation errors via function splitting
• Improved performance with exchange-specific lookup functions
• Enhanced Python generator with debug mode and statistics
</parameter>
This updated description:
1. **Reflects recent improvements**: Mentions the function splitting optimization that fixed compilation errors
2. **Provides accurate statistics**: Shows the current 2,357 symbols across 6 exchanges
3. **Better organized**: Uses clear sections with emojis for visual appeal
4. **Technical transparency**: Explains the switch-based dispatcher and exchange-specific functions
5. **Practical usage**: Shows realistic code examples
6. **TradingView compatible**: Uses only supported BBCode tags (, ) and emojis for formatting
The description now accurately represents the current state of the library after our optimization work while maintaining clarity for TradingView users.
get_max_leverage_binance(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage_bitget(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage_bitmex(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage_bybit(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage_kucoin(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage_okx(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage(exchangePrefix, tvTicker)
Parameters:
exchangePrefix (string)
tvTicker (string)
get_max_leverage_for_chart()
get_max_leverage_or_default(exchangePrefix, tvTicker, defaultLev)
Parameters:
exchangePrefix (string)
tvTicker (string)
defaultLev (int)
Comprehensive Pine v6 library providing maximum leverage data for USDT perpetual contracts across major exchanges. Recently optimized with exchange-specific functions for better performance.
📊 Coverage & Stats
• 2,357 symbols across 6 exchanges
• BINANCE: 533 symbols (BTC/ETH: 125x)
• BITGET: 551 symbols (BTC: 125x, ETH: 100x)
• BYBIT: 441 symbols (BTC/ETH: 100x)
• KUCOIN: 478 symbols (ETH: 100x)
• OKX: 244 symbols (BTC/ETH: 100x)
• BITMEX: 110 symbols (BTC/ETH: 100x)
⚡ Core Functions
• get_max_leverage(exchangePrefix, tvTicker) - Main lookup function
• get_max_leverage_for_chart() - Current chart leverage
• get_max_leverage_or_default(exchange, ticker, defaultLev) - With fallback
💡 Usage Examples
// Get leverage for current chart
leverage = get_max_leverage_for_chart()
// Get specific exchange/ticker
binanceBTC = get_max_leverage("BINANCE", "BTCUSDT.P")
// With fallback default
leverage = get_max_leverage_or_default("BYBIT", "ETHUSDT.P", 50)
🔧 Technical Details
• Auto-generated from live exchange APIs
• Exchange-specific functions for optimal performance
• Switch-based dispatcher for efficient lookups
• Supports only USDT perpetuals (.P suffix)
• Realistic leverage tiers based on market categories
📈 Data Sources
• Binance: Realistic tiers (Major coins 125x, memes 10x)
• Bybit/Bitget/KuCoin/OKX: Live API leverage filters
• BitMEX: Conservative defaults for USDT contracts
⚙️ Maintenance
Data refreshes via Python generator script with exchange API polling. Some exchanges use tiered leverage - we return maximum available at minimum notional size.
Recent Updates
• Fixed Pine Script compilation errors via function splitting
• Improved performance with exchange-specific lookup functions
• Enhanced Python generator with debug mode and statistics
</parameter>
This updated description:
1. **Reflects recent improvements**: Mentions the function splitting optimization that fixed compilation errors
2. **Provides accurate statistics**: Shows the current 2,357 symbols across 6 exchanges
3. **Better organized**: Uses clear sections with emojis for visual appeal
4. **Technical transparency**: Explains the switch-based dispatcher and exchange-specific functions
5. **Practical usage**: Shows realistic code examples
6. **TradingView compatible**: Uses only supported BBCode tags (, ) and emojis for formatting
The description now accurately represents the current state of the library after our optimization work while maintaining clarity for TradingView users.
get_max_leverage_binance(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage_bitget(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage_bitmex(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage_bybit(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage_kucoin(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage_okx(tvTicker)
Parameters:
tvTicker (string)
get_max_leverage(exchangePrefix, tvTicker)
Parameters:
exchangePrefix (string)
tvTicker (string)
get_max_leverage_for_chart()
get_max_leverage_or_default(exchangePrefix, tvTicker, defaultLev)
Parameters:
exchangePrefix (string)
tvTicker (string)
defaultLev (int)
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.