GTT Order getting failed

chetanjadhav
chetanjadhav edited June 21 in Python client
# Replace these with your actual API key and API secret
from kiteconnect import KiteConnect

kite = KiteConnect(api_key="###############")
access_token = "####################"

orders = [
{
"transaction_type": KiteConnect.TRANSACTION_TYPE_SELL,
"quantity": 1,
"price": 124.00,
"order_type":KiteConnect.ORDER_TYPE_LIMIT,
"product":KiteConnect.PRODUCT_CNC,
}, {
"transaction_type": KiteConnect.TRANSACTION_TYPE_SELL,
"quantity": 1,
"price": 123.00,
"order_type":KiteConnect.ORDER_TYPE_LIMIT,
"product":KiteConnect.PRODUCT_CNC,
},
]
kite.set_access_token(access_token)
order_id = kite.place_gtt (
trigger_type=KiteConnect.GTT_TYPE_TWO_LEG,
exchange="NSE",
symbol="IDFC",
last_price=123.70,
orders=orders,
)
print ("--order_id--",order_id)

I am gettign this error

order_id = kite.place_gtt (
AttributeError: 'KiteConnect' object has no attribute 'place_gtt'

I don't see any documentation or sample code to how to place this order

Note : I want to place GTT order or a order with stoploss and targe
  • sujith
    You can refer to the example here.
  • chetanjadhav
    chetanjadhav edited June 24
    Hi Sujith, Thanks for the reply.
    but the code you suggested is not working as per my expectation.



    above two images are from kite web. I want to place orders like this

    but the code you suggested are giving output like below


    kindly please advice


  • sujith
    Placing GTT with an order is a feature exclusive to Kite web and app, you can use order updates via Websockets and place OCO GTT once an order gets filled or completed.
  • chetanjadhav
    chetanjadhav edited June 24
    so you're saying we can not place an order through the code as per first image in this conversation
  • sujith
    You can code it as mentioned above.
Sign In or Register to comment.