import matplotlib.pyplot as plt
zhisu=D.history_data(instruments=['000001.SHA'], start_date='2012-01-01', end_date=None,
fields=['open', 'high', 'low', 'close'])
zhisu['return'] = zhisu['close'].shift(250) /zhisu['close'] - 1
zhisu['return']=zhisu['return']*100
df=D.macro_data(start_date='2012-01-01', end_date=None, fields=['ppi', 'gdp','m2'])
data= zhisu.merge(df, 'left', ['date'])
data.dropna(inplace=True)
data['cha']=data['m2']-data['return']
data['biao']=(zhisu['close']-zhisu['close'].min())/(zhisu['close'].max()-zhisu['close'].min())
plt.plot(data.biao*200)
plt.plot(data.cha)
plt.plot(data.cha)