Ejemplo n.º 1
0
        public List <CompanyDetails> CheckHighBuying(string _masterDatapathBasic, string _defaultDate)
        {
            OBJtoXML   xmltoObj    = new OBJtoXML();
            BulkEntity datafromXML = new BulkEntity();

            datafromXML.BasicData = new List <CompanyDetails>();

            var txtFiles = Directory.GetFiles(_masterDatapathBasic, "*.txt").OrderByDescending(d => new FileInfo(d).LastWriteTime);

            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                if (checkIsPostMarketData(currentFile) == true)
                {
                    datafromXML.BasicData.AddRange((List <CompanyDetails>)xmltoObj.CreateObject(datafromXML.BasicData, currentFile, false)); break;
                }
            }

            var query1 = datafromXML.BasicData.Where(x => Convert.ToDecimal(x.totalBuyQuantity) > Convert.ToDecimal(x.totalSellQuantity))
                         .Select(x =>
                                 new
            {
                x.lastPrice,
                x.CompanyName,
                x.High,
                x.Low,
                x.Open,
                Code = x.Code,
                x.totalBuyQuantity,
                x.totalSellQuantity,
                Pchange    = (((Convert.ToDecimal(x.lastPrice) / (Convert.ToDecimal(x.PreClose))) * 100) - 100),                                 //High must change with current price
                Percentage = (((Convert.ToDecimal(x.totalBuyQuantity) / (Convert.ToDecimal(x.totalSellQuantity))) * 100) - 100).ToString()
            }).ToList()
                         .OrderByDescending(x => Convert.ToDecimal(x.Percentage))
                         .ToList();

            List <CompanyDetails> newlist = new List <CompanyDetails>();
            CompanyDetails        cmp     = null;

            foreach (var item in query1)
            {
                cmp                   = new CompanyDetails();
                cmp.Code              = item.Code;
                cmp.totalBuyQuantity  = item.totalBuyQuantity;
                cmp.totalSellQuantity = item.totalSellQuantity;
                cmp.pChange           = item.Pchange.ToString();
                cmp.Percentage        = item.Percentage;
                cmp.CompanyName       = item.CompanyName;
                cmp.High              = item.High;
                cmp.Low               = item.Low;
                cmp.Open              = item.Open;
                cmp.lastPrice         = item.lastPrice;
                newlist.Add(cmp);
            }

            return(newlist);
        }
Ejemplo n.º 2
0
        public List <string> GetCodes(string basicfilePath, string ioFilePath, string _defaultDate)
        {
            List <string> objList     = new List <string>();
            BulkData      obj         = new BulkData();
            OBJtoXML      xmltoObj    = new OBJtoXML();
            BulkEntity    datafromXML = new BulkEntity();

            datafromXML.BasicData = new List <CompanyDetails>();
            string[]      txtFiles  = Directory.GetFiles(basicfilePath, "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();
            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                datafromXML.BasicData.AddRange((List <CompanyDetails>)xmltoObj.CreateObject(datafromXML.BasicData, currentFile, false)); break;
            }

            foreach (var item in datafromXML.BasicData)
            {
                if (!(objList.Contains(item.Code)))
                {
                    objList.Add(item.Code);
                }
            }



            datafromXML.OIData = new List <OIDetails>();
            var txtFilesOIDetails = Directory.EnumerateFiles(ioFilePath, "*.txt").OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();

            foreach (string currentFile in txtFilesOIDetails)
            {
                datafromXML.OIData.AddRange((List <OIDetails>)xmltoObj.CreateObject(datafromXML.OIData, currentFile, false)); break;
            }

            foreach (var item in datafromXML.OIData)
            {
                if (!(objList.Contains(item.CompanyCode)))
                {
                    objList.Add(item.CompanyCode);
                }
            }
            return(objList);
        }
Ejemplo n.º 3
0
        public List <CompanyDetails> CheckSellSignals(string _masterDatapathBasic, string _defaultDate)
        {
            ////test to read data
            OBJtoXML   xmltoObj    = new OBJtoXML();
            BulkEntity datafromXML = new BulkEntity();

            datafromXML.BasicData = new List <CompanyDetails>();
            var txtFiles = Directory.EnumerateFiles(_masterDatapathBasic, "*.txt").OrderByDescending(d => new FileInfo(d).LastWriteTime);

            foreach (string currentFile in txtFiles)
            {
                datafromXML.BasicData.AddRange((List <CompanyDetails>)xmltoObj.CreateObject(datafromXML.BasicData, currentFile, false)); break;
            }

            List <CompanyDetails> queryData = datafromXML.BasicData.Where(x => Convert.ToDecimal(x.High) == Convert.ToDecimal(x.Open)).ToList();

            return(queryData);
        }
Ejemplo n.º 4
0
        public List <Rank> CheckLTPHasBeforeLastPlace(string _masterDatapathDMA, string _defaultDate)
        {
            //test to read data
            BulkEntity datafromXML = new BulkEntity();
            OBJtoXML   xmltoObj    = new OBJtoXML();

            datafromXML.DMAData = new List <Rank>();
            var           txtFiles  = Directory.EnumerateFiles(_masterDatapathDMA, "*.txt").OrderByDescending(d => new FileInfo(d).CreationTime).ToArray();
            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                datafromXML.DMAData.AddRange((List <Rank>)xmltoObj.CreateObject(datafromXML.DMAData, currentFile, false)); break;
            }
            List <Rank> dataitem1 = datafromXML.DMAData.Where(x => x.RankId == 7 && x.Day == "LTP").ToList();

            return(dataitem1);
        }
Ejemplo n.º 5
0
        public List <Rank> BankniftyDMAScore(string _masterDatapathDMA, List <Weightage> bankNifty, string _defaultDate)
        {
            //test to read data
            BulkEntity datafromXML = new BulkEntity();
            OBJtoXML   xmltoObj    = new OBJtoXML();

            datafromXML.DMAData = new List <Rank>();
            var           txtFiles  = Directory.EnumerateFiles(_masterDatapathDMA, "*.txt").OrderByDescending(d => new FileInfo(d).CreationTime).ToArray();
            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                datafromXML.DMAData.AddRange((List <Rank>)xmltoObj.CreateObject(datafromXML.DMAData, currentFile, false)); break;
            }
            List <Rank> dataitem1 = GenerateDMAScore(datafromXML.DMAData.ToList(), bankNifty);

            return(dataitem1);
        }
Ejemplo n.º 6
0
        public List <CompanyDetails> UpdateDMAMasterSource(string _masterDatapathBasic, string _defaultDate)
        {
            ////test to read data
            OBJtoXML   xmltoObj    = new OBJtoXML();
            BulkEntity datafromXML = new BulkEntity();

            datafromXML.BasicData = new List <CompanyDetails>();
            var           txtFiles  = Directory.EnumerateFiles(_masterDatapathBasic, "*.txt").OrderByDescending(d => new FileInfo(d).LastWriteTime);
            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                if (checkIsPostMarketData(currentFile) == false)
                {
                    datafromXML.BasicData.AddRange((List <CompanyDetails>)xmltoObj.CreateObject(datafromXML.BasicData, currentFile, false)); break;
                }
            }
            return(datafromXML.BasicData);
        }
Ejemplo n.º 7
0
        public List <MCData> MCData(string path, string _defaultDate)
        {
            BulkData obj = new BulkData();
            // BulkEntity data = obj.AnalyzerData("BHARTIARTL");
            ////test to read data
            OBJtoXML      xmltoObj = new OBJtoXML();
            List <MCData> data     = new List <MCData>();

            string[] txtFiles = Directory.GetFiles(path, "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();

            //var txtFiles = Directory.EnumerateFiles("D:\\MasterData\\Basic\\", " *.txt").OrderByDescending(x => x);
            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                data = (List <MCData>)xmltoObj.CreateObject(data, currentFile, false); break;
            }
            return(data);
        }
Ejemplo n.º 8
0
        public List <UIDetailedDMA> ChangeDMAPosation(string _masterDatapathDMA, List <Weightage> nifty50, string _defaultDate)
        {
            //test to read data
            BulkEntity             datafromXML   = new BulkEntity();
            OBJtoXML               xmltoObj      = new OBJtoXML();
            ConvertiontoDMADayData objNewListObj = new ConvertiontoDMADayData();

            datafromXML.DMAData = new List <Rank>();
            var           txtFiles  = Directory.EnumerateFiles(_masterDatapathDMA, "*.txt").OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();
            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                datafromXML.DMAData.AddRange((List <Rank>)xmltoObj.CreateObject(datafromXML.DMAData, currentFile, false));
            }
            List <Rank>          dataitem1      = datafromXML.DMAData.Where(x => x.SourceName != null).ToList();
            List <UIDetailedDMA> objNewListData = objNewListObj.ConvertOnjectToDMAData(dataitem1).ToList();

            return(FindChangeInLTPPosation(objNewListData, nifty50));
        }
Ejemplo n.º 9
0
        public List <OIDetails> CheckPriceWeekIOWeek(string _masterDatapathBasic, string _defaultDate)
        {
            ////test to read data
            OBJtoXML   xmltoObj    = new OBJtoXML();
            BulkEntity datafromXML = new BulkEntity();

            datafromXML.OIData = new List <OIDetails>();
            var           txtFiles  = Directory.EnumerateFiles(_masterDatapathBasic, "*.txt").OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();
            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                datafromXML.OIData.AddRange((List <OIDetails>)xmltoObj.CreateObject(datafromXML.OIData, currentFile, false)); break;
            }

            var query7 = datafromXML.OIData.Where(x => x.PchangeinOpenInterest != null && x.PChange != null && x.PchangeinOpenInterest != "-" && x.PChange != "-")
                         .Where(x => Convert.ToDecimal(x.PChange) < 0 && Convert.ToDecimal(x.PchangeinOpenInterest) < 0)
                         .Select(x =>
                                 new
            {
                Code = x.CompanyCode,
                x.PChange,
                x.PchangeinOpenInterest,
            })
                         .OrderByDescending(x => x.PchangeinOpenInterest)
                         .ToList();

            List <OIDetails> newlist = new List <OIDetails>();
            OIDetails        cmp     = null;

            foreach (var item in query7)
            {
                cmp                       = new OIDetails();
                cmp.CompanyCode           = item.Code;
                cmp.PChange               = item.PChange.ToString();
                cmp.PchangeinOpenInterest = item.PchangeinOpenInterest;
                newlist.Add(cmp);
            }

            return(newlist);
        }
Ejemplo n.º 10
0
        public List <CompanyDetails> GetBasicAvgAll(List <Weightage> weightageData, string path, string _defaultDate)
        {
            List <CompanyDetails> queryData = new List <CompanyDetails>();
            BulkData obj = new BulkData();
            // BulkEntity data = obj.AnalyzerData("BHARTIARTL");
            ////test to read data
            OBJtoXML   xmltoObj    = new OBJtoXML();
            BulkEntity datafromXML = new BulkEntity();

            datafromXML.BasicData = new List <CompanyDetails>();
            string[]      txtFiles  = Directory.GetFiles(path, "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();
            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                datafromXML.BasicData.AddRange((List <CompanyDetails>)xmltoObj.CreateObject(datafromXML.BasicData, currentFile, false));
            }

            queryData = datafromXML.BasicData.OrderByDescending(x => x.BasicSavedTimeStamp).ToList();
            return(queryData);
        }
Ejemplo n.º 11
0
        public List <Rank> GetDMAData(string code, string path, string _defaultDate)
        {
            BulkData obj = new BulkData();
            // BulkEntity data = obj.AnalyzerData("BHARTIARTL");
            ////test to read data
            OBJtoXML   xmltoObj    = new OBJtoXML();
            BulkEntity datafromXML = new BulkEntity();

            datafromXML.DMAData = new List <Rank>();
            string[] txtFiles = Directory.GetFiles(path, "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();

            //var txtFiles = Directory.EnumerateFiles("D:\\MasterData\\Basic\\", " *.txt").OrderByDescending(x => x);
            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                datafromXML.DMAData.AddRange((List <Rank>)xmltoObj.CreateObject(datafromXML.DMAData, currentFile, false));
            }
            List <Rank> queryData = datafromXML.DMAData.Where(x => x.SourceName == code).OrderByDescending(x => x.RankSavedTimeStamp).ToList();

            return(queryData);
        }
Ejemplo n.º 12
0
        public List <OIDetails> GetOpenInterestData(string code, string path, string _defaultDate)
        {
            BulkData obj = new BulkData();
            // BulkEntity data = obj.AnalyzerData("BHARTIARTL");
            ////test to read data
            OBJtoXML   xmltoObj    = new OBJtoXML();
            BulkEntity datafromXML = new BulkEntity();

            datafromXML.OIData = new List <OIDetails>();
            string[] txtFiles = Directory.GetFiles(path, "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();

            //var txtFiles = Directory.EnumerateFiles("D:\\MasterData\\Basic\\", " *.txt").OrderByDescending(x => x);
            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                datafromXML.OIData.AddRange((List <OIDetails>)xmltoObj.CreateObject(datafromXML.OIData, currentFile, false));
                if (code == "Discounting")
                {
                    break;
                }
            }
            List <OIDetails> queryData = new List <OIDetails>();

            if (code == "Discounting")
            {
                queryData = datafromXML.OIData.OrderByDescending(x => x.OISavedTimeStamp).ToList();
            }
            else
            {
                queryData = datafromXML.OIData.Where(x => x.CompanyCode == code).OrderByDescending(x => x.OISavedTimeStamp).ToList();
            }

            //return BankNiftyMoving(queryData);
            return(queryData);
        }
Ejemplo n.º 13
0
        public List <RBOEntity> RBO(string _defaultDate)
        {
            List <RBOEntity> objRBOEntityList     = new List <RBOEntity>();
            string           _masterDatapathBasic = ConfigurationManager.AppSettings["MasterDatapathBasic"];
            string           _masterDatapathDMA   = ConfigurationManager.AppSettings["MasterDatapathDMA"];

            BulkData   obj         = new BulkData();
            OBJtoXML   xmltoObj    = new OBJtoXML();
            BulkEntity datafromXML = new BulkEntity();

            datafromXML.BasicData = new List <CompanyDetails>();
            int RBOcount = 173;

            string[] txtFiles = Directory.GetFiles(_masterDatapathBasic, "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();

            List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);

            foreach (string currentFile in filesList)
            {
                if (checkIsValidFileForRBO(currentFile))
                {
                    datafromXML.BasicData.AddRange((List <CompanyDetails>)xmltoObj.CreateObject(datafromXML.BasicData, currentFile, false));
                    if (RBOcount == datafromXML.BasicData.Count)
                    {
                        break;
                    }
                    else
                    {
                        datafromXML.BasicData = new List <CompanyDetails>();
                    }
                }
            }

            //test to read data
            datafromXML.DMAData = new List <Rank>();
            var txtDMAFiles = Directory.EnumerateFiles(_masterDatapathDMA, "*.txt").OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();

            foreach (string currentFile in txtDMAFiles)
            {
                if (checkIsValidFileForRBO(currentFile))
                {
                    datafromXML.DMAData.AddRange((List <Rank>)xmltoObj.CreateObject(datafromXML.DMAData, currentFile, false));
                    break;
                }
            }

            RBOEntity objEntity;

            foreach (var basicData in datafromXML.BasicData.Where(x => x.Code != null))
            {
                objEntity             = new RBOEntity();
                objEntity.Code        = basicData.Code;
                objEntity.LTPValue    = basicData.lastPrice;
                objEntity.LTPDate     = basicData.BasicSavedTimeStamp;
                objEntity.low52       = basicData.low52;
                objEntity.high52      = basicData.high52;
                objEntity.TotalVolume = basicData.TotalVolume;
                objEntity.CurrentPrevdayVolumePercentage = basicData.CurrentPrevdayVolumePercentage;

                objEntity.BOPercentage = Math.Round(((Convert.ToDecimal(objEntity.LTPValue) * 100) / Convert.ToDecimal(objEntity.high52)), 2).ToString();
                var     dmaData  = datafromXML.DMAData.Where(x => x.SourceName == basicData.Code).ToList();
                decimal rboValue = 0.0M;
                decimal ltpValue = 0.0M;
                int     count    = 0;
                foreach (var itemDma in dmaData)
                {
                    if (itemDma.Day != "LTP")
                    {
                        rboValue = rboValue + Convert.ToDecimal(itemDma.Value); count++;
                    }
                    else
                    {
                        ltpValue = Convert.ToDecimal(itemDma.Value);
                    }
                }
                decimal rboAvgValue   = rboValue / count;
                decimal rboPercentage = ((ltpValue - rboAvgValue) * 100) / ltpValue;
                objEntity.RangeBoundPercentage = Math.Round(rboPercentage, 2).ToString();
                objRBOEntityList.Add(objEntity);
            }
            return(objRBOEntityList);
        }
Ejemplo n.º 14
0
        public List <CompanyDetails> GetBasicData(List <Weightage> weightageData, string companyCode, string path, string _defaultDate)
        {
            List <CompanyDetails> returnData = new List <CompanyDetails>();

            if (companyCode == "Discounting")
            {
                BulkData obj = new BulkData();
                // BulkEntity data = obj.AnalyzerData("BHARTIARTL");
                ////test to read data
                OBJtoXML   xmltoObj    = new OBJtoXML();
                BulkEntity datafromXML = new BulkEntity();
                datafromXML.BasicData = new List <CompanyDetails>();
                string[] txtFiles = Directory.GetFiles(path, "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();

                //var txtFiles = Directory.EnumerateFiles("D:\\MasterData\\Basic\\", " *.txt").OrderByDescending(x => x);
                List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);
                foreach (string currentFile in filesList)
                {
                    datafromXML.BasicData.AddRange((List <CompanyDetails>)xmltoObj.CreateObject(datafromXML.BasicData, currentFile, false)); break;
                }
                List <CompanyDetails> queryData = new List <CompanyDetails>();
                returnData = datafromXML.BasicData.OrderBy(x => x.BasicSavedTimeStamp).ToList();
            }
            else if (companyCode == "All")
            {
                BulkData obj = new BulkData();
                // BulkEntity data = obj.AnalyzerData("BHARTIARTL");
                ////test to read data
                OBJtoXML   xmltoObj    = new OBJtoXML();
                BulkEntity datafromXML = new BulkEntity();
                datafromXML.BasicData = new List <CompanyDetails>();
                string[] txtFiles = Directory.GetFiles(path, "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();

                //var txtFiles = Directory.EnumerateFiles("D:\\MasterData\\Basic\\", " *.txt").OrderByDescending(x => x);
                List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);
                foreach (string currentFile in filesList)
                {
                    datafromXML.BasicData.AddRange((List <CompanyDetails>)xmltoObj.CreateObject(datafromXML.BasicData, currentFile, false));
                }
                List <CompanyDetails> queryData = new List <CompanyDetails>();
                queryData  = datafromXML.BasicData.OrderBy(x => x.BasicSavedTimeStamp).ToList();
                returnData = CalcFastMoversForAll(companyCode, queryData.Where(x => x.TotalVolume != null && x.totalBuyQuantity != "1" && x.totalSellQuantity != "1").ToList());
            }
            else if (companyCode.Split(',')[0].ToUpper() == "BANKNIFTY")
            {
                BulkData   obj         = new BulkData();
                OBJtoXML   xmltoObj    = new OBJtoXML();
                BulkEntity datafromXML = new BulkEntity();
                datafromXML.BasicData = new List <CompanyDetails>();
                string[] txtFiles = Directory.GetFiles(path, "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();

                List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);
                foreach (string currentFile in filesList)
                {
                    datafromXML.BasicData.AddRange((List <CompanyDetails>)xmltoObj.CreateObject(datafromXML.BasicData, currentFile, false));
                }
                List <CompanyDetails> queryData = new List <CompanyDetails>();
                queryData  = datafromXML.BasicData.OrderBy(x => x.BasicSavedTimeStamp).ToList();
                returnData = CalcFastMoversForBankNifty(weightageData, companyCode, queryData.Where(x => x.TotalVolume != null && x.totalBuyQuantity != "1" && x.totalSellQuantity != "1").ToList());
            }
            else
            {
                BulkData obj = new BulkData();
                // BulkEntity data = obj.AnalyzerData("BHARTIARTL");
                ////test to read data
                OBJtoXML   xmltoObj    = new OBJtoXML();
                BulkEntity datafromXML = new BulkEntity();
                datafromXML.BasicData = new List <CompanyDetails>();
                string[]      txtFiles  = Directory.GetFiles(path, "*.txt*", SearchOption.AllDirectories).OrderByDescending(d => new FileInfo(d).LastWriteTime).ToArray();
                List <string> filesList = FilterDates(txtFiles.ToList(), _defaultDate);
                foreach (string currentFile in filesList)
                {
                    datafromXML.BasicData.AddRange((List <CompanyDetails>)xmltoObj.CreateObject(datafromXML.BasicData, currentFile, false));
                }
                List <CompanyDetails> queryData = new List <CompanyDetails>();
                queryData  = datafromXML.BasicData.OrderBy(x => x.BasicSavedTimeStamp).ToList();
                returnData = CalcFastMoversBasedOnCode(queryData.Where(x => x.TotalVolume != null && x.totalBuyQuantity != "1" && x.totalSellQuantity != "1" && x.Code == companyCode).ToList());
            }

            return(returnData);
        }