%%HTML
<button onclick="$('.input, .prompt, .output_stderr, .output_error, .output_result').toggle();">点我隐藏或显示代码</button>
“通过定期投资指数基金,一个什么都不懂的投资者通常都能打败大部分的专业基金经理。”
“如果让我提供一点心得给各位参考,我认为,大部分的投资者,不管是机构投资者还是个人投资者,投资股票最好的方式是直接去买手续费低廉的指数型基金,而且这样做的收益(在扣除相关费用后),应该可以轻易地击败市场上大部分的投资专家。”
《共同基金常识》:“要想获得最大可能的市场收益率,就必须降低买入和持有基金的成本,而投资者要做的,就是买入运行成本低、没有或很少有佣金的基金,尤其是低成本的指数基金,然后持有尽可能长的时间。” 巴菲特对该书给予的评价:“令人信服,非常中肯且切中时弊,这是每个投资者必读的书籍。”
“那些收费非常低廉的指数基金,在产品设计上是非常适合投资者的,对于大多数想要投资股票的人来说,收费很低的指数基金是最理想的选择。”
“过去35年来,美国企业创造了优异的业绩,按理说股票投资者也应该相应取得优异的收益,只要大家以分散且低成本的方式投资所有美国企业即可分享其优异业绩,通过投资指数基金就可以做到,但绝大多数投资者很少投资指数基金,结果他们投资股票的业绩大多只是平平而已,甚至亏得惨不忍睹。我认为主要有三个原因:第一,成本太高,投资者买入卖出过于频繁,或者费用支出过大;第二,投资决策是根据小道消息或市场潮流,而不是根据深思熟虑并且量化分析上市公司;第三,盲目追涨杀跌,在错误的时间进入或退出股市。”
“对于绝大多数没有时间研究上市公司基本面的中小投资者来说,成本低廉的指数基金是他们投资股市的最佳选择。” “如果你坚持长期持续定期买入指数基金,你可能不会买在最低点,但你同样也不会买在最高点。”
Tim Ferriss提问:“如果你只有30岁,没有其他经济依靠,只能靠一份全日制工作谋生,没有办法每天进行投资,假设你已经有些储蓄足够你一年半的生活开支,那么你攒的第一个100万将会如何投资?” 巴菲特回答:“我会把所有的钱都投资到一个低成本的跟踪标准普尔500指数的指数基金,然后继续努力工作……”
巴菲特个人和主要投资于对冲基金的普罗蒂杰公司立下一个十年慈善赌局,2008年至2017年长期投资一只标准普尔500指数基金的收益将会跑赢普罗蒂杰公司精心选择的5只对冲基金组合,赌金为100万美元。2015年,Ted Seides基金宣布提前认输,巴菲特提前胜利。
“我对信托公司的要求非常简单:持有10%的现金购买短期政府债券,另外90%配置在低费率的标普500指数基金上。我相信遵守这个策略,信托的长期业绩会战胜大多数聘请了高费率管理人的投资者——无论是养老金、机构还是个人。”
“6年前(2009年)有权威人士警告股价会下跌,建议你投资‘安全’的国债或者银行存单。如果你真的听了这些劝告,那么现在只有微薄的回报,如果你当时买了一些低成本的指数基金,现在的回报能保证有不错的生活(标普500指数6年前约700点,现在约2100点)。
未必适合中国国情, please go on ...
import psycopg2
import numpy as np
from pandas import Series, DataFrame
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.dates import DayLocator, HourLocator, DateFormatter, drange, MonthLocator, YearLocator
from matplotlib import ticker
import datetime as dt
import matplotlib
from pylab import *
from matplotlib.font_manager import *
forcn = FontProperties(fname='/usr/share/fonts/truetype/arphic/ukai.ttc', size=14)
matplotlib.rcParams['axes.unicode_minus'] = False
index_dict = {
'000001': '上证指数'
, '000002': 'A股指数'
, '000003': 'B股指数'
, '000016': '上证50'
, '000300': '沪深300'
, '399001': '深证成指'
, '399002': '深成指R'
, '399003': '成份B指'
, '399006': '创业板指'
, '399102': '创业板综'
, '399106': '深证综指'
}
conn = psycopg2.connect(database="demo", user="demo", password="demo", host="www.jasper.wang", port="1234")
cur = conn.cursor()
sql1 = '''SELECT * FROM public.v_si_index where checkor is not null order by index_date;'''
data = pd.read_sql(sql1, conn,)
conn.commit()
df = DataFrame(data)
datas=df.head(1)
print(datas)
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 3:4]
Pamount=df.iloc[0:, 4:5]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[3][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 3].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 4].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.text(Xdate.iloc[3600][0], 860000000000, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 5:6]
Pamount=df.iloc[0:, 6:7]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[5][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 5].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 6].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.text(Xdate.iloc[3600][0], 860000000000, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 7:8]
Pamount=df.iloc[0:, 8:9]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[7][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 7].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 8].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.text(Xdate.iloc[5000][0], 7000000000, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
- 2018年5月最新上证50股票发布:
| 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|
| 浦发银行 (600000) | 民生银行 (600016) | 宝钢股份 (600019) | 中国石化 (600028) | 南方航空 (600029) |
| 中信证券 (600030) | 招商银行 (600036) | 保利地产 (600048) | 中国联通 (600050) | 上汽集团 (600104) |
| 北方稀土 (600111) | 万华化学 (600309) | 华夏幸福 (600340) | 康美药业 (600518) | 贵州茅台 (600519) |
| 山东黄金 (600547) | 绿地控股 (600606) | 海通证券 (600837) | 伊利股份 (600887) | 江苏银行 (600919) |
| 东方证券 (600958) | 招商证券 (600999) | 大秦铁路 (601006) | 中国神华 (601088) | 兴业银行 (601166) |
| 北京银行 (601169) | 中国铁建 (601186) | 国泰君安 (601211) | 上海银行 (601229) | 农业银行 (601288) |
| 中国平安 (601318) | 交通银行 (601328) | 新华保险 (601336) | 中国中铁 (601390) | 工商银行 (601398) |
| 中国太保 (601601) | 中国人寿 (601628) | 中国建筑 (601668) | 中国电建 (601669) | 华泰证券 (601688) |
| 中国中车 (601766) | 中国交建 (601800) | 光大银行 (601818) | 中国石油 (601857) | 浙商证券 (601878) |
| 中国银河 (601881) | 中国核电 (601985) | 中国银行 (601988) | 中国重工 (601989) | 洛阳钼业 (603993) |
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 9:10]
Pamount=df.iloc[0:, 10:11]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[9][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 9].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 10].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.text(Xdate.iloc[3600][0], 300000000000, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
沪深300指数的市值覆盖率高、与上证180指数及深证100指数等现有市场指数相关性高、样本股集中了市场中大量优质股票,因此,可以成为反映沪深两个市场整体走势的“晴雨表”。
沪深300指数独有的特点:
- 在样本股范围上,沪深300指数的样本股选自于沪、深两市的A股股票,对于在两地(或多地)上市的公司,其总股本仅限于A股总股本,H股和B股不包括在内。
而上证综指的样本股范围为在上海证券交易所上市的所有股票,包括A股和B股。
在权重计算上,沪深300指数采用以自由流通股本加权法,不存在流通市值与总市值之间的杠杆效应;
- 而上证指数采用总股本加权法,实际的流通市值与总市值之间存在一定的杠杆效应。(即沪深300以流通市值为准,不考虑总体市值)
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 11:12]
Pamount=df.iloc[0:, 12:13]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[11][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 11].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 12].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.text(Xdate.iloc[3600][0], 600000000000, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 13:14]
Pamount=df.iloc[0:, 14:15]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[13][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 13].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 14].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.text(Xdate.iloc[3600][0], 400000000000, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 15:16]
Pamount=df.iloc[0:, 16:17]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[15][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 15].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 16].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.text(Xdate.iloc[3600][0], 350000000000, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 17:18]
Pamount=df.iloc[0:, 18:19]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[17][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 17].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 18].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.text(Xdate.iloc[5000][0], 4000000000, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 19:20]
Pamount=df.iloc[0:, 20:21]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[19][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 19].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 20].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.text(Xdate.iloc[3600][0], 60000000000, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 21:22]
Pamount=df.iloc[0:, 22:23]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[21][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 21].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 22].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.text(Xdate.iloc[3600][0], 88000000000, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
Xdate=df.iloc[0:, 0:1]
Pclose=df.iloc[0:, 23:24]
Pamount=df.iloc[0:, 24:25]
titlelist = df.columns.values.tolist()
for k, v in index_dict.items():
if titlelist[23][-6:] == k:
label = v
figure(figsize=(16,8), dpi=80)
ax1=plt.subplot(211)
l1,=plt.plot(Xdate, Pclose, 'b-', lw=0.5, label=label+'收盘价')
plt.setp(ax1.get_xticklabels(), fontsize=14)
plt.setp(ax1.get_yticklabels(), fontsize=14)
ax1 = gca()
ax1.spines['right'].set_color('none')
ax1.spines['top'].set_color('none')
ax1.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax1.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax1.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax1.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax1.legend(handles=[l1, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pclose.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 23].tolist()[0]
mt = str(md)+', '+str(mv)
ax1.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
ax2=plt.subplot(212, sharex=ax1)
l2,=plt.plot(Xdate, Pamount, 'r-', lw=0.5, label=label+'成交额')
plt.setp(ax2.get_xticklabels(), fontsize=14)
plt.setp(ax2.get_yticklabels(), fontsize=14)
ax2 = gca()
ax2.spines['right'].set_color('none')
ax2.spines['top'].set_color('none')
ax2.grid(which = 'both' , color='k', linestyle='--', linewidth=0.3)
ax2.xaxis.set_major_locator(ticker.MultipleLocator(730))
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax2.xaxis.set_major_formatter(DateFormatter('%Y%m'))
ax2.set_xlim(Xdate.iloc[0][0]-relativedelta(months=+6), Xdate.iloc[-1][0]+relativedelta(years=+1))
ax2.legend(handles=[l2, ], loc = 2, frameon=False, prop=forcn)
max_pc = Pamount.idxmax()
md = df.iloc[max_pc, 0].tolist()[0]
mv = df.iloc[max_pc, 24].tolist()[0]
mt = str(md)+', '+str(mv)
ax2.annotate(
mt, fontproperties=forcn
, xy=(md, mv)
, xycoords='data'
, xytext=(-240, -16)
, textcoords='offset points'
, fontsize=16
, arrowprops=dict(
facecolor='black'
, shrink=0.005
, width=2
, headlength=5
, headwidth=8
)
)
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.show()
from matplotlib.dates import DayLocator, HourLocator, DateFormatter, drange, MonthLocator, YearLocator
from matplotlib import ticker
import datetime as dt
sql2 = '''
SELECT index_date, pclose_000001, pclose_000016, pclose_000300, pclose_399001, pclose_399002, pclose_399006, pclose_399102, pclose_399106
FROM public.v_si_index_percentage
order by index_date;
'''
datap = pd.read_sql(sql2, conn,)
conn.commit()
dfp = DataFrame(datap)
dataps=dfp.head(1)
print(dataps)
dindex= dfp.iloc[0:, 0:1]
tx = dindex.iloc[-1][0]
# dfirstday= dfp.iloc[0:1, 1:2]
dp000001 = [dfp.iloc[i, 1:2]/dfp.iloc[0, 1:2]-1 for i in range(0, len(dfp))]
dp000016 = [dfp.iloc[i, 2:3]/dfp.iloc[0, 2:3]-1 for i in range(0, len(dfp))]
dp000300 = [dfp.iloc[i, 3:4]/dfp.iloc[0, 3:4]-1 for i in range(0, len(dfp))]
dp399001 = [dfp.iloc[i, 4:5]/dfp.iloc[0, 4:5]-1 for i in range(0, len(dfp))]
dp399002 = [dfp.iloc[i, 5:6]/dfp.iloc[0, 5:6]-1 for i in range(0, len(dfp))]
dp399006 = [dfp.iloc[i, 6:7]/dfp.iloc[0, 6:7]-1 for i in range(0, len(dfp))]
dp399102 = [dfp.iloc[i, 7:8]/dfp.iloc[0, 7:8]-1 for i in range(0, len(dfp))]
dp399106 = [dfp.iloc[i, 8:9]/dfp.iloc[0, 8:9]-1 for i in range(0, len(dfp))]
ty000001=dp000001[-1].apply(str)[0][0:6]
ty000016=dp000016[-1].apply(str)[0][0:6]
ty000300=dp000300[-1].apply(str)[0][0:6]
ty399001=dp399001[-1].apply(str)[0][0:6]
ty399002=dp399002[-1].apply(str)[0][0:6]
ty399006=dp399006[-1].apply(str)[0][0:6]
ty399102=dp399102[-1].apply(str)[0][0:6]
ty399106=dp399106[-1].apply(str)[0][0:6]
figure(figsize=(16,16), dpi=80)
ax = gca()
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
plt.grid(True)
plot(dindex, dp000001, 'b-', lw=0.5)
plot(dindex, dp000016, 'c-', lw=0.5)
plot(dindex, dp000300, 'm-', lw=0.5)
plot(dindex, dp399001, 'y-', lw=0.5)
plot(dindex, dp399002, 'k-', lw=0.5)
plot(dindex, dp399006, 'g-', lw=0.5)
plot(dindex, dp399102, 'r-', lw=0.5)
plot(dindex, dp399106, 'b-', lw=0.5)
ax = gca()
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.grid(which = 'both' , color='b', linestyle='--', linewidth=1)
ax.set_xlim(dindex.iloc[0][0], dindex.iloc[-1][0])
ax.xaxis.set_major_locator(ticker.MultipleLocator(365))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(365))
ax.xaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
ax.yaxis.set_major_locator(ticker.MultipleLocator(0.2))
ax.yaxis.set_minor_locator(ticker.MultipleLocator(0.1))
ax.tick_params(
which= 'major'
, axis='both'
, direction='out'
, length=3
, width=1
, colors='b'
, grid_color='b'
, grid_alpha=0.5
, pad = 5
, labelsize = 13
, labeltop = False
, top = False
, labelright = False
, right = False
)
ax.tick_params(
which= 'minor'
, axis='both'
, direction='out'
, length=3
, width=1
, colors='r'
, grid_color='g'
, grid_alpha=0.2
, pad = 1
, labeltop = False
, top = False
, labelright = False
, right = False
)
titlelist = dfp.columns.values.tolist()
l_tt = []
for i in titlelist[1:9]:
for k, v in index_dict.items():
if i[-6:] == k:
tt = '-->'+v
l_tt.append(tt)
plt.text(tx, dp000001[-1], l_tt[0]+'|'+ty000001, fontproperties=forcn, fontsize=14)
plt.text(tx, dp000016[-1], l_tt[1]+'|'+ty000016, fontproperties=forcn, fontsize=14)
plt.text(tx, dp000300[-1], l_tt[2]+'|'+ty000300, fontproperties=forcn, fontsize=14)
plt.text(tx, dp399001[-1], l_tt[3]+'|'+ty399001, fontproperties=forcn, fontsize=14)
plt.text(tx, dp399002[-1], l_tt[4]+'|'+ty399002, fontproperties=forcn, fontsize=14)
plt.text(tx, dp399006[-1], l_tt[5]+'|'+ty399006, fontproperties=forcn, fontsize=14)
plt.text(tx, dp399102[-1], l_tt[6]+'|'+ty399102, fontproperties=forcn, fontsize=14)
plt.text(tx, dp399106[-1], l_tt[7]+'|'+ty399106, fontproperties=forcn, fontsize=14)
plt.text(dindex.iloc[600][0], 2, '我们制作图表时遇到的最大瓶颈\n与共享单车当初发展中遇到的瓶颈一模一样\n那就是:颜色不够用', ha='center', fontproperties=forcn, fontsize=20, color='blue')
plt.text(dindex.iloc[600][0], 1, 'www.jasper.wang\nwelcome', style='oblique', ha='center', fontsize=20, color='blue')
plt.show()
股票指数大体上可以分为两类:
一类是综合指数,囊括了某一板块的全部个股;
另一类是成分指数,由综合指数中优选出来的个股构成。
- 创业板综(399102),是综合指数,包括创业板上市的所有股票,目前 722 只。
- 创业板指(399006),是成分指数,由流通市值最大、成交最活跃的 100 只创业板个股组成。
沪市
深市
创业板综指(399102)为什么比创业板成指(399006)涨幅大?
上述自由流通股,是指扣除受限流通股份后的股本,相当于是流通股本。
創業板指的指數選樣以樣本股的“流通市值市場占比”和“成交金額市場占比”兩個指標為主要依據,體現深市流通市值比例高、成交活躍等特點
指數樣本股調整每季度進行一次,以反映創業板市場快速成長的特點
新股發行從第二天开始计算指数,一般新股从第二天起基本上都是“一”字涨停,几天后股价与第一天收盘价几乎都有翻番,使得综指上涨