Skip to content

client.PlaceNewOrder in futures is not working. #47

@tonilopezortiz78

Description

@tonilopezortiz78

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions