代码整理
This commit is contained in:
+3
-5
@@ -1,10 +1,9 @@
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from core.logger import LogLevel, LogData, PrintLog
|
||||
from core.qmt import qmtv
|
||||
from core.sfgrid.sfgrid_ui import TradeTargetUI
|
||||
|
||||
from tkinter import ttk, messagebox
|
||||
from tkinter import ttk
|
||||
from core.eventbus import EventPrintLog
|
||||
from core.eventbus import event_bus as eBus
|
||||
|
||||
@@ -15,6 +14,8 @@ class MainWindow:
|
||||
self.root.title("神之一手 - 交易系统")
|
||||
self.root.geometry("1400x700")
|
||||
|
||||
self.logLevel = LogLevel[configLogLevel]
|
||||
PrintLog(LogLevel.DEBUG, f"系统启动成功 {self.logLevel.name}")
|
||||
# 当前选中的策略Tab索引
|
||||
self.current_strategy_index = 0
|
||||
# 存储各个Frame的引用
|
||||
@@ -23,9 +24,6 @@ class MainWindow:
|
||||
self.log_visible = False
|
||||
self.create_ui()
|
||||
|
||||
self.logLevel = LogLevel[configLogLevel]
|
||||
PrintLog(LogLevel.DEBUG, f"系统启动成功 {self.logLevel.name}")
|
||||
|
||||
eBus.subscribe(EventPrintLog, self.on_log_event)
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
GridTypePercentage = "Percentage"
|
||||
GridTypeFixed = "PriceBreak"
|
||||
@@ -1,7 +0,0 @@
|
||||
from core.sfgrid.model import SFGridTradeTarget as TradeTarget
|
||||
|
||||
|
||||
class GridFixData:
|
||||
def __init__(self, grid_index, tradeTarget:TradeTarget):
|
||||
self.grid_index = grid_index
|
||||
self.tradeTarget = tradeTarget
|
||||
@@ -1,4 +1,3 @@
|
||||
from core import util
|
||||
from core.logger import LogLevel, PrintLog
|
||||
from core.qmt import qmtv
|
||||
from core.sfgrid import bus_events
|
||||
@@ -6,7 +5,6 @@ from core.sfgrid.bus_events import EventTradeTargetUpdate
|
||||
import core.sfgrid.model as model
|
||||
from core.eventbus import event_bus
|
||||
from core.constants import OrderTypeBuy, OrderTypeSell, OrderTypeInit
|
||||
from core.util import is_trading_time
|
||||
|
||||
from xtquant import xtconstant
|
||||
from xtquant.xttype import XtOrderResponse, XtTrade
|
||||
@@ -96,7 +94,7 @@ class SFGridStrategy:
|
||||
print(f'length: {len(self.tradeTarget.getPriceGrid())}, currentIdx = {currentIdx}')
|
||||
buyIdx = currentIdx + 1
|
||||
buyPrice = self.tradeTarget.getPriceGrid()[buyIdx]
|
||||
remark = f'{OrderTypeInit},{buyIdx},{self.tradeTarget.stock_code}'
|
||||
remark = f'{OrderTypeBuy},{buyIdx},{self.tradeTarget.stock_code}'
|
||||
if len([order for order in orders if order.order_type == xtconstant.STOCK_BUY and order.price == buyPrice]) == 0:
|
||||
tmpOrderSeq = qmtv.orderAsync(
|
||||
str(self.tradeTarget.stock_code),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from mimetypes import inited
|
||||
from typing import Any
|
||||
|
||||
import tkinter as tk
|
||||
|
||||
Reference in New Issue
Block a user