# -*- coding:utf-8 -*- from md.config.mysqlutil import DBUtil import pandas as pd import matplotlib import matplotlib.pyplot as plt # url = "table.finance.yahoo.com" if __name__ == '__main__': dbutil = DBUtil() table_name = 'stockdata_yahoo' symbol = '000001' market = 'sz' query = "SELECT * FROM stockdata_yahoo" result = dbutil.exec(query) dbutil.close() df = pd.DataFrame(list(result), columns=('symbol', 'market', 'date', 'open', 'high', 'low', 'close', 'volumn', 'adj_close')) # print(df) fig = plt.figure() open_fig = fig.add_axes([0.05, 0.1, 0.9, 0.8])
# -*- coding:utf-8 -*- import csv from md.config.mysqlutil import DBUtil # url = "table.finance.yahoo.com" if __name__ == '__main__': dbutil = DBUtil() table_name = 'stockdata_yahoo' symbol = '000001' market = 'sz' filename = "st.%s.%s.csv" % (symbol, market) print("filename<%s>", filename) csvReader = csv.reader(open(filename, 'r')) isTitle = True for row in csvReader: if isTitle: isTitle = False continue date = row[0] open = row[1] high = row[2] low = row[3] close = row[4]