cheak_info.py 739 B

1234567891011121314151617181920212223
  1. from sqlalchemy import create_engine
  2. import pandas as pd
  3. from xtquant import xtdata
  4. engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_tech?charset=utf8')
  5. err_list =[]
  6. stocks = xtdata.get_stock_list_in_sector('沪深A股')
  7. print(len(stocks))
  8. stocks.sort()
  9. print(stocks[0:20])
  10. for stock in stocks:
  11. try:
  12. df_day = pd.read_sql_query('select time, open_front, close_front, high_front, low_front, '
  13. 'volume_front, amount_front, dif, dea, macd,HL from `%s_1d`'% stock, engine)
  14. except BaseException as e:
  15. print(stock, e)
  16. err_list.append(stock)
  17. else:
  18. print(f'{stock}正确!')
  19. print(f'错误的有{len(err_list)}', '\n', err_list)