def setContent(self, text): """设置内容""" if text == DIRECTION_LONG or text == DIRECTION_NET: self.setForeground(QtGui.QColor('red')) elif text == DIRECTION_SHORT: self.setForeground(QtGui.QColor('green')) self.setText(text)
def __init__(self, text=None, mainEngine=None): """Constructor""" super(AskCell, self).__init__() self.data = None self.setForeground(QtGui.QColor('black')) self.setBackground(QtGui.QColor(160, 255, 160)) if text: self.setContent(text)
def addCell(self, name, row, col, color, alignment=None): """新增单元格""" cell = QtWidgets.QTableWidgetItem() self.setItem(row, col, cell) self.cellDict[name] = cell if color: cell.setForeground(QtGui.QColor(color)) if alignment: cell.setTextAlignment(alignment) else: cell.setTextAlignment(QtCore.Qt.AlignCenter)
# encoding: UTF-8 import json import csv import os import platform from collections import OrderedDict from vnpy.event import * from vnpy.trader.vtEvent import * from vnpy.trader.vtFunction import * from vnpy.trader.vtGateway import * from vnpy.trader import vtText from vnpy.trader.uiQt import QtGui, QtWidgets, QtCore, BASIC_FONT COLOR_RED = QtGui.QColor('red') COLOR_GREEN = QtGui.QColor('green') ######################################################################## class BasicCell(QtWidgets.QTableWidgetItem): """基础的单元格""" #---------------------------------------------------------------------- def __init__(self, text=None, mainEngine=None): """Constructor""" super(BasicCell, self).__init__() self.data = None if text: self.setContent(text)
def __init__(self, text=None, mainEngine=None): """Constructor""" super(BidCell, self).__init__(text) self.setForeground(QtGui.QColor('black')) self.setBackground(QtGui.QColor(255,174,201))
import os import platform from collections import OrderedDict from six import text_type from vnpy.event import * from vnpy.trader import vtText from vnpy.trader.vtEvent import * from vnpy.trader.vtConstant import * from vnpy.trader.vtFunction import * from vnpy.trader.vtGateway import * from vnpy.trader.uiQt import QtGui, QtWidgets, QtCore, BASIC_FONT COLOR_RED = QtGui.QColor('red') COLOR_GREEN = QtGui.QColor('green') COLOR_YELLOW = QtGui.QColor('yellow') ######################################################################## class BasicCell(QtWidgets.QTableWidgetItem): """基础的单元格""" #---------------------------------------------------------------------- def __init__(self, text=None, mainEngine=None): """Constructor""" super(BasicCell, self).__init__() self.data = None self.setTextAlignment(QtCore.Qt.AlignCenter)
# encoding: UTF-8 from vnpy.trader.uiQt import QtGui, QtWidgets, QtCore COLOR_BID = QtGui.QColor(255, 174, 201) COLOR_ASK = QtGui.QColor(160, 255, 160) COLOR_STRIKE = QtGui.QColor(0, 0, 160) COLOR_POS = QtGui.QColor(225, 255, 255) COLOR_SYMBOL = QtGui.QColor('white') COLOR_BLACK = QtGui.QColor('black') #波动率的计算方式comprehensive:每个月的利率一样,采用平值期权上下两档,五档数据计算,Separate:每个合约都有独立的利率分开算 VOLATILITY_RULE_COMPREHENSIVE = "comprehensive" VOLATILITY_RULE_SEPARATE = "Separate" CALL_SUFFIX = '_call' PUT_SUFFIX = '_put' STYLESHEET_START = "background-color: rgb(111,255,244); color: black" STYLESHEET_STOP = "background-color: rgb(255,201,111); color: black" ######################################################################## class OmCell(QtWidgets.QTableWidgetItem): """单元格""" #---------------------------------------------------------------------- def __init__(self, text=None, background=None, foreground=None,