node-binance-api
node-binance-api copied to clipboard
Unable to place orders, receiving empty responses
Hi, can someone help figuring out the following?
I've tried to place some orders with the following functions I wrote. These are just simple functions to see if node-binance-api
gives the result I expect. Unfortunately, I get for both calls an empty object in return, also I have confirmed that the orders are not placed when checking the balance. I can retrieve my account balance so I know the keys I use are alright.
I'm using the following config:
export const binance = new Binance().options({
APIKEY: config.binance.test.api.key,
APISECRET: config.binance.test.api.secret,
test: true,
useServerTime: true,
verbose: true,
urls: {
base: 'https://testnet.binance.vision/api/',
},
});
These are the calls that return an empty object/empty response.
export const placeLimitOrderOnExchange = async (
buyOrSell: 'BUY' | 'SELL',
symbol: string,
quantity: number,
price: number
) => {
return new Promise((resolve, reject) => {
binance.buy(symbol, quantity, price, { type: 'LIMIT' }, (err, response) => {
if (err) {
console.log('An error has occured.');
console.log(err);
reject(err);
}
console.log('Response:');
console.log(response);
resolve(response);
});
});
};
export const placeMarketOrderOnExchange = async () => {
const response = await binance.marketBuy('BNBBTC', 1);
console.log('Response:');
console.log(response);
return response;
};
Both responding with:
{}
or:
[Object: null prototype] {}
Any news on this?
I tested and found that it works in live mode, and gives empty response in test mode.