conversion of historical data of a stock to data-frame (like in R) or two dimensional array

sudheer1990
I am using historical api provided by Kite, and fetching data in below way

data = urllib.request.urlopen(url).read()
print(data)

output

b'{"status": "success", "data": {"candles": [["2016-03-01T09:15:00+0530",1199,1243.35,1195,1232.9,150747],["2016-03-02T09:15:00+0530",1240,1259.8,1233.9,1243.25,140876],["2016-03-03T09:15:00+0530",1245.7,1259.8,1233,1254.15,226023],["2016-03-04T09:15:00+0530",1255,1256,1232,1239.35,189317],["2016-03-08T09:15:00+0530",1239.1,1254.95,1231.1,1241.15,151748],["2016-03-09T09:15:00+0530",1237.3,1249.7,1233.25,1243.75,304618],["2016-03-10T09:15:00+0530",1248,1250,1226.1,1230.35,157799]]}}'

I want to convert these data into data-frame (time, open, low, high, close ) or 2 D array

kindly tell how to do ?
  • Kailash
    @sudheer1990 this is JSON. You can use any JSON parsing library (every programming language has one), and loop through the ->data->candles[] array and print the values in whatever format you want.
  • sudheer1990
    sudheer1990 edited July 2016
    got it ....thank you. I fixed this issue using Json library
Sign In or Register to comment.