基于Python实现股票数据分析的可视化

 更新时间:2021年12月31日 10:26:20   作者:hhh江月  
在购买股票的时候,可以使用历史数据来对当前的股票的走势进行预测,这就需要对股票的数据进行获取并且进行一定的分析。本文将介绍如何通过Python实现股票数据分析的可视化,需要的可以参考一下

一、简介

我们知道在购买股票的时候,可以使用历史数据来对当前的股票的走势进行预测,这就需要对股票的数据进行获取并且进行一定的分析,当然了,人们是比较喜欢图形化的界面的,因此,我们在这里采用一种可视化的方法来实现股票数据的分析。

二、代码

1、主文件

from work1 import get_data
from work1 import read_data
from work1 import plot_data
import pymysql
from uitest import MyFrame1
import wx
from database1 import write_to_base
import time


class CalcFrame(MyFrame1):
    def __init__(self, parent):
        MyFrame1.__init__(self, parent)
    # Virtual event handlers, overide them in your derived class


    def get_data(self, event):
        """
        获取数据
        :param event: 点击
        :return: 空
        """
        get_data()
        time.sleep(2)
        dlg = wx.MessageDialog(None, '已经成功获取数据', '获取数据')

        result = dlg.ShowModal()
        dlg.Destroy()

        event.Skip()


    def store_data(self, event):
        """
        存储数据
        :param event: 点击
        :return: 空
        """
        write_to_base()

        dlg = wx.MessageDialog(None, '已经成功存储数据', '存储数据')

        result = dlg.ShowModal()
        dlg.Destroy()

        event.Skip()


    def read_data(self, event):
        """
        读取数据
        :param event: 点击
        :return: 空
        """
        df0 = read_data()

        dlg = wx.MessageDialog(None, '已经成功读取数据', '读取数据')

        result = dlg.ShowModal()
        dlg.Destroy()

        event.Skip()


    def show_data(self, event):
        """
        展示数据
        :param event: 点击
        :return: 空
        """
        df0 = read_data()
        plot_data(df0)

        event.Skip()


if __name__ == '__main__':
    """
    主函数
    """

    app = wx.App(False)
    frame = CalcFrame(None)
    frame.Show(True)
    # start the applications
    app.MainLoop()


2、数据库使用文件

import pymysql
import pandas as pd


def write_to_base():
    # pass


    """
    写入数据库
    :return:空
    """
    df0 = pd.read_csv('./data.csv')
    df0[['ts_code']] = df0[['ts_code']].astype(str)
    df0[['trade_date']] = df0[['trade_date']].astype(str)
    df0[['open']] = df0[['open']].astype(str)
    df0[['high']] = df0[['high']].astype(str)
    df0[['low']] = df0[['low']].astype(str)
    df0[['close']] = df0[['close']].astype(str)
    df0[['pre_close']] = df0[['pre_close']].astype(str)
    df0[['change']] = df0[['change']].astype(str)
    df0[['pct_chg']] = df0[['pct_chg']].astype(str)
    df0[['vol']] = df0[['vol']].astype(str)
    df0[['amount']] = df0[['amount']].astype(str)
    # df0[['pre_close']] = df0[['pre_close']].astype(str)
    # df0[['ts_code']] = df0[['ts_code']].astype(str)

    # 打开数据库连接
    # print(data)
    # data = tuple(data)
    db = pymysql.connect(host="localhost",
                         user="root",
                         password="671513",
                         db="base1")

    # 使用cursor()方法获取操作游标
    cursor = db.cursor()
    # db.commit()
    # db.ping(reconnect=True)
    db.ping(reconnect=True)
    cursor.execute("use base1")

    db.commit()

    cursor.execute("truncate table tb")
    db.commit()

    sql = "INSERT INTO tb(ts_code,trdae_date,open,high,low,close,pre_close,changed,pct_chg,vol,amount) \
           VALUES ('%s', '%s',  '%s',  '%s',  '%s', '%s', '%s',  '%s',  '%s',  '%s', '%s')"
    # ('%s', '%s',  '%s',  '%s',  '%s', '%s', '%s',  '%s',  '%s',  '%s', '%s')"
    # ('000001.SZ','20210716','21.41','21.82','21.3','21.34','21.62','-0.28','-1.2951','573002.61','1230180.813')
    # ('%s', '%s',  '%s',  '%s',  '%s', '%s', '%s',  '%s',  '%s',  '%s', '%s')

    for i in range(220):


        db.ping(reconnect=True)
        # 执行sql语句
        cursor.execute(sql %\
                       (df0.iloc[i, 1], df0.iloc[i, 2], df0.iloc[i, 3], df0.iloc[i, 4],
                        df0.iloc[i, 5], df0.iloc[i, 6], df0.iloc[i, 7], df0.iloc[i, 8],
                        df0.iloc[i, 9], df0.iloc[i, 10], df0.iloc[i, 11]))
        # 执行sql语句
        db.commit()

    # 关闭数据库连接
    db.close()

3、ui设计模块

# -*- coding: utf-8 -*-

###########################################################################
## Python code generated with wxFormBuilder (version Jun 17 2015)
## http://www.wxformbuilder.org/
##
## PLEASE DO "NOT" EDIT THIS FILE!
###########################################################################

import wx
import wx.xrc


###########################################################################
## Class MyFrame1
###########################################################################

class MyFrame1(wx.Frame):

    def __init__(self, parent):
        wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"股票数据分析", pos=wx.DefaultPosition, size=wx.Size(309, 300),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)

        bSizer1 = wx.BoxSizer(wx.VERTICAL)

        self.m_button1 = wx.Button(self, wx.ID_ANY, u"获取数据", wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_button1, 1, wx.ALL | wx.EXPAND, 5)

        self.m_button2 = wx.Button(self, wx.ID_ANY, u"存储数据", wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_button2, 1, wx.ALL | wx.EXPAND, 5)

        self.m_button3 = wx.Button(self, wx.ID_ANY, u"读取数据", wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_button3, 1, wx.ALL | wx.EXPAND, 5)

        self.m_button4 = wx.Button(self, wx.ID_ANY, u"展示曲线", wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer1.Add(self.m_button4, 1, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(bSizer1)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.m_button1.Bind(wx.EVT_BUTTON, self.get_data)
        self.m_button2.Bind(wx.EVT_BUTTON, self.store_data)
        self.m_button3.Bind(wx.EVT_BUTTON, self.read_data)
        self.m_button4.Bind(wx.EVT_BUTTON, self.show_data)

    def __del__(self):
        pass

    # Virtual event handlers, overide them in your derived class
    def get_data(self, event):
        event.Skip()

    def store_data(self, event):
        event.Skip()

    def read_data(self, event):
        event.Skip()

    def show_data(self, event):
        event.Skip()
#
#
# class CalcFrame(MyFrame1):
#     def __init__(self, parent):
#         MyFrame1.__init__(self, parent)
#
#
# app = wx.App(False)
#
# frame = CalcFrame(None)
#
# frame.Show(True)
#
# # start the applications
# app.MainLoop()

4、数据处理模块

import numpy as np
import tushare as ts
import matplotlib.pyplot as plt
import pandas as pd


def get_data():
    """
    获取数据
    :return: 空
    """

    # 获取股票的数据
    pro = ts.pro_api('c62ba9195fa8b54ff78a38cab1cec01b15def7f47c32f91fb273ee3a')
    df = pro.daily(ts_code='000001.SZ', start_date='20200101', end_date='20201130')
    # 存储数据到一个文件中
    df.to_csv('./data.csv')
    print(df)


def read_data():
    """
    读取数据
    :return: 空
    """

    # 读取数据
    df = pd.read_csv('./data.csv')
    # 删除不需要的行
    df = df.drop(['Unnamed: 0'], axis=1)
    df = df.drop(['ts_code'], axis=1)
    # 反转行使得时间是从前到后的
    df = df.iloc[::-1, :]
    # 将时间由数字转为字符串
    for i in range(220):
        df.iloc[i, 0] = str(df.iloc[i, 0])
    # 将字符串转为时间类型的数据
    df['trade_date'] = pd.to_datetime(df['trade_date'])
    # 将时间设置为索引
    df = df.set_index(['trade_date'])
    df = df.iloc[:, :]
    print(df)
    return df


def plot_data(df):
    """
    展示数据
    :param df: 一个DataFrame
    :return: 空
    """

    ma5 = (df['close'].rolling(5).mean()).iloc[30:]

    ma10 = (df['close'].rolling(10).mean()).iloc[30:]

    ma20 = (df['close'].rolling(20).mean()).iloc[30:]

    plt.figure(figsize=(16, 9))

    l1, = plt.plot(ma5, label="ma5")

    l2, = plt.plot(ma10, label="ma10")

    l3, = plt.plot(ma20, label="ma20")

    l4, = plt.plot(df['close'].iloc[30:], label="close")

    plt.legend(handles=[l1, l2, l3, l4], labels=["ma5", "ma10", "ma20", "close"])
    plt.show()






三、数据样例的展示

,ts_code,trade_date,open,high,low,close,pre_close,change,pct_chg,vol,amount
0,000001.SZ,20201130,19.9,20.88,19.59,19.74,19.7,0.04,0.203,1581441.28,3213680.47
1,000001.SZ,20201127,20.0,20.0,19.38,19.7,19.5,0.2,1.0256,753773.74,1479430.635
2,000001.SZ,20201126,19.05,19.61,19.03,19.5,19.06,0.44,2.3085,639657.89,1240074.378
3,000001.SZ,20201125,19.48,19.7,19.05,19.06,19.36,-0.3,-1.5496,552585.01,1068352.014
4,000001.SZ,20201124,19.62,19.68,19.17,19.36,19.62,-0.26,-1.3252,678543.23,1313496.136
5,000001.SZ,20201123,18.85,19.62,18.8,19.62,18.86,0.76,4.0297,1165858.26,2252290.578
6,000001.SZ,20201120,18.83,18.99,18.52,18.86,18.85,0.01,0.0531,673919.22,1265262.915
7,000001.SZ,20201119,18.59,18.98,18.3,18.85,18.46,0.39,2.1127,1211740.62,2270476.474
8,000001.SZ,20201118,17.78,18.5,17.75,18.46,17.83,0.63,3.5334,1373400.72,2508632.642
9,000001.SZ,20201117,17.38,17.93,17.25,17.83,17.37,0.46,2.6482,852930.51,1509511.577
10,000001.SZ,20201116,17.08,17.43,16.9,17.37,17.18,0.19,1.1059,759856.93,1308190.459
11,000001.SZ,20201113,17.42,17.47,16.69,17.18,17.66,-0.48,-2.718,1289189.23,2191492.021
12,000001.SZ,20201112,17.81,17.94,17.45,17.66,17.81,-0.15,-0.8422,677258.48,1197284.181
13,000001.SZ,20201111,18.2,18.3,17.6,17.81,18.11,-0.3,-1.6565,940130.07,1677811.478
14,000001.SZ,20201110,18.0,18.5,17.93,18.11,17.84,0.27,1.5135,1021062.81,1854142.808
15,000001.SZ,20201109,17.67,18.0,17.54,17.84,17.64,0.2,1.1338,951424.32,1688807.401
16,000001.SZ,20201106,17.71,17.75,17.22,17.64,17.7,-0.06,-0.339,848781.53,1486492.208
17,000001.SZ,20201105,18.37,18.5,17.54,17.7,18.32,-0.62,-3.3843,1429469.44,2558562.453
18,000001.SZ,20201104,18.35,18.48,17.96,18.32,17.96,0.36,2.0045,1247636.4,2275824.963
19,000001.SZ,20201103,17.71,18.34,17.7,17.96,17.63,0.33,1.8718,957868.63,1727488.481
20,000001.SZ,20201102,17.65,18.05,17.33,17.63,17.75,-0.12,-0.6761,968452.77,1702741.437
21,000001.SZ,20201030,17.74,18.36,17.6,17.75,17.77,-0.02,-0.1125,1007803.83,1813064.343
22,000001.SZ,20201029,17.54,17.93,17.35,17.77,17.63,0.14,0.7941,846603.62,1498040.947
23,000001.SZ,20201028,17.76,17.9,17.29,17.63,17.76,-0.13,-0.732,1205823.86,2125604.541
24,000001.SZ,20201027,18.0,18.0,17.5,17.76,17.7,0.06,0.339,1034865.04,1839243.224
25,000001.SZ,20201026,18.2,18.29,17.45,17.7,18.13,-0.43,-2.3718,1175598.65,2085800.598
26,000001.SZ,20201023,17.53,18.78,17.53,18.13,17.56,0.57,3.246,1698501.68,3105623.948
27,000001.SZ,20201022,17.94,18.5,17.3,17.56,17.91,-0.35,-1.9542,1890519.05,3342069.01
28,000001.SZ,20201021,17.64,18.0,17.33,17.91,17.54,0.37,2.1095,1244560.18,2204040.364
29,000001.SZ,20201020,17.48,17.6,17.25,17.54,17.48,0.06,0.3432,960071.95,1673173.355
30,000001.SZ,20201019,17.3,18.1,17.3,17.48,17.1,0.38,2.2222,2016105.52,3571336.006
31,000001.SZ,20201016,16.56,17.37,16.54,17.1,16.56,0.54,3.2609,2095614.19,3589229.558
32,000001.SZ,20201015,16.2,16.92,16.15,16.56,16.03,0.53,3.3063,1600062.32,2654379.585
33,000001.SZ,20201014,16.04,16.12,15.8,16.03,16.06,-0.03,-0.1868,662562.36,1057937.816
34,000001.SZ,20201013,15.9,16.11,15.77,16.06,15.9,0.16,1.0063,908819.48,1453986.337
35,000001.SZ,20201012,15.22,16.05,15.21,15.9,15.18,0.72,4.7431,1591347.15,2509002.885
36,000001.SZ,20201009,15.3,15.55,15.13,15.18,15.17,0.01,0.0659,900425.93,1376995.906
37,000001.SZ,20200930,14.8,15.27,14.8,15.17,14.8,0.37,2.5,1217064.82,1838547.595
38,000001.SZ,20200929,15.39,15.41,14.76,14.8,15.31,-0.51,-3.3312,1182374.4,1766848.544
39,000001.SZ,20200928,15.19,15.37,14.98,15.31,15.19,0.12,0.79,612711.11,932800.766
40,000001.SZ,20200925,15.2,15.31,15.11,15.19,15.12,0.07,0.463,614087.0,933035.044
41,000001.SZ,20200924,15.59,15.61,15.12,15.12,15.63,-0.51,-3.263,1061011.24,1623376.2
42,000001.SZ,20200923,15.59,15.83,15.51,15.63,15.57,0.06,0.3854,599200.47,939763.265
43,000001.SZ,20200922,15.67,15.84,15.39,15.57,15.86,-0.29,-1.8285,867756.31,1354536.272
44,000001.SZ,20200921,16.0,16.05,15.71,15.86,16.07,-0.21,-1.3068,896161.65,1418370.973
45,000001.SZ,20200918,15.62,16.09,15.52,16.07,15.57,0.5,3.2113,1373193.3,2186759.087
46,000001.SZ,20200917,15.54,15.72,15.4,15.57,15.44,0.13,0.842,988215.63,1543414.501
47,000001.SZ,20200916,15.32,15.54,15.21,15.44,15.35,0.09,0.5863,722414.75,1114667.832
48,000001.SZ,20200915,15.2,15.48,15.15,15.35,15.3,0.05,0.3268,657132.67,1007999.044
49,000001.SZ,20200914,15.01,15.3,14.92,15.3,15.01,0.29,1.932,680251.05,1027508.108
50,000001.SZ,20200911,15.18,15.3,14.82,15.01,15.34,-0.33,-2.1512,954236.25,1431844.02
51,000001.SZ,20200910,15.32,15.48,15.2,15.34,15.21,0.13,0.8547,957092.39,1469402.768
52,000001.SZ,20200909,15.26,15.56,15.13,15.21,15.43,-0.22,-1.4258,1013572.47,1554005.575
53,000001.SZ,20200908,15.0,15.43,15.0,15.43,14.94,0.49,3.2798,1407601.66,2154220.778
54,000001.SZ,20200907,14.88,15.24,14.83,14.94,14.96,-0.02,-0.1337,1031376.81,1551971.38
55,000001.SZ,20200904,14.73,15.06,14.6,14.96,14.9,0.06,0.4027,909889.99,1353550.808
56,000001.SZ,20200903,15.32,15.33,14.84,14.9,15.32,-0.42,-2.7415,1279841.59,1919266.726
57,000001.SZ,20200902,15.01,15.53,15.01,15.32,15.14,0.18,1.1889,1679382.97,2575966.637
58,000001.SZ,20200901,14.96,15.23,14.88,15.14,15.08,0.06,0.3979,813642.58,1228342.741
59,000001.SZ,20200831,15.3,15.68,14.99,15.08,15.13,-0.05,-0.3305,1797129.54,2760350.322
60,000001.SZ,20200828,14.26,15.18,14.26,15.13,14.46,0.67,4.6335,2410400.02,3599035.694
61,000001.SZ,20200827,14.4,14.46,14.11,14.46,14.37,0.09,0.6263,626666.77,895618.648
62,000001.SZ,20200826,14.6,14.61,14.28,14.37,14.6,-0.23,-1.5753,734117.72,1057274.169
63,000001.SZ,20200825,14.56,14.69,14.46,14.6,14.46,0.14,0.9682,748320.22,1090756.854
64,000001.SZ,20200824,14.5,14.71,14.41,14.46,14.45,0.01,0.0692,919448.86,1338031.969
65,000001.SZ,20200821,14.71,14.71,14.32,14.45,14.59,-0.14,-0.9596,1234517.33,1787278.581
66,000001.SZ,20200820,15.01,15.14,14.53,14.59,15.1,-0.51,-3.3775,1333801.62,1962605.013
67,000001.SZ,20200819,15.11,15.35,14.96,15.1,15.15,-0.05,-0.33,1420928.11,2154215.097
68,000001.SZ,20200818,15.2,15.3,14.91,15.15,15.19,-0.04,-0.2633,1350261.07,2033477.707
69,000001.SZ,20200817,14.6,15.35,14.55,15.19,14.47,0.72,4.9758,3268027.8,4923669.137
70,000001.SZ,20200814,14.1,14.51,14.06,14.47,14.18,0.29,2.0451,1103215.82,1578543.607
71,000001.SZ,20200813,14.4,14.46,14.14,14.18,14.38,-0.2,-1.3908,837261.75,1190139.725
72,000001.SZ,20200812,14.21,14.5,14.15,14.38,14.13,0.25,1.7693,1596811.7,2287731.088
73,000001.SZ,20200811,13.97,14.66,13.97,14.13,13.95,0.18,1.2903,2603307.89,3748036.828
74,000001.SZ,20200810,13.67,14.02,13.62,13.95,13.7,0.25,1.8248,1587710.35,2208568.316
75,000001.SZ,20200807,13.8,13.9,13.62,13.7,13.9,-0.2,-1.4388,988678.37,1356305.781
76,000001.SZ,20200806,13.82,13.96,13.65,13.9,13.76,0.14,1.0174,1352510.68,1868047.342
77,000001.SZ,20200805,13.82,13.85,13.62,13.76,14.04,-0.28,-1.9943,1440203.13,1980352.978
78,000001.SZ,20200804,13.66,14.15,13.48,14.04,13.59,0.45,3.3113,2445663.25,3388510.059
79,000001.SZ,20200803,13.47,13.62,13.43,13.59,13.34,0.25,1.8741,1445096.16,1954607.257
80,000001.SZ,20200731,13.28,13.53,13.25,13.34,13.37,-0.03,-0.2244,1165821.91,1559068.291
81,000001.SZ,20200730,13.5,13.51,13.37,13.37,13.54,-0.17,-1.2555,964067.63,1294444.933
82,000001.SZ,20200729,13.35,13.63,13.21,13.54,13.34,0.2,1.4993,1519580.25,2043847.472
83,000001.SZ,20200728,13.34,13.43,13.18,13.34,13.24,0.1,0.7553,1217005.99,1618089.558
84,000001.SZ,20200727,13.67,13.68,13.1,13.24,13.5,-0.26,-1.9259,1880653.35,2497551.472
85,000001.SZ,20200724,13.97,13.99,13.42,13.5,14.01,-0.51,-3.6403,1830881.83,2504647.111
86,000001.SZ,20200723,14.24,14.29,13.81,14.01,14.41,-0.4,-2.7759,2027525.87,2838535.21
87,000001.SZ,20200722,14.49,14.65,14.27,14.41,14.49,-0.08,-0.5521,1312951.59,1895447.229
88,000001.SZ,20200721,14.68,14.68,14.4,14.49,14.73,-0.24,-1.6293,1252865.69,1815570.3
89,000001.SZ,20200720,14.23,14.77,14.1,14.73,14.14,0.59,4.1726,1979632.0,2872758.056
90,000001.SZ,20200717,14.17,14.28,13.95,14.14,14.15,-0.01,-0.0707,1291346.77,1821043.927
91,000001.SZ,20200716,14.3,14.55,14.12,14.15,14.27,-0.12,-0.8409,1930891.29,2771496.391
92,000001.SZ,20200715,14.78,14.86,14.23,14.27,14.68,-0.41,-2.7929,2042562.83,2947173.149
93,000001.SZ,20200714,14.9,15.19,14.55,14.68,14.89,-0.21,-1.4103,1953566.27,2891773.817
94,000001.SZ,20200713,14.7,15.08,14.5,14.89,14.86,0.03,0.2019,1937160.12,2871414.844
95,000001.SZ,20200710,15.35,15.48,14.76,14.86,15.53,-0.67,-4.3142,2158773.26,3254272.377
96,000001.SZ,20200709,15.66,15.66,15.31,15.53,15.76,-0.23,-1.4594,2243994.4,3469517.329
97,000001.SZ,20200708,15.23,16.0,15.23,15.76,15.48,0.28,1.8088,2631339.16,4095447.757
98,000001.SZ,20200707,16.3,16.63,15.03,15.48,15.68,-0.2,-1.2755,3964427.47,6267919.683
99,000001.SZ,20200706,14.6,15.68,14.59,15.68,14.25,1.43,10.0351,4711460.78,7168653.356
100,000001.SZ,20200703,13.57,14.32,13.56,14.25,13.43,0.82,6.1057,3768333.63,5280918.011
101,000001.SZ,20200702,13.08,13.49,12.97,13.43,13.12,0.31,2.3628,2590501.19,3433511.084
102,000001.SZ,20200701,12.79,13.15,12.74,13.12,12.8,0.32,2.5,1697390.01,2202800.843
103,000001.SZ,20200630,12.83,12.88,12.72,12.8,12.8,0.0,0.0,937940.22,1199181.601
104,000001.SZ,20200629,12.92,12.97,12.71,12.8,12.8,0.0,0.0,1038480.06,1330678.288
105,000001.SZ,20200624,12.64,12.88,12.6,12.8,12.6,0.2,1.5873,1523220.48,1946329.095
106,000001.SZ,20200623,12.65,12.69,12.52,12.6,12.64,-0.04,-0.3165,990806.73,1248046.646
107,000001.SZ,20200622,12.74,12.76,12.62,12.64,12.8,-0.16,-1.25,1319079.79,1671023.278
108,000001.SZ,20200619,12.73,12.84,12.61,12.8,12.76,0.04,0.3135,1539521.78,1954584.919
109,000001.SZ,20200618,12.76,12.8,12.59,12.76,12.85,-0.09,-0.7004,1119647.8,1419972.017
110,000001.SZ,20200617,12.89,12.92,12.76,12.85,12.89,-0.04,-0.3103,716468.24,918251.153
111,000001.SZ,20200616,12.9,12.99,12.86,12.89,12.82,0.07,0.546,718059.1,927043.687
112,000001.SZ,20200615,12.85,12.97,12.8,12.82,12.99,-0.17,-1.3087,660313.07,850767.506
113,000001.SZ,20200612,12.9,13.02,12.87,12.99,13.08,-0.09,-0.6881,1030550.57,1331618.728
114,000001.SZ,20200611,13.38,13.39,13.0,13.08,13.49,-0.41,-3.0393,1349039.82,1774199.978
115,000001.SZ,20200610,13.71,13.71,13.4,13.49,13.67,-0.18,-1.3168,580476.2,781995.749
116,000001.SZ,20200609,13.64,13.73,13.53,13.67,13.62,0.05,0.3671,474300.07,646895.834
117,000001.SZ,20200608,13.68,13.85,13.58,13.62,13.59,0.03,0.2208,585971.9,802115.792
118,000001.SZ,20200605,13.6,13.62,13.43,13.59,13.57,0.02,0.1474,383026.9,517232.135
119,000001.SZ,20200604,13.53,13.64,13.41,13.57,13.54,0.03,0.2216,583066.33,788707.63
120,000001.SZ,20200603,13.64,13.88,13.5,13.54,13.55,-0.01,-0.0738,956803.08,1308782.294
121,000001.SZ,20200602,13.29,13.63,13.28,13.55,13.32,0.23,1.7267,883458.88,1194375.822
122,000001.SZ,20200601,13.1,13.39,13.08,13.32,13.0,0.32,2.4615,882960.55,1173619.006
123,000001.SZ,20200529,13.01,13.04,12.92,13.0,13.07,-0.07,-0.5356,457808.22,594502.123
124,000001.SZ,20200528,12.87,13.18,12.81,13.07,12.78,0.29,2.2692,960760.31,1255226.999
125,000001.SZ,20200527,13.05,13.19,12.96,13.0,13.04,-0.04,-0.3067,482962.94,630305.864
126,000001.SZ,20200526,13.02,13.07,12.94,13.04,12.96,0.08,0.6173,396212.4,515451.849
127,000001.SZ,20200525,12.97,12.98,12.76,12.96,12.92,0.04,0.3096,410170.78,528769.352
128,000001.SZ,20200522,13.33,13.34,12.92,12.92,13.4,-0.48,-3.5821,856237.33,1119433.491
129,000001.SZ,20200521,13.52,13.57,13.36,13.4,13.51,-0.11,-0.8142,552312.0,742797.057
130,000001.SZ,20200520,13.38,13.62,13.27,13.51,13.36,0.15,1.1228,690851.07,929928.885
131,000001.SZ,20200519,13.41,13.45,13.27,13.36,13.2,0.16,1.2121,600368.64,801755.671
132,000001.SZ,20200518,13.2,13.34,13.12,13.2,13.23,-0.03,-0.2268,637208.57,843479.669
133,000001.SZ,20200515,13.39,13.43,13.14,13.23,13.3,-0.07,-0.5263,756794.47,1004313.267
134,000001.SZ,20200514,13.55,13.59,13.22,13.3,13.63,-0.33,-2.4211,944672.09,1259440.848
135,000001.SZ,20200513,13.75,13.78,13.53,13.63,13.79,-0.16,-1.1603,640358.79,871062.043
136,000001.SZ,20200512,13.95,14.05,13.72,13.79,14.0,-0.21,-1.5,558511.14,772109.502
137,000001.SZ,20200511,13.92,14.13,13.9,14.0,13.95,0.05,0.3584,612862.29,859156.594
138,000001.SZ,20200508,13.76,14.02,13.68,13.95,13.69,0.26,1.8992,934781.7,1297924.588
139,000001.SZ,20200507,13.76,13.76,13.6,13.69,13.77,-0.08,-0.581,662749.23,904349.531
140,000001.SZ,20200506,13.76,13.89,13.61,13.77,13.93,-0.16,-1.1486,1008998.02,1382727.481
141,000001.SZ,20200430,14.02,14.32,13.88,13.93,14.02,-0.09,-0.6419,819540.43,1155968.238
142,000001.SZ,20200429,13.48,14.1,13.45,14.02,13.52,0.5,3.6982,1108722.39,1541638.203
143,000001.SZ,20200428,13.45,13.56,13.27,13.52,13.5,0.02,0.1481,771564.17,1038718.08
144,000001.SZ,20200427,13.3,13.64,13.25,13.5,13.24,0.26,1.9637,936829.9,1263809.737
145,000001.SZ,20200424,13.17,13.28,13.11,13.24,13.23,0.01,0.0756,566001.61,747473.77
146,000001.SZ,20200423,13.23,13.31,13.11,13.23,13.23,0.0,0.0,646989.63,855052.11
147,000001.SZ,20200422,13.37,13.42,13.16,13.23,13.45,-0.22,-1.6357,1032802.74,1368222.854
148,000001.SZ,20200421,13.3,13.7,13.3,13.45,12.99,0.46,3.5412,2122448.34,2861879.086
149,000001.SZ,20200420,12.86,13.05,12.77,12.99,12.89,0.1,0.7758,818455.83,1058524.019
150,000001.SZ,20200417,12.77,13.04,12.65,12.89,12.68,0.21,1.6562,1331164.77,1713215.766
151,000001.SZ,20200416,12.79,12.79,12.54,12.68,12.87,-0.19,-1.4763,789154.98,997623.816
152,000001.SZ,20200415,12.86,12.93,12.78,12.87,12.86,0.01,0.0778,656396.4,843649.273
153,000001.SZ,20200414,12.65,12.86,12.57,12.86,12.59,0.27,2.1446,686086.87,874856.562
154,000001.SZ,20200413,12.67,12.71,12.47,12.59,12.79,-0.2,-1.5637,446214.4,562008.05
155,000001.SZ,20200410,12.76,12.98,12.65,12.79,12.74,0.05,0.3925,666674.95,853689.95
156,000001.SZ,20200409,12.88,12.89,12.72,12.74,12.78,-0.04,-0.313,408553.77,522027.888
157,000001.SZ,20200408,12.88,12.92,12.72,12.78,12.88,-0.1,-0.7764,528716.14,676604.872
158,000001.SZ,20200407,12.89,12.94,12.81,12.88,12.61,0.27,2.1412,870313.71,1121200.115
159,000001.SZ,20200403,12.82,12.89,12.55,12.61,12.97,-0.36,-2.7756,825348.14,1047282.4
160,000001.SZ,20200402,12.75,12.97,12.66,12.97,12.89,0.08,0.6206,518365.04,663197.628
161,000001.SZ,20200401,12.86,13.13,12.82,12.89,12.8,0.09,0.7031,520836.04,676070.117
162,000001.SZ,20200331,13.05,13.09,12.78,12.8,12.94,-0.14,-1.0819,513370.3,662915.471
163,000001.SZ,20200330,12.85,13.04,12.76,12.94,13.15,-0.21,-1.597,661738.79,852956.24
164,000001.SZ,20200327,13.25,13.38,13.08,13.15,13.06,0.09,0.6891,653018.88,861618.663
165,000001.SZ,20200326,12.78,13.34,12.72,13.06,12.87,0.19,1.4763,1075192.43,1408651.057
166,000001.SZ,20200325,12.88,13.07,12.7,12.87,12.61,0.26,2.0619,1136957.74,1467534.956
167,000001.SZ,20200324,12.4,12.68,12.27,12.61,12.15,0.46,3.786,1180200.26,1472909.399
168,000001.SZ,20200323,12.0,12.35,11.93,12.15,12.52,-0.37,-2.9553,1071113.64,1300469.494
169,000001.SZ,20200320,12.4,12.68,12.26,12.52,12.23,0.29,2.3712,1578352.96,1967487.818
170,000001.SZ,20200319,12.68,12.74,11.91,12.23,12.71,-0.48,-3.7766,1891457.13,2313863.663
171,000001.SZ,20200318,13.41,13.55,12.65,12.71,13.41,-0.7,-5.22,1384784.37,1816836.893
172,000001.SZ,20200317,13.75,13.97,13.13,13.41,13.75,-0.34,-2.4727,1177849.06,1582506.075
173,000001.SZ,20200316,14.45,14.46,13.75,13.75,14.52,-0.77,-5.303,1406202.18,1975824.191
174,000001.SZ,20200313,13.9,14.58,13.9,14.52,14.68,-0.16,-1.0899,1169765.8,1669009.835
175,000001.SZ,20200312,14.65,14.84,14.53,14.68,14.69,-0.01,-0.0681,986497.11,1447436.641
176,000001.SZ,20200311,14.77,14.88,14.62,14.69,14.76,-0.07,-0.4743,814381.64,1201250.682
177,000001.SZ,20200310,14.38,14.85,14.38,14.76,14.45,0.31,2.1453,1167864.97,1709084.565
178,000001.SZ,20200309,14.71,14.73,14.42,14.45,15.03,-0.58,-3.8589,1665793.54,2420392.13
179,000001.SZ,20200306,15.18,15.27,15.02,15.03,15.39,-0.36,-2.3392,1228531.03,1858691.259
180,000001.SZ,20200305,14.8,15.64,14.73,15.39,14.69,0.7,4.7651,2686602.34,4089493.523
181,000001.SZ,20200304,14.68,14.78,14.51,14.69,14.72,-0.03,-0.2038,862595.23,1261123.063
182,000001.SZ,20200303,14.96,14.99,14.63,14.72,14.79,-0.07,-0.4733,1153584.32,1705816.271
183,000001.SZ,20200302,14.55,14.95,14.46,14.79,14.5,0.29,2.0,1116580.66,1647432.269
184,000001.SZ,20200228,14.85,15.04,14.46,14.5,15.11,-0.61,-4.0371,1300644.45,1906892.413
185,000001.SZ,20200227,14.96,15.15,14.89,15.11,14.99,0.12,0.8005,975270.9,1464605.739
186,000001.SZ,20200226,14.77,15.27,14.7,14.99,15.04,-0.05,-0.3324,1176599.15,1769612.245
187,000001.SZ,20200225,15.0,15.13,14.78,15.04,15.23,-0.19,-1.2475,1144575.02,1710369.786
188,000001.SZ,20200224,15.46,15.46,15.15,15.23,15.58,-0.35,-2.2465,1191794.5,1820183.854
189,000001.SZ,20200221,15.49,15.72,15.45,15.58,15.59,-0.01,-0.0641,995071.02,1546692.93
190,000001.SZ,20200220,15.27,15.62,15.1,15.59,15.24,0.35,2.2966,1235444.34,1897923.029
191,000001.SZ,20200219,15.1,15.37,15.08,15.24,15.2,0.04,0.2632,874106.93,1333730.218
192,000001.SZ,20200218,15.33,15.33,15.01,15.2,15.37,-0.17,-1.1061,973612.35,1478274.222
193,000001.SZ,20200217,15.04,15.37,14.93,15.37,15.03,0.34,2.2621,1543696.01,2337993.586
194,000001.SZ,20200214,14.75,15.14,14.7,15.03,14.65,0.38,2.5939,1512434.73,2253906.452
195,000001.SZ,20200213,14.71,14.88,14.61,14.65,14.77,-0.12,-0.8125,1013205.28,1491327.713
196,000001.SZ,20200212,14.79,14.82,14.6,14.77,14.79,-0.02,-0.1352,1070503.21,1573229.042
197,000001.SZ,20200211,14.6,14.94,14.56,14.79,14.5,0.29,2.0,1407507.44,2077194.138
198,000001.SZ,20200210,14.51,14.53,14.3,14.5,14.62,-0.12,-0.8208,1339495.24,1931983.482
199,000001.SZ,20200207,14.6,14.69,14.41,14.62,14.77,-0.15,-1.0156,924852.96,1345053.255
200,000001.SZ,20200206,14.81,14.87,14.51,14.77,14.63,0.14,0.9569,1185815.72,1740107.625
201,000001.SZ,20200205,14.59,14.89,14.32,14.63,14.6,0.03,0.2055,1491380.21,2177632.043
202,000001.SZ,20200204,14.05,14.66,14.02,14.6,13.99,0.61,4.3603,1706172.07,2442932.842
203,000001.SZ,20200203,13.99,14.7,13.99,13.99,15.54,-1.55,-9.9743,2259194.83,3201454.164
204,000001.SZ,20200123,15.92,15.92,15.39,15.54,16.09,-0.55,-3.4183,1100592.07,1723394.336
205,000001.SZ,20200122,15.92,16.16,15.71,16.09,16.0,0.09,0.5625,719464.91,1150933.398
206,000001.SZ,20200121,16.34,16.34,15.93,16.0,16.45,-0.45,-2.7356,896603.1,1442171.431
207,000001.SZ,20200120,16.43,16.61,16.35,16.45,16.39,0.06,0.3661,746074.75,1226464.649
208,000001.SZ,20200117,16.38,16.55,16.35,16.39,16.33,0.06,0.3674,605436.69,995909.007
209,000001.SZ,20200116,16.52,16.57,16.2,16.33,16.52,-0.19,-1.1501,1028104.67,1678888.507
210,000001.SZ,20200115,16.79,16.86,16.45,16.52,16.76,-0.24,-1.432,859439.12,1424889.228
211,000001.SZ,20200114,16.99,17.27,16.76,16.76,16.99,-0.23,-1.3537,1304493.66,2217608.852
212,000001.SZ,20200113,16.75,17.03,16.61,16.99,16.69,0.3,1.7975,872133.36,1468271.683
213,000001.SZ,20200110,16.79,16.81,16.52,16.69,16.79,-0.1,-0.5956,585548.45,975154.818
214,000001.SZ,20200109,16.81,16.93,16.53,16.79,16.66,0.13,0.7803,1031636.65,1725326.806
215,000001.SZ,20200108,17.0,17.05,16.63,16.66,17.15,-0.49,-2.8571,847824.12,1423608.811
216,000001.SZ,20200107,17.13,17.28,16.95,17.15,17.07,0.08,0.4687,728607.56,1247047.135
217,000001.SZ,20200106,17.01,17.34,16.91,17.07,17.18,-0.11,-0.6403,862083.5,1477930.193
218,000001.SZ,20200103,16.94,17.31,16.92,17.18,16.87,0.31,1.8376,1116194.81,1914495.474
219,000001.SZ,20200102,16.65,16.95,16.55,16.87,16.45,0.42,2.5532,1530231.87,2571196.482

四、效果展示

我们采用视频的形式来进行效果的展示;

https://www.bilibili.com/video/BV1RF411q7g2?spm_id_from=333.999.0.0

股票数据分析的实现

以上就是我实现的股票数据分析的可视化的处理的结果,谢谢大家的阅读与支持啦。 

到此这篇关于基于Python实现股票数据分析的可视化的文章就介绍到这了,更多相关Python股票数据分析可视化内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • Python Tkinter基础控件用法

    Python Tkinter基础控件用法

    这篇文章主要介绍了Python Tkinter基础控件用法,包括窗口的显示、显示内置图片、弹出窗口、菜单等等,需要的朋友可以参考下
    2014-09-09
  • 图文详解梯度下降算法的原理及Python实现

    图文详解梯度下降算法的原理及Python实现

    梯度下降是迭代法的一种,可以用于求解最小二乘问题(线性和非线性都可以)。本文将通过图文详解梯度下降算法的原理及实现,需要的可以参考一下
    2022-08-08
  • python实现MongoDB的双活示例

    python实现MongoDB的双活示例

    本文主要介绍了python实现MongoDB的双活示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2023-02-02
  • 为什么从Python 3.6开始字典有序并效率更高

    为什么从Python 3.6开始字典有序并效率更高

    这篇文章主要给大家介绍了关于为什么从Python 3.6开始字典有序并效率更高的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用Python具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧
    2019-07-07
  • 浅谈python中常用的8种经典数据结构

    浅谈python中常用的8种经典数据结构

    这篇文章主要介绍了python中常用的8种经典数据结构,包括原生数据结构,NumPy包中的数据结构,以及Pandas包中的数据结构,需要的朋友可以参考下
    2023-03-03
  • 基于python实现的抓取腾讯视频所有电影的爬虫

    基于python实现的抓取腾讯视频所有电影的爬虫

    这篇文章主要介绍了用python实现的抓取腾讯视频所有电影的爬虫,这个程序使用芒果存, 所以大家需要下载使用mongodb才可以
    2016-04-04
  • 人工智能学习Pytorch数据集分割及动量示例详解

    人工智能学习Pytorch数据集分割及动量示例详解

    这篇文章主要为大家介绍了人工智能学习Pytorch数据集分割及动量示例详解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步
    2021-11-11
  • 浅谈keras使用中val_acc和acc值不同步的思考

    浅谈keras使用中val_acc和acc值不同步的思考

    这篇文章主要介绍了浅谈keras使用中val_acc和acc值不同步的思考,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2020-06-06
  • python文件名和文件路径操作实例

    python文件名和文件路径操作实例

    下面小编就为大家带来一篇python文件名和文件路径操作实例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2017-09-09
  • pytorch DistributedDataParallel 多卡训练结果变差的解决方案

    pytorch DistributedDataParallel 多卡训练结果变差的解决方案

    这篇文章主要介绍了pytorch DistributedDataParallel 多卡训练结果变差的解决方案,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2021-06-06

最新评论