|
|
|
@ -30,7 +30,7 @@ def toTransStockBasis(db_conn_a,dbcursor_a,db_conn_b,dbcursor_b,trade_date):
|
|
|
|
for row in basisDatas:
|
|
|
|
for row in basisDatas:
|
|
|
|
code,name,blemind2,blemind3 = row
|
|
|
|
code,name,blemind2,blemind3 = row
|
|
|
|
if code in mojin_stock_basic_map:
|
|
|
|
if code in mojin_stock_basic_map:
|
|
|
|
if mojin_stock_basic_map[code][1] == name:
|
|
|
|
if mojin_stock_basic_map[code][1] != name:
|
|
|
|
sql_insert = 'update stock_basis set name = %s where code = %s'
|
|
|
|
sql_insert = 'update stock_basis set name = %s where code = %s'
|
|
|
|
db_mojin_cursor.execute(sql_insert, (name,code))
|
|
|
|
db_mojin_cursor.execute(sql_insert, (name,code))
|
|
|
|
hasInsertData = True
|
|
|
|
hasInsertData = True
|
|
|
|
@ -197,7 +197,7 @@ def toTransStocksInTrend(db_conn_a,dbcursor_a,db_conn_b,dbcursor_b,trade_date):
|
|
|
|
|
|
|
|
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
sql_qurey = 'select code,trade_day,sort,type from stocks_in_trend where trade_day = %s'
|
|
|
|
sql_qurey = 'select code,trade_day,sort,type from stocks_in_trend where trade_day = %s'
|
|
|
|
db_ry_cursor.execute(sql_qurey)
|
|
|
|
db_ry_cursor.execute(sql_qurey,trans_date)
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
hasInsertData = False
|
|
|
|
hasInsertData = False
|
|
|
|
for row in basisDatas:
|
|
|
|
for row in basisDatas:
|
|
|
|
@ -238,7 +238,7 @@ def toTransStocksLimit(db_conn_a,dbcursor_a,db_conn_b,dbcursor_b,trade_date):
|
|
|
|
|
|
|
|
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
sql_qurey = 'select code,trade_day,islimit,isdrop from stocks_limit where trade_day = %s'
|
|
|
|
sql_qurey = 'select code,trade_day,islimit,isdrop from stocks_limit where trade_day = %s'
|
|
|
|
db_ry_cursor.execute(sql_qurey)
|
|
|
|
db_ry_cursor.execute(sql_qurey,trans_date)
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
hasInsertData = False
|
|
|
|
hasInsertData = False
|
|
|
|
for row in basisDatas:
|
|
|
|
for row in basisDatas:
|
|
|
|
@ -279,7 +279,7 @@ def toTransStocksLimitUp(db_conn_a,dbcursor_a,db_conn_b,dbcursor_b,trade_date):
|
|
|
|
|
|
|
|
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
sql_qurey = 'select code,trade_day from stocks_limit_up where trade_day = %s'
|
|
|
|
sql_qurey = 'select code,trade_day from stocks_limit_up where trade_day = %s'
|
|
|
|
db_ry_cursor.execute(sql_qurey)
|
|
|
|
db_ry_cursor.execute(sql_qurey,trans_date)
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
hasInsertData = False
|
|
|
|
hasInsertData = False
|
|
|
|
for row in basisDatas:
|
|
|
|
for row in basisDatas:
|
|
|
|
@ -320,7 +320,7 @@ def toTransStocksNewRecord(db_conn_a,dbcursor_a,db_conn_b,dbcursor_b,trade_date)
|
|
|
|
|
|
|
|
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
sql_qurey = 'select code,trade_day,isHigh,isLow from stocks_new_record where trade_day = %s'
|
|
|
|
sql_qurey = 'select code,trade_day,isHigh,isLow from stocks_new_record where trade_day = %s'
|
|
|
|
db_ry_cursor.execute(sql_qurey)
|
|
|
|
db_ry_cursor.execute(sql_qurey,trans_date)
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
hasInsertData = False
|
|
|
|
hasInsertData = False
|
|
|
|
for row in basisDatas:
|
|
|
|
for row in basisDatas:
|
|
|
|
@ -361,7 +361,7 @@ def toTransStocksTmp(db_conn_a,dbcursor_a,db_conn_b,dbcursor_b,trade_date):
|
|
|
|
|
|
|
|
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
sql_qurey = 'select code,trade_day,differrange3,differrange5,differrange15,differrange30 from stocks_tmp where trade_day = %s'
|
|
|
|
sql_qurey = 'select code,trade_day,differrange3,differrange5,differrange15,differrange30 from stocks_tmp where trade_day = %s'
|
|
|
|
db_ry_cursor.execute(sql_qurey)
|
|
|
|
db_ry_cursor.execute(sql_qurey,trans_date)
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
hasInsertData = False
|
|
|
|
hasInsertData = False
|
|
|
|
for row in basisDatas:
|
|
|
|
for row in basisDatas:
|
|
|
|
@ -402,7 +402,7 @@ def toTransTrends(db_conn_a,dbcursor_a,db_conn_b,dbcursor_b,trade_date):
|
|
|
|
|
|
|
|
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
#查询ry库中的基础数据
|
|
|
|
sql_qurey = 'select trade_day,blemind2,stocks_count,trend_value,trend_value_change,sort,sort_change,type from trends where trade_day = %s'
|
|
|
|
sql_qurey = 'select trade_day,blemind2,stocks_count,trend_value,trend_value_change,sort,sort_change,type from trends where trade_day = %s'
|
|
|
|
db_ry_cursor.execute(sql_qurey)
|
|
|
|
db_ry_cursor.execute(sql_qurey,trans_date)
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
basisDatas = db_ry_cursor.fetchall()
|
|
|
|
hasInsertData = False
|
|
|
|
hasInsertData = False
|
|
|
|
for row in basisDatas:
|
|
|
|
for row in basisDatas:
|
|
|
|
@ -460,10 +460,20 @@ if __name__ == "__main__":
|
|
|
|
db_b_conn = pymysql.connect(**db_b_config)
|
|
|
|
db_b_conn = pymysql.connect(**db_b_config)
|
|
|
|
db_b_cursor = db_b_conn.cursor()
|
|
|
|
db_b_cursor = db_b_conn.cursor()
|
|
|
|
|
|
|
|
|
|
|
|
trade_day = '2023-08-09'
|
|
|
|
trade_day = '2023-08-10'
|
|
|
|
|
|
|
|
|
|
|
|
#测试
|
|
|
|
#测试
|
|
|
|
toTransStocksInTrend(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
toTransStocksInTrend(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
|
|
|
|
toTransStockBasis(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
|
|
|
|
# toTransStockFinancial(db_conn_a,dbcursor_a,db_conn_b,dbcursor_b,trade_date)
|
|
|
|
|
|
|
|
toTransStockIndex(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
|
|
|
|
toTransStocks(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
|
|
|
|
toTransStocksInTrend(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
|
|
|
|
toTransStocksLimit(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
|
|
|
|
toTransStocksLimitUp(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
|
|
|
|
toTransStocksNewRecord(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
|
|
|
|
toTransStocksTmp(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
|
|
|
|
toTransTrends(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_day)
|
|
|
|
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
print(f"出现错误:{e}")
|
|
|
|
print(f"出现错误:{e}")
|
|
|
|
|