#获取数据货币行情 def get_szhb(): c = ['id','open','close','low','high','amount','vol','count'] df = pd.DataFrame(columns=c) url = 'https://api.huobi.pro/market/history/kline?period=1day&size=200&symbol=btcusdt' #1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1mon, 1week, 1year response = requests.get(url) res_dict = json.loads(response.text) list_lsit = res_dict['data'] db ={} for item in list_lsit: db['id'] = item['id'] db['open'] = item['open'] db['close'] = item['close'] db['low'] = item['low'] db['high'] = item['high'] db['amount'] = item['amount'] db['vol'] = item['vol'] db['count'] = item['count'] df = df.append(db,ignore_index=True) return df