I'm working on an Excel portfolio and for some reason my calculations are always slightly off from what I see on Koinly.

Assume we have the following transactions.

`Type` `Input` `Output` `Fee` `Transaction Cost Basis` `Holdings Cost Basis`
`Buy` `\$84.69` `BEST 253.23241259` `\$84.69`
`Buy` `\$28.23` `DOGE 2,880.84643012` `BEST 1.78230151 (\$0.60)` `\$28.83`
`Buy` `\$164.26` `DOGE 12,743.95948130` `BEST 8.39917181 (\$2.81)` `\$167.07`
`Sell` `DOGE 5,147.28504105` `\$200` `BEST 10.25852771 (\$3.95)` `\$200` `\$68.16`

Koinly calculates a cost basis for the sale at `\$68.16` which gives a gain of `\$131.84`.

In my excel, I end up with a cost basis of `\$64.53540257` which gives a profit of `\$135.4645974`

My formula for calculating the holdings cost basis at the time of the sale is as follows.

`Previous Transactions Cost Basis Total / Total Holdings at Time of Sale * Amount that is being Sold`

So with the values that would be

`(\$28.83 + \$167.07) / (2,880.84643012 + 12,743.95948130) * 5,147.28504105 = \$64.53540257`

I'm guessing it's something with the fee that's throwing it off. Just for fun, I tried adding the fee of the sale to my calculated holdings cost basis (`\$64.53 + \$3.95`) but this ends up at `\$68.48`.

Idk what I'm missing here. Does Koinly maybe do cross-calculation with P/L of the fee asset/value and adds/deducts this from the final P/L of a sale? Because on the exchange I used, they used their exchange token BEST to pay the fees which always triggers a P/L calculation right?

Thanks for any help!

submitted by /u/_youarewhatyouyeet
[link] [comments]

You can get bonuses upto \$100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.