adjust
This commit is contained in:
@@ -4,7 +4,7 @@ import time, sys
|
||||
sys.stdout.reconfigure(encoding='utf-8') # 设置标准输出编码为UTF-8
|
||||
import strategy_db
|
||||
from trade_thread import StockTradeThread
|
||||
from util import getInstrumentName
|
||||
from util import getInstrumentName, interact
|
||||
from xtquant.xttrader import XtQuantTrader
|
||||
from xtquant.xttype import StockAccount
|
||||
|
||||
@@ -93,10 +93,6 @@ class SFGridController:
|
||||
else:
|
||||
print("\n当前无委托记录")
|
||||
|
||||
def interact(self):
|
||||
"""执行后进入repl模式"""
|
||||
import code
|
||||
code.InteractiveConsole(locals=globals()).interact()
|
||||
|
||||
def init_stock_trade_threads(self):
|
||||
for stock_code in self.instrument_pool:
|
||||
@@ -104,8 +100,10 @@ class SFGridController:
|
||||
new_job.name = f"StockTradeThread-{stock_code}"
|
||||
new_job.start()
|
||||
|
||||
def stock_trade_thread(self, stock_code):
|
||||
print(f"启动标的交易线程 {stock_code} {getInstrumentName(stock_code)}\n")
|
||||
def start_stock_trade_thread(self, stock: strategy_db.TradeTarget):
|
||||
stock.name = f"StockTradeThread-{stock.stock_code}"
|
||||
stock.start()
|
||||
print(f"启动标的交易线程 {stock.stock_code} {getInstrumentName(stock.stock_code)}\n")
|
||||
threading.Event().wait(2) # 模拟交易操作的等待时间
|
||||
|
||||
|
||||
@@ -117,6 +115,6 @@ if __name__ == '__main__':
|
||||
ctrl.init_stock_trade_threads()
|
||||
|
||||
# 交互阻塞
|
||||
ctrl.interact()
|
||||
interact()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user