• 获取数字货币行情


    #获取数据货币行情
    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
    

      

  • 相关阅读:
    为服务部署 Jekins的使用
    spring cloud
    docker
    WebSocket
    idea
    maven
    SQL四种语言(DDL、 DML、 DCL、 TCL)
    十大经典排序
    AVL树的旋转图解和简单实现
    多个线程交替打印
  • 原文地址:https://www.cnblogs.com/wumac/p/13564477.html
Copyright © 2020-2023  润新知