Skip to content

Instantly share code, notes, and snippets.

@chiangqiqi
Last active May 18, 2017 23:48
Show Gist options
  • Save chiangqiqi/449f39c3366c80030878bfc5382cbc43 to your computer and use it in GitHub Desktop.
Save chiangqiqi/449f39c3366c80030878bfc5382cbc43 to your computer and use it in GitHub Desktop.
云币ETH价格
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