码迷,mamicode.com
首页 > 其他好文 > 详细

东方财富

时间:2019-11-16 14:28:23      阅读:72      评论:0      收藏:0      [点我收藏+]

标签:span   财富   style   time   dex   class   append   sts   oca   

# -*- 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"
        ‘‘‘

 

东方财富

标签:span   财富   style   time   dex   class   append   sts   oca   

原文地址:https://www.cnblogs.com/Iceredtea/p/11871465.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!