@fuzzle/opencode-accountant 0.16.2-next.1 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -51
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16987,7 +16987,6 @@ function loadPricesConfig(directory) {
|
|
|
16987
16987
|
}
|
|
16988
16988
|
|
|
16989
16989
|
// src/utils/journalUtils.ts
|
|
16990
|
-
init_js_yaml();
|
|
16991
16990
|
import * as fs4 from "fs";
|
|
16992
16991
|
import * as path3 from "path";
|
|
16993
16992
|
|
|
@@ -17179,50 +17178,6 @@ function ensureInvestmentAccountDeclarations(accountJournalPath, accounts, logge
|
|
|
17179
17178
|
logger?.info(`Account declarations: added ${missing.length} (${missing.join(", ")})`);
|
|
17180
17179
|
return { added: missing.sort(), updated: true };
|
|
17181
17180
|
}
|
|
17182
|
-
function ensureStockPriceEntries(directory, symbols, logger) {
|
|
17183
|
-
const pricesPath = path3.join(directory, "config", "prices.yaml");
|
|
17184
|
-
if (!fs4.existsSync(pricesPath)) {
|
|
17185
|
-
return { added: [], updated: false };
|
|
17186
|
-
}
|
|
17187
|
-
const content = fs4.readFileSync(pricesPath, "utf-8");
|
|
17188
|
-
const parsed = jsYaml.load(content);
|
|
17189
|
-
const existingStocks = new Set;
|
|
17190
|
-
if (parsed?.stocks && typeof parsed.stocks === "object" && !Array.isArray(parsed.stocks)) {
|
|
17191
|
-
for (const key of Object.keys(parsed.stocks)) {
|
|
17192
|
-
existingStocks.add(key);
|
|
17193
|
-
}
|
|
17194
|
-
}
|
|
17195
|
-
const missing = [];
|
|
17196
|
-
for (const symbol2 of symbols) {
|
|
17197
|
-
const ticker = symbol2.toUpperCase();
|
|
17198
|
-
if (!existingStocks.has(ticker)) {
|
|
17199
|
-
missing.push(ticker);
|
|
17200
|
-
}
|
|
17201
|
-
}
|
|
17202
|
-
if (missing.length === 0) {
|
|
17203
|
-
return { added: [], updated: false };
|
|
17204
|
-
}
|
|
17205
|
-
let updatedContent = content;
|
|
17206
|
-
if (!parsed?.stocks) {
|
|
17207
|
-
updatedContent = updatedContent.trimEnd() + `
|
|
17208
|
-
|
|
17209
|
-
stocks:
|
|
17210
|
-
`;
|
|
17211
|
-
}
|
|
17212
|
-
if (!updatedContent.endsWith(`
|
|
17213
|
-
`)) {
|
|
17214
|
-
updatedContent += `
|
|
17215
|
-
`;
|
|
17216
|
-
}
|
|
17217
|
-
const sorted = missing.sort();
|
|
17218
|
-
for (const ticker of sorted) {
|
|
17219
|
-
updatedContent += ` ${ticker}:
|
|
17220
|
-
`;
|
|
17221
|
-
}
|
|
17222
|
-
fs4.writeFileSync(pricesPath, updatedContent);
|
|
17223
|
-
logger?.info(`Price config: added ${sorted.length} stock(s) (${sorted.join(", ")})`);
|
|
17224
|
-
return { added: sorted, updated: true };
|
|
17225
|
-
}
|
|
17226
17181
|
|
|
17227
17182
|
// src/utils/dateUtils.ts
|
|
17228
17183
|
function formatDateISO(date5) {
|
|
@@ -17551,9 +17506,7 @@ function validateProviderConfig(name, config2) {
|
|
|
17551
17506
|
return {
|
|
17552
17507
|
detect,
|
|
17553
17508
|
currencies,
|
|
17554
|
-
importOrder: configObj.importOrder
|
|
17555
|
-
lotInventoryPath: typeof configObj.lotInventoryPath === "string" ? configObj.lotInventoryPath : undefined,
|
|
17556
|
-
symbolMapPath: typeof configObj.symbolMapPath === "string" ? configObj.symbolMapPath : undefined
|
|
17509
|
+
importOrder: configObj.importOrder
|
|
17557
17510
|
};
|
|
17558
17511
|
}
|
|
17559
17512
|
function loadImportConfig(directory) {
|
|
@@ -26475,7 +26428,6 @@ async function preprocessSwissquote(csvPath, projectDir, currency, year, lotInve
|
|
|
26475
26428
|
investmentAccounts.add(`equity:conversion:${currency.toLowerCase()}`);
|
|
26476
26429
|
investmentAccounts.add("equity:rounding");
|
|
26477
26430
|
ensureInvestmentAccountDeclarations(accountJournalPath, investmentAccounts, logger);
|
|
26478
|
-
ensureStockPriceEntries(projectDir, stockSymbols, logger);
|
|
26479
26431
|
}
|
|
26480
26432
|
logger?.logResult({
|
|
26481
26433
|
totalRows: stats.totalRows,
|
|
@@ -27068,7 +27020,7 @@ function parseIbkrCsv(content) {
|
|
|
27068
27020
|
const account = values[3]?.trim() || "";
|
|
27069
27021
|
const description = values[4]?.trim() || "";
|
|
27070
27022
|
const transactionType = values[5]?.trim() || "";
|
|
27071
|
-
const symbol2 =
|
|
27023
|
+
const symbol2 = values[6]?.trim() || "";
|
|
27072
27024
|
const quantity = parseFloat(values[7] || "0") || 0;
|
|
27073
27025
|
const price = parseFloat(values[8] || "0") || 0;
|
|
27074
27026
|
const priceCurrency = values[9]?.trim() || "";
|
|
@@ -27303,7 +27255,6 @@ async function preprocessIbkr(csvPath, directory, currency, year, lotInventoryPa
|
|
|
27303
27255
|
const accountJournalPath = path17.join(directory, "ledger", "investments", "accounts.journal");
|
|
27304
27256
|
ensureInvestmentAccountDeclarations(accountJournalPath, usedAccounts, logger);
|
|
27305
27257
|
}
|
|
27306
|
-
ensureStockPriceEntries(directory, tradedSymbols, logger);
|
|
27307
27258
|
logger?.info(`Generated IBKR journal: ${journalPath} with ${journalEntries.length} entries`);
|
|
27308
27259
|
}
|
|
27309
27260
|
let simpleTransactionsCsvPath = null;
|