Ejemplo n.º 1
0
        /// <summary>
        /// Returns a string that represents the current object.
        /// </summary>
        /// <returns>
        /// A string that represents the current object.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        public override string ToString()
        {
            var message = Invariant($"Time: {UtcTime} OrderID: {OrderId} EventID: {Id} Symbol: {Symbol.Value} Status: {Status} Quantity {Quantity}");

            if (FillQuantity != 0)
            {
                message += Invariant($" FillQuantity: {FillQuantity} FillPrice: {FillPrice.SmartRounding()} {FillPriceCurrency}");
            }

            if (LimitPrice.HasValue)
            {
                message += Invariant($" LimitPrice: {LimitPrice.Value.SmartRounding()}");
            }
            if (StopPrice.HasValue)
            {
                message += Invariant($" StopPrice: {StopPrice.Value.SmartRounding()}");
            }

            // attach the order fee so it ends up in logs properly.
            if (OrderFee.Value.Amount != 0m)
            {
                message += Invariant($" OrderFee: {OrderFee}");
            }

            // add message from brokerage
            if (!string.IsNullOrEmpty(Message))
            {
                message += Invariant($" Message: {Message}");
            }

            return(message);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a short string that represents the current object.
        /// </summary>
        public string ShortToString()
        {
            var message = Invariant($"{UtcTime} OID:{OrderId} {Symbol.Value} {Status} Q:{Quantity}");

            if (FillQuantity != 0)
            {
                message += Invariant($" FQ:{FillQuantity} FP:{FillPrice.SmartRounding()} {FillPriceCurrency}");
            }

            if (LimitPrice.HasValue)
            {
                message += Invariant($" LP:{LimitPrice.Value.SmartRounding()}");
            }
            if (StopPrice.HasValue)
            {
                message += Invariant($" SP:{StopPrice.Value.SmartRounding()}");
            }
            if (TriggerPrice.HasValue)
            {
                message += Invariant($" TP:{TriggerPrice.Value.SmartRounding()}");
            }

            // attach the order fee so it ends up in logs properly.
            if (OrderFee.Value.Amount != 0m)
            {
                message += Invariant($" OF:{OrderFee}");
            }

            // add message from brokerage
            if (!string.IsNullOrEmpty(Message))
            {
                message += Invariant($" M:{Message}");
            }

            if (Symbol.SecurityType == SecurityType.Option || Symbol.SecurityType == SecurityType.FutureOption)
            {
                message += Invariant($" IA:{IsAssignment}");
            }

            return(message);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns a string that represents the current object.
        /// </summary>
        /// <returns>
        /// A string that represents the current object.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        public override string ToString()
        {
            var message = FillQuantity == 0
                ? $"Time: {UtcTime} OrderID: {OrderId} Symbol: {Symbol.Value} Status: {Status}"
                : $"Time: {UtcTime} OrderID: {OrderId} Symbol: {Symbol.Value} Status: {Status} " +
                          $"Quantity: {FillQuantity} FillPrice: {FillPrice.SmartRounding()} {FillPriceCurrency}";

            // attach the order fee so it ends up in logs properly.
            if (OrderFee.Value.Amount != 0m)
            {
                message += $" OrderFee: {OrderFee}";
            }

            // add message from brokerage
            if (!string.IsNullOrEmpty(Message))
            {
                message += $" Message: {Message}";
            }

            return(message);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns a string that represents the current object.
        /// </summary>
        /// <returns>
        /// A string that represents the current object.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        public override string ToString()
        {
            var message = FillQuantity == 0
                ? string.Format("Time: {0} OrderID: {1} Symbol: {2} Status: {3}", UtcTime, OrderId, Symbol.Value, Status)
                : string.Format("Time: {0} OrderID: {1} Symbol: {2} Status: {3} Quantity: {4} FillPrice: {5} {6}", UtcTime, OrderId, Symbol.Value, Status, FillQuantity, FillPrice.SmartRounding(), FillPriceCurrency);

            // attach the order fee so it ends up in logs properly
            if (OrderFee != 0m)
            {
                message += string.Format(" OrderFee: {0} {1}", OrderFee, CashBook.AccountCurrency);
            }

            // add message from brokerage
            if (!string.IsNullOrEmpty(Message))
            {
                message += string.Format(" Message: {0}", Message);
            }

            return(message);
        }