provinzio / CoinTaxman

Calculate your taxes from cryptocurrency gains
GNU Affero General Public License v3.0
141 stars 31 forks source link

Commission is not a gain operation #71

Closed jhoogstraat closed 3 years ago

jhoogstraat commented 3 years ago

Commissions are currently not in the gain_operations list and are consequently sorted after SELL and FEE. This can lead to having not enough coins in queue for selling.

Minimum example:

2021-09-07 10:00:00,Spot,Buy,COIN1,100,""
2021-09-07 10:00:00,Spot,Commission Fee Shared With You,COIN1,0.02,""
2021-09-07 10:00:00,Spot,Fee,COIN1,-0.1,""
2021-09-07 10:00:00,Spot,Transaction Related,COIN2,-200,""
2021-09-07 11:00:00,Spot,Buy,COIN2,300,""
2021-09-07 11:00:00,Spot,Transaction Related,COIN1,-99.92,""

Since 100 - 0.1 is 99.9, the last line produces Not enough COIN1 in queue to sell. The correct calculation would be 100 - 0.1 + 0.02 = 99.92 (before selling).

provinzio commented 3 years ago

Thanks for letting us know :) Feel free to open a PR with the proposed change in transaction.py.