Exemplo n.º 1
0
        private void TestLoadTickData(string code, int date, string fileName)
        {
            IDataReader dataReader = DataReaderFactory.CreateDataReader(DataCenterUri.URI);
            ITickData   klineData  = dataReader.TickDataReader.GetTickData(code, date);

            AssertUtils.AssertEqual_TickData(fileName, GetType(), klineData);
        }
Exemplo n.º 2
0
        public void TestTickDataStore_Append(string uri)
        {
            string         code          = "m1005";
            int            day           = 20100108;
            IDataStore     dataStore     = DataStoreFactory.CreateDataStore(uri);
            ITickDataStore tickDataStore = dataStore.CreateTickDataStore();

            try
            {
                TickData data = (TickData)MockDataLoader.GetTickData(code, day);

                TickData d1 = data.SubData(0, 100);
                TickData d2 = data.SubData(101, data.Length - 1);

                tickDataStore.Save(code, day, d1);
                tickDataStore.Append(code, day, d2);

                TickData data2 = tickDataStore.Load(code, day);

                AssertUtils.AssertEqual_TickData(data, data2);
            }
            finally
            {
                tickDataStore.Delete(code, day);
            }
        }
Exemplo n.º 3
0
        public void TestTickDataStore_FromBytes()
        {
            TickData data = (TickData)MockDataLoader.GetTickData("m1005", 20100108);

            byte[]   bs    = TickDataStore_File_Single.GetBytes(data);
            TickData data2 = TickDataStore_File_Single.FromBytes(bs, 0, bs.Length);

            AssertUtils.AssertEqual_TickData(data, data2);
        }
        public void TestGenerator_TickData_Index()
        {
            DataUpdateHelper             dataUpdateHelper = TestDataUpdateHelper.GetDataUpdateHelper_BiaoPuYongHua();
            DataGenerator_TickData_Index generator        = new DataGenerator_TickData_Index(dataUpdateHelper);
            ITickData tickdata = generator.Generate("m", 20100106);

            AssertUtils.AssertEqual_TickData("TickData_M_20100106_Index", GetType(), tickdata);
            //AssertUtils.PrintTickData(tickdata);

            tickdata = generator.Generate("m", 20150106);
            //AssertUtils.PrintTickData(tickdata);
            AssertUtils.AssertEqual_TickData("TickData_M_20150106_Index", GetType(), tickdata);
        }
Exemplo n.º 5
0
        public void TestTickDataLoadSave()
        {
            String path = TestCaseManager.GetTestCasePath(GetType(), "TickData_Output.csv");

            string[]  lines    = TestCaseManager.LoadTestCaseFile(GetType(), "CsvUtils_TickData").Split('\r');
            ITickData tickData = CsvUtils_TickData.LoadByLines(lines);

            CsvUtils_TickData.Save(path, tickData);

            ITickData newtickData = CsvUtils_TickData.Load(path);

            AssertUtils.AssertEqual_TickData(newtickData, tickData);
        }
Exemplo n.º 6
0
        public void TestTickDataStore_SaveLoad()
        {
            TickData data = (TickData)MockDataLoader.GetTickData("m1005", 20100108);
            String   path = TestCaseManager.GetTestCasePath(GetType(), "output_tick_saveload");
            TickDataStore_File_Single store = new TickDataStore_File_Single(path);

            store.Save(data);

            TickDataStore_File_Single store2 = new TickDataStore_File_Single(path);
            TickData data2 = store2.Load();

            AssertUtils.AssertEqual_TickData(data, data2);
            File.Delete(path);
        }
Exemplo n.º 7
0
        public void TestBiaoPuYongHua()
        {
            IDataProvider dataProvider = new DataProvider_BiaoPuYongHua(DataUpdateConst.SRCDATAPATH_BIAOPUYONGHUA, DataUpdateConst.PLUGINPATH);
            List <int>    tradingDays  = dataProvider.GetNewTradingDays();

            AssertUtils.AssertEqual_List("tradingdays", GetType(), tradingDays);
            //AssertUtils.PrintLineList(tradingDays);

            List <CodeInfo> codes = dataProvider.GetNewCodes();

            AssertUtils.PrintLineList(codes);
            AssertUtils.AssertEqual_List("codes", GetType(), codes);

            ITickData tickData = dataProvider.LoadTickData("A1005", 20100105);

            //AssertUtils.PrintTickData(tickData);
            AssertUtils.AssertEqual_TickData("TickData_A1005_20100105", GetType(), tickData);
        }
        private void AssertTickDataInDic(string code)
        {
            foreach (int date in dic_Date_TickData.Keys)
            {
                //if (period.Equals(KLinePeriod.KLinePeriod_1Day))
                //    continue;
                List <string> contents = dic_Date_TickData[date];
                StringBuilder sb       = new StringBuilder();
                for (int i = 0; i < contents.Count; i++)
                {
                    if (i != 0)
                    {
                        sb.Append("\r\n");
                    }
                    sb.Append(contents[i]);
                }
                ITickData tickData = DataCenter.Default.DataReader.TickDataReader.GetTickData(code, date);

                AssertUtils.AssertEqual_TickData(sb.ToString(), tickData);
            }
        }
Exemplo n.º 9
0
        public void TestLoadDaily()
        {
            //string srcDataPath = @"E:\FUTURES\CSV\TICK_DAILY\";
            //string pluginPath = @"D:\SCWORK\DEV\SC2\bin\Debug\plugin\cnfutures\";

            IDataProvider dataProvider = new DataProvider_Daily(DataUpdateConst.SRCDATAPATH_DAILY, DataUpdateConst.PLUGINPATH);
            List <int>    tradingDays  = dataProvider.GetNewTradingDays();

            tradingDays.RemoveRange(40, tradingDays.Count - 40);
            AssertUtils.AssertEqual_List("tradingdays", GetType(), tradingDays);

            List <CodeInfo> codes = dataProvider.GetNewCodes();

            codes.Sort(new CodeInfoComparer());
            //AssertUtils.PrintLineList(codes);
            //AssertUtils.AssertEqual_List("codes", GetType(), codes);

            ITickData tickData = dataProvider.LoadTickData("A1705", 20170405);

            //AssertUtils.PrintTickData(tickData);
            AssertUtils.AssertEqual_TickData("TickData_A1705_20170405", GetType(), tickData);
        }
Exemplo n.º 10
0
        public void TestLoadJinShuYuan()
        {
            //string srcDataPath = @"E:\FUTURES\CSV\TICK_JSY\";
            //string pluginPath = @"D:\SCWORK\DEV\SC2\bin\Debug\plugin\cnfutures\";

            DataProvider_JinShuYuan dataProvider = new DataProvider_JinShuYuan(DataUpdateConst.SRCDATAPATH_JINSHUYUAN, DataUpdateConst.PLUGINPATH);

            List <CodeInfo> codes = dataProvider.GetNewCodes();

            //AssertUtils.PrintLineList(codes);
            AssertUtils.AssertEqual_List("codes", GetType(), codes);

            List <int> tradingDays = dataProvider.GetNewTradingDays();

            AssertUtils.AssertEqual_List("tradingdays", GetType(), tradingDays);

            ITickData tickData = dataProvider.LoadTickData("a1607", 20160503);

            AssertUtils.AssertEqual_TickData("TickData_A1607_20160503", GetType(), tickData);

            tickData = dataProvider.LoadTickData("CF1607", 20160503);
            AssertUtils.AssertEqual_TickData("TickData_CF1607_20160503", GetType(), tickData);
            //AssertUtils.PrintTickData(tickData);
        }