@@ -124,14 +124,14 @@ def tdx_import_stock_name_from_file(connect, filename, market, quotations=None):
124124 length = len (codepre [0 ])
125125 if code [:length ] == codepre [0 ]:
126126 count += 1
127- #print(market, code, newStockDict[code], codepre)
127+ # print(market, code, newStockDict[code], codepre)
128128 sql = "insert into Stock(marketid, code, name, type, valid, startDate, endDate) \
129129 values (%s, '%s', '%s', %s, %s, %s, %s)" \
130130 % (marketid , code , newStockDict [code ], codepre [1 ], 1 , today , 99999999 )
131131 cur .execute (sql )
132132 break
133133
134- #print('%s新增股票数:%i' % (market.upper(), count))
134+ # print('%s新增股票数:%i' % (market.upper(), count))
135135 connect .commit ()
136136 cur .close ()
137137 return count
@@ -163,7 +163,7 @@ def tdx_import_day_data_from_file(connect, filename, h5file, market, stock_recor
163163 with open (filename , 'rb' ) as src_file :
164164 data = src_file .read (32 )
165165 while data :
166- record = struct .unpack ('iiiiifii ' , data )
166+ record = struct .unpack ('IIIIIfII ' , data )
167167 if lastdatetime and record [0 ] <= lastdatetime :
168168 data = src_file .read (32 )
169169 continue
@@ -191,8 +191,8 @@ def tdx_import_day_data_from_file(connect, filename, h5file, market, stock_recor
191191 if add_record_count > 0 :
192192 table .flush ()
193193
194- #更新基础信息数据库中股票对应的起止日期及其有效标志
195- #if valid == 0:
194+ # 更新基础信息数据库中股票对应的起止日期及其有效标志
195+ # if valid == 0:
196196 cur = connect .cursor ()
197197 cur .execute (
198198 "update stock set valid=1, startdate=%i, enddate=%i where stockid=%i" %
@@ -201,13 +201,13 @@ def tdx_import_day_data_from_file(connect, filename, h5file, market, stock_recor
201201 connect .commit ()
202202 cur .close ()
203203
204- #记录最新更新日期
204+ # 记录最新更新日期
205205 if (code == '000001' and marketid == MARKETID .SH ) \
206- or (code == '399001' and marketid == MARKETID .SZ ) :
206+ or (code == '399001' and marketid == MARKETID .SZ ):
207207 update_last_date (connect , marketid , table [- 1 ]['datetime' ] / 10000 )
208208
209209 elif table .nrows == 0 :
210- #print(market, stock_record)
210+ # print(market, stock_record)
211211 table .remove ()
212212
213213 return add_record_count
@@ -290,7 +290,7 @@ def find_pos():
290290
291291 data = src_file .read (32 )
292292 while data :
293- record = struct .unpack ('HHfffffii ' , data )
293+ record = struct .unpack ('HHfffffII ' , data )
294294 if 0 not in record [2 :6 ]:
295295 if record [3 ] >= record [2 ] >= record [4 ] \
296296 and record [3 ] >= record [5 ] >= record [4 ]:
@@ -314,7 +314,7 @@ def find_pos():
314314 if add_record_count > 0 :
315315 table .flush ()
316316 elif table .nrows == 0 :
317- #print(market, stock_record)
317+ # print(market, stock_record)
318318 table .remove ()
319319
320320 return add_record_count
@@ -386,7 +386,7 @@ def tdx_import_data(connect, market, ktype, quotations, src_dir, dest_dir, progr
386386
387387 src_dir = "D:\\ TdxW_HuaTai"
388388 dest_dir = "c:\\ stock"
389- quotations = ['stock' , 'fund' ] #通达信盘后数据没有债券
389+ quotations = ['stock' , 'fund' ] # 通达信盘后数据没有债券
390390
391391 connect = sqlite3 .connect (dest_dir + "\\ stock.db" )
392392 create_database (connect )
0 commit comments