How to get required margin through API before placing order.?

SudhakarC
Hi Team,
I need to get the required margin before placing an order for FO options. For example, If i am planning to place or order for 'KOTAKBANK25JUL2240CE'. Current price is 40.30 also 1 lot is 400 quantity. So, i need to do calculation about how many quantities i can place. Is there any API to get the required margin ?
Tagged:
  • Sravanthi_bh
    You may check the margins API doc.
  • pruthvik
    As per above link,i have tried below code ,but not getting correct output.

    basket = [
    {
    "exchange": "NFO",
    "tradingsymbol": "NIFTY25JUL25900CE", # BUY leg (hedge)
    "transaction_type": "BUY",
    "variety": "regular",
    "product": "NRML",
    "order_type": "MARKET",
    "quantity": 75
    },
    {
    "exchange": "NFO",
    "tradingsymbol": "NIFTY25JUL25700CE", # SELL leg
    "transaction_type": "SELL",
    "variety": "regular",
    "product": "NRML",
    "order_type": "MARKET",
    "quantity": 75
    }
    ]

    margin_detail = kite.order_margins(basket)

    Output is :
    [{'type': 'equity',
    'tradingsymbol': 'NIFTY25JUL25900CE',
    'exchange': 'NFO',
    'span': 0,
    'exposure': 0,
    'option_premium': 11658.75,
    'additional': 0,
    'bo': 0,
    'cash': 0,
    'var': 0,
    'pnl': {'realised': 0, 'unrealised': 0},
    'leverage': 1,
    'charges': {'transaction_tax': 0,
    'transaction_tax_type': 'stt',
    'exchange_turnover_charge': 4.1423538749999995,
    'sebi_turnover_charge': 0.011658749999999999,
    'brokerage': 20,
    'stamp_duty': 0,
    'gst': {'igst': 4.3477222724999995,
    'cgst': 0,
    'sgst': 0,
    'total': 4.3477222724999995},
    'total': 28.5017348975},
    'total': 11658.75},
    {'type': 'equity',
    'tradingsymbol': 'NIFTY25JUL25700CE',
    'exchange': 'NFO',
    'span': 159005.25,
    'exposure': 38523,
    'option_premium': 0,
    'additional': 0,
    'bo': 0,
    'cash': 0,
    'var': 0,
    'pnl': {'realised': 0, 'unrealised': 0},
    'leverage': 1,
    'charges': {'transaction_tax': 17.40375,
    'transaction_tax_type': 'stt',
    'exchange_turnover_charge': 6.1835523750000005,
    'sebi_turnover_charge': 0.01740375,
    'brokerage': 20,
    'stamp_duty': 0,
    'gst': {'igst': 4.716172102499999,
    'cgst': 0,
    'sgst': 0,
    'total': 4.716172102499999},
    'total': 48.3208782275},
    'total': 197528.25}]

    It is not giving me correct margin required for hedged position, plz can you support to get correct margin for hedged positions.
  • Sravanthi_bh
    Sravanthi_bh edited July 7
    Please refer to the sample examples given here for more info.
Sign In or Register to comment.