Skip to content

feat(binance): support Spanish-language CSV exports#162

Merged
GeiserX merged 1 commit into
mainfrom
feat/binance-spanish-headers
May 12, 2026
Merged

feat(binance): support Spanish-language CSV exports#162
GeiserX merged 1 commit into
mainfrom
feat/binance-spanish-headers

Conversation

@GeiserX
Copy link
Copy Markdown
Owner

@GeiserX GeiserX commented May 12, 2026

Summary

  • Adds detection and parsing of Binance CSV exports with Spanish headers (both Spot Operations History and Transaction History formats)
  • Handles 2-digit year date format (YY-MM-DD) used in Spanish exports
  • Parses embedded asset suffixes in Ejecutado/Cantidad columns (e.g. 285.7CTK, 0.0008571BTC)
  • Updates broker guides in all 5 locales with exact Binance export navigation paths

Test plan

  • All 1035 existing tests pass
  • 16 new tests for Spanish spot and transaction history formats
  • Verified parsing of Igor's real 777-trade spot file and 3760-line transaction file
  • TypeScript typecheck passes

Summary by CodeRabbit

  • New Features
    • Binance CSV imports now support Spanish-language files for both spot trades and transaction history exports
    • Enhanced import guides with clearer, more detailed navigation instructions across Catalan, English, Spanish, Euskara, and Galego languages
    • Improved CSV parsing to handle multiple date formats and asset-suffixed amounts

Review Change Stack

Binance exports CSV files with Spanish headers when the user's UI language
is set to Spanish. This adds detection and parsing for both formats:
- Spot trade history: Tiempo,Par,Lado,Precio,Ejecutado,Cantidad,Tarifa
- Transaction history: ID de usuario,Tiempo,Cuenta,Operación,Moneda,Cambio,Observación

Also handles 2-digit year date format (YY-MM-DD) and embedded asset
suffixes in Ejecutado/Cantidad columns (e.g. "285.7CTK", "0.0008571BTC").

Updated broker guides in all 5 locales with Igor's exact export paths.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Binance CSV import now supports Spanish-language exports. Localized guide text across five languages clarifies the export flow and UTC+1 time settings. The parser detects English and Spanish headers, resolves columns with localized field names, parses amounts with asset suffixes, handles 2-digit-year dates, and includes comprehensive Spanish test coverage.

Changes

Binance CSV Localization and Spanish Format Support

Layer / File(s) Summary
Localization updates for Binance guide steps
src/i18n/locales/ca.ts, src/i18n/locales/en.ts, src/i18n/locales/es.ts, src/i18n/locales/eu.ts, src/i18n/locales/gl.ts
Replaced Binance guide steps 2–4 strings across five locales with detailed navigation instructions for spot history and transaction exports, including UTC+1 time customization and support for uploading one or both files in multiple languages.
Header detection and column resolution for Spanish variants
src/parsers/binance.ts
Extended CSV header detection and column-finding logic to recognize both English and Spanish Binance headers for trade history and transaction history files, including accented Spanish field names.
Numeric and date parsing for asset-suffixed amounts and Spanish formats
src/parsers/binance.ts
Added parseAmountWithSuffix helper to extract numeric values from asset-suffixed strings (e.g., 0.001BTC), updated parseFee to use it, and extended convertBinanceDate to support Spanish 2-digit-year formats. Updated trade-row parsing to use the extracted numeric component.
Spanish CSV detection and parsing test coverage
tests/parsers/binance.test.ts
Added two test suites validating Spanish CSV parsing: Spanish spot CSV tests covering BOM handling, 2-digit-year dates, asset-suffixed quantity/tradeMoney/fee fields, trade mapping, and count validation; Spanish transaction history CSV tests covering deposit omission, Convert trade parsing, 2-digit years, Strategy trade mapping, and validation against real fixture files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • GeiserX/DeclaRenta#105: Overlaps with Binance transaction-history parsing logic, amount parsing helpers, and related test updates.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(binance): support Spanish-language CSV exports' directly and clearly describes the main feature addition—enabling Binance parser to handle Spanish-language CSV exports across multiple locales.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/binance-spanish-headers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 96.36364% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.63%. Comparing base (6cf1506) to head (120f25f).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/parsers/binance.ts 95.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #162      +/-   ##
==========================================
- Coverage   97.65%   97.63%   -0.03%     
==========================================
  Files          38       38              
  Lines        7669     7684      +15     
  Branches     1563     1571       +8     
==========================================
+ Hits         7489     7502      +13     
- Misses        179      181       +2     
  Partials        1        1              
Files with missing lines Coverage Δ
src/i18n/locales/ca.ts 100.00% <100.00%> (ø)
src/i18n/locales/en.ts 100.00% <100.00%> (ø)
src/i18n/locales/es.ts 100.00% <100.00%> (ø)
src/i18n/locales/eu.ts 100.00% <100.00%> (ø)
src/i18n/locales/gl.ts 100.00% <100.00%> (ø)
src/parsers/binance.ts 97.19% <95.00%> (-0.47%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GeiserX GeiserX merged commit dea63bb into main May 12, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant