commodities orders

nikhil154
I cannot place my order for crude oil . Is there a proble in my code or Is order placing for CRUDEOIL not provided ?

def limit_order(scrip,qty,price,call):
try:
kite.place_order(variety="REGULAR",
validity="DAY",
exchange="MCX",
tradingsymbol=scrip,
transaction_type=call,
quantity=qty,
product="NRML",
order_type="LIMIT",
price=price)

except:
pass

CNC_limit_order("CRUDEOIL22MAY8500PE",100,355,"SELL")

* Not a funds problem
  • nikhil154
    the syntax is good , don't know why it posted that way
  • SRIJAN
    Whenever you post a query,you should post the error stacktrace, otherwise,how can anyone correctly identify the problem??

    However,first of all,your function name is limit_order but you are calling CNC_limit_order.
    Second,you are sending variety in upper-case,which should be small-case .
    https://kite.trade/docs/connect/v3/orders/#glossary-of-constants
  • nikhil154
    sorry , the cnc_limit function , i did not edit it correctly . I removed the order code from the function and executed it separately . It worked , Don't know why the same code does not work when used in a funtion.
  • SRIJAN
    Beacuse you have a pass statement in the except block.
    KiteConnect was throwing exception because of invalid variety(upper-case),but the program just ignored it.
Sign In or Register to comment.