Exemple #1
0
        private void OnInstructionRejected(InstructionRejectedEvent rejected)
        {
            var instrument = Securities.FirstOrDefault(i => i.SecurityId == rejected.InstrumentId);

            if (instrument != null)
            {
                OnOrderRejected(new Order(rejected.InstructionId, instrument.Symbol)
                {
                    AccountId  = AccountInfo.ID,
                    BrokerName = Name
                }, rejected.Reason);
            }
        }
        private void FailOnInstructionRejected(InstructionRejectedEvent instructionRejected)
        {
            long instructionId = instructionRejected.InstructionId;
            Console.Error.WriteLine("Instruction " + instructionId + " rejected: " + instructionRejected.Reason);

            if (_buyOrderTracker.CancelInstructionId == instructionId)
            {
                _buyOrderTracker.Reset();
            }
            else if (_sellOrderTracker.CancelInstructionId == instructionId)
            {
                _sellOrderTracker.Reset();
            }
        }
Exemple #3
0
        private void FailOnInstructionRejected(InstructionRejectedEvent instructionRejected)
        {
            long instructionId = instructionRejected.InstructionId;

            Console.Error.WriteLine("Instruction " + instructionId + " rejected: " + instructionRejected.Reason);

            if (_buyOrderTracker.CancelInstructionId == instructionId)
            {
                _buyOrderTracker.Reset();
            }
            else if (_sellOrderTracker.CancelInstructionId == instructionId)
            {
                _sellOrderTracker.Reset();
            }
        }
Exemple #4
0
        private void OnSessionInstructionRejected(InstructionRejectedEvent evt)
        {
            var transactionId = TryParseTransactionId(evt.InstructionId);

            if (transactionId == null)
            {
                return;
            }

            SendOutMessage(new ExecutionMessage
            {
                ExecutionType = ExecutionTypes.Order,
                SecurityId    = new SecurityId {
                    Native = evt.InstrumentId
                },
                OriginalTransactionId = transactionId.Value,
                OrderState            = OrderStates.Failed,
                Error         = new InvalidOperationException(evt.Reason),
                PortfolioName = evt.AccountId.To <string>(),
                ServerTime    = CurrentTime.Convert(TimeZoneInfo.Utc)
            });
        }
		private void OnSessionInstructionRejected(InstructionRejectedEvent evt)
		{
			var transactionId = TryParseTransactionId(evt.InstructionId);

			if (transactionId == null)
				return;

			SendOutMessage(new ExecutionMessage
			{
				ExecutionType = ExecutionTypes.Transaction,
				SecurityId = new SecurityId { Native = evt.InstrumentId },
				OriginalTransactionId = transactionId.Value,
				OrderState = OrderStates.Failed,
				Error = new InvalidOperationException(evt.Reason),
				PortfolioName = evt.AccountId.To<string>(),
				ServerTime = CurrentTime.Convert(TimeZoneInfo.Utc)
			});
		}