ETRADE Bot

Automated US Stock & Options Trading Platform — Complete User Manual
Stocks & Options OAuth 2.0 Sandbox Mode Windows
Digitally signed · DennTech Trading Solutions · Windows Authenticode

Table of Contents

  1. Overview & Key Features
  2. System Requirements & Installation
  3. Supported Brokers
  4. OAuth Authentication Process
  5. Sandbox Mode
  6. Interface Overview
  7. Watchlist & Market Data
  8. Trading Strategies
  9. Order Entry & Execution
  10. Positions & Portfolio View
  11. Sentiment Analysis
  12. Demo Mode
  13. Configuration & Settings
  14. Data Files & Logs
  15. Troubleshooting

1. Overview & Key Features

ETRADE Bot is a desktop-based automated trading platform built for US equity markets. Unlike cryptocurrency bots that operate on simple REST or WebSocket APIs, US stock brokers use OAuth-based authentication — a more involved but more secure authorization flow. ETRADE Bot handles the full OAuth handshake automatically, manages token refresh cycles, and provides a clean graphical interface for configuring and running automated trading strategies across multiple brokers.

Whether you want to automate simple moving average crossovers on individual stocks, run momentum-based strategies across a watchlist, or test your ideas risk-free in a paper trading sandbox, ETRADE Bot gives you the infrastructure to do it without writing code.

Key Features

2. System Requirements & Installation

ComponentMinimumRecommended
Operating SystemWindows 10 (64-bit)Windows 11
RAM4 GB8 GB
PythonPython 3.10+Python 3.11+
InternetRequired (OAuth)Stable broadband

Installation from Source

  1. Navigate to the ETRADE_BOT folder in PowerShell or a terminal.
  2. Create and activate a virtual environment: python -m venv .venv && .venv\Scripts\Activate.ps1
  3. Install requirements: pip install -r requirements.txt (includes pyetrade, ttkbootstrap, and broker-specific libraries).
  4. Launch: python main.py

The compiled EXE (if available via the build release script) bundles all dependencies and can be run directly without Python installed.

3. Supported Brokers

BrokerModuleAuth TypeAsset Classes
E*TRADEetrade_conn.pyOAuth 1.0aStocks, Options, ETFs
Alpacaalpaca_conn.pyAPI KeyStocks, Crypto
Charles Schwabschwab_conn.pyOAuth 2.0Stocks, Options, ETFs
Interactive Brokersibkr_conn.pyTWS/GatewayStocks, Options, Futures, Forex
Tradovatetradovate_conn.pyOAuth 2.0Futures
Webullwebull_conn.pyDevice TokenStocks, Options
CBOEcboe_conn.pyAPI KeyOptions Data

Each broker module implements a shared ExchangeBase interface, meaning strategy logic works identically regardless of which broker you connect to.

4. OAuth Authentication Process

E*TRADE uses OAuth 1.0a for API access. This is a three-step authorization process that must be completed once per session (production) or once per day (sandbox). ETRADE Bot automates every step of this flow.

Step 1: Enter Your API Keys

  1. Launch ETRADE Bot. The main window opens.
  2. Click the API Settings button (or go to Settings → API Settings) to open the credentials dialog.
  3. In the Production API Keys section, enter your E*TRADE Consumer Key and Consumer Secret from the E*TRADE developer portal.
  4. In the Sandbox API Keys section, enter your E*TRADE Sandbox Consumer Key and Sandbox Consumer Secret. These are different keys issued alongside your production keys.
  5. Check or uncheck Use Sandbox API depending on whether you want to trade with real money or simulated funds.
  6. Click Save & Get Auth URL.

Step 2: Authorize in Your Browser

After clicking Save & Get Auth URL, the bot generates an OAuth authorization URL and automatically opens it in your default web browser. You will be directed to E*TRADE's login page. Log into your E*TRADE account and click Accept to authorize the bot. E*TRADE displays a 5-digit authorization PIN on the confirmation page.

Step 3: Submit the PIN

  1. Copy the PIN from the browser page.
  2. Return to ETRADE Bot. The PIN entry field is now enabled.
  3. Paste the PIN into the PIN field and click Submit PIN & Connect.
  4. The bot exchanges the PIN for OAuth access tokens. A success message appears in the log panel and the connection status indicator turns green.
Access tokens expire after one hour. The bot automatically detects token expiry and prompts you to re-authorize. The re-authorization process requires only Steps 2 and 3 — your API keys are already saved.
For production (real money) trading, the OAuth PIN is valid for only 5 minutes after generation. Complete the authorization process promptly. For sandbox mode, there is a longer validity window.

Getting E*TRADE API Keys

To obtain API keys from E*TRADE:

  1. Navigate to developer.etrade.com and create a developer account (linked to your E*TRADE brokerage account).
  2. Register a new application. Fill in a name, description, and callback URL (use https://localhost if no web server is involved).
  3. E*TRADE will issue you a Consumer Key and Consumer Secret for both Production and Sandbox environments. Copy both pairs immediately.
  4. Your application must be approved for production access (sandbox access is immediate). Production approval typically takes 1–3 business days.

5. Sandbox Mode

Sandbox mode connects to E*TRADE's simulated trading environment. Your sandbox account has a pre-funded virtual balance, and all orders are executed against real-time market data but produce no actual financial transactions. This is ideal for:

Enabling Sandbox Mode

In the API Settings dialog, check the Use Sandbox API toggle before saving credentials and connecting. The main window title bar displays [SANDBOX] when sandbox mode is active. All log entries are prefixed with [SANDBOX] to clearly distinguish simulated activity from real activity.

Sandbox balances and positions are separate from your live account. Positions opened in sandbox mode will never appear in your real E*TRADE account.

6. Interface Overview

The ETRADE Bot interface is built with Tkinter and ttkbootstrap for a clean, professional dark-themed look. The main window is organized into four primary areas.

Top Toolbar

Left Panel — Controls

Center Panel — Activity Log

A scrollable, auto-updating log of all bot events. Every quote received, every signal evaluated, every order placed or filled, and every error is recorded here with a timestamp. Use the Clear Log button to reset the display. The log is also written to a file for persistent review.

Right Panel — Positions & Orders

7. Watchlist & Market Data

The watchlist is the set of symbols the bot actively monitors for trading signals. You can add any stock, ETF, or option symbol that your connected broker supports.

Adding Symbols

Type a ticker symbol (e.g., AAPL, SPY, TSLA) into the symbol search field at the top of the watchlist panel and press Enter or click Add. The bot immediately fetches a real-time quote and subscribes to streaming price updates for the symbol. The quote refreshes at the interval configured in Settings (default: 10 seconds).

Assigning Strategies

Each symbol in the watchlist can have its own strategy. Click a symbol to select it, then choose a strategy from the Strategy dropdown on the left panel. The strategy assignment is saved and persists across sessions. This allows you to run, for example, RSI on AAPL and MACD on SPY simultaneously from a single bot instance.

Removing Symbols

Select any symbol in the watchlist and click Remove. The bot stops monitoring that symbol and cancels any pending orders for it. Open positions for removed symbols are not automatically closed — you must close them manually or via the Positions panel.

Market Hours

The bot is aware of US market hours (9:30 AM – 4:00 PM ET, Monday–Friday). Outside of market hours, quote requests return the previous day's closing price. The bot can be configured to queue signals generated pre-market and execute them at market open via Settings → Pre-Market Queue.

8. Trading Strategies

ETRADE Bot includes several technical analysis strategies adapted specifically for US equity markets. Stock market price action differs from crypto in that it is subject to earnings, news events, dividends, and macroeconomic forces — the strategy parameters are tuned accordingly.

RSI Strategy

Uses a 14-period RSI. Generates a buy signal when RSI drops below 30 (oversold) and a sell signal when RSI rises above 70 (overbought). Recommended for stable large-cap stocks that tend to revert to the mean after short-term extremes. Not recommended during strong trend conditions.

EMA Crossover

Uses a fast EMA (default 9-period) and slow EMA (default 21-period). Buys on bullish crossover (fast above slow) and sells on bearish crossover. Well-suited for trending stocks after a breakout. Works best on daily or 1-hour timeframes.

SMA Crossover

Uses a 50-day and 200-day SMA for the classic "golden cross" (buy) and "death cross" (sell) signals. This is a long-term strategy best suited for position trading rather than day trading. Signals are rare but historically reliable on major indices and blue-chip stocks.

MACD Strategy

Standard MACD (12, 26, 9) configuration. Generates buy signals when the MACD line crosses above the signal line and sell signals on the reverse cross. The histogram provides momentum confirmation — strong histogram bars validate the signal, weak bars suggest caution.

Momentum Strategy

Ranks watchlist symbols by recent price momentum (N-day rate of change) and buys the top performers while selling or avoiding the laggards. Rebalances at configurable intervals. Best for a diversified watchlist of 10+ symbols.

Mean Reversion Strategy

Identifies stocks trading significantly below their N-day average (using Bollinger Bands or Z-score deviation) and buys the dip, expecting prices to return toward the mean. Sets a target exit at the mean or at a fixed percentage gain. Carries the risk of catching falling knives — use stop losses.

9. Order Entry & Execution

ETRADE Bot places orders through the connected broker's API. Orders are typically market orders for immediate execution, but limit orders can be configured in Settings for tighter price control.

Automated Orders

When the bot is running and detects a strategy signal for a watchlist symbol, it automatically calculates the order quantity based on your configured trade amount, then places the order. The order ID, type, quantity, and price are logged to the Activity Log and the Recent Orders panel updates in real time.

Manual Orders

Use the Manual Buy and Manual Sell buttons to place orders independently of strategy signals. Enter the symbol, quantity, and order type in the dialog that appears. Manual orders are logged with a [MANUAL] prefix in the Activity Log.

Order Types

Pattern Day Trader (PDT) Awareness

For accounts under $25,000 at US brokers, the Pattern Day Trader rule limits accounts to 3 day trades (buy and sell the same security in the same day) within a rolling 5-day window. ETRADE Bot displays your current day trade count in the Account Summary panel and warns you when you are approaching the PDT limit to prevent unintentional violations.

10. Positions & Portfolio View

The Positions table displays all open positions managed by the bot, including positions opened manually outside the bot that exist in your account. Columns include: Symbol, Quantity, Entry Price, Current Price, Market Value, Unrealized P&L ($), and Unrealized P&L (%).

Closing Positions

Right-click any position to access the context menu. Options include: Close Full Position (market sell entire quantity), Close Half Position, and Set Stop Loss (set or update the stop loss level for that specific position).

Day P&L Summary

At the bottom of the Positions panel, a running total shows today's realized P&L (from closed positions) and total unrealized P&L (from open positions). This resets at midnight each trading day.

11. Sentiment Analysis

The built-in sentiment module (sentiment.py) provides a supplementary signal layer based on news and market sentiment rather than price action alone. It is not a standalone trading engine but can be used to filter or confirm technical signals.

What It Analyzes

Using Sentiment in Strategies

In Settings → Strategy Options, enable Sentiment Filter. When enabled, the bot only executes buy signals when the sentiment score for the symbol is positive or neutral. It suppresses buy signals during negative sentiment periods (e.g., during earnings disappointments or sector-wide sell-offs). Sell signals are unaffected by the filter.

12. Demo Mode

Demo mode runs the bot with a fully simulated broker connection — no real API keys are needed, no network requests are made, and all prices are generated from a pre-loaded demo state. This is designed for first-time users who want to learn the interface before connecting a real account.

Activating Demo Mode

At the main window, click Try Demo Mode (visible before any broker connection is established). The bot loads demo state from demo_state.json, populating the watchlist with sample symbols and simulated portfolio positions. All strategy signals, order placements, and P&L calculations behave identically to a live session.

Exiting Demo Mode

Click Stop Demo or close and reopen the application to exit demo mode. Demo state can be reset via Settings → Reset Demo State, which purges the demo_state.json file and restarts fresh.

13. Configuration & Settings

Access the Settings dialog from the main window's top toolbar or via the Settings button. Key configurable options include:

All settings are saved to etrade_config.json in the application directory and persist across sessions.

14. Data Files & Logs

FileContents
etrade_config.jsonAll settings and configuration
demo_state.jsonDemo mode portfolio state
.oauth_state.jsonOAuth token state (auto-managed)
exchange_config.jsonPer-broker connection parameters
grok_logs.csvFull trade and signal history CSV export
The .oauth_state.json and .oauth_state.pkl files store active OAuth tokens. Do not delete these while a session is active — doing so forces a full re-authorization on the next action.

15. Troubleshooting

OAuth authorization fails

Ensure your Consumer Key and Secret match the environment (production vs. sandbox) that you have selected. Check that your system clock is accurate — OAuth signatures are time-sensitive. If the browser page shows "Application not found," the keys may not yet be approved for production use.

PIN is rejected

The OAuth PIN from E*TRADE is valid for only 5 minutes. If you take longer than 5 minutes between opening the browser and submitting the PIN, restart the authorization flow by clicking Save & Get Auth URL again. A new URL and PIN will be generated.

Orders are not filling

Verify market hours (9:30 AM – 4:00 PM ET). Limit orders may not fill if the market moves away from your limit price — switch to market orders if immediate execution is required. Check the Recent Orders panel for error codes returned by the broker.

"Account not authorized" error

Your E*TRADE developer application may not yet have production approval. Use sandbox mode until approval is granted, or check the E*TRADE developer portal for your application status.

Bot stops unexpectedly

Check the Activity Log for an error message. Common causes include: OAuth token expiry (re-authorize), network disconnection (reconnect), or the daily loss limit being hit (restart manually after reviewing trades). Set log level to Verbose for more detailed diagnostic output.


ETRADE Bot User Manual — DennTech Trading Solutions — May 2026