tushare.get_hist_data

Here are the examples of the python api tushare.get_hist_data taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5 Examples 7

Example 1

Project: tushare Source File: storing_test.py
Function: hdf
def hdf():
    df = ts.get_hist_data('000875')
#     df.to_hdf('c:/day/store.h5','table')
    
    store = HDFStore('c:/day/store.h5')
    store['000875'] = df
    store.close()

Example 2

Project: tushare Source File: storing_test.py
Function: json
def json():
    df = ts.get_hist_data('000875')
    df.to_json('c:/day/000875.json',orient='records')

    #或者直接使用
    print(df.to_json(orient='records'))

Example 3

Project: tushare Source File: storing_test.py
def appends():
    filename = 'c:/day/bigfile.csv'
    for code in ['000875', '600848', '000981']:
        df = ts.get_hist_data(code)
        if os.path.exists(filename):
            df.to_csv(filename, mode='a', header=None)
        else:
            df.to_csv(filename)  

Example 4

Project: tushare Source File: storing_test.py
Function: csv
def csv():
    df = ts.get_hist_data('000875')
    df.to_csv('c:/day/000875.csv',columns=['open','high','low','close'])

Example 5

Project: tushare Source File: storing_test.py
Function: xls
def xls():
    df = ts.get_hist_data('000875')
    #直接保存
    df.to_excel('c:/day/000875.xlsx', startrow=2,startcol=5)