public ActionResult LoadData()
        {
            OptionChainClass obj  = new OptionChainClass();
            string           path = ConfigurationManager.AppSettings["Dates"];

            string[] dates          = path.Split(',');
            string   masterFilePath = ConfigurationManager.AppSettings["MasterFilePath"];
            bool     isLoadAllData  = false;

            string bankNiftyStaticData = ConfigurationManager.AppSettings["BankNiftyStaticData"];;
            string niftyStaticData     = ConfigurationManager.AppSettings["NiftyStaticData"];;
            string liveMarketUrl       = ConfigurationManager.AppSettings["LiveMarketUrl"];;

            try
            {
                obj.LoadFullOptionChainData(masterFilePath, dates, isLoadAllData, bankNiftyStaticData, niftyStaticData, liveMarketUrl);
                Session["optionsData"] = LoadOptionsFullData(masterFilePath);
            }
            catch (Exception ex)
            {
                throw new Exception("Error when loading data: ", ex);
            }

            if (System.Web.HttpContext.Current.Request.UrlReferrer == null || System.Web.HttpContext.Current.Request.UrlReferrer.Segments.Length < 3)
            {
                return(View());
            }
            else
            {
                return(RedirectToAction(System.Web.HttpContext.Current.Request.UrlReferrer.Segments[2]));
            }
        }
        public ActionResult LoadData()
        {
            OptionChainClass obj  = new OptionChainClass();
            string           path = ConfigurationManager.AppSettings["dates"];

            string[] dates = path.Split(',');

            try
            {
                obj.LoadFullOptionChainData(@"D:\Q-Dashboard\MasterData\FullOptionsData\", dates, false);
                Session["optionsData"] = LoadOptionsFullData();
            }
            catch (Exception ex)
            {
                throw new Exception("Error when loading data: ", ex);
            }

            if (System.Web.HttpContext.Current.Request.UrlReferrer == null || System.Web.HttpContext.Current.Request.UrlReferrer.Segments.Length < 3)
            {
                return(View());
            }
            else
            {
                return(RedirectToAction(System.Web.HttpContext.Current.Request.UrlReferrer.Segments[2]));
            }
        }
Beispiel #3
0
        public int GetRefreshData()
        {
            OptionChainClass obj  = new OptionChainClass();
            string           path = ConfigurationManager.AppSettings["dates"];

            string[] dates = path.Split(',');
            obj.LoadFullOptionChainData(@"D:\Analyzer\MasterData\FullOptionsData\", dates, false);
            var cache = MemoryCache.Default;
            List <OptionChain> optionsData = new List <OptionChain>();
            var cachePolicty = new CacheItemPolicy();

            cachePolicty.AbsoluteExpiration = DateTime.Now.AddSeconds(600);
            optionsData = LoadOptionsFullData();
            cache.Add("dataCache", optionsData.ToList(), cachePolicty);
            return(0);
        }
Beispiel #4
0
        public static void LoadData()
        {
            OptionChainClass obj  = new OptionChainClass();
            string           path = ConfigurationManager.AppSettings["Dates"];

            string[] dates          = path.Split(',');
            string   masterFilePath = ConfigurationManager.AppSettings["MasterFilePath"];
            bool     isLoadAllData  = false;

            string bankNiftyStaticData = ConfigurationManager.AppSettings["BankNiftyStaticData"];;
            string niftyStaticData     = ConfigurationManager.AppSettings["NiftyStaticData"];;
            string liveMarketUrl       = ConfigurationManager.AppSettings["LiveMarketUrl"];;

            Console.WriteLine(path);
            Console.WriteLine(masterFilePath);
            Console.WriteLine(bankNiftyStaticData);
            Console.WriteLine(niftyStaticData);
            Console.WriteLine(liveMarketUrl);

            try
            {
                List <OptionChain> chainData = obj.LoadFullOptionChainData(masterFilePath, dates, isLoadAllData, bankNiftyStaticData, niftyStaticData, liveMarketUrl);

                OBJtoXML xmltoObj = new OBJtoXML();
                xmltoObj.CreateOptionsXML(chainData, masterFilePath, "LoadFullOptionChainData", true);
                //Code to load file to Azure blob storage account
                Console.WriteLine("Loaded data sucussfully.");
                Console.WriteLine("Thread locked.");
                System.Threading.Thread.Sleep(180000);
                Console.WriteLine("Thread lock released.");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Console.WriteLine("Process completed");
            }
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            OptionChainClass obj = new OptionChainClass();

            string[] dates = { "25OCT2018", "11OCT2018" };
            obj.LoadFullOptionChainData(@"D:\Analyzer\MasterData\FullOptionsData\", dates, false);

            OBJtoXML xmltoObj = new OBJtoXML();

            string[] txtFiles = Directory.GetFiles(@"D:\Analyzer\MasterData\FullOptionsData\", "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();

            //var txtFiles = Directory.EnumerateFiles("D:\\MasterData\\Basic\\", " *.txt").OrderByDescending(x => x);
            List <OptionChain> optionsData = new List <OptionChain>();

            foreach (string currentFile in txtFiles)
            {
                optionsData.AddRange((List <OptionChain>)xmltoObj.CreateOptionsObject(optionsData, currentFile));
            }
            optionsData = optionsData.Where(x => x.SourceName == "NIFTY" || x.SourceName == "BANKNIFTY").ToList();
            optionsData = optionsData.OrderByDescending(x => x.TimeStamp).ToList();

            // optionsData=optionsData.OrderByDescending(x => Convert.ToDecimal(x.Percentage)).ToList();
        }