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
Authenticated client returns invalid API key #1
Comments
EMX API keys are environment specific. Are you using a testnet API key? When you’re looking at your API key settings, does the browser address bar say testnet.emx.com?
Thanks for trying the API!
… On Jun 7, 2019, at 10:10, sandybradley ***@***.***> wrote:
Following the online guide, I was able to use the publicClient effectively but the authenticated client returns:
HTTP 400 Error: invalid api key
I used the following code excerpt:
const EMX = require('emx');
const authedClient = new EMX.AuthenticatedClient( '---***-', '***************************', 'https://api.testnet.emx.com', );
let buyParams = {
contractCode: 'BTCM19',
side: 'buy',
size: '0.0001', // BTC
price: '7500', // USD
type: 'limit',
};
authedClient.placeOrder(buyParams, callback);
function callback(error, response, data){
if (error) {
// handle the error
console.log(error.message);
} else {
// work with data
console.log(data);
}
}
Key and secret are correctly copied from EMX account. Does it have something to do with testnet for API requests?
Similarly for the authenticated websocket, I got the following error:
not authenticated for trading channel (upstream)
Code:
const EMX = require('emx');
const websocket = new EMX.WebSocketClient(
'', '','https://api.testnet.emx.com', );
websocket.on('open', () => {
websocket.subscribe({ contractCodes: [], channels: [ "trading"] });
});
let buyParams = {
contractCode: 'BTCM19',
side: 'buy',
size: '0.0001', // BTC
price: '7500', // USD
type: 'limit',
};
websocket.placeOrder(buyParams);
Appreciate any help. Thanks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi. Thank you for your response. I am trying to trade on my real account. API settings are from there. Accordingly, I adjusted the apiURI. Now I am getting a different error: HTTP 400 Error: invalid signature |
Hi, do you still have that issue? If so, can you please post your updated script (without private info of course)? |
Hi. Thanks for your response. Yes I do still have this issue. I have been unable to sumbit an API order. Here's the code: const EMX = require('emx'); const authedClient = new EMX.AuthenticatedClient( function callback(error, response, data){ Here's the error: HTTP 400 Error: invalid signature Key and secret were copied directly from the mainnet trading account on EMX. I tried with two different keys. Same response. Also the python client gives the same result. Any advice? |
Following the online guide, I was able to use the publicClient effectively but the authenticated client returns:
HTTP 400 Error: invalid api key
I used the following code excerpt:
const EMX = require('emx');
const authedClient = new EMX.AuthenticatedClient( '---***-', '***************************', 'https://api.testnet.emx.com', );
let buyParams = {
contractCode: 'BTCM19',
side: 'buy',
size: '0.0001', // BTC
price: '7500', // USD
type: 'limit',
};
authedClient.placeOrder(buyParams, callback);
function callback(error, response, data){
if (error) {
// handle the error
console.log(error.message);
} else {
// work with data
console.log(data);
}
}
Key and secret are correctly copied from EMX account. Does it have something to do with testnet for API requests?
Similarly for the authenticated websocket, I got the following error:
not authenticated for trading channel (upstream)
Code:
const EMX = require('emx');
const websocket = new EMX.WebSocketClient(
'', '','https://api.testnet.emx.com', );
websocket.on('open', () => {
websocket.subscribe({ contractCodes: [], channels: [ "trading"] });
});
let buyParams = {
contractCode: 'BTCM19',
side: 'buy',
size: '0.0001', // BTC
price: '7500', // USD
type: 'limit',
};
websocket.placeOrder(buyParams);
Appreciate any help. Thanks.
The text was updated successfully, but these errors were encountered: