| name | find-latest-portfolio |
| description | Find the most recently downloaded Fidelity and Tastytrade portfolio CSV files from Downloads directory. Use when you need to locate the latest portfolio data files before analysis or processing. |
| allowed-tools | Bash, Read, Glob |
Find Latest Portfolio Files
This skill automatically finds the most recently downloaded portfolio CSV files from the ~/Downloads directory for both Fidelity and Tastytrade accounts. It returns both file paths for use in portfolio analysis and visualization workflows.
Instructions
When you need to locate the latest portfolio data files, use the tools provided in the tools/ directory:
-
Use file_finder.py to find portfolio files
- Run
python tools/file_finder.py from the skill directory
- Searches for both Fidelity and Tastytrade files
- Handles version marks like
(1), (2) automatically
- Returns structured output with file paths
- Exit codes: 0 (both found), 1 (one missing), 2 (both missing)
-
Or import as Python module
- Import
file_finder from the tools directory
- Call
find_latest_files() to get both files as dict
- Use
find_latest_fidelity() or find_latest_tastytrade() for individual files
- Returns None if files not found
-
Get additional file information
- Use
./tools/get_file_info.sh <file_path> to get details
- Shows modification date, file size, and full path
- Useful for confirming file freshness
-
Error handling
- Tools return clear "NOT_FOUND" messages when files are missing
- Both files are typically needed for complete portfolio analysis
File Patterns
The skill recognizes these portfolio file naming patterns:
Fidelity Files:
- Pattern:
Portfolio_Positions_MMM-DD-YYYY.csv
- Examples:
Portfolio_Positions_Jan-04-2026.csv
Portfolio_Positions_Dec-19-2025.csv
Portfolio_Positions_Jan-04-2026 (1).csv (with version mark)
Tastytrade Files:
- Pattern:
tastytrade_positions_XXXXXXXXX_YYMMDD.csv
- Examples:
tastytrade_positions_123456789_260104.csv
tastytrade_positions_987654321_251219.csv
tastytrade_positions_123456789_260104 (2).csv (with version mark)
Version Marks:
- When files are downloaded multiple times on the same day, browsers append
(1), (2), etc.
- The skill uses modification time, not filename, to determine the most recent file
Tools
This skill provides tools in the tools/ directory:
file_finder.py - Find portfolio files
Python module that can be used as CLI or imported:
As CLI:
- Usage:
python tools/file_finder.py [downloads_dir]
- Outputs:
FIDELITY: /path/to/file.csv and TASTYTRADE: /path/to/file.csv
- Exit codes: 0 (both found), 1 (one missing), 2 (both missing)
As Python module:
- Import functions:
find_latest_fidelity(), find_latest_tastytrade(), find_latest_files()
- Returns file paths or None if not found
- Used by unit tests
get_file_info.sh - Get file information
Shell script to get detailed file information:
- Usage:
./tools/get_file_info.sh <file_path>
- Outputs: File name, path, size, and modification date
Common Tasks
Find Both Latest Portfolio Files
cd .claude/skills/find-latest-portfolio
python tools/file_finder.py
python tools/file_finder.py ~/custom/path
Find Files and Get Detailed Information
output=$(python tools/file_finder.py)
fidelity_file=$(echo "$output" | grep "FIDELITY:" | cut -d' ' -f2-)
tastytrade_file=$(echo "$output" | grep "TASTYTRADE:" | cut -d' ' -f2-)
if [ "$fidelity_file" != "NOT_FOUND" ]; then
echo "=== Fidelity File Info ==="
./tools/get_file_info.sh "$fidelity_file"
fi
if [ "$tastytrade_file" != "NOT_FOUND" ]; then
echo "=== Tastytrade File Info ==="
./tools/get_file_info.sh "$tastytrade_file"
fi
Use as Python Module
import sys
sys.path.insert(0, '.claude/skills/find-latest-portfolio/tools')
from file_finder import find_latest_files
files = find_latest_files()
print(f"Fidelity: {files['fidelity']}")
print(f"Tastytrade: {files['tastytrade']}")
Output Guidelines
When presenting results to the user:
-
Display both file paths clearly
- Show the full path or just the filename for readability
- Include modification date/time to confirm freshness
-
Format example:
Found latest portfolio files:
Fidelity:
File: Portfolio_Positions_Jan-04-2026.csv
Modified: 2026-01-04 09:30:15
Tastytrade:
File: tastytrade_positions_123456789_260104.csv
Modified: 2026-01-04 09:32:47
-
Handle missing files gracefully:
Found latest portfolio files:
Fidelity: Portfolio_Positions_Jan-04-2026.csv ✓
Tastytrade: No file found - please download from Tastytrade
Examples
Example 1: Successfully finding both files
When invoked, the skill will:
- Search ~/Downloads for Portfolio_Positions_*.csv files
- Search ~/Downloads for tastytrade_positions_*.csv files
- Return both paths with modification times
- Ready for use with portfolio-analyzer or pine-script-generator
Example 2: Handling missing Tastytrade file
If only Fidelity file exists:
- Return the Fidelity file path successfully
- Inform user that Tastytrade file was not found
- Suggest downloading fresh Tastytrade data if needed for analysis
Example 3: Files with version marks
If Downloads contains:
Portfolio_Positions_Jan-04-2026.csv (modified 9:00 AM)
Portfolio_Positions_Jan-04-2026 (1).csv (modified 9:30 AM)
The skill will return the second file because it has the most recent modification time, regardless of the version mark in the filename.
Integration with Other Skills
With portfolio-analyzer
After finding the files, pass them to the portfolio-analyzer skill:
cd .claude/skills/find-latest-portfolio
output=$(python tools/file_finder.py)
fidelity_file=$(echo "$output" | grep "FIDELITY:" | cut -d' ' -f2-)
tastytrade_file=$(echo "$output" | grep "TASTYTRADE:" | cut -d' ' -f2-)
cd ../../..
/portfolio-analyzer "$fidelity_file" "$tastytrade_file"
With pine-script-generator
After finding the files, use them to generate Pine scripts:
cd .claude/skills/find-latest-portfolio
python tools/file_finder.py
cd ../../..
Copying to data/ directory
If you need to copy the files to the project's data directory:
cd .claude/skills/find-latest-portfolio
python -c "
import sys
sys.path.insert(0, 'tools')
from file_finder import find_latest_files
import shutil
files = find_latest_files()
if files['fidelity']: shutil.copy(files['fidelity'], '../../../data/')
if files['tastytrade']: shutil.copy(files['tastytrade'], '../../../data/')
"
Tips and Best Practices
- The skill searches only the top level of ~/Downloads (not subdirectories)
- Modification time is more reliable than filename for determining "most recent"
- Both files are typically needed for complete portfolio analysis
- If files are very old, consider downloading fresh data from your brokers
- The skill is read-only and never modifies or moves files
See Also