Connecting to live market data stream…
WebSocket error: Handshake status 401 Unauthorized
WebSocket error: on_close() takes 0 positional arguments but 2 were given
Hi @AKHIL_2049352, As mentioned in the error message, are you explicitly passing parameters to the websocket on close event? Could you please share more details?
I tried using the V3 WebSocket as demonstrated in the websocket example code and it’s working as expected.
Please do refer for the V3 Websocket connection and subscription limits
Thanks
Can you please make a full python code as per my requirement? I have tried many times and failed.
@AKHIL_2049352 What is your requirement? it’s working websocket example code
If needed you can share your code for further investigation.
I can give you my full strategy. Can you make full script of that strategy.
If nifty breaks Very first 15 minute candle’s high or low then execute a buy trade.
If breaks high then call option and if breaks low then put option.
Option should be nearest weekly expiry and premium within 100-125. If 2 or more contracts in this range then choose higher one in this range. If no contract in this range then consider 95-135 range and choose one. If multiple contracts available choose higher one.
Option contact around ATM maximum ranges 300 points each side.
Target 15% and stoploss 5% for avoid stoploss slip use trigger price 5% and price 2 points below trigger price.
Place market order with 1 lot.
Only one entry per day
Please make this conditions as a python script. I have tried multiple times every time there will be errors so please help me.
Thanks for sharing your idea. We won’t be able to help with writing or building custom trading strategies, but if you face any issues with the API itself, do share the details here — we’ll be more than happy to help you out.
This strategy will make you loss in option buying bro. It may work in option selling but don’t try such strategy in option buying. It is suitable for equity trading or option selling. But option buying is not for this kind of strategy.
Thanks for your observation. I will reassure the risk of this strategy.
D:\Upstox_project\node-v22.18.0-win-x64\upstox_node_bot>node live_feed.js
Connecting to Upstox feed…
WebSocket error: Unexpected server response: 401
WebSocket closed
Why this error
Bro I am also a trader like you. Need to ask to Upstox team.
Are you getting any data or only this error?