Before you start
- An E*TRADE brokerage account
- Signed API user agreement
Create your E*TRADE API key
- 1
Request keys
While logged in, open
us.etrade.com/etx/ris/apikeyand request a sandbox key. - 2
Sign agreements
Accept the API agreement and market data terms when prompted.
- 3
Get production keys
After testing, request a production key from the same page.
- 4
Store them
Save
ETRADE_CONSUMER_KEYandETRADE_CONSUMER_SECRET.
Test the key
Before wiring the key into a strategy, make one request by hand. It separates “the key is wrong” from “my code is wrong”.
# pip install requests-oauthlib
from requests_oauthlib import OAuth1Session
import os
s = OAuth1Session(os.environ["ETRADE_CONSUMER_KEY"], os.environ["ETRADE_CONSUMER_SECRET"],
callback_uri="oob", signature_type="AUTH_HEADER")
print(s.fetch_request_token("https://apisb.etrade.com/oauth/request_token"))oauth_token in the response means the sandbox key is valid.Keep the credentials safe
- Store values in a password manager or a git-ignored
.env, never in code or notebooks you share. - In an AlgoGP project you can still add them under APIs & keys (encrypted at rest) and read them with
strategy_runtime.secrets.get("ETRADE_CONSUMER_KEY"). - Give each bot its own credential so you can revoke one without stopping the others.
ETRADE_CONSUMER_KEY=paste-your-value-here
ETRADE_CONSUMER_SECRET=paste-your-value-hereDesign and backtest your E*TRADE strategy first
AlgoGP turns an idea into Python and tests it on years of history before you connect it to E*TRADE. The exported code keeps the broker behind four small adapter methods.
- AI copilot writes and revises the rules
- Backtests with realistic costs
- Exported Python ready to wire to E*TRADE
Free plan, no card required.
AlgoGP is not affiliated with E*TRADE. Menus get renamed from time to time; if a label differs, the official documentation has the current path.