python 量化(七)股票回测

a={'000672',
 '000717',
 '000799',
 '000889',
 '000898',
 '002019',
 '002035',
 '002240',
 '002310',
 '002450',
 '002640',
 '600004',
 '600115',
 '600160',
 '600167',
 '600282',
 '600352',
 '600377',
 '600406',
 '600487',
 '600702',
 '600741',
 '601288',
 '601328'}

import tushare as ts
import pandas as pd
g=[]
for k in list(a):
    df=ts.get_hist_data(k,start='2015-01-12',end='2018-05-03')

    v1=df['close'].iloc[1]
    b1=df['high'].iloc[0]

    print(v1,b1,k)
    if df['p_change'].iloc[0]>0 or b1>v1:
        g.append(1)


b=1+1+1+1+1+1+1+1+1+1

你可能感兴趣的