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 is returning wonky USDC prices; use BUSD or USDT #12

Open
defuse opened this issue Feb 13, 2023 · 5 comments
Open

Binance is returning wonky USDC prices; use BUSD or USDT #12

defuse opened this issue Feb 13, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@defuse
Copy link

defuse commented Feb 13, 2023

I noticed in lightwalletd's logs that it was excluding the price from binance because it was 55.8 whereas the actual price of ZEC was around 42.7. Their APIs for USDC prices seem to be broken, not returning the correct price for all the coins I tried.

I was able to get the correct price using any of https://api.binance.com/api/v3/ticker/price?symbol=ZECBUSD or https://api.binance.com/api/v3/ticker/price?symbol=ZECUSDT, https://api.binance.com/api/v3/avgPrice?symbol=ZECBUSD, https://api.binance.com/api/v3/avgPrice?symbol=ZECUSDT.

I'm not sure what's going on with the USDC prices over at binance, but you might want to change the Binance URL in lightwalletd to one of the above.

@defuse defuse added the bug Something isn't working label Feb 13, 2023
@defuse
Copy link
Author

defuse commented Feb 13, 2023

Oh, it's probably because Binance stopped supporting USDC: https://techcrunch.com/2022/09/05/binance-issuer-of-stablecoin-busd-to-discontinue-support-for-usdc-usdp-and-tusd/

So, we probably want to use https://api.binance.com/api/v3/avgPrice?symbol=ZECBUSD going forward.

@LarryRuane
Copy link

That URL doesn't work for me, at least at this moment:

$ curl -s https://api.binance.com/api/v3/avgPrice?symbol=ZECBUSD
{
  "code": 0,
  "msg": "Service unavailable from a restricted location according to 'b. Eligibility' in https://www.binance.com/en/terms. Please contact customer service if you believe you received this message in error."
$

The old URL gives the same error. Does this work for you? Maybe there's something wrong in my setup?

@defuse
Copy link
Author

defuse commented Feb 14, 2023

It works for me when I request it from Canada. However when I turn on a VPN to the USA, I get the same error. 😞 I get the same error when I request the URL that's currently in lightwalletd, too, so it might still be worth changing it.

@defuse
Copy link
Author

defuse commented Feb 14, 2023

https://api.binance.us/api/v3/avgPrice?symbol=ZECUSDT (note .us instead of .com) seems to work from USA, Canada, Hong Kong, Germany, .... hopefully that one isn't geo-restricted.

@LarryRuane
Copy link

Yes, replacing .com with .us works for me too. (BTW, I think you have a typo in your comment above, ZECBUSD, #12 (comment))

Should we include both the .com and .us endpoints? It's okay if one of them fails. PR zcash#354 currently has 4 price providers and requires any combination of 3 of them to respond. If we now have 5, we could still require any 3 of them to respond.

When should we actually merge zcash#354, by the way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants