'''
 Generated by EZX Code Generator  
Date: 06/08/22 
'''


from iserver.EzxMsg import EzxMsg, EzxMsgMeta
from iserver.msgs import *
from iserver.enums import api

from .OrderRequestInfo import OrderRequestInfo


# constants
REJECT_NO_MEMORY = 2000
REJECT_DECODE_FAILURE = 2001
REJECT_UNKNOWN_FIXID = 2002
REJECT_UNKNOWN_ROID = 2003
REJECT_UNKNOWN_CLOID = 2004
REJECT_UNKNOWN_EVENT = 2005
REJECT_SE_FAILURE = 2006
REJECT_UPDATE_FAILURE = 2007
REJECT_FIX_FAILURE = 2008
REJECT_ENCODE_FAILURE = 2009
REJECT_SYSTEM_EXCEPTION = 2010
REJECT_USER_NOT_ACTIVE = 2011
REJECT_ROUTER_FAILURE = 2012
REJECT_INVALID_REQUEST = 2013
REJECT_DATABASE_ERROR = 2014
REJECT_COMMUNICATION_ERROR = 2015
REJECT_MISSSING_ORDERID = 2016
REJECT_FAILED_RISK_CHECK = 2017
REJECT_BAD_INBOUND_ORDER_HANDLING = 2018
REJECT_BUYING_POWER_EXCEEDED = 2019
REJECT_DESTINATION_DOWN = 2020
REJECT_FAILED_RISK_DUPLICATE_CHECK = 2021
REJECT_FAILED_RISK_ETB_CHECK = 2022
REJECT_FAILED_RISK_PENDING_ORDER_CHECK = 2023
REJECT_FAILED_RISK_AGGREGATE_EXECUTED_CHECK = 2024
REJECT_FAILED_RISK_SELF_TRADE_CHECK = 2025
REJECT_FAILED_RISK_ORDER_MARKING_CHECK = 2026
REJECT_FAILED_RISK_ERRONEOUS_PRICE_CHECK = 2027
REJECT_FAILED_RISK_INVALID_SIDE_CHECK = 2028
REJECT_FAILED_RISK_MAX_SHARES_CHECK = 2029
REJECT_FAILED_RISK_MAX_VALUE_CHECK = 2030
REJECT_FAILED_RISK_ON_CLOSE_CHECK = 2031
REJECT_CROSSING_ENGINE_REJECT = 2032
REJECT_POSITION_LIMIT_REACHED = 2033
REJECT_IPO_MKT_ORDER = 2034
REJECT_NOT_ENOUGH_LOCATES = 2035
REJECT_UNKNOWN_ACCOUNT = 2036
REJECT_MAX_LOSS_REACHED = 2037
REJECT_POSITION_OR_OPEN_LIMIT_REACHED = 2038
REJECT_MAX_ORDERS_PER_SECOND = 2039
REJECT_MAX_UNIQUE_POSITIONS = 2040
REJECT_MAX_EXECUTED_LIMIT = 2041
REJECT_MAX_OPEN_AND_EXECUTED_LIMIT = 2042
REJECT_ADV_PCT_EXCEEDED = 2043
REJECT_NYSE_TPA_NO_PARENT_ORDER = 2044
REJECT_FAILED_RISK_MAX_OPEN_ORDERS_CHECK = 2053
REJECT_FAILED_TICKSIZEPILOT_PRICE_CHECK = 2060
REJECT_CLIENT_POSITION_LIMIT_REACHED = 2061
REJECT_CLIENT_MAX_LOSS_REACHED = 2062
REJECT_CLIENT_MAX_OPEN_ORDERS_PER_SYMBOL = 2063
REJECT_EXCEEDS_UNROUTEDQTY = 2070
REJECT_MAX_SHARES_TRADED_LIMIT = 2076
REJECT_TRADING_NOT_ALLOWED = 2077
REJECT_CXL_REPLACE_CLOSED_ORDER = 2078
REJECT_USER_NOT_ALLOWED_TO_TRADE_SYMBOL = 2079
REJECT_NYSE_TPA_MISSING_BADGE_ID = 2080


class Reject(EzxMsg, metaclass=EzxMsgMeta):

	__block_fields__ = {
		'ORB' : Field('rejectedRequest', 'ORB', noop_decode_func, ), 
	}

	def __init__(self, **kwargs):
		self.msgType : int = None
		self.routerOrderID : int = None
		self.myID : str = None
		self.parentKey : str = None
		self.side : int = None
		self.symbol : str = None
		self.price : float = None
		self.orderQty : float = None
		self.returnCode : int = None
		self.returnDesc : str = None
		self.userName : str = None
		self.state : str = None
		self.leavesQty : float = None
		self.cumQty : float = None
		self.avgPrice : float = None
		self.unroutedQty : float = None
		self.rejectedRequest : OrderRequestInfo = None
		super(Reject, self).__init__(**kwargs)
		self.msg_type = api.IserverMsgType.APPLICATION.value
		self.msg_subtype = api.IserverMsgSubType.REJECT.value

