Beispiel #1
0
        public static CodeInfo GetCodeInfo(CodeIdParser parser, DataLoader_Variety dataLoader_Variety)
        {
            string varietyId = parser.VarietyId;
            string suffix    = parser.Suffix;
            int    year      = parser.Year;
            int    month     = parser.Month;

            VarietyInfo varietyInfo = dataLoader_Variety.GetVariety(varietyId);

            if (varietyInfo == null)
            {
                return(null);
            }
            string   codeId      = parser.CodeId;
            string   codeName    = varietyInfo.Name + suffix;
            int      start       = parser.StartDay;
            int      end         = parser.EndDay;
            string   exchange    = varietyInfo.Exchange;
            string   varietyName = varietyInfo.Name;
            CodeInfo code        = new CodeInfo(parser.CodeId, codeName, varietyId, varietyName, start, end, exchange, "");

            code.ServerCode = GetServerCode(parser.CodeId, exchange);
            code.ShortCode  = parser.ShortCode;
            return(code);
        }
        public DataLoader_TradingSessionDetail(string pluginPath, DataLoader_Variety dataLoader_Variety)
        {
            PathUtils   pathUtils = new PathUtils(pluginPath);
            XmlDocument doc       = new XmlDocument();

            doc.Load(pathUtils.TradingSessionDetailPath);
            this.dataLoader_Variety = dataLoader_Variety;
            Load(doc);
        }
Beispiel #3
0
        public void TestGetTradingSessionDetail()
        {
            string             pluginPath              = ScConfig.Instance.ScPath;
            DataLoader_Variety dataLoader_Instrument   = new DataLoader_Variety(pluginPath);
            DataLoader_TradingSessionDetail dataLoader = new DataLoader_TradingSessionDetail(pluginPath, dataLoader_Instrument);

            List <double[]> tradingSessionDetail = dataLoader.GetTradingTime("m1005", 20100104);

            AssertUtils.AssertEqual_List <double[]>("tradingsessiondetail_normal", GetType(), tradingSessionDetail);

            tradingSessionDetail = dataLoader.GetTradingTime("rb1005", 20100106);
            AssertUtils.AssertEqual_List <double[]>("tradingsessiondetail_sqearly", GetType(), tradingSessionDetail);

            tradingSessionDetail = dataLoader.GetTradingTime(20100104);
            AssertUtils.PrintLineList(tradingSessionDetail);
        }
Beispiel #4
0
        public void TestGetCodeInfo()
        {
            string             path = @"D:\SCWORK\DEV\SC2\bin\Debug\plugin\cnfutures";
            DataLoader_Variety dataLoader_Variety = new DataLoader_Variety(path);
            CodeInfo           codeInfo           = CodeInfoUtils.GetCodeInfo("m1501", dataLoader_Variety);

            Assert.AreEqual("M1501,豆粕1501,M,豆粕,20140119,20150116,DL,M1501,M01", codeInfo.ToString());

            codeInfo = CodeInfoUtils.GetCodeInfo("mmi", dataLoader_Variety);
            //Console.WriteLine(codeInfo);
            Assert.AreEqual("MMI,豆粕MI,M,豆粕,0,0,DL,MMI,MMI", codeInfo.ToString());

            codeInfo = CodeInfoUtils.GetCodeInfo("m0000", dataLoader_Variety);
            Assert.AreEqual("M0000,豆粕0000,M,豆粕,0,0,DL,M0000,M13", codeInfo.ToString());

            codeInfo = CodeInfoUtils.GetCodeInfo("FG701", dataLoader_Variety);
            Assert.AreEqual("FG1701,玻璃1701,FG,玻璃,20160117,20170120,ZZ,FG701,FG01", codeInfo.ToString());
        }
Beispiel #5
0
 public static CodeInfo GetCodeInfo(String newCodeId, DataLoader_Variety dataLoader_Variety)
 {
     return(GetCodeInfo(new CodeIdParser(newCodeId), dataLoader_Variety));
 }