Hi,
there are some issues in codebase file for zerodha which I want to point out…
- for stock options ATM, ITM, OTM, get_atm, get_otm function it first check the step_value_dict dictionary, there are lot of mistakes in step value of stocks, few example (‘TRENT’: 20 >> 100, ‘BHARTIARTL’: 10 >> 20, ‘SBIN’: 5 >> 10, ‘MPHASIS’: 20 >> 50, )
- to overcome this issue I have written a function to get step value from insruments file but there are some stocks which step value are different (not in sequence) for exampl - (IOC, VEDL, HINDPETRO)
- get_fut_scripts, get_itm, get_otm, get_atm misses the future or options for SENSEX and BANKEX INDEX
- there is no step dictionary for MCX scripts
- tsl.market_over_close_all_order() dosent work
- there is no cancel_order in zerodha codebase, took it from kite.cancel_order
- need a margin requirement function,
- the code below is working code for margin requirement , we can add in the main file. Thanks…
def get_order_margin(self, tradingsymbol:str, exchange:str, quantity:int, transaction_type:str, product:str, order_type:str):
try:
order_params = [{
"exchange": exchange,
"tradingsymbol": tradingsymbol,
"transaction_type": transaction_type,
"variety": self.kite.VARIETY_REGULAR,
"product": product,
"order_type": order_type,
"quantity": quantity
}]
margin_info = self.kite.order_margins(order_params)
return margin_info
except Exception as e:
print("Error fetching order margin:", e)
return None