Questions on behavior of java client.

kcsomisetty
Question#1
a. I placed an intra-day (MIS) buy order and orderId is 123.
b. I want to sell order#123 (aka exist position). how to do this ?

Should i place a sell order ? How to make sure this does not end up as short-sell order.

Question#2
Can i place an intra-day buy order and use KiteConnect.modifyProduct() to make it as CNC ?
is it allowed ?
Tagged:
  • sujith
    1. Order is different from positions. You cannot exit position based on order id. Checkout Examples class of this repository https://github.com/rainmattertech/javakiteconnect/tree/master/sample/src
    2. Yes, you can do using modifyProduct method in the same Examples class.
  • kcsomisetty
    For Question#1,
    i can not find anything from example.
    Please let me know how to sell an MIS intra-day order,

    Question#2
    Thanks, this is a relief :)
  • sujith
    Use product as MIS for intraday and CNC(EQ) or NRML(FNO) for delivery.
    And checkout placeorder method in Examples class, it is stoploss intraday example.
  • Kailash
    1) Yes, you have to place an opposite SELL order. To avoid short selling, check it against holdings/positions before you fire the order.
  • kcsomisetty
    kcsomisetty edited October 2016
    @Kailash can you elaborate on what you mean by "check it against holdings/positions before you fire the order."

    Does this mean,
    If I have BUY-MIS order in COMPLETE state, the
    next SELL-MIS order is treated as opposite SELL order automatically, otherwise will treated as short sell.

    is my understanding correct ?
  • sujith
    @kcsomisetty Yes. You are right.
  • kcsomisetty
    @sujith @Kailash I have tried the above said instructions,

    But getting an error while placing a SELL order after my BUY/MIS is successful.

    "Invalid order_type"

    the params i used are
    LMT/BUY/DAY for buy
    LMT/SELL/DAY for sell

    Can you let me know what is going wrong ?
  • sujith
    @kcsomisetty Can post code, where you placing sell order?
  • kcsomisetty
    kcsomisetty edited October 2016
    Here you go.

    //buy order

    Map params = new HashMap() {
    {
    put("quantity", String.valueOf(tradeInput.per_order_quantity));
    put("order_type", "LIMIT");
    put("tradingsymbol", tradeInput.symbol);
    put("product", tradeInput.product);
    put("exchange", "NSE");
    put("transaction_type", "BUY");
    put("validity", "DAY");
    put("price", String.valueOf(buy_price));
    }
    };
    Order buyOrder = kite.placeOrder(params, "regular");

    //sell order code
    Map params = new HashMap() {
    {
    put("quantity", String.valueOf(tradeInput.per_order_quantity));
    put("order_type", "LMT");
    put("tradingsymbol", tradeInput.symbol);
    put("product", tradeInput.product);
    put("exchange", "NSE");
    put("transaction_type", "SELL");
    put("validity", "DAY");
    put("price", String.valueOf(sell_price));
    }
    };
    Order sellOrder = kite.placeOrder(params, "regular");


    In both cases product is MIS and symbol is GMRINFRA
  • sujith
    @kcsomisetty order_type for sell is 'LIMIT' not 'LMT'.
  • kcsomisetty
    @sujith lol!. i feel stupid. will try.
Sign In or Register to comment.