120 lines
1.7 KiB
Python
120 lines
1.7 KiB
Python
"""
|
|
General constant string used in VN Trader.
|
|
"""
|
|
|
|
from enum import Enum
|
|
|
|
|
|
class Direction(Enum):
|
|
"""
|
|
Direction of order/trade/position.
|
|
"""
|
|
LONG = "多"
|
|
SHORT = "空"
|
|
NET = "净"
|
|
|
|
|
|
class Offset(Enum):
|
|
"""
|
|
Offset of order/trade.
|
|
"""
|
|
NONE = ""
|
|
OPEN = "开"
|
|
CLOSE = "平"
|
|
CLOSETODAY = "平今"
|
|
CLOSEYESTERDAY = "平昨"
|
|
|
|
|
|
class Status(Enum):
|
|
"""
|
|
Order status.
|
|
"""
|
|
SUBMITTING = "提交中"
|
|
NOTTRADED = "未成交"
|
|
PARTTRADED = "部分成交"
|
|
ALLTRADED = "全部成交"
|
|
CANCELLED = "已撤销"
|
|
REJECTED = "拒单"
|
|
|
|
|
|
class Product(Enum):
|
|
"""
|
|
Product class.
|
|
"""
|
|
EQUITY = "股票"
|
|
FUTURES = "期货"
|
|
OPTION = "期权"
|
|
INDEX = "指数"
|
|
FOREX = "外汇"
|
|
SPOT = "现货"
|
|
ETF = "ETF"
|
|
BOND = "债券"
|
|
WARRANT = "权证"
|
|
SPREAD = "价差"
|
|
|
|
|
|
class OrderType(Enum):
|
|
"""
|
|
Order type.
|
|
"""
|
|
LIMIT = "限价"
|
|
MARKET = "市价"
|
|
STOP = "STOP"
|
|
FAK = "FAK"
|
|
FOK = "FOK"
|
|
|
|
|
|
class OptionType(Enum):
|
|
"""
|
|
Option type.
|
|
"""
|
|
CALL = "看涨期权"
|
|
PUT = "看跌期权"
|
|
|
|
|
|
class Exchange(Enum):
|
|
"""
|
|
Exchange.
|
|
"""
|
|
# Chinese
|
|
CFFEX = "CFFEX"
|
|
SHFE = "SHFE"
|
|
CZCE = "CZCE"
|
|
DCE = "DCE"
|
|
INE = "INE"
|
|
SSE = "SSE"
|
|
SZSE = "SZSE"
|
|
SGE = "SGE"
|
|
|
|
# Global
|
|
SMART = "SMART"
|
|
NYMEX = "NYMEX"
|
|
GLOBEX = "GLOBEX"
|
|
IDEALPRO = "IDEALPRO"
|
|
CME = "CME"
|
|
ICE = "ICE"
|
|
SEHK = "SEHK"
|
|
HKFE = "HKFE"
|
|
|
|
# CryptoCurrency
|
|
BITMEX = "BITMEX"
|
|
|
|
|
|
class Currency(Enum):
|
|
"""
|
|
Currency.
|
|
"""
|
|
USD = "USD"
|
|
HKD = "HKD"
|
|
CNY = "CNY"
|
|
|
|
|
|
class Interval(Enum):
|
|
"""
|
|
Interval of bar data.
|
|
"""
|
|
MINUTE = "1m"
|
|
HOUR = "1h"
|
|
DAILY = "d"
|
|
WEEKLY = "w"
|