Interactive Brokers Web Margin Usage Badge
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
This tool monitors margin-related data from Interactive Brokers pages and presents it in a compact, color-coded badge. It extracts equity with loan value, initial margin, maintenance margin, available funds, and buying power from the page. The badge displays your current margin usage percentage and available funds, with colors indicating safety level: green for safe, yellow for warning, and red for danger. A progress bar visualizes usage relative to your equity. The panel expands to show a detailed breakdown of each margin component, summary statistics including net liquidation value, and trend arrows showing changes from the last reading.
WHERE IT RUNS
The script activates on Interactive Brokers pages (interactivebrokers.com), including account summary, portfolio, and margin overview screens. It automatically detects margin data using multiple extraction strategies that work across different IBKR interfaces and layouts. The panel appears as a draggable overlay that stays accessible as you browse your account data.
HOW TO USE
Navigate to any Interactive Brokers page containing margin or account data. The panel will appear showing your margin usage percentage and available funds. Use the "Warn %" and "Danger %" inputs to set custom thresholds for yellow and red alert levels — for example, set warning at 60% and danger at 80%. The badge color updates automatically when usage crosses these thresholds. The "Refresh" button manually scans for updated data, and "Export" copies all margin metrics as JSON to your clipboard. The panel updates automatically at your configured interval.
THE TECHNICAL MECHANISM
The script employs a cascading extraction strategy specifically designed for Interactive Brokers' dynamic interface. It first attempts to find margin data in structured containers using CSS selectors targeting class names like .margin-data, .account-data, and .portfolio-data. When structured selectors fail, it falls back to a comprehensive text scanner that traverses visible DOM nodes using a TreeWalker, matching labeled patterns for each margin metric. The scanner uses case-insensitive regex patterns for common IBKR labels including "Equity", "Initial Margin", "Maintenance Margin", "Available Funds", and "Buying Power". Each value is extracted with currency detection, supporting $, €, and £ symbols. The margin usage percentage is calculated as (initial margin / equity) * 100 when both values are available. The trend indicator compares the current usage against the previous reading stored in memory, displaying an up or down arrow with the percentage change. All historical readings are persisted to track usage over time.
THE PANEL
The panel is fully draggable by its header and remembers its position on the page across sessions. It can be collapsed to a small bubble using the minimize button, then restored by clicking the bubble. The panel resizes automatically to fit its content and can be closed with the Escape key or by clicking the close button. The panel's position and state persist globally, so it returns to the same location on subsequent visits.
PLEASE NOTE
Requires the free BotGentz extension to run. Interactive Brokers may update its site structure, which could affect the script's ability to detect margin data — updates will be released as needed. All margin data is read from the page and displayed locally; nothing is transmitted externally. This tool is for informational purposes only and does not provide trading or margin advice. Always verify margin data against the official Interactive Brokers platform before making trading decisions. The script does not execute trades or modify your account in any way.