BitMEX trading gains show incorrect cost basis

All transactions imported via BitMEX APIs are showing trading loss in the Send column, and trading gains in the received column. Losses correctly show a difference between cost basis and value, and indicate the loss amount. Trading gains are showing as buys, with cost basis = current value.

These are margin trades, and the system does not appear to be understanding these correctly.

Thanks for flagging here. Could you share what you see on BitMEX and what you’d expect to be seeing here? We’d love to help get to the bottom of this ASAP

There are a couple of things to note:

  1. The time is always reported as 12:00 UTC. I assume this is because the time is not included in the API, or not in a format that is being recognized.
  2. Fees are not being reported.
  3. The trades themselves are not being reflected, just in/out of the BTC wallet. But this doesn’t really matter, as long as the amounts in/out of the BTC wallet are accurate.
  4. Balance remaining in the info tooltip is incorrect. But this may be due to incomplete data, and other transactions not being reflected properly.

The transactions shown in CoinTracker line up with the Transaction History in BitMEX (showing RealizedPnL and deposits/withdrawals.

Here’s an example set of transactions from the past couple days, first in BitMEX’s history, and then in CoinTracker:

The loss shows as a Send, and indicates “Trading Loss”, yet calculates as a gain due to the cost basis. The profits show as Receive, with the “Trading Gain” icon. But the value and cost basis are the same on several. The top item, a $50 gain, has a cost basis of $0.49!

Thanks for flagging this. Do you mind shooting us a note on support chat so that we can take a look at your BitMEX transactions and ensure that they are being calculated correctly?

Let me know how I can do that.

Additionally, I downloaded a CSV of all transactions from CoinTracker, to take a closer look. The transactions that are in question are all showing up as send/receive, vs buy/sell/trade.

Kraken works. I see margin fees, rollovers, and gains/losses properly.
Bittrex appears to be working as well. Transactions show as Trades, USDT to BTC, BTC to USDT.
BitMEX fails, as all transactions are send/receive, and do not reflect that they are margin trades.

Hi @sforman52,

Could you please send us a note with permission to take a look at your CoinTracker account at feedback [at]

Just sent the message as requested.

1 Like

I’m having the exact same issue with bybit. Has it been fixed yet?

The exact same issue is happening with bybit.

Hi @onlysuper,

Thanks for flagging this. Is this for regular trading or margin trading on ByBit?

margin trading on bybit. I also dont see the fees there, or the coin swaps.

@onlysuper, got it. We will work on adding ByBit margin support and let you know as soon as it is live.

ByBit only has margin trading. And I was told to upload my CSV to it a few weeks ago. So ByBit hasn’t been working this whole time?

Hi @onlysuper, we’re going to take a look at ByBit maring transactions and circle back with you on an update as soon as we have one.

Hi @sforman52,

We have updated the BitMEX margin tracking on CoinTracker (more details on how BitMEX tracking works). Simply remove and re-add your BitMEX account. If you have any questions or concerns, please let us know.

How can change the one i make transaction

Hi @Pauleenjoy2211- I’m not sure I understand your question. Can I ask you to create a new topic with more details on the main forum page? Thanks!

I am currently having the same problem as well. I also noticed that the note shows a ‘remaining balance’ that is definitely incorrect (I wish I had the BTC balance though).

Hi @pucknut4coins,

Could you please send us a screenshot of the issue to feedback [at] Also please enable debug permission on your account so that we can take a look.

1 Like


Bybit API is now live in beta