Postback not working for my id

Rishant
Hi,

I have implemented Postback.When I am using the following code, the postback is working but it is not working with Zerodha Postback. Can you please help in this ?

import requests
import json
import urllib2
payload ={
"order_id": "16032300017157",
"exchange_order_id": "511220371736111",
"placed_by": "AB0012",
"status": "COMPLETE",
"status_message": "",

"tradingsymbol": "SUZLON",
"exchange": "NSE",
"order_type": "MARKET",
"transaction_type": "SELL",
"validity": "DAY",
"product": "CNC",

"average_price": 376.35,
"price": 376.35,
"quantity": 1,
"filled_quantity": 1,
"unfilled_quantity": 0,
"trigger_price": 0,
"status_message": "",
"order_timestamp": "2015-12-20 15:01:43",
"exchange_timestamp": "2015-12-20 15:01:43",
"checksum": "5aa3f8e3c8cc41cff362de9f73212e28"
}

#payload = 'payload=RishantMumbaiCheck123'
r = requests.post('https://xxx.com/', json =payload)

datadump = json.dumps(payload)

print type(datadump)
print type(payload)
print r
  • Vivek
    Can you please post your App name you have registered with Zerodha ?
  • Vivek
    I was checking orderbook for your registered app and it seems like all of the orders has been placed from Kite web and not through your app. Your app will be getting postbacks only for the orders placed via itself and not for other platforms for the user id.
  • Rishant
    I sent an order using my Kite Connect api also. It also doesnot result in the postback. Does the order need to come from https://database-165705.appspot.com/ ?
    Will the postback not be generated if I use my local system which has a different address than my application mentioned above and place order via Kite connect api?
  • sujith
    HI @Rishant,
    It is based on api_key of the app from where the order was originated.
  • Rishant
    I placed an order using the below code.

    from kiteconnect import KiteConnect

    specs = {}
    specs['access_token']="xxxxx"
    specs['api_key'] = "yyyyyyyy"
    kite = KiteConnect(specs['api_key'])
    kite.set_access_token(specs['access_token'])

    r = kite.order_place(exchange ="NSE",tradingsymbol = "ACC" ,quantity = 1, transaction_type = "BUY",order_type = "MARKET",product ="MIS")

    The order was placed and rejected as well. I did not receive any postback. Is it the case that first I need to have an open position and only if the open Position changes to cancelled or complete, I will receive a postback ?

    If I simply place an order and it got rejected , than it would not come in the postback message that the order got rejected ?
  • Rishant
    So,
    I got a postback for the completed order but not for the rejected one.

    Following was the rejected order:
    PRICE
    ₹0.00
    TRIGGER PRICE
    ₹0.00
    ORDER PLACED BY
    DR1125
    ORDER TYPE
    MARKET
    PRODUCT / VALIDITY
    MIS / DAY
    TIME
    2017-06-30 10:03:10
    ORDER ID
    170630000182404
    EXCHANGE ORDER ID

    EXCHANGE TIME

    STATUS
    REJECTED
    STATUS MESSAGE
    rms:margin exceeds,required:109.70, available:3.04 for entity account-dr1125 across exchange across segment across product

    Can you check once and let me know. It would be great help as I am about to go live with the new callback feature implemented in my Strategy.
  • Vivek
    We can see the postbacks sent in our logs and one of the request also returned us 200 response. Seems like it's an issue at your end.
    INFO:2017/06/30 10:03:13 https://database-165705.appspot.com/ 500
    INFO:2017/06/30 10:28:51 https://database-165705.appspot.com/ 200
  • Rishant
    Thanks a lot @vivek . Let me check on my end the reason for it to fail.
This discussion has been closed.