margin calculator for equity

puneetbijnor4020
Can you please provide logic (code) of margin calculator for BO/CO:
e.g. "BHEL":{"mis_margin":9,"mis_multiplier":11,"co_lower":4,"co_upper":4.5}

I think for CO order trigger_range is calculated like this:
e.g for BUY--
start=last_price
end=last_price*(1-(co_upper/100))
end=int(end*20)/20

please answer both question.it is required because no margin requirement api is active .
  • puneetbijnor4020
    puneetbijnor4020 edited September 2017
    or depth data is used for trigger_range
  • sujith
    sujith edited September 2017
    Hi @puneetbijnor4020,
    Appologies for late response.

    Let us consider a scenario if CO trigger range for an instrument is 4.5%, you are placing a BUY order, LTP of the scrip is 100, the best bid is 99 and best offer is 101.

    1. Parent leg is bought @ market i.e. @ 101
    2. Stop-loss leg trigger range is from 96.45 - 101 calculated as
    co_upper_absolute = (best_offer - ( best_offer * (co_upper_percent/100))
    T.R (trigger range) will be rounded off to closest tick but the only change is instead of LTP, trigger range is calculated from best ask for buy CO and from best bid for sell CO.
Sign In or Register to comment.