东方财富
Posted iceredtea
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了东方财富相关的知识,希望对你有一定的参考价值。
# -*- coding: utf-8 -*- import requests import pandas as pd import time ‘‘‘ type = "8201,8202,8193,4,32,64,8207,8209,8211,8213,8215,8204,8203,8194,8,16,128,8208,8210,8212,8214,8216" url = "http://push2ex.eastmoney.com/getAllStockChanges?type=" + type for pageindex in range(0,100): data = { "pageindex": pageindex, "pagesize": 64, "ut": ‘7eea3edcaed734bea9cbfc24409ed989‘, "dpt": ‘wzchanges‘ } html = requests.get(url=url,params=data).text print(html) ‘‘‘ allstock = html[‘data‘][‘allstock‘] date = time.strftime("%Y%m%d", time.localtime()) print(date) stk_code = [] stk_name = [] chg_date = [] chg_time = [] chg_type = [] chg_value= [] data = { "stk_code": stk_code, "stk_name": stk_name, "chg_date": chg_date, "chg_time": chg_time, "chg_type": chg_type, "chg_value": chg_value } for stock in allstock: for key in stock: stk_code.append(stock[‘c‘]) stk_name.append(stock[‘n‘]) chg_date.append(date) chg_time.append(stock[‘tm‘]) chg_type.append(stock[‘t‘]) chg_value.append(stock[‘i‘]) df = pd.DataFrame(data) print(df) ‘‘‘ "tm": 145557, "c": "002797", "m": 0, "n": "第一创业", "t": 64, "i": "4034400" ‘‘‘
以上是关于东方财富的主要内容,如果未能解决你的问题,请参考以下文章