Binance API:如何使用API​​获取Binance用户ID

发布于 2025-01-12 03:25:28 字数 146 浏览 4 评论 0原文

如何使用 API 获取币安用户 ID。我刚刚创建了一个机器人,我需要独特的值来创建机器人激活,以便用户只能将我的机器人用于该帐户。

这就是为什么我需要 Binance API 的用户 ID。如何通过 API 获取用户 ID 或获取任何其他唯一值(例如用户 ID)。

How to get Binance User ID using API. I just created a bot and I need unique value to create a bot activation so a user can use my bot only for that account.

That is why I need a User ID by Binance API. How can I get a User ID or get any other unique value like a User ID by API.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

走走停停 2025-01-19 03:25:29

出于隐私原因,币安不会共享每个用户的任何唯一 ID。

您可以通过查询每个 API 密钥的余额来部分绕过此限制。如果两个 API 密钥具有相同的余额集,则很可能是同一用户。请注意,该解决方案不易扩展。对于数千个用户,您将必须运行数千个请求才能获取他们的余额。并且可能会缓存这些结果,这样您就不会遇到速率限制(来自服务器 IP 的 API 请求数量),这会带来另一个不准确的情况。

Binance does not share any unique ID of each user, most likely for privacy reasons.

You can partially bypass this limitation by querying balances of each API key. If there are two API keys with the same set of balances, chances are it's the same user. Mind that this solution is not easily scalable. With thousands of users you'll have to run thousands of requests to get their balances. And probably cache these results, so that you don't run into rate limits (number of API requests from your server IP), which introduces another inaccuracies.

罪歌 2025-01-19 03:25:29

您可以通过用户余额查询“/fapi/v2/balance”。每个余额都有“accountAlias”字段,正如 Binance API 文档所述,该字段对于每个用户来说都是唯一的

You can query "/fapi/v2/balance" with User's Balances. Every Balance has field "accountAlias", which is unique per user as Binance API Docs states

生寂 2025-01-19 03:25:29

我还没有尝试过,但下一个 API 会给你一个 UID,它应该识别用户:

https://binance-docs.github.io/apidocs/spot/en/#account-information-user_data

 {
  "makerCommission": 15,
  "takerCommission": 15,
  "buyerCommission": 0,
  ...
  "accountType": "SPOT",
  "balances": [
    {
      "asset": "BTC",
      "free": "4723846.89208129",
      "locked": "0.00000000"
    },
    {
      "asset": "LTC",
      "free": "4763368.68006011",
      "locked": "0.00000000"
    }
  ],
  ...
  "uid": 354937868
}

I haven't tried yet but next API gives you an UID which should identify the user:

https://binance-docs.github.io/apidocs/spot/en/#account-information-user_data

 {
  "makerCommission": 15,
  "takerCommission": 15,
  "buyerCommission": 0,
  ...
  "accountType": "SPOT",
  "balances": [
    {
      "asset": "BTC",
      "free": "4723846.89208129",
      "locked": "0.00000000"
    },
    {
      "asset": "LTC",
      "free": "4763368.68006011",
      "locked": "0.00000000"
    }
  ],
  ...
  "uid": 354937868
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文