[Add] Add trader constant definition

This commit is contained in:
vn.py 2019-01-06 20:13:50 +08:00
parent 9d3ec12695
commit e32b76d243
6 changed files with 65 additions and 2 deletions

2
.gitignore vendored
View File

@ -4,6 +4,8 @@
# IDE # IDE
.vscode .vscode
.idea .idea
*.wpr
*.wpu
# Temp # Temp
build build

View File

@ -139,7 +139,7 @@ bad-names=foo,
tata tata
# Naming style matching correct class attribute names. # 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- # Regular expression matching correct class attribute names. Overrides class-
# attribute-naming-style. # attribute-naming-style.

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
pyqt
qdarkstyle

View File

@ -1 +1 @@
from engine import Event, EventEngine, EVENT_TIMER from .engine import Event, EventEngine, EVENT_TIMER

View File

@ -1,3 +1,7 @@
"""
Event-driven framework of vn.py framework.
"""
from queue import Queue, Empty from queue import Queue, Empty
from threading import Thread, Timer from threading import Thread, Timer
from collections import defaultdict from collections import defaultdict

55
vnpy/trader/constant.py Normal file
View File

@ -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 = '周线'