ndri / python-bittrex

Python library for the Bittrex API
67 stars 45 forks source link

convert string to pandas dataframe #16

Open MasterGeorge opened 5 years ago

MasterGeorge commented 5 years ago

I have this code:

import requests import json as JSON import pandas as pd

item = "BTC-LTC" url = "https://bittrex.com/Api/v2.0/pub/market/GetTicks?marketName="+item+"&tickInterval=fiveMin" headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'} response = requests.get(url, headers=headers) print (response.content)

this is the result:

{"success":true,"message":"","result":[{"O":0.00884499,"H":0.00884499,"L":0.00884499,"C":0.00884499,"V":4.93801966,"T":"2019-01-13T02:45:00","BV":0.04367673},{"O":0.00884499,"H":0.00884499,"L":0.00884499,"C":0.00884499,"V":2.06198034,"T":"2019-01-13T02:50:00","BV":0.01823818},{"O":0.00886499,"H":0.00887511,"L":0.00886499,"C":0.00887511,"V":7.10660996,"T":"2019-01-13T02:55:00","BV":0.06300412},

how do i convert this string to json format or pandas dataframe for later use ? notice that this is a response<200> from html and give me a string, and i neet to conver it to a python dict JSON OR PANDAS