eprbell / dali-rp2

DaLI (Data Loader Interface) is a data loader and input generator for RP2 (https://pypi.org/project/rp2), the privacy-focused, free, open-source cryptocurrency tax calculator: DaLI removes the need to manually prepare RP2 input files. Just like RP2, DaLI is also free, open-source and it prioritizes user privacy.
https://pypi.org/project/dali-rp2/
Apache License 2.0
64 stars 42 forks source link

Missing transactions with Binance REST plugin #121

Open gandy92 opened 1 year ago

gandy92 commented 1 year ago

While tying to get DaLI up and running for my exchanges, I've encountered a few issues with the Binance REST plugin I'd like to discuss:

I am willing to look into this if no one is already working on it; though I won't be able to put much work into it until April. While the two available implicit API endpoints seem straight forward to tackle, I'm a bit concerned about how to address the API endpoint with the changed method; in face of the amount of open issues and PRs for ccxt, would it be possible to implement some kind of workaround until the required change makes it into ccxt?

Also, I'm wondering if there is a good way of handling the token swap; the amount stays the same but other than that there is no obvious clue on which token was swapped. Would a token swap always preserve the amount?

macanudo527 commented 1 year ago

I am willing to look into this if no one is already working on it; though I won't be able to put much work into it until April. While the two available implicit API endpoints seem straight forward to tackle, I'm a bit concerned about how to address the API endpoint with the changed method; in face of the amount of open issues and PRs for ccxt, would it be possible to implement some kind of workaround until the required change makes it into ccxt?

What do you mean by 'changed method'?

A lot of the current issues are working with the CCXT pair converter used for pricing and not the CCXT input plugins. There shouldn't be any issues with you adding to binance_com.py. That's mature enough for basic functions. I personally just used it for taxes and everything added up for me.

Are you familiar with the CCXT implicit api? I wrote a brief explainer on it.

Also, I'm wondering if there is a good way of handling the token swap; the amount stays the same but other than that there is no obvious clue on which token was swapped. Would a token swap always preserve the amount?

I'm not all that familiar with token swaps. Can you walk me through a simple example? I mean, isn't it basically an OTC order, but for smaller amounts? So why would the amount stay the same?

macanudo527 commented 1 year ago

Note that the current input plugin is for Binance .com and not .us. They are two different exchanges. You might be able to borrow code from .com though.

gandy92 commented 1 year ago

I am willing to look into this if no one is already working on it; though I won't be able to put much work into it until April. While the two available implicit API endpoints seem straight forward to tackle, I'm a bit concerned about how to address the API endpoint with the changed method; in face of the amount of open issues and PRs for ccxt, would it be possible to implement some kind of workaround until the required change makes it into ccxt?

What do you mean by 'changed method'?

The HTTP method was changed from POST to GET; I haven't tested yet if the POST method is still available but even if so, eventually if will not be. What I know about the Binance.com API is from tests with a modified python-binance package, I've only learned about ccxt through dali-rp2.

A lot of the current issues are working with the CCXT pair converter used for pricing and not the CCXT input plugins. There shouldn't be any issues with you adding to binance_com.py. That's mature enough for basic functions. I personally just used it for taxes and everything added up for me.

Indeed, the plugin works well for retrieving most transactions, and I'll try to add the missing ones to offer a PR; since I'm located outside the US, that would be the Binance.com plugin.

Are you familiar with the CCXT implicit api? I wrote a brief explainer on it.

From what I understood so far, the implicit api functions are generated upon initialization of the client from the information returned by the describe() member function. So overloading that function with one that injects missing endpoints may be a way to work around this until ccxt provides the required endpoint. Looking forward to the PR review, already :smile:

Also, I'm wondering if there is a good way of handling the token swap; the amount stays the same but other than that there is no obvious clue on which token was swapped. Would a token swap always preserve the amount?

I'm not all that familiar with token swaps. Can you walk me through a simple example? I mean, isn't it basically an OTC order, but for smaller amounts? So why would the amount stay the same?

Neither am I, I was caught completely off guard by this. Maybe this is best resolved with some sort of manual correction.