Open santhosh1vaddi opened 2 months ago
i need to know LTP of any strike price. please share details if someone has it For example : 12852482 BANKNIFTY2480751600CE
Same problem. client.quotes(instrument_tokens=[{'instrument_token': 2885, 'exchange_segment': 'nse_cm'}]) it is returning nothing
Yes, I am facing this issue since last 15 days. Their API team does not know anything. According to their everything is working.
Hi
It is working. You have to define callback function. It is not convenient. They are working on new quotes function. Expected release 31 aug.
On Sat, 10 Aug, 2024, 9:27 pm Rajan, @.***> wrote:
Yes, I am facing this issue since last 15 days. Their API team does not know anything. According to their everything is working.
— Reply to this email directly, view it on GitHub https://github.com/Kotak-Neo/kotak-neo-api/issues/218#issuecomment-2282193519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIDIZGKAKK3WETEGOTVHCG3ZQY2ALAVCNFSM6AAAAABMEH2PIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSGE4TGNJRHE . You are receiving this because you commented.Message ID: @.***>
Hi It is working. You have to define callback function. It is not convenient. They are working on new quotes function. Expected release 31 aug. … On Sat, 10 Aug, 2024, 9:27 pm Rajan, @.> wrote: Yes, I am facing this issue since last 15 days. Their API team does not know anything. According to their everything is working. — Reply to this email directly, view it on GitHub <#218 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIDIZGKAKK3WETEGOTVHCG3ZQY2ALAVCNFSM6AAAAABMEH2PIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSGE4TGNJRHE . You are receiving this because you commented.Message ID: @.>
I have defined the call back functions. Earlier it was working. All of sudden it stops working. There is an issue from the end of the kotak api.
is there any solution we have got for this issue? i have tried a below, still its returning None.
@chetan-deshpande as you can see this issue is pending from so many days and has not been resolved till now. It means the kotak api team does not know anything and their api is useless. It will be better if you shift to any other api which has better customer support and less issues. If you use kotak api I am sure you may incur a loss because of the glitches in their api. Most important is, their customer support is worst. They do not even accept that the fault is from their api side. Better to shift any other platform such as angle one, upstox, Zerodha etc. Do not stick with kotak Neo because of zero brokerage.
@RajanGoyal1002 , that's true, no point in talking about it. I have moved to upstox just for getting the quotings, then I am placing the orders accordingly in neo. that's kind of working for me as of now.
@chetan-deshpande can you send me your python code. It will help me a lot. My email id is rajangoyal68@gmail.com
Setup Callbacks for websocket events (Optional)
client.on_message = on_message # called when message is received from websocket client.on_error = on_error # called when any error or exception occurs in code or websocket client.on_close = None # called when websocket connection is closed client.on_open = None # called when websocket successfully connects
inst_tokens = [{"instrument_token": "12851458", "exchange_segment": "nse_fo"}]
LTP = client.quotes(instrument_tokens=inst_tokens, quote_type="", isIndex=False)
are you using correct token? 12852482 BANKNIFTY2480751600CE, for this i see correct token as 50205. make sure to use correct token
i am able to fetch quotes with attached code screenshot
@Chetansuri7 I am also getting today. Last week also same thing happened. I got data on sunday but on monday again it stopped working. No doubt kotak is cheapest option but not the trustworthy. Their support service is worst. I have shifted to zerodha and though it is paid but their service is good. You will get instant reply. In my opinion for paper trading kotak neo is good. you will learn a lot but for real trading go for paid one.
@Chetansuri7 I am also getting today. Last week also same thing happened. I got data on sunday but on monday again it stopped working. No doubt kotak is cheapest option but not the trustworthy. Their support service is worst. I have shifted to zerodha and though it is paid but their service is good. You will get instant reply. In my opinion for paper trading kotak neo is good. you will learn a lot but for real trading go for paid one.
I haven't had API issues with kotak, but yeah they aren't providing much support and fixes. zerodha is too costly to run and even they are known for latency in their data at times. Try AngelOne api, but their rate limit is kind of lower than zerodha. I guess its about paid vs free for lower limit in free API's.
Tiered pricing of API's could do great for brokers.
import logging import time from threading import Timer from time import sleep import multiprocessing from neo_api_client import NeoAPI import traceback import sys import requests import os import pandas as pd from datetime import datetime, time,timedelta from dateutil.relativedelta import relativedelta import IPython from IPython.display import display, Javascript import calendar import ast
today = datetime.now()
logger = logging.getLogger()
if logger.hasHandlers(): logger.handlers.clear()
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filename='log_file.log', # Log file name filemode='a') # Append to log file
stream_handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') stream_handler.setFormatter(formatter)
logger.addHandler(stream_handler)
CK= "" CS= "" Mob = "" pwd = "" token= '' client = NeoAPI(consumer_key=CK, consumer_secret=CS, environment='prod', access_token=None, neo_fin_key=None) ret = client.login(mobilenumber=Mob, password=pwd) start = client.session_2fa(OTP=token)
inst_tokens=[{'instrument_token': 'SENSEX', 'exchange_segment': 'bse_cm'}] def subscribe_func(): global inst_tokens try:
print("subscribing the session")
client.subscribe(instrument_tokens=inst_tokens, isIndex=True, isDepth=False)
except Exception as e:
print("Exception while connection to socket->socket: %s\n" % e)
def un_subscribe_func(): global inst_tokens print("Unsubscribing the session") client.un_subscribe(instrument_tokens=inst_tokens, isIndex=True, isDepth=False)
def on_message(message): t=1 print(f'[OnMessage]:{message}')
def on_error(message): t=1 print(f'[OnError]: {message}')
def on_open(message): t=1 print(f'[OnOpen]: {message}')
def on_close(message): t=1 print(f'[OnClose]: {message}')
client.on_message = on_message # called when message is received from websocket client.on_error = on_error # called when any error or exception occurs in code or websocket client.on_close = on_close # called when websocket connection is closed client.on_open = on_open # called when websocket successfully connects
inst_tokens=[{'instrument_token': 'SENSEX', 'exchange_segment': 'bse_cm'}] client.quotes(instrument_tokens=inst_tokens, quote_type="", isIndex=True)
inst_tokens=[{'instrument_token': 'SENSEX', 'exchange_segment': 'bse_cm'}] client.subscribe(instrument_tokens=inst_tokens, isIndex=True, isDepth=False)
client.un_subscribe(instrument_tokens=inst_tokens, isIndex=True, isDepth=False)
Can you please try this code, put your 5 credentials and run this and at bottom you will find quotes, subscribe and unsubscribe, do run one by one based on your need
Thanks
@chetan-deshpande , @Chetansuri7 @RajanGoyal1002 , @ramprasad12323 , can you please send me you contact number for more conversation on this email id ronusen19@gmail.com ?
I am building one AI Algo trading tool so.
Hi It is working. You have to define callback function. It is not convenient. They are working on new quotes function. Expected release 31 aug. … On Sat, 10 Aug, 2024, 9:27 pm Rajan, @.> wrote: Yes, I am facing this issue since last 15 days. Their API team does not know anything. According to their everything is working. — Reply to this email directly, view it on GitHub <#218 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIDIZGKAKK3WETEGOTVHCG3ZQY2ALAVCNFSM6AAAAABMEH2PIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSGE4TGNJRHE . You are receiving this because you commented.Message ID: @.>
Hi @ramprasad12323 , @RajanGoyal1002 , facing intermittent issue for multiple time in client quotes like this , can you please ask the dev team to fix this issue as well with proper exceptional handling so that while running client.quotes mulltiple time this error should not get printed as it shows generally after running client quotes multiple times in same logged in session
2024-08-27 14:48:10,657 - websocket - INFO - Websocket connected 2024-08-27 14:48:10,659 - websocket - ERROR - error from callback <bound method StartServer.on_open of <neo_api_client.HSWebSocketLib.StartServer object at 0x000001F5ADB6A050>>: Connection is already closed. 2024-08-27 14:48:10,660 - root - INFO - [OnError]: Connection is already closed. 2024-08-27 14:48:11,999 - websocket - INFO - Connection to remote host was lost. - reconnect 2024-08-27 14:48:12,014 - websocket - INFO - reconnect() - retrying in 5 seconds [8 frames in stack] 2024-08-27 14:48:14,916 - websocket - INFO - Connection to remote host was lost. - reconnect 2024-08-27 14:48:14,932 - websocket - INFO - reconnect() - retrying in 5 seconds [8 frames in stack] 2024-08-27 14:48:15,391 - websocket - INFO - Websocket connected 2024-08-27 14:48:15,394 - websocket - ERROR - error from callback <bound method StartServer.on_open of <neo_api_client.HSWebSocketLib.StartServer object at 0x000001F5AD87C2
Raised a issue ticket as well : https://github.com/Kotak-Neo/kotak-neo-api/issues/224
@chetan-deshpande , @Chetansuri7 @RajanGoyal1002 , @ramprasad12323 , can you please send me you contact number for more conversation on this email id ronusen19@gmail.com ?
I am building one AI Algo trading tool so.
You can create an algo trading tool. But not AI one. The stock market follows brownian motion which is completely random and does not exhibit any pattern. So you can not use ML and data science to predict the stock market especially in option trading. By the way which ML and DS algo you are using to predict options price.
@chetan-deshpande , @Chetansuri7 @RajanGoyal1002 , @ramprasad12323 , can you please send me you contact number for more conversation on this email id ronusen19@gmail.com ? I am building one AI Algo trading tool so.
You can create an algo trading tool. But not AI one. The stock market follows brownian motion which is completely random and does not exhibit any pattern. So you can not use ML and data science to predict the stock market especially in option trading. By the way which ML and DS algo you are using to predict options price.
Custom Rule Based Association and also will be adding super trend indication with Sarimax and LSTM use
@chetan-deshpande , @Chetansuri7 @RajanGoyal1002 , @ramprasad12323 , can you please send me you contact number for more conversation on this email id ronusen19@gmail.com ? I am building one AI Algo trading tool so.
You can create an algo trading tool. But not AI one. The stock market follows brownian motion which is completely random and does not exhibit any pattern. So you can not use ML and data science to predict the stock market especially in option trading. By the way which ML and DS algo you are using to predict options price.
Custom Rule Based Association and also will be adding super trend indication with Sarimax and LSTM use
and how you are utilizing this api in your tool ?
Hi @RajanGoyal1002 , can you please reply on this ?
@Sunil2k1S If you remove seasonality and trend then you won't get any pattern. LSTM or any other deep learning algo won't work. You can use super trend or any other technical indicator but all are lagging. Risk management can only help.
@chetan-deshpande can you share your upstox code for LTP to santhosh123vaddi@gmail.com
Setup Callbacks for websocket events (Optional)
client.on_message = on_message # called when message is received from websocket client.on_error = on_error # called when any error or exception occurs in code or websocket client.on_close = None # called when websocket connection is closed client.on_open = None # called when websocket successfully connects
inst_tokens = [{"instrument_token": "12851458", "exchange_segment": "nse_fo"}]
LTP = client.quotes(instrument_tokens=inst_tokens, quote_type="", isIndex=False)