got an unexpected keyword argument "trigger_values" while placing GTT order

Dileep
Dileep edited September 2 in Python client
Hi,
When i place GTT order through python API getting the error as "place_order() got an unexpected keyword argument 'trigger_values"
kite.place_order(tradingsymbol="HDFCBANK20SEPFUT",
quantity=550,
trigger_values=[1150.0, 1160.0],
exchange="NFO",
variety="regular",
order_type="MARKET",
transaction_type="SELL",
product="NRML"
)
I am placing a market order with stoploss and target
Can any one help me to fix the issue.
  • sujith
    You can check out the documentation here to know more about placing GTT.
  • Dileep
    Dileep edited September 3
    Hi @sujith last_price is mandatory in condition ,if i place Market order of GTT ?
  • rakeshr
    Yes, last_price is a mandatory field. And GTT orders are placed as the limit. You can go through this article to know more about GTT.
  • Dileep
    Dileep edited September 3
    Thanks @rakeshr , @sujith So , through Web UI i can place market order, but through API i can place only limit order of GTT?

    This is below sample code of mine i am placing limit order of infy at 702. and placing target order at 710. But i am getting the error.Can you please advise what needs to modify in the below code.
    kite.place_order(
    type="single",
    condition= {
    "exchange":"NSE",
    "tradingsymbol":"INFY",
    "trigger_values":[702.0],
    "last_price":742.0
    },
    orders=
    {
    "exchange":"NSE",
    "tradingsymbol":"INFY",
    "transaction_type": "SELL",
    "quantity": 1,
    "order_type": "LIMIT",
    "product":"CNC",
    "price":710
    }
    )

    getting error as place_order() got an unexpected keyword argument 'type'
    Note: type is a keyword in python.Can you change the parameter name in your code?
  • sujith
    I think you are confused between place order and place GTT.
    Can you let us know in detail, what are you trying to achieve?
  • Dileep
    Dileep edited September 3
    Hi @sujith i am replacing BO with GTT . Can you provide the sample code?


  • rakeshr
    i am replacing BO with GTT
    No, you can't place BO order with GTT or via versa, both are independent and different product.
    The order placement APIs don't accept GTT fields. So, you need to place either GTT or Order Placement, as per your requirement.
  • Dileep
    Hi @rakeshr , @sujith

    In web UI i am able to place GTT with target and stoploss with market order of selling a "HDFCBANK future" can i achive the same using API.?
  • rakeshr
    @Dileep
    place GTT with target and stoploss with market order of selling
    Yes, you can achieve this by Sell two-leg gtt order. You have to set stoploss and target values as trigger price in two leg GTT.
    Eg. Here for HDFCBANK for last_price = 1135.60 and if you want stoploss and target % = 2 %
    stoploss = 1112.8 and target = 1158.3
    "trigger_values":[1112.8, 1158.3]
    You can go through this documentation.
  • Dileep
    Hi @rakeshr thanks for your help. Now i am able to successfully place the GTT created. But HDFCBANK not showing in the Positions. Means it is just created GTT, But not entered in to the Postion with market order. Please advise me.


    trigger_type="two-leg",
    tradingsymbol ="HDFCBANK20SEPFUT",
    exchange="NFO",
    trigger_values=[1112,1158],
    last_price=1138.95,
    Where should we mention "Market" order type in the code?
  • rakeshr
    @Dileep
    Means it is just created GTT, But not entered in to the Postion with market order
    Yes, GTT is created, and once that triggered param is meet. It will be executed as Market.
Sign In or Register to comment.