Could anyone provide 1 simple example buy order in testnet.binancefuture?
My code so far. it dosen’t work. Copied api key and secret from https://testnet.binancefuture.com/en/futures/
[Object: null prototype] {
code: -1022,
msg: ‘Signature for this request is not valid.’
}
const Binance = require('node-binance-api');
const binance = new Binance().options({
APIKEY: '',
APISECRET: '',
useServerTime: true,
test: true,
baseURL: 'https://testnet.binancefuture.com'
});
// Place a new order
const symbol = 'BNBUSDT'; // Replace with the symbol you want to trade
const side = 'BUY'; // 'BUY' or 'SELL'
const type = 'LIMIT'; // 'LIMIT', 'MARKET', 'STOP_LIMIT', etc.
const quantity = 1; // Quantity of the asset you want to trade
const price = 350; // Price at which you want to place the order
binance.futuresOrder({
symbol: symbol,
side: side,
type: type,
quantity: quantity,
price: price
})
.then((response) => {
console.log(response);
// Handle success
})
.catch((error) => {
console.error(error);
// Handle error
});