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

Missing transactions with Binance REST plugin #121

Open
gandy92 opened this issue Feb 13, 2023 · 3 comments
Open

Missing transactions with Binance REST plugin #121

gandy92 opened this issue Feb 13, 2023 · 3 comments

Comments

@gandy92
Copy link

gandy92 commented Feb 13, 2023

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:

  • A conversion from USDT to BUSD is missing; the corresponding API endpoint is available only through the implicit API in ccxt.
  • Spot rebates seem to be missing entirely; the corresponding API endpoint is available only through the implicit API in ccxt.
  • A conversion from USDC to BUSD is missing; this kind of conversion happens automatically when transferring USDC to Binance (e.g. from Kraken). The corresponding API endpoint was switched from POST method to GET on 2022-10-28, which is not yet reflected in ccxt.
  • A token swap from GTO (delistet "old" Gifto token) to GFT ("new" Gifto token) is reflected only partially:
    GFT shows up as "Staking" in its IN record while the API endpoint states a "Token swap distribution"
    GTO is missing an OUT record, and the price base for GFT is lost; resolving this may be a tricky one since there does not seem to be an obvious API endpoint that shows which token was swapped for GFT.

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
Copy link
Collaborator

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
Copy link
Collaborator

macanudo527 commented Feb 14, 2023

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
Copy link
Author

gandy92 commented Feb 14, 2023

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 😄

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.

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