phase-1: optimize code

This commit is contained in:
Kazuma
2026-06-04 01:32:05 -04:00
parent cd74497de6
commit 3513024fc6
58 changed files with 7380 additions and 850 deletions
-36
View File
@@ -1,36 +0,0 @@
/**
* 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);
}
+14
View File
@@ -0,0 +1,14 @@
import 'dotenv/config';
import { buildApp } from '../src/server/app.js';
const PORT = process.env.PORT ?? 3000;
const HOST = process.env.HOST ?? '0.0.0.0';
const app = await buildApp();
try {
await app.listen({ port: Number(PORT), host: HOST });
} catch (err) {
app.log.error(err);
process.exit(1);
}