Hello Devs
I want to extract only I1 OHLC data in marketfeed stream in websocket through python, can you write an example code for me so that i can implement that in my main code without printing whole FULL mode data…
Hello Devs
I want to extract only I1 OHLC data in marketfeed stream in websocket through python, can you write an example code for me so that i can implement that in my main code without printing whole FULL mode data…
Share your code when you print the entire object.
Technically, accessing the 1-day OHLC data from a WebSocket should be straightforward. Consider the following full feed response:
To find the OHLC, use:
["feeds"]["{instrument_key}"]["ff"]["marketOHLC"]["OHLC"]
Then loop through it to match the interval to 1d
.
{
"type": "live_feed",
"feeds": {
"NSE_INDEX|Nifty 50": {
"ff": {
"indexFF": {
"ltpc": {
"ltp": 19047.25,
"ltt": "1698402306000",
"cp": 18857.25
},
"marketOHLC": {
"ohlc": [
{
"interval": "1d",
"open": 18928.75,
"high": 19076.15,
"low": 18926.65,
"close": 19047.25,
"ts": "1698345000000"
},
{
"interval": "I1",
"open": 19049.7,
"high": 19060.5,
"low": 19049.7,
"close": 19060.5,
"ts": "1698400740000"
},
{
"interval": "I1",
"open": 19059.7,
"high": 19059.7,
"low": 19059.7,
"close": 19059.7,
"ts": "1698400800000"
},
{
"interval": "I30",
"open": 19066.2,
"high": 19071.65,
"low": 19036.85,
"close": 19036.85,
"ts": "1698398100000"
},
{
"interval": "I30",
"open": 19037.4,
"high": 19060.5,
"low": 19033.7,
"close": 19059.7,
"ts": "1698399900000"
}
]
},
"yh": 20222.45,
"yl": 16828.35
}
}
}
}
}
https://github.com/Pritish8619/Upstox-Trial5 please go through this code and tell me what i need to do to extract I1 OHLC data in live feeds…Please rely soon
Hello @Pradeep_Jaiswar, @Pritish_Dash
I was also confused by this because there are two I1 and I3, and I don’t know which one to use.
I got the answer please read