@fuzzle/opencode-accountant 0.13.19 → 0.13.20-next.1

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -24712,7 +24712,6 @@ function formatJournalEntry(match2) {
24712
24712
  const btcQuantity = formatBtcQuantity(btcRow.quantity);
24713
24713
  const priceCurrency = btcRow.price.currency;
24714
24714
  const hasFees = btcRow.fees.amount > 0;
24715
- const isBaseCurrency = fiatCurrency === "CHF";
24716
24715
  const netFiatAmount = hasFees ? fiatRow.amount - btcRow.fees.amount : fiatRow.amount;
24717
24716
  const effectivePrice = hasFees ? netFiatAmount / btcRow.quantity : btcRow.price.amount;
24718
24717
  const fiatAmount = formatAmount(fiatRow.amount);
@@ -24721,7 +24720,7 @@ function formatJournalEntry(match2) {
24721
24720
  const pair = `${fiatCurrency.toLowerCase()}-btc`;
24722
24721
  const equityFiat = `equity:conversion:${pair}:${fiatCurrency.toLowerCase()}`;
24723
24722
  const equityBtc = `equity:conversion:${pair}:btc`;
24724
- const costAnnotation = isBaseCurrency ? ` @ ${btcPrice} ${priceCurrency}` : "";
24723
+ const costAnnotation = ` @ ${btcPrice} ${priceCurrency}`;
24725
24724
  const postings = [
24726
24725
  {
24727
24726
  account: `assets:bank:revolut:${fiatCurrency.toLowerCase()}`,
@@ -25272,7 +25271,8 @@ function generateSellEntry(trade, consumed, logger) {
25272
25271
  }
25273
25272
  function generateDividendEntry(dividend, logger) {
25274
25273
  const date5 = formatDate(dividend.date);
25275
- const description = escapeDescription(`Dividend ${dividend.symbol} - ${dividend.name}`);
25274
+ const label = dividend.transactionType ?? "Dividend";
25275
+ const description = escapeDescription(`${label} ${dividend.symbol} - ${dividend.name}`);
25276
25276
  logger?.debug(`Generating Dividend entry: ${dividend.symbol}, net: ${dividend.netAmount} ${dividend.currency}`);
25277
25277
  const postings = [
25278
25278
  {
@@ -25602,13 +25602,11 @@ var SIMPLE_TRANSACTION_TYPES = new Set([
25602
25602
  "Payment",
25603
25603
  "Debit",
25604
25604
  "Fees Tax Statement",
25605
- "Dividend (Reversed)",
25606
- "Reversal (Dividend)",
25607
25605
  "Redemption"
25608
25606
  ]);
25609
25607
  var FOREX_TYPES = new Set(["Forex credit", "Forex debit"]);
25610
25608
  var TRADE_TYPES = new Set(["Buy", "Sell"]);
25611
- var DIVIDEND_TYPES = new Set(["Dividend"]);
25609
+ var DIVIDEND_TYPES = new Set(["Dividend", "Dividend (Reversed)", "Reversal (Dividend)"]);
25612
25610
  var CORPORATE_ACTION_TYPES = new Set([
25613
25611
  "Merger",
25614
25612
  "Reverse Split",
@@ -25717,7 +25715,8 @@ function toDividendEntry(txn) {
25717
25715
  grossAmount,
25718
25716
  withholdingTax,
25719
25717
  netAmount,
25720
- currency: txn.currency
25718
+ currency: txn.currency,
25719
+ transactionType: txn.transaction
25721
25720
  };
25722
25721
  }
25723
25722
  function toCorporateActionEntry(txn) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzzle/opencode-accountant",
3
- "version": "0.13.19",
3
+ "version": "0.13.20-next.1",
4
4
  "description": "An OpenCode accounting agent, specialized in double-entry-bookkepping with hledger",
5
5
  "author": {
6
6
  "name": "ali bengali",