I want to trans my BTC from SPOT to ISOLATED(ETC/BTC)
but API server response this json format.
——————————————————————————————————————————————————
{
code: -1002,
msg: ‘CheckRule: ruleId [1] has no operation privilege.’
}
——————————————————————————————————————————————————
I checked my API restrictions first. but all check-box checked except only ‘Enable Margin’(about cross margin).
why it doesn’t work? plz answer me.
this is my test code. thank you!
——————————————————————————————————————————————————
const http2 = require(‘http2’);
const fs = require(‘fs’);
const crypto = require(‘crypto’);
const gAPIs = JSON.parse(fs.readFileSync(‘API_KEY.txt’, ‘utf-8’));
// bnx request
const gBnxClient = http2.connect(https://api.binance.com
);
let asset = ‘BTC’;
let symbol = ‘ETHBTC’;
let transFrom = ‘ISOLATED_MARGIN’;
let transTo = ‘SPOT’;
let amount = ‘0.00111’;
let timestamp = + new Date().getTime();
let queryString = asset=${asset}&symbol=${symbol}&transFrom=${transFrom}&transTo=${transTo}&amount=${amount}×tamp=${timestamp}
;
let signature = crypto.createHmac(‘sha256’, gAPIs.bnx.secKey).update(queryString).digest(‘hex’);
let bnxReqSymbol = gBnxClient.request({ ‘:method’: ‘POST’ , ‘:path’: /sapi/v1/margin/isolated/transfer?${queryString}&signature=${signature}
, ‘X-MBX-APIKEY’:gAPIs.bnx.apiKey });
bnxReqSymbol.on(‘error’, (err) => console.error(’[connBnxRest()]’, err));
bnxReqSymbol.on(‘response’, (headers, flags) => {
// for (const name in headers) {
// console.log(${name}: ${headers[name]}
);
// }
});
bnxReqSymbol.setEncoding(‘utf8’);
let data = ‘’;
bnxReqSymbol.on(‘data’, (chunk) => { data += chunk; });
bnxReqSymbol.on(‘end’, () => {
let json = JSON.parse(data);
console.log(json);
bnxReqSymbol.close();
});
bnxReqSymbol.end();