Publisher is not working during market hours

eeesathiaeee
Publisher is not working during market hours and orders are not getting placed with no errors but orders are getting placed and getting rejected during non market hours as expected. Please advise. Coding was done for banknifty options spread with limit order.
Tagged:
  • sujith
    Can you paste your code here?
  • eeesathiaeee
    eeesathiaeee edited May 2018
    Here is the main js code.
    KiteConnect.ready(function() {
    var kite = new KiteConnect("xxxx");

    var cestrike = $("#cestrike").val();
    var pestrike = $("#pestrike").val();
    cestrike = Number(cestrike);
    pestrike = Number(pestrike);

    var cesymbol = $("#symbol").val() + $("#closestexpiry").val() + cestrike + "CE";
    var pesymbol = $("#symbol").val() + $("#closestexpiry").val() + pestrike + "PE";

    var celots = $("#lots").val();
    var pelots = $("#lots").val();
    celots = Number(celots);
    pelots = Number(pelots);

    var celimit = $("#limit").val();
    var pelimit = $("#limit").val();
    celimit = Number(celimit);
    pelimit = Number(pelimit);

    kite.add({
    "exchange": "NFO",
    "tradingsymbol": cesymbol,
    "quantity": celots,
    "transaction_type": "BUY",
    "order_type": "LIMIT",
    "price": celimit
    });

    kite.add({
    "exchange": "NFO",
    "tradingsymbol": pesymbol,
    "quantity": pelots,
    "transaction_type": "BUY",
    "order_type": "LIMIT",
    "price": pelimit
    });

    kite.finished(function(status, request_token) {
    alert("Finished. Status is " + status);
    });

    kite.link("#trade");
    });
  • sujith
    The code seems fine. Can you elaborate what do you mean by not working?
    Does screen become empty or you don't get to see success page? Can you take a screenshot and paste it?
  • eeesathiaeee
    No errors received bust success message is getting received in the app and web version but order is not getting placed during market hours.
  • eeesathiaeee
    I mean i could not see the executed orders in kite during market hours but able to see rejected orders when placed during non market hours.
  • sujith
    Do you see this during market hours?
  • eeesathiaeee
    Yes. I am able to see that page during market hours.
  • eeesathiaeee
    It was coded from sample codes from demo page only. Not sure of this issue during market hours.
  • eeesathiaeee
    @sujith please advise.
  • sujith
    I am not sure what you are referring to. You need to be clear what is not working. We can't help you without proper information.

  • sujith
    Check the above image of Kite Publisher. Many users are using this in production not sure what is wrong here.
  • eeesathiaeee

    This is one example of an order getting submitted after market hours and getting rejected as expected. Same submission does not come to kite during market hours. Please advise.
  • eeesathiaeee
    @sujith please advise for the above.
  • Vivek
    @eeesathiaeee Tested your script after removing your symbol get logic and it works fine and order shows up in orderbook once I place it. Please be more specific about the issue like were you able to place the order but doesn't shows up or it doesn't even load the publisher page.
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://kite.trade/publisher.js?v=3"></script>
    </head>
    <body>
    <button id="custom-btn">Place order</button>

    <script>
    KiteConnect.ready(function () {
    var kite = new KiteConnect("kitedemo");

    kite.add({
    "exchange": "NFO",
    "tradingsymbol": "NIFTY18JUNFUT",
    "quantity": 75,
    "transaction_type": "BUY",
    "order_type": "LIMIT",
    "price": 1000
    });

    kite.add({
    "exchange": "NFO",
    "tradingsymbol": "NIFTY18JUN3500CE",
    "quantity": 75,
    "transaction_type": "BUY",
    "order_type": "LIMIT",
    "price": 100
    });

    kite.finished(function (status, request_token) {
    alert("Finished. Status is " + status);
    });

    kite.link("#custom-btn");
    });
    </script>
    </body>
    </html>
  • eeesathiaeee
    I am able to see the place order button during market hours but clicking the place order and finish buttons does not bring the order to kite. Should i add double quotes to the symbol. Even if that is the case it is working perfectly during non market hours. Please advise.
  • eeesathiaeee
    Additional double quotes throw the other error(no valid order found in payload). Please advise for all the concerns shared.
  • sujith
    Make sure you are not passing numbers as a string like a price, trigger price, square off etc and send tradingsymbol, exchange, order type etc as strings.
  • sujith
    You can check out all Kite Connect string constants here.
  • eeesathiaeee
    Everything is being passed as suggested. Main question is how it works during non market hours correctly. Could you please advise what is the main validation/logic difference at kite side during and after market hours which will resolve the original issue.
  • sujith
    It works for us all the time. We are not able to reproduce the behavior.
  • eeesathiaeee
    I am attaching all the codes(both the web version and the apk) for you to verify the codes and reproduce the behaviour. This works perfectly during non market hours but not during market hours. Please let me know your findings.

    Please input banknifty call strike price and put strike price(both for buys) and a common limit price and a common lot size in multiples of 40. Click the 'Check' button first and then the 'Trade' button. This can be done in any version(web html version or android version).
  • tonystark
    @eeesathiaeee The code example you have given is for a Cordova application. But you are using Publisher JS plugin in it which is meant to be used in a browser environment. For a mobile application Basket order is more appropriate. You have to make a POST request as described in the link to a new WebView window in your app.

    As you requested we tested in browser and in the app during market hours. In the browser, it successfully placed the orders. In the app, after clicking trade it was showing Kite login screen in a very small space just below the table. This is probably because of JS plugin. Try the Basket order(Publisher - Offsite orders).

    Also, next time onwards try to give more details such as the platform you are working on, the flow of the process, errors if any, versions affected, screenshots etc. which will help us to easily diagnose the issue.

    Thank you.
  • eeesathiaeee
    Thank you so much!!!
  • eeesathiaeee
    The app works during non market hours.
  • eeesathiaeee
    Will you be able to test the app during non market hours(after 3:30 pm) one last time!
  • eeesathiaeee
    Thanks for all your support. I just embedded all the codes into a single html and trading with the mobile browser since the app version for the same codes does not work during market hours. Again, great support provided, thanks!!!
Sign In or Register to comment.