Last active
May 18, 2017 23:48
-
-
Save chiangqiqi/449f39c3366c80030878bfc5382cbc43 to your computer and use it in GitHub Desktop.
云币ETH价格
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import pandas as pd | |
from datetime import datetime | |
def get_data(): | |
url = 'https://plugin.sosobtc.com/widgetembed/data/period' | |
data = requests.get(url, {'symbol':'yunbiethcny', 'step':86400}) | |
return json.loads(data.text) | |
def data2frame(data): | |
df= pd.DataFrame(data) | |
df.columns = ['ts', 'begin', 'high', 'low', 'end', 'vol'] | |
df['dt'] = df.ts.map(lambda i: datetime.fromtimestamp(i)) | |
del df['ts'] | |
return df.set_index('dt') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment