|
@@ -3,11 +3,11 @@ from sqlalchemy import create_engine
|
|
|
auth('18616891214', 'Ea?*7f68nD.dafcW34d!')
|
|
|
|
|
|
# 获得代码列表
|
|
|
-stocks = list(get_all_securities(['stock'], date='2022-02-01').index)
|
|
|
-stocks = stocks[0:50]
|
|
|
+stocks = list(get_all_securities(['stock'], date='2022-03-08').index)
|
|
|
+# stocks = stocks[0:50]
|
|
|
|
|
|
# 建立stocks 数据库
|
|
|
-engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/sit?charset=utf8')
|
|
|
+engine = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/stocks?charset=utf8')
|
|
|
|
|
|
# 定义周期级别
|
|
|
fre = '1d'
|
|
@@ -15,7 +15,7 @@ print('ready to get history')
|
|
|
# 逐一取数据,写入sql
|
|
|
for stock in stocks:
|
|
|
print(stock)
|
|
|
- df_stock = get_price(stock, start_date='2020-01-01 00:00:00', end_date='2022-02-01 00:00:00',
|
|
|
+ df_stock = get_price(stock, start_date='2010-01-01 00:00:00', end_date='2022-02-01 00:00:00',
|
|
|
frequency=fre, fields=['open', 'close', 'high', 'low', 'volume', 'money'], skip_paused=False,
|
|
|
fq='pre', count=None, panel=False)
|
|
|
# 去除无数据日
|