Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

canada-acb

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canada-acb

Canadian ACB parsing and analysis utilities for ANET equity compensation PDFs

latest
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

canada-acb

Standalone TypeScript/npm package for the core anet-acb data pipeline:

  • PDF parsing for ANET sell, RSU release, and ESPP purchase confirmations
  • CRA-style USD/CAD exchange-rate lookup from the Bank of Canada
  • Transaction normalization, ACB calculation, and tax-year summaries
  • CSV and audit exports derived from the generated ledger

The package is browser-friendly and is designed to be consumed by a UI layer that handles uploads, state, and visualization.

Install

npm install canada-acb

For local development alongside the original site:

{
  "dependencies": {
    "canada-acb": "file:../canada-acb"
  }
}

Usage

import {
  fetchExchangeRates,
  generateAcbData,
  parsePdfs,
  exportAcbToCsv,
} from "canada-acb";

const parsed = await parsePdfs(files);
const dates = generateAcbData(parsed, {}).allDates;
const exchangeRates = await fetchExchangeRates(dates);
const data = generateAcbData(parsed, exchangeRates);
const csv = exportAcbToCsv(data.acbEntries);

API

Root exports include:

  • PDF parsing helpers: parsePdf, parsePdfs, extractPdfText
  • Core data pipeline: buildNormalizedTransactions, collectTransactionDates, generateAcbData
  • Analysis: calculateAcb, summarizeByTaxYear
  • Exchange rates: fetchExchangeRates
  • Output helpers: exportAcbToCsv, exportTaxYearsToCsv, generateAuditReport, exportForAcbTool, generateTamperMonkeyScript
  • WealthSimple Tax auto-fill script generator: generateWsTamperScript (generic), generateTamperMonkeyScript (ANET-specific convenience wrapper)
  • Supporting types and split-normalization utilities

generateWsTamperScript

Generates a Tampermonkey UserScript that auto-fills capital gains dispositions in WealthSimple Tax.

import { generateWsTamperScript } from 'canada-acb';

const script = generateWsTamperScript(
  [
    {
      description: 'FOO 2024-03-15',
      settlementDate: '2024-03-15',
      proceeds: 1000,
      costBase: 800,
      expenses: 5,
    },
  ],
  2024,
  { label: 'FOO' },
);

generateTamperMonkeyScript(AcbEntry[], year) is an ANET-specific convenience wrapper around generateWsTamperScript that maps AcbEntry fields, filters in only sell transactions and passes label: 'ANET'.

Development

Install dependencies (includes dev tooling for build, typecheck, and tests):

npm install

Tests

Unit tests use Vitest. Test files live alongside sources as src/*.test.ts.

npm test           # run the suite once
npm run test:watch # re-run on file changes

Node 18+ is supported by the pinned vitest@^2 (newer majors require Node 20+).

Typecheck and build

npm run typecheck  # tsc --noEmit
npm run build      # tsup bundle to dist/

Keywords

acb

FAQs

Package last updated on 25 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts