Algo order placing Error

nikhil154
My algo is written in python .
When i try to place an order , it gives as error - Invalid `api_key` or `access_token`

def placeorder(scrip,qty,PRICE):
kite.place_order(variety="REGULAR",
exchange="NSE",
tradingsymbol=scrip,
transaction_type="BUY",
quantity=qty,
product="MIS",
order_type="LIMIT",
price=PRICE)

1. I can download data perfectly and also get the quotes perfectly
2. I have also enabled 2 factor authentication.
3. I have run these codes before and they have worked perfectly .


Can someone please tell me the error ?
What am i missing ?
  • nikhil154
    i even changed 'REGULAR' to 'regular'
  • dearsatya
    #This wrapper function works for me:

    def PlaceBuyOrderLimitNSE(self, tradingsymbol, qty, price):
    orderid = 1
    try:
    orderid = self.kite.place_order(variety=self.kite.VARIETY_REGULAR,
    exchange=self.kite.EXCHANGE_NSE,
    product=self.kite.PRODUCT_MIS,
    order_type=self.kite.ORDER_TYPE_LIMIT,
    tradingsymbol= tradingsymbol,
    transaction_type=self.kite.TRANSACTION_TYPE_BUY,
    quantity = qty,
    price= price
    )
    except Exception as e:
    print("Order placement failed: {}".format(e))
    return orderid
Sign In or Register to comment.