Contact: app.royal.dev@gmail.com
This application is purpose-built for options day trading, specifically tailored for Index ETF options with daily expirations, such as SPY (SPDR S&P 500 ETF Trust) and QQQ (Invesco QQQ Trust). It offers a fully keyboard-driven interface to execute trades, manage options positions, and monitor your portfolio efficiently through Interactive Brokers (IBKR).
This application runs locally and does not connect to the Internet, it only communicates with IBKR TWS/GateWay API on your device.
⚠️ Note: KeyTrader exclusively interacts with open option positions. It does not affect other asset types, such as stocks.
⚠️ IMPORTANT: If your portfolio contains long-term or LEAP option positions, either:
Close them before connecting this software to that account, or
Use a separate IBKR account dedicated to options day trading with KeyTrader.
⚠️ IMPORTANT: Always begin with a Paper (simulated) account to:
Familiarize yourself with the software
Practice safely before trading live
Before diving into the settings, it's essential to properly configure your IBKR Trader Workstation (TWS) or IB Gateway to enable API access. This guide will walk you through the setup process and explain each available setting in detail.
To connect the KeyTrader to your IBKR account, you must enable API connectivity in either TWS or IB Gateway. These platforms act as the bridge between your application and IBKR's servers. Follow these steps to get started:
TWS (Trader Workstation): This is the full-featured desktop application for trading. Download and install from the IBKR website.
IB Gateway: A lightweight alternative to TWS, ideal for automated trading without the full . Download and install from the same site under "IB Gateway".
Launch TWS or IB Gateway.
Enter your IBKR username and password.
Select your account type: Live (real money) or Paper Trading (simulated, recommended for testing).
API settings are found in the configuration menu. Enable socket-based connections, as KeyTrader uses this method.
For TWS:
Go to File > Global Configuration.
In the left panel, navigate to API > Settings.
Check the box for Enable ActiveX and Socket Clients.
Under Socket Port, note the default port and use it in this software or change it to an arbitrary port number.
Ensure Read-Only API is unchecked so you can place orders through API and this application.
In Trusted IPs, add 127.0.0.1 or localhost to allow connections from your local machine.
Optionally, check Allow connections from localhost only for added security.
Click Apply and OK.
For IB Gateway:
Launch IB Gateway and log in.
Click the Configure > Settings button (gear icon).
Navigate to API > Settings.
Follow the same steps as TWS: Enable Socket Clients, set the port, add trusted IPs (localhost), and apply changes.
Once set up, proceed to configure the KeyTrader settings below.
These settings establish and manage the connection between KeyTrader and your TWS or IB Gateway instance. A stable connection is crucial for real-time data and order execution in options trading.
Host: The hostname or IP address where TWS or IB Gateway is running. Use localhost or 127.0.0.1 if on the same machine (default: localhost).
Port: The socket port for API communication. This must match the port configured in TWS/Gateway.
Client ID: A unique numeric identifier for this KeyTrader instance to prevent conflicts with other API clients connected to the same TWS/Gateway. Start with 0 for the first client; increment for additional ones (default: 0). Typically, you won't need to change this.
These parameters control the core options trading logic, including order placement, risk controls, and instrument selection for Index ETF options with daily expirations (e.g., SPY, QQQ). They allow customization for strategies focused on short-term options plays.
Account Number: Your full IBKR account ID (e.g., DU1234567), retrieved from the TWS Account Window or IBKR portal. This specifies which account to trade on if you have multiple sub-accounts.
Limit Offset Ticks: The number of price ticks to offset limit orders from the current market price, providing a buffer for execution in volatile options markets. For example, a value of 1 places the limit slightly away from the ask (for buys) or bid (for sells) to improve fill chances.
Symbol: The ticker symbol for the underlying Index ETF you're trading options on (e.g., SPY for SPDR S&P 500 ETF, QQQ for Invesco QQQ Trust). This app is optimized for these symbols with daily expiration options.
Option Strike Mode: Determines how option strike prices are automatically selected based on the underlying asset's price for daily expiration contracts. Options include:
Deep OTM (Out-of-the-Money): Far from current price, lower premium but higher risk—suitable for speculative plays.
Slight OTM: Slightly out-of-the-money, balanced risk/reward for directional bets.
ATM (At-the-Money, default): Closest to current price, highest premium for neutral or high-probability trades.
Slight ITM (In-the-Money): Slightly in-the-money, higher delta for conservative positions.
Deep ITM: Far in-the-money, behaves more like the underlying for leveraged exposure.
Option Strike Offsets: Fine-tune the strike selection in tick steps from the underlying price.
Deep OTM: Large offset for aggressive OTM selection (default: 3 ticks).
Slight OTM: Small offset (default: 1 tick).
ATM: No offset (default: 0).
Slight ITM: Small offset (default: 1 tick).
Deep ITM: Large offset (default: 3 ticks).
Exchange: The venue for options order routing. SMARTas in IBKR's default, automatically selects the best exchange.
Security Type: The security type, set to STK for options (yes, not OPT).
Buy Order Type: Type of order for entering options positions. LIMIT for price-specific buys (default, safer in illiquid options), MKT for immediate execution at market price (faster but slippage risk in fast markets).
Close Order Type: Order type for exiting options positions. LIMIT (default) or MKT. Use LIMIT for controlled closes.
Partial Close Percentage: The portion of an open options position to close in partial exit actions (default: 0.25 or 25%). Useful for scaling out of multi-contract trades gradually.
⚠️Caution: If your account is permitted to sell naked option calls, with rapid consecutive key presses there is a risk that the API sells more than open positions. To reduce the risk use a proper Key Debounce value. The default Key Debounce value of 800ms works fine, but test it on your system first in your Paper Account (simulated trading).
Entry Amount Bound by Net Liq percentage: Enable this checkbox to limit new options position sizes based on your account's net liquidation value (total portfolio value). Prevents overexposure in leveraged options trading.
Net Liq Bound Percent: The maximum percentage of net liquidation to risk per entry (default: 0.02 or 2%). For a $100,000 account, this caps entries at $2,000 worth of options.
⚠️Caution: Depending on your IBKR account settings, this might not work if it cannot load the net liquidation value
Relative Stop Percentage: For relative (trailing) stop-loss orders on options, the percentage distance from the highest/lowest price since entry (default: 0.04 or 4%).
TRSt Limit Percentage: Trailing stop limit offset as a percentage (default: 0.02 or 2%). Sets the limit price relative to the trailing stop trigger for options exits.
Stop Loss Order Percentage: Fixed stop-loss percentage from entry price for options (default: 0.10 or 10%). Triggers a market order to exit at a loss, protecting against adverse moves.
Key Debouance (ms): Used to limit the rate of physical key press admission. This is important for risk management, specially for buy order submissions and partial closures. The default value is 800 milliseconds. Optimal value could vary depending on your system setup. A zero, 0 ms, means that all key strokes will be accepted (no response lags), hence increasing the risk of processing unctrolled key presses.
Max Open Positions Limit: Caps the total number of concurrent options positions to manage risk (default: 10). Exceeding this blocks new entries.
⚠️Caution: Rapid consecutive key presses of the order buttons may result in exceeding the configured limit. To reduce the risk, use a proper Key Debounce value. The default Key Debounce value of 800ms works fine, but test it on your system first in your Paper Account (simulated trading).
Enable Max Open Position Guard: Toggle to enforce the max positions limit (default: enabled). Disabling allows unlimited positions (use cautiously!).
KeyTrader leverages keyboard shortcuts for rapid options execution, reducing mouse dependency in fast-paced trading. Customize them to fit your workflow, each can combine keys (e.g., F2) with modifiers (Ctrl, Shift). Actions are:
PrintPnlAndOpenPositions: Displays current profit/loss and open options positions summary.
IncrementDTE: Increases days to expiration (DTE) for option selection by 1 day.
ResetDTE: Resets DTE to default 0DTE (Zero Days To Expiration).
CancelAllOpenOptionOrders: Cancels all pending options orders.
ToggleEntryAmountPercentage: Toggles between fixed entry size and percentage of net liquidation with the given percentage bound.
FetchOptionContracts: Requests and displays option contracts for calls and puts on the selected date and strike mode for the given symbol. Use this key to update the contracts before placing orders. If you already placed orders at a certain strike, and the current price of the underlying moved from that strike, do not update the contracts if you wish to add to your existing positions on the same contracts.
RotateOptionStrikeMode: Cycles through strike modes (Deep OTM → Slight OTM → ATM → Slight ITM → Deep ITM)
PrintOptionStrikeInfo: Shows details on selected strike price, expiration.
ToggleBuyOrderType: Switches buy orders between LIMIT and MKT.
ToggleCloseOrderType: Switches close orders between LIMIT and MKT.
BuyCallQty1 / BuyCallQty2 / BuyCallQty5: Enters call option buys for 1, 2, or 5 contracts on the fetched contract.
BuyPutQty1 / BuyPutQty2 / BuyPutQty5: Enters put option buys for 1, 2, or 5 contracts on the fetched contract.
CloseAllOptionPositions: Fully exits all options positions. This will first cancel any open orders and then place orders for closing open positions.
PartiallyCloseOptionPositions: Closes partial options positions per the percentage setting. This will first cancel any open orders and then place orders for partial-close of open positions.
AttachTRStopOrder: Adds a trailing stop to the current options position.
AttachSTLossOrder: Adds a fixed stop-loss to options.
When you change the settings press Save to store them permanently. To revert your changes to the previously saved settings, press Load. Load Default will load the default settings of the application. Default shortcuts are pre-assigned for quick start, review and remap in the for personalization.
⚠️Caution: To avoid any unintended behaviour try not to change the settings when the application is running.
After you have configured the settings and your TWS or Gateway application is started (logged in), press Start to run the application. In the Console Output you will see if the application could connect to TWS/Gateway or not. When connected, you will see relevant messages for each shortcut key that you press. Press Stop for stopping the application.
⚠️Caution: Do not leave the application open and connected to TWS/Gateway with your shortcut keyboard unattended! Any key press could cost you a lot. Always, stop the application when you are done.