104 lines
3.8 KiB
Python
104 lines
3.8 KiB
Python
# encoding: UTF-8
|
||
|
||
from vtConstant import EMPTY_UNICODE, EMPTY_STRING, EMPTY_FLOAT, EMPTY_INT,COLOR_EQUAL
|
||
|
||
|
||
########################################################################
|
||
class StopOrder(object):
|
||
"""本地停止单"""
|
||
|
||
#----------------------------------------------------------------------
|
||
def __init__(self):
|
||
"""Constructor"""
|
||
self.vtSymbol = EMPTY_STRING
|
||
self.orderType = EMPTY_UNICODE
|
||
self.price = EMPTY_FLOAT
|
||
self.volume = EMPTY_INT
|
||
|
||
self.strategy = None # 下停止单的策略对象
|
||
self.stopOrderID = EMPTY_STRING # 停止单的本地编号
|
||
self.status = EMPTY_STRING # 停止单状态
|
||
|
||
|
||
########################################################################
|
||
class CtaBarData(object):
|
||
"""K线数据"""
|
||
|
||
#----------------------------------------------------------------------
|
||
def __init__(self):
|
||
"""Constructor"""
|
||
self.vtSymbol = EMPTY_STRING # vt系统代码
|
||
self.symbol = EMPTY_STRING # 代码
|
||
self.exchange = EMPTY_STRING # 交易所
|
||
|
||
self.open = EMPTY_FLOAT # OHLC
|
||
self.high = EMPTY_FLOAT
|
||
self.low = EMPTY_FLOAT
|
||
self.close = EMPTY_FLOAT
|
||
|
||
self.date = EMPTY_STRING # bar开始的时间,日期
|
||
self.time = EMPTY_STRING # 时间
|
||
self.datetime = None # python的datetime时间对象
|
||
|
||
self.volume = EMPTY_INT # 成交量
|
||
self.openInterest = EMPTY_INT # 持仓量
|
||
|
||
self.color = COLOR_EQUAL # k 线颜色,COLOR_RED,COLOR_BLUE
|
||
self.traded = False
|
||
self.tradeStatus = EMPTY_STRING # 当前bar的交易情况: CTAORDER_BUY 、CTAORDER_SELL、
|
||
# CTAORDER_SHORT 、CTAORDER_COVER 、 CTAORDER_OPEN_REJECT 、
|
||
# CTAORDER_OPEN_FAIL 、CTAORDER_CLOSE_FAIL
|
||
|
||
self.seconds = EMPTY_INT # 当前Bar的秒数(针对RenkoBar)
|
||
|
||
|
||
########################################################################
|
||
class CtaTickData(object):
|
||
"""Tick数据"""
|
||
|
||
#----------------------------------------------------------------------
|
||
def __init__(self):
|
||
"""Constructor"""
|
||
self.vtSymbol = EMPTY_STRING # vt系统代码
|
||
self.symbol = EMPTY_STRING # 合约代码
|
||
self.exchange = EMPTY_STRING # 交易所代码
|
||
|
||
# 成交数据
|
||
self.lastPrice = EMPTY_FLOAT # 最新成交价
|
||
self.volume = EMPTY_INT # 最新成交量
|
||
self.openInterest = EMPTY_INT # 持仓量
|
||
|
||
self.upperLimit = EMPTY_FLOAT # 涨停价
|
||
self.lowerLimit = EMPTY_FLOAT # 跌停价
|
||
|
||
# tick的时间
|
||
self.date = EMPTY_STRING # 日期
|
||
self.time = EMPTY_STRING # 时间
|
||
self.datetime = None # python的datetime时间对象
|
||
|
||
# 五档行情
|
||
self.bidPrice1 = EMPTY_FLOAT
|
||
self.bidPrice2 = EMPTY_FLOAT
|
||
self.bidPrice3 = EMPTY_FLOAT
|
||
self.bidPrice4 = EMPTY_FLOAT
|
||
self.bidPrice5 = EMPTY_FLOAT
|
||
|
||
self.askPrice1 = EMPTY_FLOAT
|
||
self.askPrice2 = EMPTY_FLOAT
|
||
self.askPrice3 = EMPTY_FLOAT
|
||
self.askPrice4 = EMPTY_FLOAT
|
||
self.askPrice5 = EMPTY_FLOAT
|
||
|
||
self.bidVolume1 = EMPTY_INT
|
||
self.bidVolume2 = EMPTY_INT
|
||
self.bidVolume3 = EMPTY_INT
|
||
self.bidVolume4 = EMPTY_INT
|
||
self.bidVolume5 = EMPTY_INT
|
||
|
||
self.askVolume1 = EMPTY_INT
|
||
self.askVolume2 = EMPTY_INT
|
||
self.askVolume3 = EMPTY_INT
|
||
self.askVolume4 = EMPTY_INT
|
||
self.askVolume5 = EMPTY_INT
|
||
|