public void BNNextIndex() { string _pathOptionsData = ConfigurationManager.AppSettings["BNNextOptions"]; string _masterDatapathBasic = ConfigurationManager.AppSettings["bnUrl"]; string _bnCurrentExpiryDate = ConfigurationManager.AppSettings["BnNextExpiryDate"]; string _bnBNSeriousValue = ConfigurationManager.AppSettings["BNSeriousValue"]; string _bnCurrentUrlValue = ConfigurationManager.AppSettings["bnUrl"]; int _count = Convert.ToInt32(ConfigurationManager.AppSettings["IndexNumbers"]); string _url = _bnCurrentUrlValue.Replace("EXPIRYCODE", _bnCurrentExpiryDate).Replace("TYPECEPE", "CE").Replace("INDEXVALUE", _bnBNSeriousValue); QueryBinder dataList = new QueryBinder(); OptionsIO obj = new OptionsIO(); List <OIOData.OIDetails> optionsData = obj.LoadOptionsData(_masterDatapathBasic, _bnCurrentExpiryDate, _url, 100F, _count); OBJtoXML xmltoObj = new OBJtoXML(); xmltoObj.CreateOptionsXML(optionsData, _pathOptionsData, "BNNextIndex"); }
public void LoadFullOptionChainData(string filepathtoSave, string[] dates, bool isLoadAll) { List <OptionChain> chainData = new List <OptionChain>(); string _masterDataStaticBankNifty = ConfigurationManager.AppSettings["MasterDataStaticBankNifty"]; string _masterDataStaticNifty = ConfigurationManager.AppSettings["MasterDataStaticNifty"]; // List<SourceList> listofSources = StrikeSource.Sources(_masterDataStaticBankNifty, _masterDataStaticNifty, "25OCT2018", "11OCT2018"); List <SourceList> listofSources = StrikeSource.Sources(_masterDataStaticBankNifty, _masterDataStaticNifty, dates[0], dates[1], isLoadAll); foreach (var item in listofSources) { string url = "https://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?segmentLink=17&instrument=OPTIDX&symbol=BANKNIFTY&date=XXXDATE"; url = url.Replace("OPTIDX", item.instrument).Replace("BANKNIFTY", item.symbol).Replace("XXXDATE", item.date); chainData.Add(GenerateOptionChain(url, item.SourceName, item.date, item.instrument)); } OBJtoXML xmltoObj = new OBJtoXML(); xmltoObj.CreateOptionsXML(chainData, filepathtoSave, "LoadFullOptionChainData"); }
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"); } }
public void Stk() { string _masterDatapathBasic = ConfigurationManager.AppSettings["bnUrl"]; string _pathOptionsData = ConfigurationManager.AppSettings["StkOptions"]; string _expiryDate = ConfigurationManager.AppSettings["ExpiryDate"]; string _nSeriousValue = ConfigurationManager.AppSettings["NSeriousValue"]; string _nCurrentUrlValue = ConfigurationManager.AppSettings["StkUrlBasic"]; int _count = Convert.ToInt32(ConfigurationManager.AppSettings["StkNumbers"]); List <string> objStkList = IOData.StPrice.StkPrices(); List <OIOData.OIDetails> optionsData = new List <OIDetails>(); foreach (var item in objStkList) { string _url = _nCurrentUrlValue.Replace("EXPIRYCODE", _expiryDate).Replace("COMPANYNAME", item.Split('#')[0].Trim()); QueryBinder dataList = new QueryBinder(); OptionsIO obj = new OptionsIO(); optionsData.AddRange(obj.LoadOptionsData(_masterDatapathBasic.Replace("BANKNIFTY", item.Split('#')[0].Trim()).Replace("OPTIDX", "OPTSTK"), _expiryDate, _url, Convert.ToSingle(item.Split('#')[1].Trim()), _count)); } OBJtoXML xmltoObj = new OBJtoXML(); xmltoObj.CreateOptionsXML(optionsData, _pathOptionsData, "StkOptions"); }