I successfully get the balance of my real binance account with my API Key, but I would like to use a test account to make fake order. I found this post :
I get the API key for the SPOT Testnet application, but when I try to use it in my web application, I have an error which say that API key are not correct.
Thanks, and can I use the futures testnet API key to make orders ? Because I try to use the API key from the futures testnet and it doesn’t seem to work either…
I’ve had the same problem. After some reverse engineering of the node-binance-api package, I found that it is not enough to specify “test: true” in the connection options.
On the contrary, you must also specify the testnet endpoint: because the package does not have it in its programming.
Here is a portion of my code, working
// my ./config/binance_apikeys
module.exports = {
api_key: 'your-test-or-live-api-key',
api_secret: 'your-test-or-live-api-secret',
test: true // true to point testnet API
}
// my Testnet or Live Connection
const apiKeys = require('./config/binance_apikeys')
const client = new Binance({
APIKEY: apiKeys.api_key,
APISECRET: apiKeys.api_secret,
test: apiKeys.test,
urls: {
base: apiKeys.test ? 'https://testnet.binance.vision/api/' : undefined // testnet endpoint or default
}
})
Thanks buddy
It’s working perfectly.
you can only pass test url(not test:true) for test real fake order, it will output a placed order details,
with (test:true) you’ll only get black order object.