creating basket using API

Hi, is it possible to create baskets using API?
    There is no API to place basket orders directly.

    You can use basket margins API to check the margin and then place orders sequentially.
  • DD1365
    Obviously you can create baskets as per your requirements.

    Firstly, get the basket margin required by adding required instruments in correct order (first buy then sell) as params and pass the argument to fetch basket margin API call [kite.basket_order_margins(params,consider_positions=False,mode="compact")]

    This will give you required margin. Cross check the initial margin with available capital in your account, make sure that available capital is atleast 10% more than initial margin required to ensure that any orders in your basket don't get rejected. Immediately after this step you must proceed with placing the basket orders as explained below:

    Make a parent list of 2 sub-lists, first sub-list containing buy orders and the second sub-list containing sell orders. Then loop through the parent list and use parallel processing using concurrent.futures.ThreadPoolExecutor() to first place all buy orders simultaneously and then all sell orders simultaneously by passing each sub-list one after another to the ThreadPoolExecutor()
Sign In or Register to comment.