Hi there
Below returns error. What is wrong with the code ? Please help
Error setting futures leverage: Request failed with status code 404
const axios = require(‘axios’);
const crypto = require(‘crypto’);
require(‘dotenv’).config();
const apiKey = process.env.BINANCE_API_KEY;
const apiSecret = process.env.BINANCE_API_SECRET;
const apiUrl = ‘https://testnet.binance.vision’;
async function setFuturesLeverage(symbol, leverage) {
const endpoint = ‘/api/v3/order/test/’;
const timestamp = Date.now();
//const queryString = symbol=${symbol}&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2×tamp=${timestamp}
;
const queryString = symbol=${symbol}&side=SELL&type=LIMIT×tamp=${timestamp}
;
const signature = crypto.createHmac(‘sha256’, apiSecret).update(queryString).digest(‘hex’);
console.log( `${apiUrl}${endpoint}?${queryString}&signature=${signature}`);
try {
const response = await axios.post(
${apiUrl}${endpoint}?${queryString}&signature=${signature}
,
{},
{
headers: {
‘X-MBX-APIKEY’: apiKey
}
}
);
console.info(response.data);
} catch (error) {
console.error(‘Error setting futures leverage:’, error.message);
}
}
setFuturesLeverage(‘ETHUSDT’, 50);
Error setting futures leverage: Request failed with status code 404