| name | colab-unzip-workflow |
| description | Colab file paths after unzipping repo. Trigger when: (1) API key file not found, (2) file path errors in Colab, (3) configuring notebook paths, (4) 'yfinance fallback' despite keys existing. |
| author | Claude Code |
| date | "2024-12-28T00:00:00.000Z" |
Colab Unzip Workflow - File Paths
Critical Information
When you unzip Alpaca_trading.zip in Colab, the files are at:
/content/Alpaca_trading/
NOT on Google Drive. NOT at /content/drive/MyDrive/.
API Key Files in This Repo
The repo contains these API key files:
/content/Alpaca_trading/API_key_500Paper.txt # 500 paper account
/content/Alpaca_trading/API_key_100kPaper.txt # 100k paper account
NOT API_key.txt. The files have specific names.
Correct Default in training.ipynb
API_KEYS_FILE = '/content/Alpaca_trading/API_key_500Paper.txt'
API_KEYS_FILE = '/content/drive/MyDrive/API_key.txt'
API_KEYS_FILE = '/content/Alpaca_trading/API_key.txt'
Failed Attempts (Critical)
| Attempt | Why it Failed | Lesson Learned |
|---|
API_KEYS_FILE = None | No keys loaded, yfinance used | Always set explicit path |
/content/drive/MyDrive/API_key.txt | File not on Drive after unzip | Unzip goes to /content/, not Drive |
API_key.txt (relative) | Wrong working directory in Colab | Use absolute paths |
API_key.txt (wrong name) | File is API_key_500Paper.txt | Check actual filenames in repo |
Colab Directory Structure After Unzip
/content/
├── Alpaca_trading/ # Unzipped repo
│ ├── API_key_500Paper.txt # API keys (500 paper)
│ ├── API_key_100kPaper.txt # API keys (100k paper)
│ ├── notebooks/
│ │ └── training.ipynb
│ ├── alpaca_trading/
│ │ └── ...
│ └── ...
├── drive/ # Google Drive (if mounted)
│ └── MyDrive/
│ └── ... # User's Drive files
└── sample_data/ # Colab default
How to Verify in Colab
import os
print(os.listdir('/content/'))
print(os.listdir('/content/Alpaca_trading/'))
api_path = '/content/Alpaca_trading/API_key_500Paper.txt'
print(f"File exists: {os.path.exists(api_path)}")
Key Rules
- After unzip:
/content/Alpaca_trading/ - not Drive
- Check actual filenames - don't assume
API_key.txt
- Use absolute paths - relative paths break in Colab
- Verify before assuming -
os.path.exists() is your friend
Files Modified
notebooks/training.ipynb:
- Cell 15: API_KEYS_FILE = '/content/Alpaca_trading/API_key_500Paper.txt'
References
- Skill:
data-source-priority - Why Alpaca API matters
alpaca_trading/data/fetcher.py - Key loading logic with logging