From e32b76d243a7c2d63d29ebf8e84d8a74d347a227 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Sun, 6 Jan 2019 20:13:50 +0800 Subject: [PATCH] [Add] Add trader constant definition --- .gitignore | 2 ++ .pylintrc | 2 +- requirements.txt | 2 ++ vnpy/event/__init__.py | 2 +- vnpy/event/engine.py | 4 +++ vnpy/trader/constant.py | 55 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 requirements.txt create mode 100644 vnpy/trader/constant.py diff --git a/.gitignore b/.gitignore index 9c033465..eeec9ee7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ # IDE .vscode .idea +*.wpr +*.wpu # Temp build diff --git a/.pylintrc b/.pylintrc index 31be539b..dfa488fb 100644 --- a/.pylintrc +++ b/.pylintrc @@ -139,7 +139,7 @@ bad-names=foo, tata # Naming style matching correct class attribute names. -class-attribute-naming-style=camelCase +class-attribute-naming-style=snake_case # Regular expression matching correct class attribute names. Overrides class- # attribute-naming-style. diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..c212511b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pyqt +qdarkstyle \ No newline at end of file diff --git a/vnpy/event/__init__.py b/vnpy/event/__init__.py index d1f08b68..db211d01 100644 --- a/vnpy/event/__init__.py +++ b/vnpy/event/__init__.py @@ -1 +1 @@ -from engine import Event, EventEngine, EVENT_TIMER \ No newline at end of file +from .engine import Event, EventEngine, EVENT_TIMER \ No newline at end of file diff --git a/vnpy/event/engine.py b/vnpy/event/engine.py index 625c6222..c90dc412 100644 --- a/vnpy/event/engine.py +++ b/vnpy/event/engine.py @@ -1,3 +1,7 @@ +""" +Event-driven framework of vn.py framework. +""" + from queue import Queue, Empty from threading import Thread, Timer from collections import defaultdict diff --git a/vnpy/trader/constant.py b/vnpy/trader/constant.py new file mode 100644 index 00000000..cd1e53e3 --- /dev/null +++ b/vnpy/trader/constant.py @@ -0,0 +1,55 @@ +""" +General constant string used in VN Trader. +""" + +DIRECTION_LONG = '多' +DIRECTION_SHORT = '空' +DIRECTION_NET = '净' + +OFFSET_OPEN = '开' +OFFSET_CLOSE = '平' +OFFSET_CLOSETODAY = '平今' +OFFSET_CLOSEYESTERDAY = '平昨' + +STATUS_SUBMITTING = '提交中' +STATUS_NOTTRADED = '未成交' +STATUS_PARTTRADED = '部分成交' +STATUS_ALLTRADED = '全部成交' +STATUS_CANCELLED = '已撤销' +STATUS_REJECTED = '拒单' + +PRODUCT_EQUITY = '股票' +PRODUCT_FUTURES = '期货' +PRODUCT_OPTION = '期权' +PRODUCT_INDEX = '指数' +PRODUCT_FOREX = '外汇' +PRODUCT_SPOT = '现货' + +PRICETYPE_LIMIT = '限价' +PRICETYPE_MARKET = '市价' +PRICETYPE_FAK = 'FAK' +PRICETYPE_FOK = 'FOK' + +OPTION_CALL = '看涨期权' +OPTION_PUT = '看跌期权' + +EXCHANGE_SSE = 'SSE' +EXCHANGE_SZSE = 'SZSE' +EXCHANGE_CFFEX = 'CFFEX' +EXCHANGE_SHFE = 'SHFE' +EXCHANGE_CZCE = 'CZCE' +EXCHANGE_DCE = 'DCE' +EXCHANGE_INE = 'INE' +EXCHANGE_SGE = 'SGE' + +CURRENCY_USD = 'USD' +CURRENCY_HKD = 'HKD' + +INTERVAL_1M = '1分钟' +INTERVAL_5M = '5分钟' +INTERVAL_15M = '15分钟' +INTERVAL_30M = '30分钟' +INTERVAL_1H = '1小时' +INTERVAL_4H = '4小时' +INTERVAL_DAILY = '日线' +INTERVAL_WEEKLY = '周线' \ No newline at end of file