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
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// import-portfolio.js
|
||||
//
|
||||
// Imports holdings from a broker CSV export into portfolio.json.
|
||||
//
|
||||
// Usage:
|
||||
// npm run import-portfolio -- holdings.csv
|
||||
//
|
||||
// Supported brokers (auto-detected from headers):
|
||||
// Robinhood → Account → Statements & History → Export → Holdings
|
||||
// Vanguard → My Accounts → Holdings → Download (top-right icon)
|
||||
// Fidelity → Accounts & Trade → Portfolio → Positions → Download CSV
|
||||
//
|
||||
// If you have multiple brokers, run the command once per file —
|
||||
// each import merges into portfolio.json without overwriting previous entries.
|
||||
|
||||
import { PortfolioImporter } from './src/finance/PortfolioImporter.js';
|
||||
|
||||
const csvPath = process.argv[2];
|
||||
|
||||
if (!csvPath) {
|
||||
console.error('Usage: npm run import-portfolio -- <path-to-csv>');
|
||||
console.error('');
|
||||
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(`\n======>>>> Import failed <<<<====== ${err.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user