BO order via kiteconnect

Encrypted
Hi please check if my below code for placing BO order is correct or not from C#.net application
kite.PlaceOrder("NSE", "INFY", "BUY", "400", null, "BO", "MARKET", "DAY", null, null, "30", "2", "2", "regular", "");
today is sunday. I am trying to execute order for testing purpose.
it is not giving me any error but I am not able to see any order logging in kite application.
I am able to download instruments so I hope my token not expired.
Appreciate any help.
  • Vivek
    Can you post the error you are getting after placing?
  • tonystark
    Hi @Encrypted,

    It will not throw an exception. Instead, PlaceOrder function will return the response from API as a dictionary. If the order is successful this will have the order id otherwise it will have the error information. In order to know the issue, it is better to look what is inside that dictionary. You can use this function to print it out to command line. It is better to collect the order ids of every PlaceOrder call for debugging purposes.
  • Encrypted
    Thank you ajinasokan and vivek I shall post error here soon.one more query:for is there separate API for data feed?I need 1 min data for stocks.i am getting error invalid API.
  • sujith
    Hi,
    Historical data API is not included in the base package. It is an add-on subscription. You can go to developers console > app details page and subscribe for the same.
  • Encrypted
    Soory..i am not able to get you.i am new in this forum.please ping the URL and price.
  • sujith
    Hi,
    Go to https://developers.kite.trade/login and then click on My apps and then go to Kite Connect app(SankarTrading) details page and on the right side there is a card with heading ADDONS. You can subscribe for historical data API there.
  • Encrypted
    Thanks Sujith.
  • Encrypted
    For BO I am getting following error "the remote server returned an error(400) bad request.
  • Encrypted
    but I am able to place currency order.I think I am not passing parameters as expected.
  • sujith
    Hi,
    Refer java example to check if you are sending correct params.
  • Encrypted
    Encrypted edited September 2017
    .i am able to place order.it is not bracket order that placed. Simultaneously not buy sell order placed. (both buy order placed)but why order rejection status is 'adapter is not ready'.Please refer my query.what is equivalent to placebracketorder() in java.in java there is Order order10 = kiteconnect.placeOrder(param10, "bo");
  • Encrypted
    one more thing here product is showing MIS not BO
  • tonystark
    tonystark edited September 2017
    Hi @Encrypted,

    In dotnetkiteconnect library, PlaceOrder function accepts "Variety" parameter which can be "regular", "amo", "bo" or "co". By default, it is "regular". You can change this to "bo" place bracket order.
  • Encrypted
    I have tried that but that is giving error.(400).
  • Encrypted
    @ajinasokan : Is it working fine for you?
  • tonystark
    Hi @Encrypted,

    What is the error message for that 400 response?
  • Encrypted
    Encrypted edited September 2017
    Remote server returned an error.@sujith,@ajinasokan plz help
  • botany02
    @Encrypted
    You need to catch the WebException to see the complete error response.

    Post your complete code snippet,will be easy to debug.
  • tonystark
    Hi @Encrypted,

    Error code 400 refers to errors from the client side. This happens probably due to incorrect parameters. To collect such errors you can directly print the return value of the PlaceOrder function like this:

    Console.WriteLine(JsonSerialize(kite.PlaceOrder( .... )))

    In your code statement, BO orders should have "LIMIT" as OrderType and the price should not be null.
  • Encrypted
    Hi @ajinasokan ,@botany02 below code is working fine for me
    kite.PlaceOrder("NSE", "INFY", "BUY", "400", quote.LastPrice.ToString(),"MIS", "LIMIT", "DAY", null,null, "30", "2", "2", "regular", "");
    but I wanted to place BO order
    what should be correct code for placing BO order?
    earlier sujith posted me java code but that is different
    I tried below one:
    kite.PlaceOrder("NSE", "INFY", "BUY", "400", quote.LastPrice.ToString(), "MIS", "LIMIT", "DAY", null, null, "30", "2", "2", "BO", ""))
    it is not working.I am getting below error:
    DEBUG: 404 {"status": "error", "message": "Route not found", "error_type": "GeneralException"}

    {"status":"error","message":"Route not found","error_type":"GeneralException"}
    anyone able to place BO using dotnetkiteconnect please help.

  • tonystark
    Hi @Encrypted,

    Variety parameter is in lower case. So it should be "bo" instead of "BO". Try

    kite.PlaceOrder("NSE", "INFY", "BUY", "400", quote.LastPrice.ToString(),"MIS", "LIMIT", "DAY", null,null, "30", "2", "2", "bo", "");
This discussion has been closed.