/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace QuantConnect.Brokerages { /// /// Represents a message received from a brokerage /// public class BrokerageMessageEvent { /// /// Gets the type of brokerage message /// public BrokerageMessageType Type { get; private set; } /// /// Gets the brokerage specific code for this message, zero if no code was specified /// public string Code { get; private set; } /// /// Gets the message text received from the brokerage /// public string Message { get; private set; } /// /// Initializes a new instance of the BrokerageMessageEvent class /// /// The type of brokerage message /// The brokerage specific code /// The message text received from the brokerage public BrokerageMessageEvent(BrokerageMessageType type, int code, string message) { Type = type; Code = code.ToStringInvariant(); Message = message; } /// /// Initializes a new instance of the BrokerageMessageEvent class /// /// The type of brokerage message /// The brokerage specific code /// The message text received from the brokerage public BrokerageMessageEvent(BrokerageMessageType type, string code, string message) { Type = type; Code = code; Message = message; } /// /// Creates a new to represent a disconnect message /// /// The message from the brokerage /// A brokerage disconnect message public static BrokerageMessageEvent Disconnected(string message) { return new BrokerageMessageEvent(BrokerageMessageType.Disconnect, Messages.BrokerageMessageEvent.DisconnectCode, message); } /// /// Creates a new to represent a reconnect message /// /// The message from the brokerage /// A brokerage reconnect message public static BrokerageMessageEvent Reconnected(string message) { return new BrokerageMessageEvent(BrokerageMessageType.Reconnect, Messages.BrokerageMessageEvent.ReconnectCode, message); } /// /// Returns a string that represents the current object. /// /// /// A string that represents the current object. /// /// 2 public override string ToString() { return Messages.BrokerageMessageEvent.ToString(this); } } }