def test_save(): import stock r = redis.Redis(host='localhost', port=6379, db=0) ths = stock.createThs() #df = stock.Guider(code).ToDataFrame() f = cStringIO.StringIO() cPickle.dump(ths, f) #df.to_csv(f) s = f.getvalue() f.close() print(len(s)) r.set('ths', s)
def _dump(): import stock as mystock ths = mystock.createThs() df_fenhong = ths.getDf(-1) df_fenhong = _convert_fenhong(df_fenhong) fname = enum.fname_fenhong df_fenhong.to_csv(fname, index=False) #历次股本变动 df_stockchange = ths.getDf(3) df_stockchange = _convert_stockchange(df_stockchange) fname = enum.fname_astockchange df_stockchange.to_csv(fname, index=False)
def __init__(self): #记录策略runlog上次提交的时间 self.pre_post_runlog = { 1: datetime.datetime(2015, 10, 19, 15, 33, 47, 53000) } self.ths = stock.createThs()