/// <summary> /// 从万德数据库中读取交易日信息数据。 /// </summary> private void GetDataFromWindDataBase() { int theLastDay = 0; if (tradeDaysOfDataBase.Count > 0) { theLastDay = tradeDaysOfDataBase[tradeDaysOfDataBase.Count - 1]; } //万德API接口的类。 WindAPI w = new WindAPI(); w.start(); //从万德数据库中抓取交易日信息。 WindData days = w.tdays("20100101", "20161231", ""); //将万德中读取的数据转化成object数组的形式。 object[] dayData = days.data as object[]; foreach (object item in dayData) { DateTime today = (DateTime)item; int now = DateTimeToInt(today); if (now > theLastDay) { tradeDaysOfDataBase.Add(now); } } w.stop(); }
/// <summary> /// 从万德API获取 /// </summary> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <returns></returns> List <DateTime> readFromWind(DateTime startTime, DateTime endTime) { WindAPI wapi = Platforms.GetWindAPI(); WindData wd = wapi.tdays(startTime, endTime, ""); var wdd = (object[])wd.data; return(wdd.Select(x => (DateTime)x).ToList()); }