-
Notifications
You must be signed in to change notification settings - Fork 41
Description
const Future = require("./mexc-api-demo/node.js/src/future");
//https://vscode.dev/github/mexcdevelop/mexc-api-demo/blob/main/node.js/src/future.js
const apiKey = process.env.API_KEY;
const apiSecret = process.env.API_SECRET;
const client = new Future(apiKey, apiSecret, {
baseURL: "https://contract.mexc.com",
// https://api.mexc.com
});
client
.PlaceNewOrder({
symbol: "SOL_USDT",
price: 166,
vol: 1,
side: 1,
type: 1,
openType: 2,
})
.then((response) => {
client.logger.log(response.data);
console.log(response.data);
});
client
.Ticker({ symbol: "BTC_USDT" })
.then((response) => client.logger.log(response.data))
.catch((error) => client.logger.error(error));
client.PlaceNewOrder();
//client.OpenOrders();
//client.Ticker();
response:
node placeorder.js
(node:25883) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^
AxiosError: read ECONNRESET
at AxiosError.from (/home/tony/software/trading/mexcapi/node_modules/axios/dist/node/axios.cjs:877:14)
at RedirectableRequest.handleRequestError (/home/tony/software/trading/mexcapi/node_modules/axios/dist/node/axios.cjs:3163:25)
at RedirectableRequest.emit (node:events:524:28)
at eventHandlers. (/home/tony/software/trading/mexcapi/node_modules/follow-redirects/index.js:49:24)
at ClientRequest.emit (node:events:524:28)
at emitErrorEvent (node:_http_client:104:11)
at TLSSocket.socketErrorListener (node:_http_client:512:5)
at TLSSocket.emit (node:events:524:28)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at Axios.request (/home/tony/software/trading/mexcapi/node_modules/axios/dist/node/axios.cjs:4252:41)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
syscall: 'read',
code: 'ECONNRESET',
errno: -104,
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
......
},
_currentUrl: 'https://contract.mexc.com/api/v1/private/order/submit',
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false
},
cause: Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:216:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
}
Node.js v22.12.0