Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binance Futures - Add Coin-M Futures #369

Open
AnthonyFJGarner opened this issue Jun 18, 2024 · 7 comments
Open

Binance Futures - Add Coin-M Futures #369

AnthonyFJGarner opened this issue Jun 18, 2024 · 7 comments
Assignees
Labels
data file update Correction to an existing data file format

Comments

@AnthonyFJGarner
Copy link

if row_dict["Account"] in ("USDT-Futures", "USD-MFutures", "USD-M Futures"):

if row_dict["Account"] in ("USDT-Futures", "USD-MFutures", "USD-M Futures"):

Need to include "Coin-M Futures"

See Binance Statement below:

`

<style> </style>
User_ID UTC_Time Account Operation Coin Change Remark  
12345 19/06/2023 09:28 Coin-M Futures Fee BTC -1.9E-06 TradeID - 637493616
12345 24/12/2023 16:52 Coin-M Futures Fee ETH -9.7E-05 TradeID - 1187502
12345 19/06/2023 09:29 Coin-M Futures Realized Profit and Loss BTC -1.00E-08 TradeID - 637493657
12345 30/12/2023 09:55 Coin-M Futures Realized Profit and Loss ETH -0.00062 TradeID - 687240602
12345 31/12/2023 11:30 Coin-M Futures Realized Profit and Loss BTC 4.24E-05 TradeID - 1681579
12345 03/05/2023 15:25 Coin-M Futures Transfer Between Spot Account and CM Futures Account BTC 0.001    
12345 04/05/2023 15:46 Coin-M Futures Transfer Between Spot Account and CM Futures Account BTC 0.001    
12345 19/06/2023 09:26 Coin-M Futures Transfer Between Spot Account and CM Futures Account BTC 0.002    
12345 05/12/2023 18:56 Coin-M Futures Transfer Between Spot Account and CM Futures Account BTC -0.004    
12345 06/12/2023 17:05 Coin-M Futures Transfer Between Spot Account and CM Futures Account BTC 0.00228    
12345 06/12/2023 17:06 Coin-M Futures Transfer Between Spot Account and CM Futures Account BTC 0.00008    
12345 07/12/2023 12:08 Coin-M Futures Transfer Between Spot Account and CM Futures Account BTC 0.012    
12345 24/12/2023 16:42 Coin-M Futures Transfer Between Spot Account and CM Futures Account ETH 2    
7.25E+08 03/05/2023 15:05 Spot Deposit BTC 0.001    

`

@nanonano nanonano self-assigned this Jun 18, 2024
@nanonano nanonano added data file update Correction to an existing data file format labels Jun 18, 2024
@AnthonyFJGarner
Copy link
Author

Currently, the report format used by the Bittytax parser, when downloaded from Binance, fails to list "funding fee" income from Coin M Futures. I have pointed out this error to Binance. Who have accepted that it is indeed their error.

This report used by the Bittytax parser can be downloaded from Binance here by accessing the arrow at the top right hand side of the screen which leads you to "Export Transaction Records" https://www.binance.com/en/my/wallet/history/deposit-crypto

You can obtain the funding fee information for Coin M futures either by accessing the Binance API or through a different area of the website. Either way, the information comes in a different format and can only be obtained separately for Coin and USD margined futures.

The required info can be obtained from here https://www.binance.com/en/my/orders/futures/transactionhistory but in the following format:

`

<style> </style>
Date(UTC) type Amount Asset Symbol Transaction ID
16/06/2024 16:00 FUNDING_FEE 1.2E-06 BTC BTCUSD_PERP 1796867278670
16/06/2024 16:00 FUNDING_FEE 0.000395 ETH ETHUSD_PERP 7521798544999620
16/06/2024 08:00 FUNDING_FEE 1.2E-06 BTC BTCUSD_PERP 4631383593115839
16/06/2024 08:00 FUNDING_FEE 0.000399 ETH ETHUSD_PERP 8546318878600
16/06/2024 00:00 FUNDING_FEE 1.2E-06 BTC BTCUSD_PERP 105873736748320
16/06/2024 00:00 FUNDING_FEE 0.000398 ETH ETHUSD_PERP 451014468840
`

Whether they will correct the fault I can not say but currently, if you hold Coin Margined futures, the CSV file required by the Bittytax parser will not suffice for tax purposes with this missing information.

@nanonano
Copy link
Member

Hi @AnthonyFJGarner, thanks for investigating this with Binance.

I've got a fix for the first part, the "Coin-M Futures" account name, etc.

Are you able to email me privately an example of the futures transaction history CSV file?

I'm assuming the "FUNDING FEE" type should map to a BittyTax Margin-Fee type, or is it Income?

@AnthonyFJGarner
Copy link
Author

Note comments on this other issue on the question of Funding Fee and CGT. I don't know the answer but would guess Funding Fee is probably "income" which has to be accounted for on a daily basis? In any event it's not margin interest and I doubt that it is capital gains.

If it is income, we have a difficulty with the Kucoin parser and the Kucoin account statements which only include Funding Fee on the exit date of the futures position rather than on a daily basis.

Crypto Futures - tax calculation of capital gains #22
https://github.com/BittyTax/BittyTax/issues/22#issuecomment-2172955141
https://github.com/BittyTax/BittyTax/issues/22#issuecomment-2172967366
https://github.com/BittyTax/BittyTax/issues/22#issuecomment-2172980593
https://github.com/BittyTax/BittyTax/issues/22#issuecomment-2172990062

@nanonano
Copy link
Member

Hi @AnthonyFJGarner, thanks for sharing the Binance exports files privately.

Just to confirm my understanding of the issue, for "Coin-M Futures" the "Funding Fee" operation is NOT included in Statements export, whereas for "USD-M Futures" it is?

To get the "Coin-M Futures" funding fees we have to use the Futures transaction history CSV file in addition, which contains this as the "FUNDING_FEE" type.

Questions:

  1. How can we differentiate "FUNDING_FEE"s for "Coin-M Futures", from "USD-M Futures"? Is it possible, otherwise these could get duplicated without manual editing
  2. I've only just noticed that "Funding Fee" can be a credit or a debit, I was assuming they would always be debits, so mapped to a Margin-Fee in Bittytax. Please can you explain why a funding fee would be a credit? Is this some sort of fee rebate?

@AnthonyFJGarner
Copy link
Author

I wonder if we should talk? It's quite difficult to explain all this. I have had over 2 years of getting to grips with it, doing endless back testing before actually trading. I'll come back on how to distinguish Coin from USD margin payment when I have had a look at the documents again.

But the funding fee is a method whereby a perpetual futures contract is prevented from straying too far from the spot rate.

With dated, traditional contracts they are closed out at the spot rate when they expire so they are tethered to the spot rate in this way.

Since perpetuals never expire they have to be forced closer to the spot rate by means of funding payments.

If the perpetual is too far above spot, the holder of a long position will make an interest payment to the holder of a short position. If the perpetual is to far below spot, the holder of a short will make a funding payment to the holder of a long position.

Thus for any holder of a perpetual he will both make and take funding fees (IE sometimes he will receive a payment, sometimes he will have to make one.)

@AnthonyFJGarner
Copy link
Author

So whether I am short or long I can expect both credits and debits depending on market conditions.

@AnthonyFJGarner
Copy link
Author

As I will report in due course, the situation gets even more amusing. Funding fees on Coin Margin are paid out in coin but are calculated in USDT or USDC quite often. That's the case at Kucoin for instance. So receipt of a funding payment is a receipt of a small amount of the appropriate coin. Sorry to rant on. But of course I'm having to look at all this very carefully for tax reporting purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data file update Correction to an existing data file format
Projects
None yet
Development

No branches or pull requests

2 participants