Exemple #1
0
 public IDataNavigate_Code CreateDataNavigate_Code(string code, double time)
 {
     int openDate = this.dataReader.CreateTradingTimeReader(code).GetRecentTradingDay(time);
     if (openDate < 0)
         return null;
     IDataPackage_Code dataPackage = DataPackageFactory.CreateDataPackage(dataReader, code, openDate, 500, 500);
     return CreateDataNavigate_Code(dataPackage, time);
 }
Exemple #2
0
        public HistoryDataForward_Code(IDataReader dataReader, string code, HistoryDataForwardArguments args)
        {
            IDataPackage_Code     dataPackage    = DataPackageFactory.CreateDataPackage(dataReader, code, args.StartDate, args.EndDate);
            ForwardReferedPeriods referedPeriods = args.ReferedPeriods;
            ForwardPeriod         forwardPeriod  = new ForwardPeriod(args.IsTickForward, args.ForwardKLinePeriod);

            this.Init(dataPackage, referedPeriods, forwardPeriod);
        }
Exemple #3
0
    public static DataPackage FromString(Client c, string s)
    {
        string[] split = s.Split(delimiter, 2);
        int      id;

        if (!int.TryParse(split[0], out id))
        {
            return(null);
        }

        DataPackageFactory factory = c.GetFactory(id);

        if (factory == null)
        {
            return(null);
        }

        return(factory.CreateFromBody(split[1]));
    }
Exemple #4
0
        public DataNavigate_Code2(IDataReader dataReader, string code, double time)
        {
            int openDate = dataReader.CreateTradingTimeReader(code).GetRecentTradingDay(time);
            ITradingDayReader tradingDayReader = dataReader.TradingDayReader;

            int index = dataReader.TradingDayReader.GetTradingDayIndex(openDate);
            //默认取前100天,后50天数据
            int startIndex = index - 100;

            startIndex = startIndex < 0 ? 0 : startIndex;
            int startDate = tradingDayReader.GetTradingDay(startIndex);

            int endIndex = index + 50;

            if (endIndex >= tradingDayReader.GetAllTradingDays().Count)
            {
                endIndex = tradingDayReader.GetAllTradingDays().Count - 1;
            }
            int endDate = tradingDayReader.GetTradingDay(endIndex);

            this.dataPackage = DataPackageFactory.CreateDataPackage(dataReader, code, startDate, endDate);
            this.NavigateTo(time);
        }
Exemple #5
0
 public IDataNavigate_Code CreateDataNavigate_Code(string code, double time, int beforeDays, int afterDays)
 {
     int openDate = this.dataReader.CreateTradingTimeReader(code).GetRecentTradingDay(time);
     IDataPackage_Code dataPackage = DataPackageFactory.CreateDataPackage(dataReader, code, openDate, beforeDays, afterDays);
     return CreateDataNavigate_Code(dataPackage, time);
 }