Пример #1
0
        private string PeriodToString(TAFHistoricalPeriod p)
        {
            switch (p)
            {
            case TAFHistoricalPeriod.Minute:
                return("MM");

            case TAFHistoricalPeriod.Hour:
                return("HH");

            case TAFHistoricalPeriod.Day:
                return("D");

            case TAFHistoricalPeriod.Month:
                return("M");

            case TAFHistoricalPeriod.Week:
                return("W");

            case TAFHistoricalPeriod.Year:
                return("Y");

            default:
                throw new Exception(p.ToString() + " is not known yet.");
            }
        }
Пример #2
0
 public void GetHistoricalData(string ticker, DateTime from, DateTime to, TAFHistoricalPeriod p)
 {
     writer.WriteLine("%" + ticker + "!" +
                      from.Year.ToString() + (from.Month < 10 ? "0" : "") + from.Month.ToString() + (from.Day < 10 ? "0" : "") + from.Day.ToString() + "!" +
                      to.Year.ToString() + (to.Month < 10 ? "0" : "") + to.Month.ToString() + (to.Day < 10 ? "0" : "") + to.Day.ToString() + "!" +
                      PeriodToString(p));
     writer.Flush();
 }