trans from SPOT to ISOLATED doesn't work

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}&timestamp=${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();

Hello, the message for ‘Enable Margin’ is that it can only be adjusted after cross margin is set up but it should apply to both cross and isolated margin. Can you enable it and try again?

Oh I really appropriciate sir.

I did it that day midnight… you’re right. ‘Enable Margin’ wasn’t enable check. I had to move my BTC on Cross margin account. so then I can check that check-box, then trans works.

thank you for your answer… :slight_smile:

1 Like