Kotak-Neo / kotak-neo-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facing Issue while placing order

VNivasChowdary opened this issue · comments

The error message says

{'stat': 'Not_Ok', 'error': [{'code': '10020', 'message': 'Authentication Failed'}], 'tid': 'server3_27430'}

here is my code

try:
    od=client.place_order(exchange_segment='nse_cm', product='NRML', price='0', order_type='MKT', quantity='15', validity='DAY', trading_symbol='IDFC-EQ',
                       transaction_type='B', amo="NO", disclosed_quantity="0", market_protection="0", pf="N",
                       trigger_price="0", tag=None)
    print(od)
except Exception as e:
    print("Exception when calling OrderApi->place_order: %s\n" % e)

@VNivasChowdary
This error occurred because your authentication was not completed properly
see #166

@nprejit

This is my login code

from neo_api_client import NeoAPI
import creds as c

client = NeoAPI(consumer_key=c.consumer_key, consumer_secret=c.consumer_secret, environment='prod',
                access_token=None, neo_fin_key=None)

# client = NeoAPI(consumer_key=c.consumer_key, consumer_secret=c.consumer_secret, environment='prod') I have tried with this also 

print(client.login(mobilenumber="+91XXXXXXXX", password=c.password))
print(client.session_2fa(OTP=c.mpin))

This is my place order code

print(client.place_order(exchange_segment="nse_fo", product="NRML", price="0", order_type="MKT", quantity="15", validity="DAY", trading_symbol="BANKNIFTY2471652300PE",
                       transaction_type="B", amo="NO", disclosed_quantity="0", market_protection="0", pf="N",
                       trigger_price="0",tag=None))

My creds are correct, I was able to fetch my name and other details but it is showing below error

{'error': [{'code': '10525', 'message': 'Your account is locked, your account locked for today'}]}

@VNivasChowdary

Your account is locked because of 5 wrong credential attempts, you change the password from the web or wait for tomorrow.

Note: check client.session_2fa response 'rid' and 'sid' must be same as client.login response, if not, place order show the error
{'stat': 'Not_Ok', 'error': [{'code': '10020', 'message': 'Authentication Failed'}]
other functions will work like margins, order report etc.