Binance api php



我正在尝试将binance api与php集成。我想花我的现货钱包和收入。我找不到我需要的url,也找不到端点。

附加问题:我需要时间戳做什么?

$secret = "mySecretKey";
$key = "myApiKey";

$s_time = "timestamp=".time()*1000;

$sign=hash_hmac('SHA256', $s_time, $secret);


$url = "https://api.binance.com/api/v1/balances?".$s_time.'&signature='.$sign;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-MBX-APIKEY:'.$key));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL, $url);

$result = curl_exec($ch);

$result = json_decode($result, true);

echo '<pre>';
var_dump($result);
echo '</pre>';

curl_close($ch);

我已经尝试了许多url并查看了很长时间的binance文档,但我就是找不到它。

谢谢你的帮助!

我在他们的API文档中找到的唯一链接是

查询子账户资产(For Master Account)

GET /sapi/v3/sub-account/assets (HMAC SHA256) 

反应:

{
"balances":[
{
"asset":"ADA",
"free":10000,
"locked":0
},
{
"asset":"BNB",
"free":10003,
"locked":0
},
{
"asset":"BTC",
"free":11467.6399,
"locked":0
},
{
"asset":"ETH",
"free":10004.995,
"locked":0
},
{
"asset":"USDT",
"free":11652.14213,
"locked":0
}
]
}

我不知道你到底想做什么,但如果你想要概述你的现货平衡,正确的终点是:

GET/api/v3/account (HMAC SHA256),链接到更多信息:https://binance-docs.github.io/apidocs/spot/en/#account-information-user_data

反应:

{"makerCommission":15日"takerCommission":15日"buyerCommission":0,"sellerCommission":0," commissionRates ": {"制造商":"0.00150000","接受者":"0.00150000","买家":"0.00000000","卖方":"0.00000000"},"canTrade":没错,"canWithdraw":没错,"canDeposit":没错,"撮合":假的,"requireSelfTradePrevention":假的,"updateTime":123456789,"accountType":"点","平衡":[{"资产":"BTC","免费":"4723846.89208129","锁定":"0.00000000"},{"资产":"LTC","免费":"4763368.68006011","锁定":"0.00000000"}],"权限":["现货"]} 之前关于时间戳的更多信息可以在这里找到:https://binance-docs.github.io/apidocs/spot/en/#signed-trade-user_data-and-margin-endpoint-security

相关内容

  • 没有找到相关文章

最新更新