protected override Position Build()
        {
            Position?existingPosition = Database.GetPosition(Symbol);

            if (existingPosition?.LongQuantity == Quantity)
            {
                return(existingPosition);
            }
            else
            {
                bool isValid = MarketDataClient.ValidateWithinTodaysRangeAndGetQuote(Symbol, (float)Last, out _);
                if (isValid)
                {
                    return(new Position(Symbol, Quantity, (float)Average));
                }
                else
                {
                    Log.Information("Found invalid symbol/price in parsed position: Symbol {Symbol}. Builder {@Builder}", Symbol, this);
                    return(BuildModelFromSimilarUsedSymbol());
                }
            }
        }
        protected override FilledOrder Build()
        {
            UnvalidatedFilledOrder unvalidatedOrder = new UnvalidatedFilledOrder(Symbol, (float)FilledPrice, Instruction, OrderType, (float)Limit, Quantity, Time);
            FilledOrder?           existingOrder    = Database.GetTodaysFilledOrders().FirstOrDefault(order => unvalidatedOrder.StrictEquals(order));

            if (existingOrder != null)
            {
                return(existingOrder);
            }
            else
            {
                bool isValid = MarketDataClient.ValidateWithinTodaysRangeAndGetQuote(unvalidatedOrder, out OptionQuote? quote);
                if (isValid)
                {
                    return(new FilledOrder(unvalidatedOrder, quote));
                }
                else
                {
                    Log.Information("Found invalid symbol/price in parsed order: Symbol {Symbol}. Builder {@Builder}", Symbol, this);
                    return(BuildModelFromSimilarUsedSymbol());
                }
            }
        }
 protected override bool ValidateWithSymbolOverride(string overrideSymbol, out OptionQuote?quote)
 {
     return(MarketDataClient.ValidateWithinTodaysRangeAndGetQuote(overrideSymbol, (float)Last, out quote));
 }