public float GetStockData(StockDataType dataType) { if (dataType == StockDataType.VOLUME) { return (float)this.VOLUME; } Type type = this.GetType(); System.Reflection.PropertyInfo propInfo = type.GetProperty(dataType.ToString()); if (propInfo == null) { return Serie.GetSerie(dataType).Values[Serie.IndexOf(this.DATE)]; } else { return (float)propInfo.GetValue(this, null); } }
public bool LowerOrEquals(StockDataType dataType, StockDailyValue dailyValue, float accuracyPercent) { float thisValue = this.GetStockData(dataType); float otherValue = dailyValue.GetStockData(dataType); float accuracy = thisValue * accuracyPercent; if (((thisValue - accuracy) <= otherValue)) { return true; } else { return false; } }
private int GetGraphCurveTypeIndex(StockDataType dataType) { int index = 0; foreach (GraphCurveType graphCurveType in CurveList) { if (graphCurveType.CurveDataType == dataType) { return index; } index++; } return -1; }