forked from selimerunkut/binance_brokarage_api_client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_subaccount_api_key.html
39 lines (24 loc) · 999 Bytes
/
create_subaccount_api_key.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<html>
<script type="text/javascript" src="crypto-js.js"></script>
<script>
var burl = 'https://api.binance.com';
var endPoint = '/sapi/v1/broker/subAccountApi';
var accountID = 1
var extraParams = "subAccountId=" + accountID + "&canTrade=true&marginTrade=false&futuresTrade=false&"
var dataQueryString = extraParams + "recvWindow=20000×tamp=" + Date.now();
var keys = {
'akey': '',
'skey': ''
}
var signature = CryptoJS.HmacSHA256(dataQueryString, keys['skey']).toString(CryptoJS.enc.Hex);
var ourRequest = new XMLHttpRequest();
var url = burl + endPoint + '?' + dataQueryString + '&signature=' + signature;
var ourRequest = new XMLHttpRequest();
ourRequest.open('POST', url, true);
ourRequest.setRequestHeader('X-MBX-APIKEY', keys['akey']);
ourRequest.onload = function () {
console.log(ourRequest.responseText);
}
ourRequest.send();
</script>
</html>