Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Command } from "commander";
import Decimal from "decimal.js";
import { detectBroker, getBroker, brokerParsers } from "../parsers/index.js";
import { parseEtoroXlsx, detectEtoroXlsx } from "../parsers/etoro.js";
import { parseRevolutXlsx, detectRevolutXlsx } from "../parsers/revolut.js";
import type { Statement } from "../types/broker.js";
import type { EcbRateMap } from "../types/ecb.js";
import { fetchEcbRates } from "../engine/ecb.js";
Expand Down Expand Up @@ -71,8 +72,15 @@ async function parseAndMerge(
const brokerNames: string[] = [];

for (const file of inputFiles) {
// Check for binary XLSX (eToro) first
// Check for binary XLSX (Revolut, eToro) first
const buf = readFileSync(file);
if (await detectRevolutXlsx(buf)) {
const statement = await parseRevolutXlsx(buf);
mergeStatement(merged, statement);
brokerNames.push("Revolut");
console.error(` [Revolut XLSX] ${file}: ${statement.trades.length} operaciones, ${statement.cashTransactions.length} transacciones`);
continue;
}
if (detectEtoroXlsx(buf)) {
const statement = await parseEtoroXlsx(buf);
mergeStatement(merged, statement);
Expand Down
1 change: 1 addition & 0 deletions src/engine/wash-sale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,6 @@ export function detectWashSales(disposals: FifoDisposal[], allTrades: Trade[]):
function homogeneousKey(isin: string, symbol: string, assetCategory: string): string {
if (assetCategory === "CRYPTO") return `CRYPTO:${symbol.toUpperCase()}`;
if (isin) return isin;
if (symbol) return `${assetCategory}:${symbol.toUpperCase()}`;
return "";
}
Loading
Loading