合并UI
This commit is contained in:
+9
-70
@@ -1,82 +1,21 @@
|
||||
# coding:utf-8
|
||||
from mimetypes import init
|
||||
import sys
|
||||
sys.stdout.reconfigure(encoding='utf-8') # 设置标准输出编码为UTF-8 # type: ignore
|
||||
from core import strategy_db
|
||||
# from core.main_controller import SFGridController
|
||||
# import core.util as util
|
||||
from core.main_controller import SFGridController
|
||||
import sfgrid_constants as sdConstants
|
||||
# from xtquant import xtdata
|
||||
import ui
|
||||
|
||||
def interact():
|
||||
"""执行后进入repl模式"""
|
||||
import code
|
||||
code.InteractiveConsole(locals=globals()).interact()
|
||||
|
||||
# def startMarketData():
|
||||
# ctrl.startMarketData()
|
||||
|
||||
# def stopMarketData():
|
||||
# ctrl.stopMarketData()
|
||||
|
||||
# def pool():
|
||||
# ctrl.print_pool()
|
||||
|
||||
# def addTarget(stock_code):
|
||||
# ctrl.add_trade_target(stock_code)
|
||||
|
||||
# def delTarget(index:int):
|
||||
# ctrl.del_trade_target(index)
|
||||
|
||||
# def accountInfo():
|
||||
# ctrl.print_account_info()
|
||||
|
||||
# def positionInfo():
|
||||
# ctrl.print_position_info()
|
||||
|
||||
# def startTrade(index:int):
|
||||
# ctrl.start_stock_trade(index)
|
||||
|
||||
# def pauseTrade(index:int):
|
||||
# ctrl.pause_stock_trade(index)
|
||||
|
||||
# def stockTradeCtrl(index: int):
|
||||
# return ctrl.stock_trade_ctrl[ctrl.instrument_pool[index].stock_code]
|
||||
|
||||
def help():
|
||||
print("基础指令:")
|
||||
print(" ===================================================")
|
||||
print(" startMarketData() - 启动市场数据接收")
|
||||
print(" stopMarketData() - 停止市场数据接收\n")
|
||||
print(" pool() - 打印标的池信息")
|
||||
print(" addTarget(stock_code) - 添加交易标的")
|
||||
print(" delTarget(index) - 删除交易标的\n")
|
||||
print(" accountInfo() - 打印账户信息")
|
||||
print(" positionInfo() - 打印持仓信息\n")
|
||||
print(" startTrade(index) - 启动标的交易")
|
||||
print(" pauseTrade(index) - 暂停标的交易")
|
||||
print(" ===================================================")
|
||||
print("内部指令:")
|
||||
print(" stockTradeCtrl(index) - 获取标的交易控制器")
|
||||
print(" ctrl - 访问控制器实例")
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
sdConstants.initConfig()
|
||||
strategy_db.db.connect()
|
||||
strategy_db.db.create_tables([strategy_db.TradeTarget])
|
||||
print('- [成功]数据库模块初始化')
|
||||
|
||||
targets = strategy_db.TradeTarget.select()
|
||||
|
||||
|
||||
app = ui.TradeTargetUI(trade_targets=targets)
|
||||
app.run()
|
||||
|
||||
# sdConstants.initConfig()
|
||||
# print(f'{sdConstants.account_no} : {sdConstants.miniQMTPath}')
|
||||
# ctrl: SFGridController = SFGridController(sdConstants.account_no, sdConstants.miniQMTPath)
|
||||
# if ctrl.inited:
|
||||
# interact()
|
||||
# else:
|
||||
# print("控制器初始化失败")
|
||||
targets = strategy_db.TradeTarget.select()
|
||||
appUi = ui.TradeTargetUI(trade_targets=targets)
|
||||
|
||||
print(f'{sdConstants.account_no} : {sdConstants.miniQMTPath}')
|
||||
ctrl: SFGridController = SFGridController(sdConstants.account_no, sdConstants.miniQMTPath)
|
||||
|
||||
appUi.run()
|
||||
|
||||
Reference in New Issue
Block a user