
stock_list="
SZ000534
SH600629
SH600807
SH600871
SH600816
SZ000526
SZ000564
SH600881
SZ000540
SZ000050
SZ000555
SZ000589
SH600875
SH600884
SH600879
SH600895
SH600889
SZ000560
SH600897
SZ000055
SH600887
SZ000029
SZ000599
SH600862
SH600873
SH600888
SH600687
SH600894
SH600718
SZ000598
SZ000017
SH600717
SZ000402
SZ000419
SH600702
SH600855
SZ000597
SH600713
SH600712
SZ000404
SZ000417
SH600837
SH600698
SH600742
SH600708
SH600726
SH600720
SZ000591
SH600706
SH600723
SH600731
SH600761
SH600755
SZ000420
SZ000594
SZ000506
SH600021
SH600993
SH600325
SH600992
SH600405
SH600543
SH600517
SH600273
SH600493
SH600354
SH600435
SH600432
SH600114
SH600976
SH600540
SH600491
SH600980
SH600545
SH600547
SH600406
SH600284
SH600452
SH600584
SH600515
SH600495
SZ002001
SH600446
SZ000757
SH600433
SH600469
SZ002028
SZ002007
SH600340
SZ002023
SH600575
SH600429
SH600478
SZ002024
SZ002008
SH600392
SH600966
SZ002022
SZ002017
SZ002029
SH600387
SH600997
SZ002038
SH600995
SH600971
SH600423
SH600410
SH600483
SH600961
SH600438
SH600987
SZ002031
SH600963
SZ002030
SH600143
SH600444
SZ002032
SH600975
SZ002035
SH600035
SH600990
SH600982
SZ002016
SH600420
SZ002003
SH600960
SZ000981
SH600461
SH600572
SH600962
SH600576
SZ002020
SZ002019
SZ002027
SH600967
SZ002014
SZ002010
SZ002026
SH600973
SZ002009
SZ002033
SZ002013
SH600986
SH600482
SH600027
SZ002036
SH600585
SH600984
SH600965
SH600981
SZ002004
SH600979
SZ002034
SH600985
SZ002011
SZ002039
SH600497
SZ002041
SH600983
SZ000100
SZ002025
SH600900
SZ002037
SH600970
SH600490
SZ002045
SZ002005
SH600978
SH600022
SZ002040
SZ002046
SZ002043
SZ002018
SZ002012
SH600988
SH600462
SZ002048
SH600421
SZ002006
SZ002021
SZ002050
SZ002042
SH601988
SZ000693
SZ002047
SZ002002
SH601006
SH600048
SZ002056
SZ002066
SZ002054
SZ002064
SZ002049
SH600485
SZ002058
SZ002060
SZ002067
SZ002044
SZ002062
SH601699
SH601588
SZ002068
SH601398
SH601111
SH601666
SH600017
SZ002015
SZ002083
SZ002095
SH601333
SZ002055
"
for stock in $stock_list
do
  echo $stock
  sql="INSERT IGNORE INTO final_a_stock_eod_price (tradedate, symbol, high, low, open, close, volume, adjclose) 
select ts_a_stock_eod_price.tradedate, 
			link_info.w_symbol as symbol,
			ts_a_stock_eod_price.high,
			ts_a_stock_eod_price.low,
			ts_a_stock_eod_price.open,
			ts_a_stock_eod_price.close,
			ts_a_stock_eod_price.volume,
			ROUND(ts_a_stock_eod_price.adjclose / link_info.adj_ratio, 2) as adjclose 
FROM ts_a_stock_eod_price, 
 (select link_symbol, adj_ratio, w_symbol from ts_link_table WHERE ts_link_table.w_symbol = '${stock}') link_info
  WHERE symbol = link_symbol"
  echo $sql
  dolt sql -q "$sql"
done

dolt table import -u c_a_stock_eod_price ./one_time_db_scripts/caihui_stockprice.csv
