예제 #1
0
 parseResponseTime(dataTable, nameof(Tests.JilJsonFormatterActionResult)));
예제 #2
0
        static public List <Price> readDataFromDataBase(GlobalObjects.TimeInterval T, dataTable TD, DateTime Start, DateTime End, bool reverseList)
        {
            List <Price> prices = new List <Price>();

            AlsiDBDataContext dc = new AlsiDBDataContext();


            if (TD == dataTable.Temp)
            {
                var result = from q in dc.OHLC_Temps
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close     = v.C;
                    p.Open      = v.O;
                    p.High      = v.H;
                    p.Low       = v.L;
                    p.TimeStamp = v.Stamp;
                    prices.Add(p);
                }
                dc.Clean_OHLC_Temp();
                if (reverseList)
                {
                    prices.Reverse();
                }
                return(prices);
            }

            if (TD == dataTable.AllHistory)
            {
                if (T == GlobalObjects.TimeInterval.Minute_2)
                {
                    var firstinDB = dc.OHLC_2_Minutes.AsEnumerable().First().Stamp;
                    var lastinDB  = dc.OHLC_2_Minutes.AsEnumerable().Last().Stamp;
                    if (firstinDB > Start)
                    {
                        dc.OHLC_2_AllHistory();
                    }
                    if (lastinDB > End)
                    {
                        dc.OHLC_2_AllHistory();
                    }
                }
                if (T == GlobalObjects.TimeInterval.Minute_5)
                {
                    try
                    {
                        var firstinDB = dc.OHLC_5_Minutes.AsEnumerable().First().Stamp;
                        var lastinDB  = dc.OHLC_5_Minutes.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start)
                        {
                            dc.OHLC_5_AllHistory();
                        }
                        if (lastinDB < End)
                        {
                            dc.OHLC_5_AllHistory();
                        }
                    }
                    catch { dc.OHLC_5_AllHistory(); }
                }
                if (T == GlobalObjects.TimeInterval.Minute_10)
                {
                    var firstinDB = dc.OHLC_10_Minutes.AsEnumerable().First().Stamp;
                    var lastinDB  = dc.OHLC_10_Minutes.AsEnumerable().Last().Stamp;
                    if (firstinDB > Start)
                    {
                        dc.OHLC_10_AllHistory();
                    }
                    if (lastinDB < End)
                    {
                        dc.OHLC_10_AllHistory();
                    }
                }
            }
            if (TD == dataTable.MasterMinute)
            {
                if (T == GlobalObjects.TimeInterval.Minute_2)
                {
                    var min2 = dc.OHLC_2_Minutes;
                    if (min2.Count() == 0)
                    {
                        dc.OHLC_2();
                    }
                    else
                    {
                        var firstinDB = dc.OHLC_2_Minutes.AsEnumerable().First().Stamp;
                        var lastinDB  = dc.OHLC_2_Minutes.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start)
                        {
                            dc.OHLC_2();
                        }
                        if (lastinDB < End)
                        {
                            dc.OHLC_2();
                        }
                    }
                }

                if (T == GlobalObjects.TimeInterval.Minute_5)
                {
                    var min5 = dc.OHLC_5_Minutes;
                    if (min5.Count() == 0)
                    {
                        dc.OHLC_5();
                    }
                    else
                    {
                        var firstinDB = min5.AsEnumerable().First().Stamp;
                        var lastinDB  = min5.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start)
                        {
                            dc.OHLC_5();
                        }
                        if (lastinDB < End)
                        {
                            dc.OHLC_5();
                        }
                    }
                }

                if (T == GlobalObjects.TimeInterval.Minute_10)
                {
                    var min10 = dc.OHLC_10_Minutes;
                    if (min10.Count() == 0)
                    {
                        dc.OHLC_10();
                    }
                    else
                    {
                        var firstinDB = dc.OHLC_10_Minutes.AsEnumerable().First().Stamp;
                        var lastinDB  = dc.OHLC_10_Minutes.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start)
                        {
                            dc.OHLC_10();
                        }
                        if (lastinDB < End)
                        {
                            dc.OHLC_10();
                        }
                    }
                }

                if (T == GlobalObjects.TimeInterval.Hour_1)
                {
                    dc.OHLC_Hour_1();
                }
            }



            if (T == GlobalObjects.TimeInterval.Minute_2)
            {
                var result = from q in dc.OHLC_2_Minutes
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close          = v.C;
                    p.Open           = v.O;
                    p.High           = v.H;
                    p.Low            = v.L;
                    p.TimeStamp      = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);
                }
            }

            if (T == GlobalObjects.TimeInterval.Minute_5)
            {
                var result = from q in dc.OHLC_5_Minutes
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close          = v.C;
                    p.Open           = v.O;
                    p.High           = v.H;
                    p.Low            = v.L;
                    p.TimeStamp      = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);
                }
            }
            if (T == GlobalObjects.TimeInterval.Minute_10)
            {
                var result = from q in dc.OHLC_10_Minutes
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close          = v.C;
                    p.Open           = v.O;
                    p.High           = v.H;
                    p.Low            = v.L;
                    p.TimeStamp      = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);
                }
            }

            if (T == GlobalObjects.TimeInterval.Hour_1)
            {
                var result = from q in dc.OHLC_1_Hours
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close          = v.C;
                    p.Open           = v.O;
                    p.High           = v.H;
                    p.Low            = v.L;
                    p.TimeStamp      = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);
                }
            }



            if (reverseList)
            {
                prices.Reverse();
            }
            return(prices);
        }
예제 #3
0
 parseResponseTime(dataTable, nameof(Tests.JsonDefaultActionResult)),
예제 #4
0
 parseResponseTime(dataTable, nameof(Tests.JilJsonFormatter)),
예제 #5
0
 parseResponseTime(dataTable, nameof(Tests.Csv)),
예제 #6
0
 parseResponseTime(dataTable, nameof(Tests.ByteArrayActionResult)),
예제 #7
0
 public void BestMovieTest()
 {
     dataTable obj = new dataTable();
 }
예제 #8
0
 parseResponseTime(dataTable, nameof(Tests.JilJsonActionResultNoNulls)),
 parseResponseTime(dataTable, nameof(Tests.AspNetCoreApiByteArrayActionResult)));
 parseResponseTime(dataTable, nameof(Tests.AspNetCoreApiCsv)),
 parseResponseTime(dataTable, nameof(Tests.AspNetCoreApiJilJsonActionResult)),
 parseResponseTime(dataTable, nameof(Tests.AspNetCoreApiDefaultJson)),
예제 #13
0
        static public List<Price> readDataFromDataBase(GlobalObjects.TimeInterval T, dataTable TD, DateTime Start, DateTime End, bool reverseList)
        {

            List<Price> prices = new List<Price>();

            AlsiDBDataContext dc = new AlsiDBDataContext();


            if (TD == dataTable.Temp)
            {
                var result = from q in dc.OHLC_Temps
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    prices.Add(p);

                }
                dc.Clean_OHLC_Temp();
                if (reverseList) prices.Reverse();
                return prices;
            }

            if (TD == dataTable.AllHistory)
            {
                if (T == GlobalObjects.TimeInterval.Minute_2)
                {
                    var firstinDB = dc.OHLC_2_Minutes.AsEnumerable().First().Stamp;
                    var lastinDB = dc.OHLC_2_Minutes.AsEnumerable().Last().Stamp;
                    if (firstinDB > Start) dc.OHLC_2_AllHistory();
                    if (lastinDB > End) dc.OHLC_2_AllHistory();
                }
                if (T == GlobalObjects.TimeInterval.Minute_5)
                {
                    try
                    {
                        var firstinDB = dc.OHLC_5_Minutes.AsEnumerable().First().Stamp;
                        var lastinDB = dc.OHLC_5_Minutes.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start) dc.OHLC_5_AllHistory();
                        if (lastinDB < End) dc.OHLC_5_AllHistory();
                    }
                    catch { dc.OHLC_5_AllHistory(); }

                }
                if (T == GlobalObjects.TimeInterval.Minute_10)
                {
                    var firstinDB = dc.OHLC_10_Minutes.AsEnumerable().First().Stamp;
                    var lastinDB = dc.OHLC_10_Minutes.AsEnumerable().Last().Stamp;
                    if (firstinDB > Start) dc.OHLC_10_AllHistory();
                    if (lastinDB < End) dc.OHLC_10_AllHistory();
                }
            }
            if (TD == dataTable.MasterMinute)
            {
                if (T == GlobalObjects.TimeInterval.Minute_2)
                {
                    var min2 = dc.OHLC_2_Minutes;
                    if (min2.Count() == 0)
                    {
                        dc.OHLC_2();
                    }
                    else
                    {
                        var firstinDB = dc.OHLC_2_Minutes.AsEnumerable().First().Stamp;
                        var lastinDB = dc.OHLC_2_Minutes.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start) dc.OHLC_2();
                        if (lastinDB < End) dc.OHLC_2();
                    }
                }

                if (T == GlobalObjects.TimeInterval.Minute_5)
                {
                    var min5 = dc.OHLC_5_Minutes;
                    if (min5.Count() == 0)
                    {
                        dc.OHLC_5();
                    }
                    else
                    {
                        var firstinDB = min5.AsEnumerable().First().Stamp;
                        var lastinDB = min5.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start) dc.OHLC_5();
                        if (lastinDB < End) dc.OHLC_5();
                    }
                }

                if (T == GlobalObjects.TimeInterval.Minute_10)
                {
                    var min10 = dc.OHLC_10_Minutes;
                    if (min10.Count() == 0)
                    {
                        dc.OHLC_10();
                    }
                    else
                    {
                        var firstinDB = dc.OHLC_10_Minutes.AsEnumerable().First().Stamp;
                        var lastinDB = dc.OHLC_10_Minutes.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start) dc.OHLC_10();
                        if (lastinDB < End) dc.OHLC_10();
                    }
                }

                if (T == GlobalObjects.TimeInterval.Hour_1)
                {
                   dc.OHLC_Hour_1();
                }
            }





            if (T == GlobalObjects.TimeInterval.Minute_2)
            {
                var result = from q in dc.OHLC_2_Minutes
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);

                }
            }

            if (T == GlobalObjects.TimeInterval.Minute_5)
            {
                var result = from q in dc.OHLC_5_Minutes
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);

                }
            }
            if (T == GlobalObjects.TimeInterval.Minute_10)
            {
                var result = from q in dc.OHLC_10_Minutes
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);

                }
            }

            if (T == GlobalObjects.TimeInterval.Hour_1)
            {
                var result = from q in dc.OHLC_1_Hours 
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);

                }
            }




            if (reverseList) prices.Reverse();
            return prices;


        }