/// <summary> /// Parse inner fields from a string array of values /// </summary> /// <param name="valuesArray">expect array of 6 string values /// in a presented order: Date, Open, High, Low, Close, Volume</param> /// <returns>parsed TradeData object</returns> public static TradeData Parse(string[] valuesArray) { if (valuesArray == null) { throw new ArgumentNullException("valuesArray"); } if (valuesArray.Length < 6) { throw new FormatException("Expected 6 values in array to parse"); } if (valuesArray.Any(String.IsNullOrWhiteSpace)) { throw new FormatException("Can't parse some fo the values because they are null, empty strings, or whitespaces only"); } var data = new TradeData( DateTime.Parse(valuesArray[0]), Decimal.Parse(valuesArray[1]), Decimal.Parse(valuesArray[2]), Decimal.Parse(valuesArray[3]), Decimal.Parse(valuesArray[4]), Int32.Parse(valuesArray[5])); return(data); }
protected bool Equals(TradeData other) { return(Volume == other.Volume && Close == other.Close && Low == other.Low && High == other.High && Open == other.Open && Date.Equals(other.Date)); }