UNPKG

shubhadownloader

Version:

There is large amount of information available in market place. The markets are always in sync. In today's world investors find it very difficult to make effective use of information available to them. Shubha Downloader is great tool which resolves this problem and helps investor to increase his productivity and stay focused on decision making. Shubha Downloader enable end user to download market data from available sources and organize it. Shubha Downloader is Open source & FREE utility for end users. Shubha Downloader have main features as follows End of the day market data from web to your favorite charting application . Fundamental market data from web to your favorite charting application. Market reports from web to your favorite charting application.

397 lines (376 loc) 14.7 kB
function callfun(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,m) { try{ var ds,days; Ext.getCmp('pbar3').updateText(''); Ext.getCmp('pbar3').updateProgress(0); outputpath=outputpath.replace(/reports/g,'std_csv'); for (var i=0;i<baseurl.length;i++) { if(baseurl[i].toString().split(',')[0]=='options') ds=baseurl[i].toString().split(',')[1].split('-'); if(baseurl[i].toString().split(',')[0]=='days') days=baseurl[i].toString().split(',')[1]; } //console.log(ds[0]); var ds2=new Array(); for(i=0;i<ds.length-1;i++) { //console.log('data-'+ds[i]); ds2.push(ds[i]); } //console.log('m'+m); //console.log('output-'+outputpath); //console.log('length'+ds2.length); if(m<=ds2.length-1){ for (i =m; i<ds2.length; i++) { //console.log('ds2['+i+']-'+ds2[i]); if(ds2[i]=="Nse_Equity_Options") { Ext.getCmp('pbar3').updateText('Nse Equity Options Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.1); process_nseoption(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if(ds2[i]=="MCX_Index") { Ext.getCmp('pbar3').updateText('MCX Index Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.09); mcx_Future_IndexHistory(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i) break; } if(ds2[i]=="National_Spot_Exchange") { Ext.getCmp('pbar3').updateText('NSX EOD Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.09); process_nsxeod(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if(ds2[i]=="Nse_Equity_Futures") { Ext.getCmp('pbar3').updateText('Nse Equity Futures Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.1); process_nsefuture(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i) break; } if(ds2[i]=="Nse_Forex_Futures") { Ext.getCmp('pbar3').updateText('Nse Forex Futures Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.1); process_nseforexf(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if(ds2[i]=="Nse_Forex_Options") { Ext.getCmp('pbar3').updateText('Nse Forex Options Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.1); process_nseforexo(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if (ds2[i]=="Nse_Sme") { Ext.getCmp('pbar3').updateText('Nse Sme Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.1); process_nsesme(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if (ds2[i]=="Nse_Etf") { Ext.getCmp('pbar3').updateText('Nse Etf Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.1); process_nse_etf(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if (ds2[i]=="Bse_Index") { Ext.getCmp('pbar3').updateText('Bse Index Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.1); process_bse_indexdata(baseurl,downloadpath,unzippath,outputpath,fromd,tod,logpath,count,i) break; } if (ds2[i]=="Bse_Cash_Market") { Ext.getCmp('pbar3').updateText('Bse Cash Market Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.1); download_bseequity(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); //process_bseequity(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i) break; } if(ds2[i]=="Ncdex_Futures") { Ext.getCmp('pbar3').updateText('Ncdex Futures Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.1); process_ncdex(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i) break; } if(ds2[i]=="Yahoo_Fundamental") { Ext.getCmp('pbar3').updateText('Yahoo fundamental Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.1); process_yahoodata(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if(ds2[i]=="MCX_Commodity_Futures") { Ext.getCmp('pbar3').updateText('MCX bhavcopy Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.09); mcx_bhavcopy(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if(ds2[i]=="Nse_reports") { Ext.getCmp('pbar3').updateText('Nse Reports processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.09); download_nsema(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if(ds2[i]=="Nse_Combined_reports") { Ext.getCmp('pbar3').updateText('NSE Combined reports Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.09); download_nse_cmbnd_rpt_zip(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if(ds2[i]=='Nse_Index') { Ext.getCmp('pbar3').updateText('NSE Index Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.09); process_nseindex(count,0,baseurl,downloadpath,unzippath,outputpath,logpath,fromd ,tod,i); break; } if(ds2[i]=='Yahoo_EOD') { Ext.getCmp('pbar3').updateText('Yahoo EOD Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.09); process_yahooeod(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } if(ds2[i]=='Yahoo_IEOD_1min') { Ext.getCmp('pbar3').updateText('Yahoo IEOD 1min Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.09); process_yahooieod(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i,"1"); break; } if(ds2[i]=='Yahoo_IEOD_5min') { Ext.getCmp('pbar3').updateText('Yahoo IEOD 5min Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.09); process_yahooieod(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i,"5"); break; } if(ds2[i]=='Google_5min_IEOD') { Ext.getCmp('pbar3').updateText('Google IEOD 5 Minute processing started'); Ext.getCmp('pbar3').updateProgress(0.09); process_googleieod(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i,'5',days); break; } if(ds2[i]=='Google_1min_IEOD') { Ext.getCmp('pbar3').updateText('Google IEOD 1Minute processing started'); Ext.getCmp('pbar3').updateProgress(0.09); process_googleieod(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i,'1',days); break; } if(ds2[i]=='Google_EOD') { Ext.getCmp('pbar3').updateText('Google IEOD 1Minute processing started'); Ext.getCmp('pbar3').updateProgress(0.09); process_googleeod(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i,'1440',days); break; } if(ds2[i]=='Yahoo_Realtime') { Ext.getCmp('pbar3').updateText('Google IEOD 1Minute processing started'); Ext.getCmp('pbar3').updateProgress(0.09); downloadAndProcessYahooRT(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,i); break; } } } else { //finish(); //console.log("finishing all before amibroker"); //loadprogressbar(); //$("#autoupdate-boxLabelEl").text('Loading.....'); var csv = require('ya-csv'); var reader = csv.createCsvFileReader('settings.csv',{'separator': ','}); reader.addListener('data', function(data) { if(data[0]=='format') { var baseurlFormate = ""; if(data[1] != "" || data[1] != null) baseurlFormate = data[1].toString(); //console.log('\n data[1]'+data[1]); //console.log('\n baseurlFormate'+baseurlFormate); setTimeout(function(){processfun(outputpath,0,baseurlFormate);},5000); } }); } } catch(err) { console.log(err.stack); document.getElementById("om").innerHTML+="<br/><font color=red>Error ocuured durring processing files, Please contact to your Admin</font>"; } } function finish() { //Ext.getCmp('pbar3').updateText('All processing are finshed . . .'); //Ext.getCmp('pbar3').updateProgress(0); Ext.Msg.alert("Message","<font color='green'><b>All processing has been finished successfully.</b></font>", function(err){ if(err)console.log('error-'+err); Ext.getCmp('tabpan').getComponent(1).setDisabled(false); Ext.getCmp('tabpan').getComponent(2).setDisabled(false); Ext.getCmp('tabpan').getComponent(3).setDisabled(false); Ext.getCmp('tabpan').getComponent(4).setDisabled(false); Ext.getCmp('tabpan').getComponent(5).setDisabled(false); Ext.getCmp('tabpan').getComponent(6).setDisabled(false); Ext.getCmp('tabpan').getComponent(7).setDisabled(false); var stop = Ext.getCmp('stop'); stop.disable(); }); document.getElementById("om").innerHTML+="<br/><font color=green>***********************************************************************<br/><b>All processing has been finished.</b><br/>Thank you for using. <hr/>Copyright, &copy2013 by Shubha Downloader.<br/>***********************************************************************</font></b>"; var csv = require('ya-csv'); var fs=require('fs'); var reader; if(fs.existsSync('lastupdate.csv')){ reader = csv.createCsvFileReader('lastupdate.csv',{'separator': ','}); reader.addListener('data', function(data) { if(data[0]=='lastdate') { $("#autoupdate-boxLabelEl").text('Auto Update From '+data[1]); } });} } function processfun(outputpath,m,baseurl) { var ds = new Array(); //console.log('\n >>>>>>> baseurl = '+baseurl); ds = baseurl.split('-'); //console.log(ds[0]); var ds2=new Array(); for(i=0;i<ds.length-1;i++) { //console.log('data-'+ds[i]); ds2.push(ds[i]); } //console.log('m'+m); //console.log('output-'+outputpath); //console.log('length'+ds2.length); if(m<=ds2.length-1) { for (var i =m; i<ds2.length; i++) { //console.log('\n ds2 >> '+ds2[i]); if(ds2[i]=="AmiBroker") { process_amibroker(outputpath,i,baseurl); break; } if(ds2[i]=="FChart") { process_fcharts(outputpath,i,baseurl); break; } if(ds2[i]=="MetaStock") { process_metastock(outputpath,i,baseurl); break; } if(ds2[i]=="Ninja") { process_ninja(outputpath,i,baseurl); break; } if(ds2[i]=="Advanced_Get") { advanceget_eod(outputpath,i,baseurl); break; } } } else { Ext.getCmp('pbar3').updateText('Finishing all processes...'); $("#p3").hide(); $("#autoupdate-boxLabelEl").text('Last Date Updating.....'); setTimeout(finish,2000); } } function loadprogressbar() { var sync =require('async'); sync.series([ function(callback){ setTimeout(function (){ Ext.getCmp('pbar3').updateProgress(0.1); callback(null, 'one'); },10); }, function(callback){ setTimeout(function (){ Ext.getCmp('pbar3').updateProgress(0.2); callback(null, 'one'); },10); }, function(callback){ setTimeout(function (){ Ext.getCmp('pbar3').updateProgress(0.3); callback(null, 'one'); },10); }, function(callback){ setTimeout(function (){ Ext.getCmp('pbar3').updateProgress(0.4); callback(null, 'one'); },10); }, function(callback){ setTimeout(function (){ Ext.getCmp('pbar3').updateProgress(0.5); callback(null, 'one'); },10); }, function(callback){ setTimeout(function (){ Ext.getCmp('pbar3').updateProgress(0.6); callback(null, 'one'); },10); }, function(callback){ setTimeout(function (){ Ext.getCmp('pbar3').updateProgress(0.7); callback(null, 'one'); },10); }, function(callback){ setTimeout(function (){ Ext.getCmp('pbar3').updateProgress(0.8); callback(null, 'one'); },10); }, function(callback){ setTimeout(function (){ Ext.getCmp('pbar3').updateProgress(0.9); callback(null, 'one'); },10); }, function(callback){ setTimeout(function (){ //Ext.getCmp('pbar3').updateText(""); Ext.getCmp('pbar3').updateProgress(1); callback(null, 'one'); },50); }, function(callback){ setTimeout(function (){ Ext.getCmp('pbar3').updateText('Loading Next...'); Ext.getCmp('pbar3').updateProgress(0.005); callback(null, 'one'); },10); } ]);}