File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -370,23 +370,29 @@ def record_stock_quote(subscribe=False):
370370 import time
371371
372372 first_time = True
373+ last_time = False
373374 while True :
374375 if not first_time and Stock .in_trading_time () and not Stock .in_real_trading_time ():
375- logger .info (f "Sleeping time......" )
376+ logger .info ("Sleeping time......" )
376377 time .sleep (60 * 1 )
377378 continue
378379
380+ if not Stock .in_trading_time ():
381+ logger .info ("Not in trading time......" )
382+ time .sleep (60 * 1 )
383+ last_time = True
384+
379385 datas = xtdata .get_full_tick (code_list = qmt_stocks )
380386 on_data_func (datas = datas )
381387
382388 time .sleep (3 )
383- current_timestamp = now_pd_timestamp ()
384- if not Stock .in_trading_time ():
389+ first_time = False
390+
391+ if last_time :
392+ current_timestamp = now_pd_timestamp ()
385393 logger .info (f"record tick finished at: { current_timestamp } " )
386394 break
387395
388- first_time = False
389-
390396
391397if __name__ == "__main__" :
392398 from apscheduler .schedulers .background import BackgroundScheduler
You can’t perform that action at this time.
0 commit comments