@jaskrowo/xtb2sure

中文文档
0.4.3发布于 2026/11/01MITTypeScriptES Module构建来源已验证

Convert XTB .xlsx exports into Sure-compatible CSV files

原始使用文档
文档目录7 节
  1. What it does
  2. Requirements
  3. Install
  4. Usage
  5. Configuration
  6. Exit codes
  7. Development

xtb2sure

Convert XTB .xlsx exports into Sure.am-compatible CSV files.

What it does

  • Reads the Cash Operations sheet from an XTB export workbook.
  • Produces two CSV files:
    • transactions CSV (date,amount,name,account,notes)
    • investments CSV (date,ticker,currency,qty,price,account,name)

Requirements

  • Node.js 24+

Install

Install globally with npm:

npm install -g @jaskrowo/xtb2sure

This makes the xtb2sure command available everywhere on your system.

Usage

xtb2sure convert <input.xlsx> --currency <CODE> --account "<ACCOUNT_NAME>"

Options:

  • --out-dir <dir> — output directory for default file names (defaults to the input file's directory)
  • --transactions-out <file> — transactions CSV path
  • --investments-out <file> — investments CSV path
  • --strict — fail on the first conversion issue
  • --dry-run — do not write output files
  • --report <file> — write conversion report JSON to file
  • --config <file> — path to config file (defaults to ~/.config/xtb2sure/config.json)

Examples:

xtb2sure convert report.xlsx --currency USD --account "XTB IKE"
xtb2sure convert report.xlsx --currency PLN --account "XTB PLN" --out-dir ./out

Configuration

Some XTB tickers differ from the tickers used by Sure.am's providers. You can override exported tickers via a JSON config file at ~/.config/xtb2sure/config.json (or $XDG_CONFIG_HOME/xtb2sure/config.json when set):

{
    "tickerOverrides": {
        "IPOL.UK": "IPOL.L"
    }
}

Keys are the XTB ticker, values are the Sure.am ticker. Overrides apply to the investments CSV only; unmatched tickers are exported unchanged.

Use --config <file> to load a config file from a different location.

Exit codes

  • 0 success
  • 1 conversion or validation failure
  • 2 usage or config error

Development

Clone the repository and install dependencies:

git clone https://github.com/domeq/xtb2sure.git
cd xtb2sure
npm install

Run the CLI directly from source — no build step required (Node.js runs TypeScript natively):

node src/cli.ts convert report.xlsx --currency USD --account "XTB IKE"

You can use any CLI flag this way, e.g. node src/cli.ts --version.

Build the compiled output (needed for dist/, which the published package uses):

npm run build

Run tests (Node.js test runner):

npm test

Run linting and type checking:

npm run lint
npm run typecheck

版本与发布记录

@jaskrowo/xtb2sure 共发布 16 个版本,首次发布于 2026/10/09;过去 12 个月发布了 16 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.3latest2026/11/012 天前
0.4.22026/10/1915 天前
0.4.12026/10/1024 天前
0.4.02026/10/1024 天前
0.3.12026/10/0924 天前
0.3.02026/10/0924 天前

关于 @jaskrowo/xtb2sure 的常见问题

@jaskrowo/xtb2sure 是什么?

转换XTB .xlsx导出到确定兼容的CSV文件

如何安装 @jaskrowo/xtb2sure?

在项目目录运行 npm install @jaskrowo/xtb2sure,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 xtb2sure,可以用 npx xtb2sure 直接运行。

@jaskrowo/xtb2sure 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@jaskrowo/xtb2sure 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@jaskrowo/xtb2sure 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@jaskrowo/xtb2sure 可以商用吗?

@jaskrowo/xtb2sure 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@jaskrowo/xtb2sure 还在维护吗?

最新版本 0.4.3 发布于 2026/11/01(2 天前);至今共发布 16 个版本,其中过去 12 个月发布了 16 个;首次发布于 2026/10/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。