2015-08-14 08:11:53 +00:00
|
|
|
|
# encoding: UTF-8
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
本文件仅用于存放对于事件类型常量的定义。
|
|
|
|
|
|
|
|
|
|
由于python中不存在真正的常量概念,因此选择使用全大写的变量名来代替常量。
|
|
|
|
|
这里设计的命名规则以EVENT_前缀开头。
|
|
|
|
|
|
|
|
|
|
常量的内容通常选择一个能够代表真实意义的字符串(便于理解)。
|
|
|
|
|
|
|
|
|
|
建议将所有的常量定义放在该文件中,便于检查是否存在重复的现象。
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
# 系统相关
|
|
|
|
|
EVENT_TIMER = 'eTimer' # 计时器事件,每隔1秒发送一次
|
|
|
|
|
EVENT_LOG = 'eLog' # 日志事件,全局通用
|
|
|
|
|
|
|
|
|
|
# Gateway相关
|
|
|
|
|
EVENT_TICK = 'eTick.' # TICK行情事件,可后接具体的vtSymbol
|
|
|
|
|
EVENT_TRADE = 'eTrade.' # 成交回报事件
|
|
|
|
|
EVENT_ORDER = 'eOrder.' # 报单回报事件
|
|
|
|
|
EVENT_POSITION = 'ePosition.' # 持仓回报事件
|
|
|
|
|
EVENT_ACCOUNT = 'eAccount.' # 账户回报事件
|
2015-09-09 01:20:02 +00:00
|
|
|
|
EVENT_CONTRACT = 'eContract.' # 合约基础信息回报事件
|
2015-08-14 08:11:53 +00:00
|
|
|
|
EVENT_ERROR = 'eError.' # 错误回报事件
|
|
|
|
|
|
2015-10-19 07:06:50 +00:00
|
|
|
|
# CTA模块相关
|
|
|
|
|
EVENT_CTA_LOG = 'eCtaLog' # CTA相关的日志事件
|
|
|
|
|
|
|
|
|
|
# Wind接口相关
|
|
|
|
|
EVENT_WIND_CONNECTREQ = 'eWindConnectReq' # Wind接口请求连接事件
|
|
|
|
|
|
2015-11-20 06:11:29 +00:00
|
|
|
|
# 20151020后更新
|
|
|
|
|
# LTS Gateway相关
|
|
|
|
|
EVENT_LTS_SF = 'eLtsSf.' # SF基金查询推送事件
|
|
|
|
|
|
|
|
|
|
# 分级A算法相关
|
|
|
|
|
EVENT_FUNDA_DATA = 'eFaData.' # 分级A基金更新事件
|
|
|
|
|
EVENT_FUNDA_LOG = 'eFaLog' # 分级A算法日志事件
|
2015-08-14 08:11:53 +00:00
|
|
|
|
|
2015-11-15 07:53:54 +00:00
|
|
|
|
# ----------------------------------------------------------------------
|
2015-08-14 08:11:53 +00:00
|
|
|
|
def test():
|
|
|
|
|
"""检查是否存在内容重复的常量定义"""
|
|
|
|
|
check_dict = {}
|
|
|
|
|
|
|
|
|
|
global_dict = globals()
|
|
|
|
|
|
|
|
|
|
for key, value in global_dict.items():
|
|
|
|
|
if '__' not in key: # 不检查python内置对象
|
|
|
|
|
if value in check_dict:
|
|
|
|
|
check_dict[value].append(key)
|
|
|
|
|
else:
|
|
|
|
|
check_dict[value] = [key]
|
|
|
|
|
|
|
|
|
|
for key, value in check_dict.items():
|
|
|
|
|
if len(value)>1:
|
|
|
|
|
print u'存在重复的常量定义:' + str(key)
|
|
|
|
|
for name in value:
|
|
|
|
|
print name
|
|
|
|
|
print ''
|
|
|
|
|
|
|
|
|
|
print u'测试完毕'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 直接运行脚本可以进行测试
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
test()
|