Ejemplo n.º 1
0
        public bool Equals([AllowNull] Indicator other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) &&
                   (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) &&
                   (UId == other.UId && UId != null && other.UId != null && UId.Equals(other.UId)) &&
                   (Equals(Ids, other.Ids) || Ids != null && other.Ids != null && Ids.SequenceEqual(other.Ids)) &&
                   (Equals(CustomData, other.CustomData) || CustomData != null && other.CustomData != null && CustomData.SequenceEqual(other.CustomData)) &&
                   (Meta == other.Meta && Meta != null && other.Meta != null && Meta.Equals(other.Meta)) &&
                   (Equals(MetaArray, other.MetaArray) || MetaArray != null && other.MetaArray != null && MetaArray.SequenceEqual(other.MetaArray)) &&
                   (Stream == other.Stream && Stream != null && other.Stream != null && Stream.Equals(other.Stream)) &&
                   (Equals(Transforms, other.Transforms) || Transforms != null && other.Transforms != null && Transforms.SequenceEqual(other.Transforms)) &&
                   (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) &&
                   (Mode == other.Mode && Mode != null && other.Mode != null && Mode.Equals(other.Mode)) &&
                   (Value == other.Value && Value != null && other.Value != null && Value.Equals(other.Value)) &&
                   (Align == other.Align && Align != null && other.Align != null && Align.Equals(other.Align)) &&
                   (Domain == other.Domain && Domain != null && other.Domain != null && Domain.Equals(other.Domain)) &&
                   (Title == other.Title && Title != null && other.Title != null && Title.Equals(other.Title)) &&
                   (Number == other.Number && Number != null && other.Number != null && Number.Equals(other.Number)) &&
                   (Delta == other.Delta && Delta != null && other.Delta != null && Delta.Equals(other.Delta)) &&
                   (Gauge == other.Gauge && Gauge != null && other.Gauge != null && Gauge.Equals(other.Gauge)) &&
                   (IdsSrc == other.IdsSrc && IdsSrc != null && other.IdsSrc != null && IdsSrc.Equals(other.IdsSrc)) &&
                   (CustomDataSrc == other.CustomDataSrc && CustomDataSrc != null && other.CustomDataSrc != null && CustomDataSrc.Equals(other.CustomDataSrc)) &&
                   (MetaSrc == other.MetaSrc && MetaSrc != null && other.MetaSrc != null && MetaSrc.Equals(other.MetaSrc)));
        }
Ejemplo n.º 2
0
        private int SecondCondition()
        {
            var values = new List <double>()
            {
                Func(CurrentValue),
                Func(NextValue)
            };

            Str += $"Итерация {Iteration} | Действие 6: \n";
            Str += $"\t[CurrentValue = {Math.Round(values[0], SignsCount)}; NextValue = {Math.Round(values[1], SignsCount)}]\n";

            if (values[0] > values[1])
            {
                if (Delta.Equals(Step))
                {
                    LowerLimit = CurrentValue;

                    Str += "\tF(CurrentValue) > F(NextValue) && Step == Step:\n";
                    Str += $"\t\tLowerLimit = {CurrentValue}\n\t\tCount = {Count}\n";
                }
                else
                {
                    UpperLimit = CurrentValue;

                    Str += "\tF(CurrentValue) > F(NextValue) && Step == -Step:\n";
                    Str += $"\t\tUpperLimit = {CurrentValue}\n\t\tCount = {Count}\n";
                }

                Count++;
                return(-1);
            }

            if (values[0] < values[1])
            {
                if (Delta.Equals(Step))
                {
                    UpperLimit = NextValue;

                    Str += "\tF(CurrentValue) < F(NextValue) && Step == Step:\n";
                    Str += $"\t\tUpperLimit = {UpperLimit}\n";
                }
                else
                {
                    LowerLimit = NextValue;

                    Str += "\tF(CurrentValue) < F(NextValue) && Step != -Step:\n";
                    Str += $"\t\tLowerLimit = {LowerLimit}\n";
                }

                return(0);
            }

            return(1);
        }
Ejemplo n.º 3
0
        public override string ToString()
        {
            if (Roots.Count == 2)
            {
                return($"Equation has two roots: {Roots[0]},{Roots[1]}");
            }

            else if (Roots.Count == 1)
            {
                return($"Equation has one root: {Roots[0]}");
            }

            else if (Delta.Equals(double.NaN))
            {
                return("Roots were not calculated yet");
            }
            else
            {
                return("Equation has 0 roots in real domain");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns true if Position instances are equal
        /// </summary>
        /// <param name="other">Instance of Position to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Position other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Direction == other.Direction ||

                     Direction.Equals(other.Direction)
                     ) &&
                 (
                     AveragePriceUsd == other.AveragePriceUsd ||
                     AveragePriceUsd != null &&
                     AveragePriceUsd.Equals(other.AveragePriceUsd)
                 ) &&
                 (
                     EstimatedLiquidationPrice == other.EstimatedLiquidationPrice ||
                     EstimatedLiquidationPrice != null &&
                     EstimatedLiquidationPrice.Equals(other.EstimatedLiquidationPrice)
                 ) &&
                 (
                     FloatingProfitLoss == other.FloatingProfitLoss ||
                     FloatingProfitLoss != null &&
                     FloatingProfitLoss.Equals(other.FloatingProfitLoss)
                 ) &&
                 (
                     FloatingProfitLossUsd == other.FloatingProfitLossUsd ||
                     FloatingProfitLossUsd != null &&
                     FloatingProfitLossUsd.Equals(other.FloatingProfitLossUsd)
                 ) &&
                 (
                     OpenOrdersMargin == other.OpenOrdersMargin ||
                     OpenOrdersMargin != null &&
                     OpenOrdersMargin.Equals(other.OpenOrdersMargin)
                 ) &&
                 (
                     TotalProfitLoss == other.TotalProfitLoss ||
                     TotalProfitLoss != null &&
                     TotalProfitLoss.Equals(other.TotalProfitLoss)
                 ) &&
                 (
                     RealizedProfitLoss == other.RealizedProfitLoss ||
                     RealizedProfitLoss != null &&
                     RealizedProfitLoss.Equals(other.RealizedProfitLoss)
                 ) &&
                 (
                     Delta == other.Delta ||
                     Delta != null &&
                     Delta.Equals(other.Delta)
                 ) &&
                 (
                     InitialMargin == other.InitialMargin ||
                     InitialMargin != null &&
                     InitialMargin.Equals(other.InitialMargin)
                 ) &&
                 (
                     Size == other.Size ||
                     Size != null &&
                     Size.Equals(other.Size)
                 ) &&
                 (
                     MaintenanceMargin == other.MaintenanceMargin ||
                     MaintenanceMargin != null &&
                     MaintenanceMargin.Equals(other.MaintenanceMargin)
                 ) &&
                 (
                     Kind == other.Kind ||

                     Kind.Equals(other.Kind)
                 ) &&
                 (
                     MarkPrice == other.MarkPrice ||
                     MarkPrice != null &&
                     MarkPrice.Equals(other.MarkPrice)
                 ) &&
                 (
                     AveragePrice == other.AveragePrice ||
                     AveragePrice != null &&
                     AveragePrice.Equals(other.AveragePrice)
                 ) &&
                 (
                     SettlementPrice == other.SettlementPrice ||
                     SettlementPrice != null &&
                     SettlementPrice.Equals(other.SettlementPrice)
                 ) &&
                 (
                     IndexPrice == other.IndexPrice ||
                     IndexPrice != null &&
                     IndexPrice.Equals(other.IndexPrice)
                 ) &&
                 (
                     InstrumentName == other.InstrumentName ||
                     InstrumentName != null &&
                     InstrumentName.Equals(other.InstrumentName)
                 ) &&
                 (
                     SizeCurrency == other.SizeCurrency ||
                     SizeCurrency != null &&
                     SizeCurrency.Equals(other.SizeCurrency)
                 ));
        }