diff --git a/vn.trader/ctaStrategy/language/__init__.py b/vn.trader/ctaStrategy/language/__init__.py new file mode 100644 index 00000000..e42bd064 --- /dev/null +++ b/vn.trader/ctaStrategy/language/__init__.py @@ -0,0 +1,23 @@ +# encoding: UTF-8 + +import json +import os +import traceback + +# 默认设置 +from chinese import text + +# 获取目录上级路径 +path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) +SETTING_FILENAME = 'VT_setting.json' +SETTING_FILENAME = os.path.join(path, SETTING_FILENAME) + +# 打开配置文件,读取语言配置 +try: + f = file(SETTING_FILENAME) + setting = json.load(f) + if setting['language'] == 'english': + from english import text + f.close() +except: + traceback.print_exc() diff --git a/vn.trader/ctaStrategy/language/chinese/__init__.py b/vn.trader/ctaStrategy/language/chinese/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/ctaStrategy/language/chinese/text.py b/vn.trader/ctaStrategy/language/chinese/text.py new file mode 100644 index 00000000..e8410d15 --- /dev/null +++ b/vn.trader/ctaStrategy/language/chinese/text.py @@ -0,0 +1,18 @@ +# encoding: UTF-8 + +INIT = u'初始化' +START = u'启动' +STOP = u'停止' + +CTA_ENGINE_STARTED = u'CTA引擎启动成功' + +CTA_STRATEGY = u'CTA策略' +LOAD_STRATEGY = u'加载策略' +INIT_ALL = u'全部初始化' +START_ALL = u'全部启动' +STOP_ALL = u'全部停止' +SAVE_POSITION_DATA = u'保存持仓' + +STRATEGY_LOADED = u'策略加载成功' + +SAVE_POSITION_QUESTION = u'是否要保存策略持仓数据到数据库?' \ No newline at end of file diff --git a/vn.trader/ctaStrategy/language/english/__init__.py b/vn.trader/ctaStrategy/language/english/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/ctaStrategy/language/english/text.py b/vn.trader/ctaStrategy/language/english/text.py new file mode 100644 index 00000000..5e8bfb34 --- /dev/null +++ b/vn.trader/ctaStrategy/language/english/text.py @@ -0,0 +1,18 @@ +# encoding: UTF-8 + +INIT = u'Init' +START = u'Start' +STOP = u'Stop' + +CTA_ENGINE_STARTED = u'CTA engine started.' + +CTA_STRATEGY = u'CTA Strategy' +LOAD_STRATEGY = u'Load Strategy' +INIT_ALL = u'Init All' +START_ALL = u'Start All' +STOP_ALL = u'Stop All' +SAVE_POSITION_DATA = u'Save Position Data' + +STRATEGY_LOADED = u'Strategy loaded.' + +SAVE_POSITION_QUESTION = u'Do you want to save strategy position data into database?' \ No newline at end of file diff --git a/vn.trader/dataRecorder/language/__init__.py b/vn.trader/dataRecorder/language/__init__.py new file mode 100644 index 00000000..e42bd064 --- /dev/null +++ b/vn.trader/dataRecorder/language/__init__.py @@ -0,0 +1,23 @@ +# encoding: UTF-8 + +import json +import os +import traceback + +# 默认设置 +from chinese import text + +# 获取目录上级路径 +path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) +SETTING_FILENAME = 'VT_setting.json' +SETTING_FILENAME = os.path.join(path, SETTING_FILENAME) + +# 打开配置文件,读取语言配置 +try: + f = file(SETTING_FILENAME) + setting = json.load(f) + if setting['language'] == 'english': + from english import text + f.close() +except: + traceback.print_exc() diff --git a/vn.trader/dataRecorder/language/chinese/__init__.py b/vn.trader/dataRecorder/language/chinese/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/dataRecorder/language/chinese/text.py b/vn.trader/dataRecorder/language/chinese/text.py new file mode 100644 index 00000000..fdb2179f --- /dev/null +++ b/vn.trader/dataRecorder/language/chinese/text.py @@ -0,0 +1,16 @@ +# encoding: UTF-8 + +DATA_RECORDER = u'行情记录' + +TICK_RECORD = u'Tick记录' +BAR_RECORD = u'Bar记录' +TICK_RECORD = u'Tick记录' + +CONTRACT_SYMBOL = u'合约代码' +GATEWAY = u'接口' + +DOMINANT_CONTRACT = u'主力合约' +DOMINANT_SYMBOL = u'主力代码' + +TICK_LOGGING_MESSAGE = u'记录Tick数据{symbol},时间:{time}, last:{last}, bid:{bid}, ask:{ask}' +BAR_LOGGING_MESSAGE = u'记录分钟线数据{symbol},时间:{time}, O:{open}, H:{high}, L:{low}, C:{close}' \ No newline at end of file diff --git a/vn.trader/dataRecorder/language/english/__init__.py b/vn.trader/dataRecorder/language/english/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/dataRecorder/language/english/text.py b/vn.trader/dataRecorder/language/english/text.py new file mode 100644 index 00000000..2230e6ca --- /dev/null +++ b/vn.trader/dataRecorder/language/english/text.py @@ -0,0 +1,15 @@ +# encoding: UTF-8 + +DATA_RECORDER = u'Data Recorder' + +TICK_RECORD = u'Tick Record' +BAR_RECORD = u'Bar Record' + +CONTRACT_SYMBOL = u'Contract Symbol' +GATEWAY = u'Gateway' + +DOMINANT_CONTRACT = u'Dominant Contract' +DOMINANT_SYMBOL = u'Dominant Symbol' + +TICK_LOGGING_MESSAGE = u'Record Tick Data {symbol}, Time:{time}, last:{last}, bid:{bid}, ask:{ask}' +BAR_LOGGING_MESSAGE = u'Record Bar Data {symbol}, Time:{time}, O:{open}, H:{high}, L:{low}, C:{close}' \ No newline at end of file diff --git a/vn.trader/gateway/ctpGateway/language/__init__.py b/vn.trader/gateway/ctpGateway/language/__init__.py new file mode 100644 index 00000000..8325ae0c --- /dev/null +++ b/vn.trader/gateway/ctpGateway/language/__init__.py @@ -0,0 +1,23 @@ +# encoding: UTF-8 + +import json +import os +import traceback + +# 默认设置 +from chinese import text + +# 获取目录上级路径 +path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')) +SETTING_FILENAME = 'VT_setting.json' +SETTING_FILENAME = os.path.join(path, SETTING_FILENAME) + +# 打开配置文件,读取语言配置 +try: + f = file(SETTING_FILENAME) + setting = json.load(f) + if setting['language'] == 'english': + from english import text + f.close() +except: + traceback.print_exc() diff --git a/vn.trader/gateway/ctpGateway/language/chinese/__init__.py b/vn.trader/gateway/ctpGateway/language/chinese/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/gateway/ctpGateway/language/chinese/text.py b/vn.trader/gateway/ctpGateway/language/chinese/text.py new file mode 100644 index 00000000..217fff5d --- /dev/null +++ b/vn.trader/gateway/ctpGateway/language/chinese/text.py @@ -0,0 +1,18 @@ +# encoding: UTF-8 + +LOADING_ERROR = u'读取连接配置出错,请检查' +CONFIG_KEY_MISSING = u'连接配置缺少字段,请检查' + +DATA_SERVER_CONNECTED = u'行情服务器连接成功' +DATA_SERVER_DISCONNECTED = u'行情服务器连接断开' +DATA_SERVER_LOGIN = u'行情服务器登录完成' +DATA_SERVER_LOGOUT = u'行情服务器登出完成' + +TRADING_SERVER_CONNECTED = u'交易服务器连接成功' +TRADING_SERVER_DISCONNECTED = u'交易服务器连接断开' +TRADING_SERVER_AUTHENTICATED = u'交易服务器验证成功' +TRADING_SERVER_LOGIN = u'交易服务器登录完成' +TRADING_SERVER_LOGOUT = u'交易服务器登出完成' + +SETTLEMENT_INFO_CONFIRMED = u'结算信息确认完成' +CONTRACT_DATA_RECEIVED = u'交易合约信息获取完成' \ No newline at end of file diff --git a/vn.trader/gateway/ctpGateway/language/english/__init__.py b/vn.trader/gateway/ctpGateway/language/english/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/gateway/ctpGateway/language/english/text.py b/vn.trader/gateway/ctpGateway/language/english/text.py new file mode 100644 index 00000000..743167f4 --- /dev/null +++ b/vn.trader/gateway/ctpGateway/language/english/text.py @@ -0,0 +1,18 @@ +# encoding: UTF-8 + +LOADING_ERROR = u'Error occurred when loading the config file, please check.' +CONFIG_KEY_MISSING = u'Key missing in the config file, please check.' + +DATA_SERVER_CONNECTED = u'Data server connected.' +DATA_SERVER_DISCONNECTED = u'Data server disconnected' +DATA_SERVER_LOGIN = u'Data server login completed.' +DATA_SERVER_LOGOUT = u'Data server logout completed.' + +TRADING_SERVER_CONNECTED = u'Trading server connected.' +TRADING_SERVER_DISCONNECTED = u'Trading server disconnected.' +TRADING_SERVER_AUTHENTICATED = u'Trading server authenticated.' +TRADING_SERVER_LOGIN = u'Trading server login completed.' +TRADING_SERVER_LOGOUT = u'Trading server logout completed.' + +SETTLEMENT_INFO_CONFIRMED = u'Settlement info confirmed.' +CONTRACT_DATA_RECEIVED = u'Contract data received.' \ No newline at end of file diff --git a/vn.trader/gateway/ibGateway/language/__init__.py b/vn.trader/gateway/ibGateway/language/__init__.py new file mode 100644 index 00000000..8325ae0c --- /dev/null +++ b/vn.trader/gateway/ibGateway/language/__init__.py @@ -0,0 +1,23 @@ +# encoding: UTF-8 + +import json +import os +import traceback + +# 默认设置 +from chinese import text + +# 获取目录上级路径 +path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')) +SETTING_FILENAME = 'VT_setting.json' +SETTING_FILENAME = os.path.join(path, SETTING_FILENAME) + +# 打开配置文件,读取语言配置 +try: + f = file(SETTING_FILENAME) + setting = json.load(f) + if setting['language'] == 'english': + from english import text + f.close() +except: + traceback.print_exc() diff --git a/vn.trader/gateway/ibGateway/language/chinese/__init__.py b/vn.trader/gateway/ibGateway/language/chinese/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/gateway/ibGateway/language/chinese/text.py b/vn.trader/gateway/ibGateway/language/chinese/text.py new file mode 100644 index 00000000..38a64374 --- /dev/null +++ b/vn.trader/gateway/ibGateway/language/chinese/text.py @@ -0,0 +1,9 @@ +# encoding: UTF-8 + +LOADING_ERROR = u'读取连接配置出错,请检查' +CONFIG_KEY_MISSING = u'连接配置缺少字段,请检查' +NONEED_TO_QRYACCOUNT = u'IB接口账户信息提供主推更新,无需查询' +NONEED_TO_QRYPOSITION = u'IB接口持仓信息提供主推更新,无需查询' + +API_CONNECTED = u'IB接口连接成功,当前服务器时间{time}' +API_DISCONNECTED = u'IB接口连接断开' \ No newline at end of file diff --git a/vn.trader/gateway/ibGateway/language/english/__init__.py b/vn.trader/gateway/ibGateway/language/english/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/gateway/ibGateway/language/english/text.py b/vn.trader/gateway/ibGateway/language/english/text.py new file mode 100644 index 00000000..ffc76d88 --- /dev/null +++ b/vn.trader/gateway/ibGateway/language/english/text.py @@ -0,0 +1,9 @@ +# encoding: UTF-8 + +LOADING_ERROR = u'Error occurred when loading the config file, please check.' +CONFIG_KEY_MISSING = u'Key missing in the config file, please check.' +NONEED_TO_QRYACCOUNT = u'IB account data is automatically updated.' +NONEED_TO_QRYPOSITION = u'IB position data is automatically updated.' + +API_CONNECTED = u'IB gateway connected,current server time is {time}.' +API_DISCONNECTED = u'IB gateway disconnected.' \ No newline at end of file diff --git a/vn.trader/language/__init__.py b/vn.trader/language/__init__.py new file mode 100644 index 00000000..696e9d4e --- /dev/null +++ b/vn.trader/language/__init__.py @@ -0,0 +1,22 @@ +# encoding: UTF-8 + +import json +import os + +# 默认设置 +from chinese import text, constant + +# 获取目录上级路径 +path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +SETTING_FILENAME = 'VT_setting.json' +SETTING_FILENAME = os.path.join(path, SETTING_FILENAME) + +# 打开配置文件,读取语言配置 +try: + f = file(SETTING_FILENAME) + setting = json.load(f) + if setting['language'] == 'english': + from english import text, constant + f.close() +except: + pass diff --git a/vn.trader/language/chinese/__init__.py b/vn.trader/language/chinese/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/language/chinese/constant.py b/vn.trader/language/chinese/constant.py new file mode 100644 index 00000000..908f8184 --- /dev/null +++ b/vn.trader/language/chinese/constant.py @@ -0,0 +1,97 @@ +# encoding: UTF-8 + +# 默认空值 +EMPTY_STRING = '' +EMPTY_UNICODE = u'' +EMPTY_INT = 0 +EMPTY_FLOAT = 0.0 + +# 方向常量 +DIRECTION_NONE = u'无方向' +DIRECTION_LONG = u'多' +DIRECTION_SHORT = u'空' +DIRECTION_UNKNOWN = u'未知' +DIRECTION_NET = u'净' +DIRECTION_SELL = u'卖出' # IB接口 + +# 开平常量 +OFFSET_NONE = u'无开平' +OFFSET_OPEN = u'开仓' +OFFSET_CLOSE = u'平仓' +OFFSET_CLOSETODAY = u'平今' +OFFSET_CLOSEYESTERDAY = u'平昨' +OFFSET_UNKNOWN = u'未知' + +# 状态常量 +STATUS_NOTTRADED = u'未成交' +STATUS_PARTTRADED = u'部分成交' +STATUS_ALLTRADED = u'全部成交' +STATUS_CANCELLED = u'已撤销' +STATUS_REJECTED = u'拒单' +STATUS_UNKNOWN = u'未知' + +# 合约类型常量 +PRODUCT_EQUITY = u'股票' +PRODUCT_FUTURES = u'期货' +PRODUCT_OPTION = u'期权' +PRODUCT_INDEX = u'指数' +PRODUCT_COMBINATION = u'组合' +PRODUCT_FOREX = u'外汇' +PRODUCT_UNKNOWN = u'未知' +PRODUCT_SPOT = u'现货' +PRODUCT_DEFER = u'延期' +PRODUCT_NONE = '' + +# 价格类型常量 +PRICETYPE_LIMITPRICE = u'限价' +PRICETYPE_MARKETPRICE = u'市价' +PRICETYPE_FAK = u'FAK' +PRICETYPE_FOK = u'FOK' + +# 期权类型 +OPTION_CALL = u'看涨期权' +OPTION_PUT = u'看跌期权' + +# 交易所类型 +EXCHANGE_SSE = 'SSE' # 上交所 +EXCHANGE_SZSE = 'SZSE' # 深交所 +EXCHANGE_CFFEX = 'CFFEX' # 中金所 +EXCHANGE_SHFE = 'SHFE' # 上期所 +EXCHANGE_CZCE = 'CZCE' # 郑商所 +EXCHANGE_DCE = 'DCE' # 大商所 +EXCHANGE_SGE = 'SGE' # 上金所 +EXCHANGE_INE = 'INE' # 国际能源交易中心 +EXCHANGE_UNKNOWN = 'UNKNOWN'# 未知交易所 +EXCHANGE_NONE = '' # 空交易所 +EXCHANGE_HKEX = 'HKEX' # 港交所 +EXCHANGE_HKFE = 'HKFE' # 香港期货交易所 + +EXCHANGE_SMART = 'SMART' # IB智能路由(股票、期权) +EXCHANGE_NYMEX = 'NYMEX' # IB 期货 +EXCHANGE_GLOBEX = 'GLOBEX' # CME电子交易平台 +EXCHANGE_IDEALPRO = 'IDEALPRO' # IB外汇ECN + +EXCHANGE_CME = 'CME' # CME交易所 +EXCHANGE_ICE = 'ICE' # ICE交易所 + +EXCHANGE_OANDA = 'OANDA' # OANDA外汇做市商 +EXCHANGE_OKCOIN = 'OKCOIN' # OKCOIN比特币交易所 +EXCHANGE_HUOBI = 'HUOBI' # 火币比特币交易所 +EXCHANGE_LHANG = 'LHANG' # 链行比特币交易所 + +# 货币类型 +CURRENCY_USD = 'USD' # 美元 +CURRENCY_CNY = 'CNY' # 人民币 +CURRENCY_HKD = 'HKD' # 港币 +CURRENCY_UNKNOWN = 'UNKNOWN' # 未知货币 +CURRENCY_NONE = '' # 空货币 + +# 数据库 +LOG_DB_NAME = 'VnTrader_Log_Db' + +# 接口类型 +GATEWAYTYPE_EQUITY = 'equity' # 股票、ETF、债券 +GATEWAYTYPE_FUTURES = 'futures' # 期货、期权、贵金属 +GATEWAYTYPE_INTERNATIONAL = 'international' # 外盘 +GATEWAYTYPE_BTC = 'btc' # 比特币 +GATEWAYTYPE_DATA = 'data' # 数据(非交易) \ No newline at end of file diff --git a/vn.trader/language/chinese/text.py b/vn.trader/language/chinese/text.py new file mode 100644 index 00000000..dfad30fb --- /dev/null +++ b/vn.trader/language/chinese/text.py @@ -0,0 +1,133 @@ +# encoding: UTF-8 + +SAVE_DATA = u'保存数据' + +CONTRACT_SYMBOL = u'合约代码' +CONTRACT_NAME = u'名称' +LAST_PRICE = u'最新价' +PRE_CLOSE_PRICE = u'昨收盘' +VOLUME = u'成交量' +OPEN_INTEREST = u'持仓量' +OPEN_PRICE = u'开盘价' +HIGH_PRICE = u'最高价' +LOW_PRICE = u'最低价' +TIME = u'时间' +GATEWAY = u'接口' +CONTENT = u'内容' + +ERROR_CODE = u'错误代码' +ERROR_MESSAGE = u'错误信息' + +TRADE_ID = u'成交编号' +ORDER_ID = u'委托编号' +DIRECTION = u'方向' +OFFSET = u'开平' +PRICE = u'价格' +TRADE_TIME = u'成交时间' + +ORDER_VOLUME = u'委托数量' +TRADED_VOLUME = u'成交数量' +ORDER_STATUS = u'委托状态' +ORDER_TIME = u'委托时间' +CANCEL_TIME = u'撤销时间' +FRONT_ID = u'前置编号' +SESSION_ID = u'会话编号' +POSITION = u'持仓量' +YD_POSITION = u'昨持仓' +FROZEN = u'冻结量' +POSITION_PROFIT = u'持仓盈亏' + +ACCOUNT_ID = u'账户编号' +PRE_BALANCE = u'昨净值' +BALANCE = u'净值' +AVAILABLE = u'可用' +COMMISSION = u'手续费' +MARGIN = u'保证金' +CLOSE_PROFIT = u'平仓盈亏' + +TRADING = u'交易' +PRICE_TYPE = u'价格类型' +EXCHANGE = u'交易所' +CURRENCY = u'货币' +PRODUCT_CLASS = u'产品类型' +LAST = u'最新' +SEND_ORDER = u'发单' +CANCEL_ALL = u'全撤' +VT_SYMBOL = u'vt系统代码' +CONTRACT_SIZE = u'合约大小' +PRICE_TICK = u'最小价格变动' +STRIKE_PRICE = u'行权价' +UNDERLYING_SYMBOL = u'标的代码' +OPTION_TYPE = u'期权类型' + +REFRESH = u'刷新' +SEARCH = u'查询' +CONTRACT_SEARCH = u'合约查询' + + +BID_1 = u'买一' +BID_2 = u'买二' +BID_3 = u'买三' +BID_4 = u'买四' +BID_5 = u'买五' +ASK_1 = u'卖一' +ASK_2 = u'卖二' +ASK_3 = u'卖三' +ASK_4 = u'卖四' +ASK_5 = u'卖五' + +BID_PRICE_1 = u'买一价' +BID_PRICE_2 = u'买二价' +BID_PRICE_3 = u'买三价' +BID_PRICE_4 = u'买四价' +BID_PRICE_5 = u'买五价' +ASK_PRICE_1 = u'卖一价' +ASK_PRICE_2 = u'卖二价' +ASK_PRICE_3 = u'卖三价' +ASK_PRICE_4 = u'卖四价' +ASK_PRICE_5 = u'卖五价' + +BID_VOLUME_1 = u'买一量' +BID_VOLUME_2 = u'买二量' +BID_VOLUME_3 = u'买三量' +BID_VOLUME_4 = u'买四量' +BID_VOLUME_5 = u'买五量' +ASK_VOLUME_1 = u'卖一量' +ASK_VOLUME_2 = u'卖二量' +ASK_VOLUME_3 = u'卖三量' +ASK_VOLUME_4 = u'卖四量' +ASK_VOLUME_5 = u'卖五量' + +MARKET_DATA = u'行情' +LOG = u'日志' +ERROR = u'错误' +TRADE = u'成交' +ORDER = u'委托' +POSITION = u'持仓' +ACCOUNT = u'账户' + +SYSTEM = u'系统' +CONNECT_DATABASE = u'连接数据库' +EXIT = u'退出' +APPLICATION = u'功能' +DATA_RECORDER = u'行情记录' +RISK_MANAGER = u'风控管理' + +STRATEGY = u'策略' +CTA_STRATEGY = u'CTA策略' + +HELP = u'帮助' +RESTORE = u'还原' +ABOUT = u'关于' +TEST = u'测试' +CONNECT = u'连接' + +CPU_MEMORY_INFO = u'CPU使用率:{cpu}% 内存使用率:{memory}%' +CONFIRM_EXIT = u'确认退出?' + +GATEWAY_NOT_EXIST = u'接口不存在:{gateway}' +DATABASE_CONNECTING_COMPLETED = u'MongoDB连接成功' +DATABASE_CONNECTING_FAILED = u'MongoDB连接失败' +DATA_INSERT_FAILED = u'数据插入失败,MongoDB没有连接' +DATA_QUERY_FAILED = u'数据查询失败,MongoDB没有连接' +DATA_UPDATE_FAILED = u'数据更新失败,MongoDB没有连接' diff --git a/vn.trader/language/english/__init__.py b/vn.trader/language/english/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/language/english/constant.py b/vn.trader/language/english/constant.py new file mode 100644 index 00000000..579c15b3 --- /dev/null +++ b/vn.trader/language/english/constant.py @@ -0,0 +1,97 @@ +# encoding: UTF-8 + +# 默认空值 +EMPTY_STRING = '' +EMPTY_UNICODE = u'' +EMPTY_INT = 0 +EMPTY_FLOAT = 0.0 + +# 方向常量 +DIRECTION_NONE = u'none' +DIRECTION_LONG = u'long' +DIRECTION_SHORT = u'short' +DIRECTION_UNKNOWN = u'unknown' +DIRECTION_NET = u'net' +DIRECTION_SELL = u'sell' # IB接口 + +# 开平常量 +OFFSET_NONE = u'none' +OFFSET_OPEN = u'open' +OFFSET_CLOSE = u'close' +OFFSET_CLOSETODAY = u'close today' +OFFSET_CLOSEYESTERDAY = u'close yesterday' +OFFSET_UNKNOWN = u'unknown' + +# 状态常量 +STATUS_NOTTRADED = u'pending' +STATUS_PARTTRADED = u'partial filled' +STATUS_ALLTRADED = u'filled' +STATUS_CANCELLED = u'cancelled' +STATUS_REJECTED = u'rejected' +STATUS_UNKNOWN = u'unknown' + +# 合约类型常量 +PRODUCT_EQUITY = u'equity' +PRODUCT_FUTURES = u'futures' +PRODUCT_OPTION = u'option' +PRODUCT_INDEX = u'index' +PRODUCT_COMBINATION = u'combination' +PRODUCT_FOREX = u'forex' +PRODUCT_UNKNOWN = u'unknown' +PRODUCT_SPOT = u'spot' +PRODUCT_DEFER = u'defer' +PRODUCT_NONE = 'none' + +# 价格类型常量 +PRICETYPE_LIMITPRICE = u'limit order' +PRICETYPE_MARKETPRICE = u'market order' +PRICETYPE_FAK = u'FAK' +PRICETYPE_FOK = u'FOK' + +# 期权类型 +OPTION_CALL = u'call' +OPTION_PUT = u'put' + +# 交易所类型 +EXCHANGE_SSE = 'SSE' # 上交所 +EXCHANGE_SZSE = 'SZSE' # 深交所 +EXCHANGE_CFFEX = 'CFFEX' # 中金所 +EXCHANGE_SHFE = 'SHFE' # 上期所 +EXCHANGE_CZCE = 'CZCE' # 郑商所 +EXCHANGE_DCE = 'DCE' # 大商所 +EXCHANGE_SGE = 'SGE' # 上金所 +EXCHANGE_INE = 'INE' # 国际能源交易中心 +EXCHANGE_UNKNOWN = 'UNKNOWN'# 未知交易所 +EXCHANGE_NONE = '' # 空交易所 +EXCHANGE_HKEX = 'HKEX' # 港交所 +EXCHANGE_HKFE = 'HKFE' # 香港期货交易所 + +EXCHANGE_SMART = 'SMART' # IB智能路由(股票、期权) +EXCHANGE_NYMEX = 'NYMEX' # IB 期货 +EXCHANGE_GLOBEX = 'GLOBEX' # CME电子交易平台 +EXCHANGE_IDEALPRO = 'IDEALPRO' # IB外汇ECN + +EXCHANGE_CME = 'CME' # CME交易所 +EXCHANGE_ICE = 'ICE' # ICE交易所 + +EXCHANGE_OANDA = 'OANDA' # OANDA外汇做市商 +EXCHANGE_OKCOIN = 'OKCOIN' # OKCOIN比特币交易所 +EXCHANGE_HUOBI = 'HUOBI' # 火币比特币交易所 +EXCHANGE_LHANG = 'LHANG' # 链行比特币交易所 + +# 货币类型 +CURRENCY_USD = 'USD' # 美元 +CURRENCY_CNY = 'CNY' # 人民币 +CURRENCY_HKD = 'HKD' # 港币 +CURRENCY_UNKNOWN = 'UNKNOWN' # 未知货币 +CURRENCY_NONE = '' # 空货币 + +# 数据库 +LOG_DB_NAME = 'VnTrader_Log_Db' + +# 接口类型 +GATEWAYTYPE_EQUITY = 'equity' # 股票、ETF、债券 +GATEWAYTYPE_FUTURES = 'futures' # 期货、期权、贵金属 +GATEWAYTYPE_INTERNATIONAL = 'international' # 外盘 +GATEWAYTYPE_BTC = 'btc' # 比特币 +GATEWAYTYPE_DATA = 'data' # 数据(非交易) \ No newline at end of file diff --git a/vn.trader/language/english/text.py b/vn.trader/language/english/text.py new file mode 100644 index 00000000..3864191d --- /dev/null +++ b/vn.trader/language/english/text.py @@ -0,0 +1,133 @@ +# encoding: UTF-8 + +SAVE_DATA = 'Save Data' + +CONTRACT_SYMBOL = 'Symbol' +CONTRACT_NAME = 'Name' +LAST_PRICE = 'Last' +PRE_CLOSE_PRICE = 'PreClose' +VOLUME = 'Volume' +OPEN_INTEREST = 'Open Interest' +OPEN_PRICE = 'Open' +HIGH_PRICE = 'High' +LOW_PRICE = 'Low' +TIME = 'Time' +GATEWAY = 'Gateway' +CONTENT = 'Content' + +ERROR_CODE = u'Error Code' +ERROR_MESSAGE = u'Error Message' + +TRADE_ID = u'Fill ID' +ORDER_ID = u'Order ID' +DIRECTION = u'Direction' +OFFSET = u'Offset' +PRICE = u'Price' +TRADE_TIME = u'Fill Time' + +ORDER_VOLUME = u'Order Volume' +TRADED_VOLUME = u'Filled Volume' +ORDER_STATUS = u'Order Status' +ORDER_TIME = u'Order Time' +CANCEL_TIME = u'Cancel Time' +FRONT_ID = u'Front ID' +SESSION_ID = u'Session ID' +POSITION = u'Position' +YD_POSITION = u'Yesterday Position' +FROZEN = u'Frozen' +POSITION_PROFIT = u'Position Profit' + +ACCOUNT_ID = u'Account ID' +PRE_BALANCE = u'Pre Balance' +BALANCE = u'Balance' +AVAILABLE = u'Available' +COMMISSION = u'Commission' +MARGIN = u'Margin' +CLOSE_PROFIT = u'Close Profit' + +TRADING = u'Trading' +PRICE_TYPE = u'Price Type' +EXCHANGE = u'Exchange' +CURRENCY = u'Currency' +PRODUCT_CLASS = u'Product Class' +LAST = u'Last' +SEND_ORDER = u'Send Order' +CANCEL_ALL = u'Cancel All' +VT_SYMBOL = u'Vt System Symbol' +CONTRACT_SIZE = u'Contract Size' +PRICE_TICK = u'Price Tick' +STRIKE_PRICE = u'Strike Price' +UNDERLYING_SYMBOL = u'Underlying Symbol' +OPTION_TYPE = u'Option Type' + +REFRESH = u'Refresh' +SEARCH = u'Search' +CONTRACT_SEARCH = u'Contract Search' + + +BID_1 = u'Bid1' +BID_2 = u'Bid2' +BID_3 = u'Bid3' +BID_4 = u'Bid4' +BID_5 = u'Bid5' +ASK_1 = u'Ask1' +ASK_2 = u'Ask2' +ASK_3 = u'Ask3' +ASK_4 = u'Ask4' +ASK_5 = u'Ask5' + +BID_PRICE_1 = u'Bid Price 1' +BID_PRICE_2 = u'Bid Price 2' +BID_PRICE_3 = u'Bid Price 3' +BID_PRICE_4 = u'Bid Price 4' +BID_PRICE_5 = u'Bid Price 5' +ASK_PRICE_1 = u'Ask Price 1' +ASK_PRICE_2 = u'Ask Price 2' +ASK_PRICE_3 = u'Ask Price 3' +ASK_PRICE_4 = u'Ask Price 4' +ASK_PRICE_5 = u'Ask Price 5' + +BID_VOLUME_1 = u'Bid Volume 1' +BID_VOLUME_2 = u'Bid Volume 2' +BID_VOLUME_3 = u'Bid Volume 3' +BID_VOLUME_4 = u'Bid Volume 4' +BID_VOLUME_5 = u'Bid Volume 5' +ASK_VOLUME_1 = u'Ask Volume 1' +ASK_VOLUME_2 = u'Ask Volume 2' +ASK_VOLUME_3 = u'Ask Volume 3' +ASK_VOLUME_4 = u'Ask Volume 4' +ASK_VOLUME_5 = u'Ask Volume 5' + +MARKET_DATA = u'Market Data' +LOG = u'Log' +ERROR = u'Error' +TRADE = u'Fill' +ORDER = u'Order' +POSITION = u'Position' +ACCOUNT = u'Account' + +SYSTEM = u'System' +CONNECT_DATABASE = u'Connect Database' +EXIT = u'Exit' +APPLICATION = u'Application' +DATA_RECORDER = u'Data Recorder' +RISK_MANAGER = u'Risk Manager' + +STRATEGY = u'Strategy' +CTA_STRATEGY = u'CTA Strategy' + +HELP = u'Help' +RESTORE = u'Restore' +ABOUT = u'About' +TEST = u'Test' +CONNECT = u'Connect ' + +CPU_MEMORY_INFO = u'CPU Usage:{cpu}% Memory Usage:{memory}%' +CONFIRM_EXIT = u'Confirm Exit?' + +GATEWAY_NOT_EXIST = u"Can't find the gateway:{gateway}" +DATABASE_CONNECTING_COMPLETED = u'MongoDB is connected.' +DATABASE_CONNECTING_FAILED = u'Failed to connect to MongoDB.' +DATA_INSERT_FAILED = u'Data insert failed,please connect MongoDB first.' +DATA_QUERY_FAILED = u'Data query failed, please connect MongoDB first.' +DATA_UPDATE_FAILED = u'Data update failed, please connect MongoDB first.' \ No newline at end of file diff --git a/vn.trader/riskManager/language/__init__.py b/vn.trader/riskManager/language/__init__.py new file mode 100644 index 00000000..e42bd064 --- /dev/null +++ b/vn.trader/riskManager/language/__init__.py @@ -0,0 +1,23 @@ +# encoding: UTF-8 + +import json +import os +import traceback + +# 默认设置 +from chinese import text + +# 获取目录上级路径 +path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) +SETTING_FILENAME = 'VT_setting.json' +SETTING_FILENAME = os.path.join(path, SETTING_FILENAME) + +# 打开配置文件,读取语言配置 +try: + f = file(SETTING_FILENAME) + setting = json.load(f) + if setting['language'] == 'english': + from english import text + f.close() +except: + traceback.print_exc() diff --git a/vn.trader/riskManager/language/chinese/__init__.py b/vn.trader/riskManager/language/chinese/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/riskManager/language/chinese/text.py b/vn.trader/riskManager/language/chinese/text.py new file mode 100644 index 00000000..6884d48e --- /dev/null +++ b/vn.trader/riskManager/language/chinese/text.py @@ -0,0 +1,17 @@ +# encoding: UTF-8 + +RISK_MANAGER = u'风控管理' + +RISK_MANAGER_STOP = u'风控模块未启动' +RISK_MANAGER_RUNNING = u'风控模块运行中' +CLEAR_ORDER_FLOW_COUNT = u'清空流控计数' +CLEAR_TOTAL_FILL_COUNT = u'清空总成交计数' +SAVE_SETTING = u'保存设置' + +WORKING_STATUS = u'工作状态' +ORDER_FLOW_LIMIT = u'流控上限' +ORDER_FLOW_CLEAR = u'流控清空(秒)' +ORDER_SIZE_LIMIT = u'单笔委托上限' +TOTAL_TRADE_LIMIT = u'总成交上限' +WORKING_ORDER_LIMIT = u'活动订单上限' +CONTRACT_CANCEL_LIMIT = u'单合约撤单上限' \ No newline at end of file diff --git a/vn.trader/riskManager/language/english/__init__.py b/vn.trader/riskManager/language/english/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/riskManager/language/english/text.py b/vn.trader/riskManager/language/english/text.py new file mode 100644 index 00000000..3355c722 --- /dev/null +++ b/vn.trader/riskManager/language/english/text.py @@ -0,0 +1,17 @@ +# encoding: UTF-8 + +RISK_MANAGER = u'Risk Manager' + +RISK_MANAGER_STOP = u'RM Stop' +RISK_MANAGER_RUNNING = u'RM Running' +CLEAR_ORDER_FLOW_COUNT = u'Clear Flow Count' +CLEAR_TOTAL_FILL_COUNT = u'Clear Fill Count' +SAVE_SETTING = u'Save Setting' + +WORKING_STATUS = u'Working Status' +ORDER_FLOW_LIMIT = u'Flow Limit' +ORDER_FLOW_CLEAR = u'Flow Clear(s)' +ORDER_SIZE_LIMIT = u'Order Size Limit' +TOTAL_TRADE_LIMIT = u'Total Fill Limit' +WORKING_ORDER_LIMIT = u'Working Order Limit' +CONTRACT_CANCEL_LIMIT = u'Contract Cancel Limit' \ No newline at end of file