Maintaining User Session and Linking New Dynamic Buttons after kite loading.

sedhuait
  1. Is it possible to maintain user session in publisher api for multiple orders ?
  2. Is it possible to instruct user to login before click on trade buttons, so that they dont have to login again when the button is clicked?
  3. How to link the newly added buttons to kite , ex kite was loaded on page load but buttons are added after every button click ? so now new buttons has to be linked with kite.. how?
  • sujith
    1. Yes, the user has to log in once then the session will persist until the user logs out manually or until next day.

    2. I don't think adding a login page before opening Kite Publisher is a good idea because there, a user will have an option to create a session only for one time which is exactly the opposite of what you want.

    3. This is not possible. You can't dynamically add items to the basket. You will have to add all the instruments to the basket before opening the basket page.
  • sedhuait
    1. Yes, the user has to log in once then the session will persist until the user logs out manually or until next day.
    Is it automatic, or anything needs to be set ?

  • sujith
    It is the default behavior, you don't have to do anything.
  • sedhuait
    {"status":"error","message":"Invalid orders payload.","data":null,"error_type":"InputException"}
  • sedhuait
    sedhuait edited May 2018
    its happening when adding multiple baskets / buttons using KiteConnect.ready
  • sedhuait
    @sujith : hey can you help please ...

    {"status":"error","message":"Invalid orders payload.","data":null,"error_type":"InputException"}

    im still getting the same errrors
  • sujith
    You can check out demo here.
  • sedhuait
    sedhuait edited May 2018
    {"status":"error","message":"invalid host","data":null,"error_type":"GeneralException"}

    Order are going through now.. but getting this error after closing the orders page @sujith

    url

    https://kite.zerodha.com/connect/login?api_key=1xaloxfy&sess_id=zBvaCi
  • sedhuait
    sedhuait edited May 2018
    also finished callback is not getting triggered.
    var kite = new KiteConnect(ZAPI_KEY);
    if(config.otype === 'bo'){
    let order_config = {
    "tradingsymbol": data.tradingsymbol,
    "exchange": "NSE",
    "transaction_type": data.transaction_type,
    "order_type": "LIMIT",
    "product": "MIS",
    "price": parseFloat(data.price),
    "quantity": parseFloat(data.quantity) || 1 ,
    "variety": "bo",
    "stoploss": parseFloat(data.stoploss),
    "squareoff": parseFloat(data.squareoff),
    "trailing_stoploss": parseFloat(0)
    };
    console.log("order config", order_config);
    kite.add(order_config);
    kite.finished( (status, request_token) => {
    alert(`${data.tradingsymbol} order Finished. Status is ${status}`);
    });
    kite.connect();
    }
Sign In or Register to comment.