Skip to content

slugiscool99/rob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

rob

A command-line tool for Robinhood portfolio management and AI-powered stock analysis.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Portfolio                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Total      $125,432.00            β”‚
β”‚  Cash         $8,234.00            β”‚
β”‚  Invested   $117,198.00            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β–Ά πŸ“Š  View positions with ratings
  πŸ“ˆ  Increase all positions by %
  πŸ“‰  Decrease all positions by %
  πŸ”  Analyze a ticker
  ──────────────────────────────────
  βœ—   Exit

What It Does

πŸ–₯️ Interactive Dashboard

Run rob with no arguments to launch the interactive dashboard:

rob

This gives you a visual portfolio summary and menu to:

  • View positions with ratings and allocation %
  • Increase or decrease all positions by a percentage
  • Analyze any ticker with AI
  • Navigate with arrow keys, no commands to remember

πŸ“Š Portfolio Management

Increase or decrease all your Robinhood positions by a percentage with a single command. Perfect for systematic rebalancing or scaling in/out of your entire portfolio.

# Increase all positions by 5%
rob adjust --action increase --percentage 5

# Decrease all positions by 10% (taking profits)
rob adjust -a decrease -p 10

# Preview what would happen (no trades executed)
rob adjust -a increase -p 3 --dry-run

Features:

  • Cost estimation before executing any trades
  • Balance checking to prevent insufficient funds errors
  • Interactive confirmation for each trade (or --no-confirm for automation)
  • Position-by-position control with skip/abort options

πŸ€– AI Stock Analysis

Get comprehensive analysis on any stock using earnings data, transcripts, and real-time web search.

rob analyze AAPL

The analyzer:

  1. Fetches latest ticker data (price, market cap, etc.)
  2. Fetches latest earnings report (revenue, EPS, margins)
  3. Fetches earnings call transcript (management commentary)
  4. Runs analysis through GPT-5.2 with web search to:
    • Find comparable companies and relative valuation
    • Check recent news and analyst sentiment
    • Evaluate management credibility
    • Identify headwinds and tailwinds
    • Generate a 1-5 buy score with rationale

Results are cached per quarter - if you've already analyzed a stock for the current quarter, it shows the cached analysis instantly. Use --refresh to force a new analysis.

# Force fresh analysis even if cached
rob analyze AAPL --refresh

Analysis Output

Shows a compact summary first, then an interactive menu to drill into sections:

============================================================
         AAPL ANALYSIS SUMMARY
============================================================

  Rating: β˜…β˜…β˜…β˜…β˜† BUY
  Outlook: Long-term BULLISH | Short-term NEUTRAL
  Valuation: FAIRLY VALUED vs peers
  News: POSITIVE
  Management: 4/5
  ⚠ Top Risk: Smartphone market saturation in developed markets...
  ✦ Top Catalyst: Services revenue growing at 15% annually...

============================================================

  AAPL  β˜…β˜…β˜…β˜…β˜† BUY
  Strong services growth offsetting hardware maturity...

  ↑↓ Navigate  β”‚  Enter Select  β”‚  q Quit

β–Ά πŸ“Š Summary & Rationale
  πŸ“ˆ Long-term Outlook
  πŸ“‰ Short-term Outlook
  🏒 Comparables & Valuation
  πŸ“° Recent News
  ⚠️  Risks & Headwinds
  πŸš€ Growth & Tailwinds
  πŸ‘” Management Assessment
  πŸ“‹ Show All
  βœ“ Done

πŸ“ˆ Interactive Position Viewer

rob positions

Browse all your positions sorted by value with allocation percentages and analysis ratings:

  Positions β”‚ Select to analyze β”‚ q Quit

β–Ά NVDA    $    45,200    35.2%  β˜…β˜…β˜…β˜…β˜… BUY
  AAPL    $    32,500    25.3%  β˜…β˜…β˜…β˜…β˜† BUY
  MSFT    $    28,400    22.1%  β˜…β˜…β˜…β˜…β˜† BUY
  GOOGL   $    12,100     9.4%  β˜…β˜…β˜…β˜†β˜† HOLD
  AMZN    $    10,200     7.9%
  ────────────────────────────────────────
  βœ“ Done

Features:

  • Positions sorted by value (largest first)
  • Shows allocation percentage of total portfolio
  • Displays cached buy/sell ratings (if analyzed)
  • Select any position to view or run analysis
  • Offer to refresh stale analyses

πŸ“Š Portfolio Summary

rob portfolio

Quick view of:

  • Total portfolio value
  • Available cash
  • Each position with current price and value

Installation

Quick Install

git clone <repository-url>
cd rob
./install.sh

Configure Credentials

rob config

You'll be prompted for:

Robinhood Credentials:

  • Username (email)
  • Password
  • TOTP secret (optional, for automatic 2FA)

API Keys (for analyze command):

  • API Ninjas key - for fetching earnings data and transcripts
  • OpenAI key - for AI-powered analysis with GPT-5.2

All credentials are stored securely in ~/.config/rob/.env with proper permissions (readable only by you).

Getting API Keys

Service Get Key Notes
API Ninjas https://api-ninjas.com/ Free tier: 10,000 requests/month
OpenAI https://platform.openai.com/api-keys Pay-per-use, ~$0.05 per analysis

You can also pass keys directly via CLI options:

rob config --api-ninjas YOUR_KEY --openai YOUR_KEY

Or set individual keys without re-entering everything (just press Enter to keep existing values).

Commands Reference

Command Description
rob Interactive mode with portfolio dashboard and menus
rob positions Interactive position viewer with analysis ratings
rob portfolio Show portfolio summary and positions (text output)
rob adjust Bulk adjust positions by percentage
rob analyze TICKER AI analysis of a stock
rob config Configure Robinhood credentials and API keys
rob --help Show help

rob adjust Options

Option Short Description
--action -a increase or decrease (required)
--percentage -p Percentage to adjust (0-100, required)
--confirm/--no-confirm Prompt before each trade (default: confirm)
--dry-run Preview trades without executing

rob analyze Options

Option Short Description
--refresh -r Force new analysis even if cached

rob config Options

Option Description
--username Robinhood username (email)
--password Robinhood password
--totp-secret TOTP secret for automatic 2FA
--api-ninjas API Ninjas key (for earnings data)
--openai OpenAI API key (for AI analysis)

All options are interactive if not provided - just run rob config and follow the prompts.

Examples

Morning Portfolio Check

# Interactive dashboard - best for daily use
rob

# Or jump straight to positions with ratings
rob positions

# Quick text summary (no interactivity)
rob portfolio

Scale Into Positions

# Preview first
rob adjust -a increase -p 5 --dry-run

# Execute with confirmation on each trade
rob adjust -a increase -p 5

# Execute without prompts (be careful!)
rob adjust -a increase -p 5 --no-confirm

Research a Stock

rob analyze NVDA

Analyze Multiple Stocks

for ticker in AAPL MSFT GOOGL; do
  rob analyze $ticker
done

Setting Up Automatic 2FA

Instead of manually entering your 2FA code each time, configure automatic code generation:

Getting Your TOTP Secret

Option 1: Setting up 2FA for the first time

  1. When Robinhood shows you the QR code during 2FA setup
  2. Look for "Can't scan? Enter manually"
  3. Copy the secret key (looks like: ABCD1234EFGH5678...)
  4. Run rob config and paste it when prompted

Option 2: Already have 2FA enabled

  1. Temporarily disable 2FA in Robinhood security settings
  2. Re-enable 2FA and grab the secret key when shown
  3. Add it via rob config

Option 3: From Google Authenticator

  1. Transfer accounts β†’ Export accounts β†’ Select Robinhood
  2. Read QR code to get otpauth-migration://offline?data={code}
  3. Use otpauth to decode the secret

How It Works

Position Adjustment

  1. Authenticates with Robinhood (uses saved token if available)
  2. Fetches your current portfolio and positions
  3. Calculates shares to trade for each position based on percentage
  4. Shows estimated total cost and checks available cash
  5. Iterates through each position:
    • Shows current position details
    • Calculates and displays proposed trade
    • Waits for confirmation (unless --no-confirm)
    • Executes market order
  6. Logs out

Stock Analysis

  1. Checks for cached analysis from current quarter
  2. If no cache or --refresh:
    • Fetches ticker data from API Ninjas
    • Fetches latest earnings transcript
    • Fetches earnings data for that quarter
    • Sends all data to GPT-5.2 with web search enabled
    • AI searches for comparables, recent news, analyst opinions
    • Generates structured analysis with buy score
    • Caches result for the quarter
  3. Displays interactive analysis with drill-down menu

Data Storage

  • Credentials: ~/.config/rob/.env
  • Auth token: ./robinhood.pickle (in current directory)
  • Analysis data: ~/.config/rob/data/{TICKER}/
    • ticker_data.json - Price, market cap, etc.
    • earnings_YYYY_QN.json - Quarterly earnings
    • transcript_YYYY_QN.json - Earnings call transcript
    • analysis_YYYYMMDD.json - AI analysis results

Environment Variables

Variable Description
ROBINHOOD_USERNAME Robinhood email
ROBINHOOD_PASSWORD Robinhood password
ROBINHOOD_TOTP_SECRET TOTP secret for automatic 2FA
API_NINJAS_KEY API Ninjas API key (for analysis)
OPENAI_KEY OpenAI API key (for analysis)
ROB_DEBUG Set to 1 for debug output

Troubleshooting

Permission denied accessing ~/.config/rob/.env

If you see this error, the config directory was created with root ownership during installation. Fix it with:

sudo chown -R $USER ~/.config/rob

Then run rob config to set up your credentials.

Disclaimer

⚠️ This tool executes real trades on your Robinhood account.

  • Always review each trade carefully before confirming
  • Use --dry-run to preview trades first
  • The authors are not responsible for any financial losses
  • AI analysis is for informational purposes only - not financial advice

License

MIT

About

Bulk buy/sell Robinhood portfolio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published