Files
market_screener/bin/import-portfolio.js
T
Kazuma cd74497de6 refactor: restructure to clean architecture
fix: restore ScoringConfig improvements lost in refactor commit

docs: rewrite README and CLAUDE.md to reflect current architecture

code-format

code fixes
2026-06-03 01:36:21 -04:00

37 lines
1.1 KiB
JavaScript

/**
* bin/import-portfolio.js — Portfolio CSV Importer
*
* Reads a holdings export from Robinhood, Vanguard, or Fidelity
* and merges the positions into portfolio.json.
*
* Broker is auto-detected from CSV headers.
* Existing entries are updated in-place; new tickers are added.
*
* How to export:
* Robinhood → Account → Statements & History → Export → Holdings
* Vanguard → My Accounts → Holdings → Download (top-right icon)
* Fidelity → Accounts & Trade → Portfolio → Positions → Download CSV
*
* Usage:
* npm run import-portfolio -- <file.csv>
*/
import { PortfolioImporter } from '../src/finance/PortfolioImporter.js';
const csvPath = process.argv[2];
if (!csvPath) {
console.error('Usage: npm run import-portfolio -- <path-to-csv>\n');
console.error('Examples:');
console.error(' npm run import-portfolio -- ~/Downloads/robinhood_holdings.csv');
console.error(' npm run import-portfolio -- ~/Downloads/vanguard_holdings.csv');
process.exit(1);
}
try {
new PortfolioImporter().import(csvPath);
} catch (err) {
console.error(`\nImport failed: ${err.message}`);
process.exit(1);
}