public void LoadConfig(XmlElement elem) { this.ID = elem.GetAttribute("ID"); String time = elem.GetAttribute("TIME"); String[] timeArr = time.Split('-'); string str = timeArr[0]; if (str.Equals("")) { StartTime = int.MinValue; } else { StartTime = int.Parse(str); } str = timeArr[1]; if (str.Equals("")) { EndTime = int.MaxValue; } else { EndTime = int.Parse(str); } string openid = elem.GetAttribute("OPENID"); if (openid.Equals("")) { Period = dataLoader.defaultOpenTime; } else { Period = dataLoader.GetOpenPeriod(openid); } for (int i = 0; i < elem.ChildNodes.Count; i++) { XmlNode node = elem.ChildNodes[i]; if (node is XmlElement) { XmlElement ee = (XmlElement)node; TradingSession_Variety variety = new TradingSession_Variety(); variety.BelongMarket = this; variety.LoadConfig(ee); varieties.Add(variety); } } }
public List <double[]> GetOpenTime(String market, String variety, int date) { if (!market.Equals(ID)) { return(null); } if (date < StartTime || date > EndTime) { return(null); } for (int i = 0; i < varieties.Count; i++) { TradingSession_Variety v = varieties[i]; if (v.IsCurrent(variety, date)) { return(v.GetOpenTime()); } } return(GetPeriod().OpenTime); }