B13: Binance commission rebates sign-flipped into fake fee disposals

Open Beginner friendly
#53 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
cli

Research direction

Start in binance/csv.ts at lines 367 and 213, tracing how operation names are classified and how the fee check precedes income handling. Add coverage for Commission Rebate as positive income and Commission Fee as a fee, then run the relevant test suite. Done means rebates retain a positive income leg and fees retain fee treatment without sign errors.

Written by the indexing model from the issue text.

Description

bug

VERIFIED. binance/csv.ts:367:

return value.includes('fee') || value.includes('commission');

Binance ledger operations Commission Rebate, Commission Fee Shared With You, and
Commission History are positive income, but they match includes('commission'). Line 213 then
negates the positive change and flags it as a fee. isFeeOperation is also tested before
isIncomeOperation, so the income branch is unreachable for these rows.

input:    1,2024-01-15 12:00:00,Spot,Commission Rebate,USDT,5,
observed: { type: 'fee_only', legs: [{ USDT, -5, feeFlag: true }] }
expected: { type: 'income',   legs: [{ USDT, +5 }] }

$5 of income is dropped and a bogus $5 deductible disposal is invented — a 2x error on the amount.

What's needed

  • Match rebate/shared-commission operations as income before the fee check
  • Test both Commission Rebate (income) and Commission Fee (fee) so the precedence is pinned

Extracted from a repo audit performed 2026-07 (the audit doc it came from was proposed via an unmerged docs PR).

Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
2d 17h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from gfargo/daybook

All issues in gfargo/daybook

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.