You’re using
client.apis.Orders.changeOrderLeverage()
which doesn’t match the actual API endpoint structure. According to the Delta Exchange documentation, the correct endpoint for changing leverage is:
POST /products/{product_id}/orders/leverage
Here’s how you should modify your code to correctly change the leverage for BTCUSD:
new DeltaRestClient(vApiKey, vApiSecret).then(client => {
// The correct endpoint is /products/{product_id}/orders/leverage
client.post(`/products/27/orders/leverage`, {
leverage: '50' // This should be the body parameter
})
.then(function (response) {
let objResult = response.data; // The response might already be parsed
if(objResult.success){
res.send({ "status": "success", "message": "Order Leverage is Set Successfully!", "data": objResult });
}
else{
res.send({ "status": "warning", "message": "Error: Contact Admin!", "data": objResult });
}
})
.catch(function(objError) {
console.log(objError);
res.send({ "status": "danger", "message": objError.response ? objError.response.text : objError.message, "data": objError });
});
});
Let me know if this helps or if you need further assistance!
Sir,
Its not working and the error is
D:\NodeJS\AlgoMarti\server\controller\controllerDeltaLive.js:70
client.post(/products/27/orders/leverage, { leverage: ‘50’ }).then(function (response) {
^
TypeError: client.post is not a function
at D:\NodeJS\AlgoMarti\server\controller\controllerDeltaLive.js:70:16
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)