Our app handles fees in the following manner:
If you pay a fee in your local currency it is added to the cost basis of that trade.
If you sell a cryptocurrency and the fee is in the same currency as the cryptocurrency which was sold, it is added to the cost basis of that cryptocurrency.
If you sell a cryptocurrency for another cryptocurrency, and the fee was paid in the currency you are "buying", then this fee is carried forward, and the fee is added to the cost basis of the future sale of that currency.
If you swap cryptocurrency, and the fee is in a third currency (e.g. you swap UNI/DAI and gas fee is in ETH, that fee is added to the cost basis of the current trade.
Fees on transfers that cannot be immediately assigned to trade are recorded as a miscellaneous expense.
Carrying forward the "buy" fee
It is important to note that we do not immediately "realize" the fee in all circumstances (see point 3). Most tax agencies allow you to add costs associated with a trade such as commissions. However, the concept of swapping directly one asset for another is not something most agencies acknowledge. From their point of view, you are selling one cryptocurrency back to local fiat, and then buy another cryptocurrency with that fiat. Following through with this concept, it can be argued that the buy-side of the fee should be "assigned" to that asset. At least this is how we handle it in our app. To add clarity, the HMRC (UK tax agency) recently explicitly stated that you cannot claim all fees, all the time, straight up, and that you need to have a methodology for assigning fees equitably when "swapping" currency. We expect other tax agencies to follow suit. At the end of the day, you are still claiming the fees as a cost. The effect is that you are not claiming everything upfront in one year.
It is also important to note point 5. We have split out fees associate with transfers and on-chain smart contract interactions because it is unclear if these fees can be claimed. Again, the HMRC (UK tax agency) has explicitly stated that these fees cannot be claimed as an expense. We are waiting on more guidance from other countries to come out before we create a default option. You can discuss with your tax professional how to handle these miscellaneous expenses.
In rare circumstances, your fee might be entirely missing from the transaction. This might be caused due to missing data from the exchange (more common), or from the exchange changing their CSV format. If you think it is the latter, please reach out to support with the exchange name and a sample of the CSV format so we can look into this.