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

(new format of csv) Unrecognized file type error #14

Open
rolsoft opened this issue Jul 26, 2024 · 5 comments
Open

(new format of csv) Unrecognized file type error #14

rolsoft opened this issue Jul 26, 2024 · 5 comments

Comments

@rolsoft
Copy link

rolsoft commented Jul 26, 2024

I am using a not very well known DeX (apex omni, from bybit team), hopefully this is not a dealbreaker, I understand if we can't add the formatting for it.

The csv looks like this:

Time,Side,Markets,Size,EntryPrice,ExitPrice,TradeType,Closed P&L,CloseFee,OpenFee,LiquidateFee,ExitType
2024-07-24 19:55:07,LONG,ETHUSDT,0.07,3308.97142857,3360.55,SELL,2.839064,0.058809625000000000,0.034732000000000000,0,Trade

If somebody, or Bjorn himself, has the knowledge required to add this format of csv I would be very grateful, thanks a lot.

@bjorn
Copy link
Owner

bjorn commented Aug 29, 2024

It should not be too hard to load this file type, but your example only contains a single example line so it does not provide a lot of information. In particular:

  • "Side" column has value "LONG", but which other values can this column take? "SHORT"?
  • "Markets" column has value "ETHUSDT". Is it clear which currency is being sold and which is being bought?
  • "TradeType" has value "SELL". I guess "BUY" is the only other valid value?
  • "ExitType" has value "Trade". What other exit types exist?

Finally, this appears to rather be a kind of position being held, given that there is a "LONG" and an "ExitPrice"? Is this just a future trade waiting to happen or does it actually map to a transaction?

@rolsoft
Copy link
Author

rolsoft commented Aug 29, 2024

Hello, sorry for providing incomplete data.

  • You are right, either LONG or SHORT.
  • No actual crypto is being bought, since this is derivative perpetuals, against USDT, so in theory the asset doesn't really matter, it is just used for the prices.
  • Yes, the other trade type is BUY.
  • I haven't seen any other than just Trade, so I suppose it is just a placeholder for the future.

It is a perpetual trade that has already been finished, hence the closed profit and loss being reported (p&l), so it is finished.
Here's some info I found from Koinly, on how they tax the perpetuals: Koinly support.

Based on what I've seen on the Koinly support page, these trades should just be the p&l. Since they aren't actual transactions (ex: buying or selling btc), it is all just smart contracts.

Thanks a lot for your help, I appreciate what your software offers against the SAAS alternatives.

@bjorn
Copy link
Owner

bjorn commented Aug 30, 2024

Alright, so that's going to be a little more tricky, since it means not only parsing a new CSV format but also adjusting the application in general support this new type of transaction. Still not that big of a deal though, we can uncomment "RealizedProfit" and "RealizedLoss" in base.rs, add an Amount field and then handle this in fifo.rs (and some other places).

@rolsoft
Copy link
Author

rolsoft commented Aug 30, 2024

This is quickly getting difficult, and I am not a experienced coder, this is out of my reach.
If you find the new implementation could be reused in the future for other exchanges, and feel like it is worth it, you may try to code it, but by no means feel obligated to do it, it is your project after all!
Thank you for the work you put in, but always prioritize your preferences.

@bjorn
Copy link
Owner

bjorn commented Sep 3, 2024

This is quickly getting difficult, and I am not a experienced coder, this is out of my reach.

I've made a bit of a start on this at #15. What is missing is:

  • Add support for your CSV format that would set up transactions with this new type of operation.
  • Check and possibly adjust the tax calculations in fifo.rs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants