## Questions 1. Are there additional parameters needed to receive leverage details in the response? 2. Is this information only available for certain instruments or during specific market hours?
It seems fine at our end. A param can't go missing from the response. It might show full leverage but can't go missing. You can know more about the response parameters here.
## Questions 1. Is this response structure correct? The raw response shows nested data objects but the logged data is different. 3. Is the `mode=compact` parameter affecting the response structure?
async getOrderMargins(req, res) {
try {
const orders = [{
exchange: "NSE",
tradingsymbol: "INFY",
transaction_type: "BUY",
variety: "regular",
product: "CNC",
order_type: "MARKET",
quantity: 1,
price: 0,
trigger_price: 0
}];
const response = await kiteService.getOrderMargins(orders);
console.log('Complete Response:', JSON.stringify(response, null, 2));
res.json(response);
} catch (error) {
console.error('Error getting order margins:', error);
res.status(500).json({
error: 'Failed to fetch order margins',
details: error.message
});
}
}
## Service Code
javascript:backend/services/kiteService.js
async getOrderMargins(orders) {
try {
const response = await this.kiteConnect.orderMargins(orders);
console.log('Full API Response:', JSON.stringify(response, null, 2));
return response;
} catch (err) {
console.error('Error getting order margins:', {
message: err.message,
stack: err.stack,
response: err.response?.data
});
throw err;
}
}
// Raw Response Object
{
data: {
status: 'success',
data: [ [Object] ]
}
}
// Actual Data when Logged
[
{
"type": "equity",
"tradingsymbol": "INFY",
"exchange": "NSE",
"charges": {
"transaction_tax": 1.9788,
"transaction_tax_type": "stt",
"exchange_turnover_charge": 0.06074916,
"sebi_turnover_charge": 0.0019787999999999997,
"brokerage": 0,
"stamp_duty": 0,
"gst": {
"igst": 0.0112910328,
"cgst": 0,
"sgst": 0,
"total": 0.0112910328
},
"total": 2.0528189928
},
"total": 1978.8
}
]
## Questions
1. Is this response structure correct? The raw response shows nested data objects but the logged data is different.
3. Is the `mode=compact` parameter affecting the response structure?
Any guidance would be appreciated. Thank you!