Iceberg orders tracking and other documentation

healthsecure15
Hi

I cannot find proper documentation about iceberg orders and related stop-loss order implementation. I can't outright test this because of obvious reasons.

Please have a look at the following The order placement:

iceberg_legs = ceil(qty / freeze_qty)
order_id = kite.place_order(variety='iceberg',
iceberg_legs=iceberg_legs,
tradingsymbol=tradingsymbol,
exchange=exch,
transaction_type=buy_sell,
iceberg_quantity=freeze_qty,
order_type=otype,
price=price,
trigger_price=t_price,
product=nrml_mis,
tag='bnf_multi_iceberg')


1- Is this the correct way to place this order,

2- note removed quantity for iceberg_quantity, (is this the quantity per order in the iceberg or the overall quantity)? I assume we have to give the quantity field as well.

3- If the total quantity, assume is 1900 BANKNIFTY Future, then iceberg legs will be 3 but orders will be:
i) Order 1 - 900
ii) Order 2 - 900
iii) Order 3 - 100

4- Once partial orders are filled, lets assume 700 in order 1, I can place a SL order for 700 quantity. If the full quantity is filled, 1900, then a SL order of 1900 would not be placeable I assume. Do we need to place separate SL orders of the 900 freeze quantity?

I will have a bunch of similar questions regarding this.

Thanks
  • sujith
    You need to send quantity field while placing iceberg order.

    You can refer to the example params for placing iceberg order here.

    For slice calculation, you can refer to this thread.

    The total quantity of the iceberg can't be 1900 since it is not a multiple of lot size.

    Partial fill happens in multiples of 15 (lot size), a partial fill of 700 is not possible. You can place an independent stoploss order of sliced quantity or wait for everything to execute and place another iceberg order for exit. It is up to you, how you want to code.
  • healthsecure15
    @sujith

    Am I correct in assuming:

    If the order quantity is: freeze quantity x 2 + 15x4

    The orders will be separate i.e.

    I will have to place a iceberg order for: freeze quantity x 2.

    Second order: NRML/MIS type 15 x 4

    Same way for the stop-loss order?

    I would try the code in a sandbox environment, but unfortunately I don't believe that option is available.

    Thanks
  • sujith
    You can place one order with total quantity and keep the leg quantity less than freeze quantity.
    The total number of legs allowed is 2 to 10. After first leg gets executed, the second order is placed automatically by the system itself.

    The iceberg order backend is designed in such a way that it requires both iceberg_quantity and iceberg_legs to be sent from the frontend.

    You can use this logic for iceberg_quantity calculation
    double slice = quantity / max(leg_count, 2);
    iceberg_quantity = (slice / lot_size).ceil() * lot_size;

    iceberg_legs = leg_count;
  • sutolani@gmail.com
    I am not able to figure this out....I have tried many option...Could you send me the exact formula if I want to sell 10500 lots of MidCpNifty (LotSize 75, Freeze Quantity 4200)
Sign In or Register to comment.