Binance(US) - unknown binance Operation 'Buy'

Describe the problem:
I’m trying to import the Transaction History report from Binance(US) into Koinly and I get a ton of errors that say: unknown binance Operation ‘Buy’

All of the data looks valid, so I don’t understand:

"Row #87":{
	"Time":"2021-07-14 05:47:15.941"

What’s going on here? Is this a known issue?

Which exchange/wallet is this regarding?

How did you import data into this wallet?
Transaction History report CSV

What have you tried to fix this so far?
Deleting old wallet and recreating

1 Like

I’m having this same issue with Binance.US csv files.
Errors for all transactions purchased with Binance’s built in “buy”/“sell” function.
This is different from “spot trading”.

Hello? Does anyone work at Koinly anymore?

1 Like

Hi @dropdx and @Goopy6,

Thank you both for your patience with us, and my apologies for the delay in response!

The issue was brought to our attention recently, and it seems to stem from a change in wording from Binance(US). Fortunately, there is a workaround, which involves ‘renaming’ those ‘unknown operations’ as such:

Open the CSV file and filter and replace all listed operations with ‘reward’ (no ’ ’ are required):

  1. Staking Rewards
  2. Simple Earn Flexible Interest
  3. Simple Earn Locked Rewards
  4. Simple Earn Flexible Airdrop
  5. Swap Farming Rewards
  6. BNB Vault Rewards
  7. Liquidity Farming Rewards
  8. DOT Slot Auction Rewards

Something noteworthy to mention here is that it’s best not to mix import methods, so either a) sync via API, or b) import your CSV files. Please note that although you set the API, you haven’t triggered the syncing process (you have to click on sync - the wallet also shows the indication ‘synced never’ to warn you).

The errors you will still be receiving can be ignored , as we will be skipping those rows anyway(internal transfers), once our dev team has updated our importer.

Speaking of which. Our dev team has this fix planned on their roadmap. If those with a Binance(US) or Binance account are experiencing this issue and would like to be notified once the fix is ready to go, please connect with our support team to make that request.

Distinguish which Binance(US)/Binance you use to the support member so we can send you the correct notification. :raised_hands:

Thank you all again for your patience, and have an awesome day! :sparkles:

I tried this fix but the transactions are still failing to load. I know you said to ignore the errors but the data is not being loaded into your system because the transactions are not recognized at all with the buy function or the reward function under “category” column

It’s “operation” column containing “buy” that’s causing the issue. I don’t have any of the transactions listed above in my history and I’m getting the same issue. All of my transactions are daily buys with cash.

I found a fix that’s annoying but works. Maybe this will help the devs adjust Koinly’s import mechanism.

I selected all cells with the term “buy” under the “category” column. I then moved the associated rows to a new sheet. I replaced the term “buy” under the “category” column with “spot trading”. I then swapped the data for columns: “Realized_Amount_For_Base_Asset” and “Realized_Amount_For_Quote_Asset” as well as “Base_Asset” and “Quote_Asset”. I imported these transactions as a separate file, and they worked fine.


You are a lifesaver. Thank you!

@Goopy6 Do you think the Category is the issue or just that they flip flopped the Base and Quote assets? I typed out basically what you said at the bottom of this thread after I figured out BUYS were different than SPOT TRADES in the CSV.

I’m concerned if Koinly adjusts the import methodology for “BUY” category and THEN Binance.US decides to actually fix the issue, we will be right back where we are today with the wrong thing happening in our Koinly import.

Hi everyone,

Thank you @Goopy6 for sharing the fix with the community!

Pardon the late response here, though we’re happy to share this update with future eyes that will come across this post!

The Binance CSV importer has now been updated to match the recent changes made by Binance. :raised_hands: :sparkles:

The files should now import correctly, but please let us know if you do encounter transaction types that result in an error.

Thank you again, Goopy6, Wakkamess, and dropdx!

Have an awesome day everyone!

@Michael_Koinly So, I just got back to this thread, and I downloaded all my Binance US annual transaction reports, and imported them… I didn’t get any errors, but you guys still aren’t processing the data correctly. It’s showing me depositing my USD but then it shows me selling BTC or ETH for $100 instead of using the $100 to buy BTC or ETH. What’s going on here?

This is very important to get correct, and Binance is the largest exchange, how are you not getting this correct? I’m a little concerned here.

Why is it showing me selling BTC/ETH instead of buying it?

1 Like

@Michael_Koinly So, I just got back to this thread, and I downloaded all my Binance US annual transaction reports, and imported them… I didn’t get any errors, but you guys still aren’t processing the data correctly. It’s showing me depositing my USD but then it shows me selling BTC or ETH for $100 instead of using the $100 to buy BTC or ETH. What’s going on here?

This is very important to get correct, and Binance is the largest exchange, how is this not correct? Needs to be testing.

Why is it showing me selling BTC/ETH instead of buying it?

Here’s a Python script I wrote that fixes this issue:

import glob
import csv
import os

for file in glob.glob("./*.csv"):


    output_file_name = f"""./processed/{str(os.path.basename(file).split(".")[0])}_processed.csv"""

    input_file = open(file, "r", newline="")
    reader = csv.reader(input_file, delimiter=',')

    output_file = open(output_file_name, "w", newline="")
    writer = csv.writer(output_file, delimiter=",")

    for row in reader:

        if str(row[2]) == "Buy":
            Base_Asset = str(row[9])
            Realized_Amount_For_Base_Asset = str(row[10])
            Realized_Amount_For_Base_Asset_In_USD_Value = str(row[11])

            Quote_Asset = str(row[12])
            Realized_Amount_For_Quote_Asset = str(row[13])
            Realized_Amount_For_Quote_Asset_In_USD_Value = str(row[14])

            row[9] = Quote_Asset
            row[10] = Realized_Amount_For_Quote_Asset
            row[11] = Realized_Amount_For_Quote_Asset_In_USD_Value

            row[12] = Base_Asset
            row[13] = Realized_Amount_For_Base_Asset
            row[14] = Realized_Amount_For_Base_Asset_In_USD_Value




Hello Michael, I just tried to import a brand new Binance file with the “Buy” operation and the problem continue to happen, could you confirm that the problem is really fixed. Thanks

Hi @Picoviski,

Thank you for shining a light on this, man! My apologies for the delay in response to update here. I’ve checked with our dev team and they are currently in progress to resolve this persistent problem.

That said, we still can help move the ball forward for anyone with Binance CSVs that are not fully importing. Please connect with our support team, and send them your files to amend. We’re happy to do it on our end! :raised_hands:

Also, please request to be notified when this issue has been completely fixed. Our support team will be able to send the notification. :+1:

My apologies for this inconvenience. Reach out to us in the meantime!

Have a wonderful day!

Hi @dropdx and @Picoviski

Thank you so much for this fix, man! I’ve sent your script to the dev team to ensure they have their eyes on it. I’m also happy to report that the team recently confirmed the issue has been fixed! :raised_hands:


Please let us know if anyone is continuing to have issues importing their files. Our support team is keen to resolve any persistent errors if they come up. We’re aligned on the importance of having our Binance measures work efficiently. :handshake:

We appreciate the continued patience and opportunity you all offer Koinly. There are still features and integrations relevant to Binance/Binance.US on our roadmap. If you have the time, please check out our Canny page and add your support to Binance related projects. It will help our dev team expedite the features/integrations that best serve the community! :sparkles:

Pardon the canny/feedback tangent. Have a stellar day everyone!

1 Like

Hello @Michael_Koinly,
Hope you can help or lead me in the right direction. Im not very tech savvy. Ive been in crypto one year and this is my first time using Koinly. I have no idea how to follow some of the others suggestions regarding python script etc. I’m still having errors with missing transactions but more importantly Im having the same issue as @dropdx. For example it shows two of my deposits of USD ($350 +$500) but then shows me selling my crypto for the ($350 +$500) instead of using these deposits to buy my cryptos. What can I do about this? Ive tried attaching a screenshot but it doesn’t seem to work. Like I said Its just like the problem @dropdx had. Thank you.!

BinanceUS issue|690x338

Hello @Michael_Koinly Michael_Koinly

I am having the same issue also. I have a recurring buy from my bank to Binance.US and it is showing the information me selling opposed to deposits and purchasing.

thank you

SAME PROBLEM - I posted this in another thread from yesterday but thought I would put it here also. Binance is flipping the assets in the CSV file for recurring buys. Koinly can’t fix this if Binance is giving them the wrong info, imo.

I have analyzed my typical “trade” buys using BinanceUS manually (either website or App). In my attached screenshot example: Line 549, I “traded” $265.6824 USD and received 31 SOL. Koinly grabbed this correctly and it shows exactly what I did. BOUGHT SOL with USD.

Notice on that same day I had a recurring weekly buy of $150USD of BTC. My actual purchase was to spend $150 USD for .00883989 BTC. However, the .csv file from Binance.US shows that I sold .00883989 BTC for $150 USD. Basically the exact opposite of what I did. And since Koinly doesn’t have a cost basis for this sale, they just assume I made $150USD in gains (minus the $2.94 fee).

It seems like this might be a problem with BinanceUS incorrectly outputting recurring purchases (just checked all my weekly buys over the past 6 months, all are flip flopped. I don’t know if I am right but this seems like a really obvious error on BinanceUS side that they sure better fix or everybody using recurring buys are going to have massive gains due to there being no cost basis. Is this only happening to me or are there others using recurring buys that have this issue?

Holy crap, I thought this was just on recurring purchases (which I setup mid last year) but I decided to check for anything with “BUY” category in the CSV and found multiple times in 2021 that I used an ACH deposit to buy LARGE sums of SOL, LTC, DOGE, HNT, BNB. The CSV and resulting Koinly import all show that I SOLD those large amounts instead of buying them. This CSV error cost me over $30k of taxes I shouldn’t have paid.