历史总是相似 牛市还在延续

来源:https://uqer.io/community/share/5541f07af9f06c1c3d687ffa

07年与15年的牛市时如此相似,你准备好继续all in 了吗?

话不多说,图见真章!

  1. import datetime as dt
  2. import numpy as np
  3. import seaborn as sns
  4. sns.set_style('white')
  5. from matplotlib import pyplot as plt
  6. from CAL.PyCAL import *
  7. font.set_size(20)
  8. index = '000300'
  9. data = DataAPI.MktIdxdGet(ticker = index, beginDate='20070101', endDate='20071101')
  10. data.index = data.tradeDate.apply(lambda x: dt.datetime.strptime(x, '%Y-%m-%d'))
  11. data2 = DataAPI.MktIdxdGet(ticker =index, beginDate='20140830', endDate='20150428')
  12. data2.index = data2.tradeDate.apply(lambda x: dt.datetime.strptime(x, '%Y-%m-%d'))
  13. data['2006 - 2008'] = data['closeIndex']
  14. data = data[['2006 - 2008']]
  15. data['2014 - 2015'] = np.nan
  16. data['2014 - 2015'][:len(data2.closeIndex.values)] = data2.closeIndex.values
  17. data = data[['2006 - 2008', '2014 - 2015']]
  18. data.plot(figsize=(8,4), grid = False)
  19. plt.legend([u'2007年牛市', u'2015年牛市'], prop = font, loc = 'best')
  20. sns.despine()

历史总是相似 牛市还在延续 - 图1