-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to connect to testnet? #209
Comments
You can try passing this in the first parameter (REST client options) in any of the rest clients:
|
Hi there, any way to use it for the websocket also ?
Thank you in advance ! |
Actually it s very easy, by using the wsUrl in the options
in case some one have the same question |
did anything change in the meantime by any chance? I'm trying to connect to testnet via;
The response I'm getting is: { 404 Not found","headers": { "content-length": "48", "connection": "close", "date": "Thu, 17 Nov 2022 14:02:16 GMT", "server": "nginx", "strict-transport-security": "max-age=31536000; includeSubdomains", "x-frame-options": "SAMEORIGIN", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "content-security-policy": "default-src 'self'", "x-content-security-policy": "default-src 'self'", "x-webkit-csp": "default-src 'self'", "cache-control": "no-cache, no-store, must-revalidate", "pragma": "no-cache", "expires": "0", "x-cache": "Error from cloudfront", "via": "1.1 6851e5f468b237438eae4078fbc9d3b8.cloudfront.net (CloudFront)", "x-amz-cf-pop": "AMS1-P2", "x-amz-cf-id": "af7sa1JRboWR1PINCs-DkUr3gHn63nw_Fa2IH9pDzHfvC0TESYflOQ==" }, "requestUrl": "https://testnet.binance.vision/api/sapi/v1/account/apiRestrictions?timestamp=1668693736113&recvWindow=5000&signature=aad906b3933767274ea689724d60c26bda90849101c979c3ef3cf0f8d6dd351f", "requestOptions": { "recvWindow": 5000, "syncIntervalMs": 3600000, "strictParamValidation": false, "baseUrl": "https://testnet.binance.vision/api" } more or less the same reply without /api: { |
I believe it is still working |
I was getting 404s too but this was from using the wrong client for the operation - I was trying use the import {CoinMClient, MainClient, USDMClient} from "binance";
const testnet = true;
const baseUrl = (testnet ? "https://testnet.binance.vision" : "https://api.binance.com");
const client = new MainClient({
api_key: process.env["BINANCE_API_KEY"],
api_secret: process.env["BINANCE_API_SECRET"],
baseUrl
});
// Get the account balance
client
.getAccountInformation()
.then((result) => {
console.log('getSymbolOrderBookTicker result: ', result);
console.log("time to die!");
process.exit()
})
.catch((err) => {
console.error('getSymbolOrderBookTicker error: ', err);
}); |
Seems MainClient.getBalances() is using /sapi endpoints and when we are connecting to testnet , is not working.. |
How to connect to https://testnet.binance.vision/api instead of main net?
The text was updated successfully, but these errors were encountered: