Comments (5)
it seems they have some session time, which is default to 3600 seconds (1 hr).
we can update that and we need not have to login again for specified period.
https://napi.kotaksecurities.com/devportal/applications/
note: I was also facing same issue, I am also trying the same now.
after try please add your views
from kotak-neo-api.
Hi Shidas,
client.modify_order(order_id = "", price = 0, quantity = 1, disclosed_quantity = 0, trigger_price = 0, validity = "GFD")
To use modify order, I need client object. This object is initiating the login process. If I have logged in one time, I should not require to login again till session timeout.
from kotak-neo-api.
@shusinghal That may be because you are calling client.login(mobilenumber=neo_creds.mobile_num, password=neo_creds.password)
again. This is what I am doing:
Ex.,
neo_object = None
def get_neo_client():
if neo_object is not None:
return neo_object
# Normal login process
client = NeoAPI(access_token=neo_creds.accesstoken.strip(), consumer_key=neo_creds.consumerkey.strip(),
consumer_secret=neo_creds.consumer_secret.strip(), environment='prod', on_close=None, on_open=None)
.....
.....
# Once session is generated, set neo_object
neo_object = client
from kotak-neo-api.
As per my analysis,
once you are logged in to kotak api and generated session,
generated session is used in all your subsequent request.
Library is not doing re-login
`class ModifyOrder(object):
def init(self, api_client):
self.api_client = api_client ## already logged in session
self.rest_client = rest.RESTClientObject(api_client.configuration)
def quick_modification(self, order_id, price, order_type, quantity, validity, instrument_token,
exchange_segment, product, trading_symbol, transaction_type, trigger_price,
dd, market_protection, disclosed_quantity, filled_quantity, amo):
header_params = {'Authorization': "Bearer " + self.api_client.configuration.bearer_token,
"Sid": self.api_client.configuration.edit_sid,
"Auth": self.api_client.configuration.edit_token,
"neo-fin-key": self.api_client.configuration.get_neo_fin_key(),
"Content-Type": "application/x-www-form-urlencoded"}
body_params = {"tk": instrument_token, "mp": market_protection, "pc": product, "dd": dd,
"dq": disclosed_quantity, "vd": validity, "ts": trading_symbol, "tt": transaction_type,
"pr": price, "pt": order_type, "fq": filled_quantity, 'am': amo,
"tp": trigger_price, "qt": quantity, "no": order_id, "es": exchange_segment}
query_params = {"sId": self.api_client.configuration.serverId}
try:
URL = self.api_client.configuration.get_url_details("modify_order")
orders_resp = self.rest_client.request(
url=URL, method='POST',
query_params=query_params,
headers=header_params,
body=body_params
)
return orders_resp.json()
except ApiException as ex:
return {"error": ex}`
from kotak-neo-api.
@shusinghal The library is not re-logging while calling any method. Please debug your code to rectify this issue.
from kotak-neo-api.
Related Issues (20)
- How to exit positions with order id or Exit all positions?
- Invalid option 'LIVE' for environment, it should be 'PROD'
- Expiry format should be in YYYYMMDD, and not YYMM
- order_report() api is failing for live account HOT 1
- Time pExpiry date column in files returned by scrip_master() is off by 10 years HOT 4
- How to get available margin HOT 1
- Documentation or root cause analysis for Not_Ok response in position api HOT 1
- web socket not supported error HOT 5
- Unable to calculate PNL using formula provided in API docs HOT 13
- incorrect key value pairs in quotes api HOT 3
- Orderfeed connection getting lost HOT 2
- Bracket Order Issue HOT 1
- Quote api not working since 6 Nov HOT 2
- What is the difference between client.quotes and client.subscribe? HOT 2
- Issue with on_close in websocket HOT 1
- Square off option API HOT 2
- Need an api for net mtm pnl HOT 2
- order placement - product type HOT 1
- response from order_report() HOT 1
- All the scripts getting unsubscribed when trying to unsubscribe one script HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotak-neo-api.