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.US Implementation #228

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Binance.US Implementation #228

wants to merge 7 commits into from

Conversation

tpaynter4
Copy link

@tpaynter4 tpaynter4 commented Mar 25, 2024

Implement Binance.US Plugin

Copy link
Collaborator

@macanudo527 macanudo527 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is on the right course. I just remembered, we do have exchange locked aliases that you could try to implement.

You could also give that a try. Sorry I didn't think of it earlier. Since USD and USD4 are one-to-one, you can follow the example of the ETH2 -> ETH alias on Coinbase.

raise RP2RuntimeError("Exchange is not instance of class binanceus.")
return super_client

def _get_algos(self) -> List[str]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is associated with mining so it can be deleted too if Binance.us doesn't deal with mining.

self.__api_key = api_key
self.__api_secret = api_secret
# We will have a default start time of July 13th, 2017 since Binance Exchange officially launched on July 14th Beijing Time.
super().__init__(account_holder, datetime(2017, 7, 13, 0, 0, 0, 0), native_fiat, thread_count)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you track down the start date for Binance.us?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How exact do I need to be? I think it is 09/22/2019 to the nearest day.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An safe approximation is okay. Err on the side of being too early. For example, if you think it might be 9/22/2019 EST, you might as well make it 9/21/2019 just to be safe.

This just helps with optimization, so that we don't pull unnecessary information.

@@ -0,0 +1,1329 @@
# Copyright 2022 macanudo527
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be sure to take credit for this.



"""
def test_gains(self, mocker: Any) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to disable a test, you can simply put disabled in front of the method name:

Suggested change
def test_gains(self, mocker: Any) -> None:
def disabled_test_gains(self, mocker: Any) -> None:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, if you never need gains, you can just delete the test entirely. You can always copy and paste the code from binance in the future if you think you need it.

@tpaynter4
Copy link
Author

I just realized that the plugin does not load my deposits or withdrawals. Are deposits and withdrawals processed in the _process_fiat_order method?

@macanudo527
Copy link
Collaborator

macanudo527 commented Mar 28, 2024

I just realized that the plugin does not load my deposits or withdrawals. Are deposits and withdrawals processed in the _process_fiat_order method?

They should be covered by the abstract plugin. Something might be wrong with the pagination details. You'll have to look into it. Is it missing fiat deposits and withdrawals only?

@tpaynter4
Copy link
Author

I believe it is only fiat.

@macanudo527
Copy link
Collaborator

I believe it is only fiat.

OK, well, my guess is that there is an implicit API function that covers fiat withdrawal/deposit you will have to look up. This looks like it right here:
https://docs.binance.us/#get-fiat-deposit-history

And the withdrawal Endpoint is there too.

@tpaynter4
Copy link
Author

The sapiGetFiatpaymentQueryWithdrawHistory and sapiGetFiatpaymentQueryDepositHistory end points are not available in the version of ccxt that dali-rp2 uses (3.0.79), but they are available in the current version (4.2.86). Is it possible to upgrade? Or would there be a way for me to use them with the current version?

@macanudo527
Copy link
Collaborator

Yeah, that was on the todo list. Upgrades tend to break things. You can give it a try and I'll try with my exchanges as well, but these days I don't use as many advanced features.

Be sure to double-check all your math. If something doesn't look right, there is probably a bug. CCXT is pretty finicky.

@savgrace
Copy link

Is this ready to merge? I'm in need of a plugin for binance.us. If there's anything left to do I'd be happy help get this across the finish line with a few pointers :)

@eprbell
Copy link
Owner

eprbell commented May 9, 2024

@savgrace, thanks for offering to help (sorry, this fell through the cracks and I just noticed your message now). @tpaynter4 and @macanudo527, is there any way @savgrace can help with this?

@tpaynter4
Copy link
Author

I've been pretty busy lately, but I am still having problems with deposits and withdrawals. I think there are pagination issues when using the CCXT endpoints for deposits and withdrawals, but I am not sure.

@macanudo527
Copy link
Collaborator

I've been pretty busy lately, but I am still having problems with deposits and withdrawals. I think there are pagination issues when using the CCXT endpoints for deposits and withdrawals, but I am not sure.

Have you looked at the API feed with Postman? In my experience, that has been a huge help for troubleshooting what the feed looks like.

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

Successfully merging this pull request may close these issues.

None yet

4 participants