I have a class
class MarketData
{
public double Open {get;set;}
public double High{get;set;}
public double Low{get;set;}
public double Close{get;set;}
}
Now I have created List and filled it with last 30 days data. Here's where I am struggling to find best solution for this. A user can enter conditions manually but in fixed format, the fields can be e.g
Open is Greater Than Previous.Close
High is Less Than Previous.Low
Low is Greater Than Next.High,etc
I am parsing the string conditions to
public enum ConditionComparer { And, Or }
class SimpleCondition
{
public string Operand1 { get; set; }
public Operators Operator { get; set; }
public string Operand2 { get; set; }
public ConditionComparer Compare { get; set; }
}
Now I have to apply this conditions on the List<MarketData>
and get matching results.
I used DynamicQueryable class in bit different scenario where conditions where dynamic and it worked perfectly but now I have to compare record with next or previous record.