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.

340 lines (291 loc) 10.3 kB
/***************** Company Name:XNet Inc. Last Modified Date:31-Dec-2012 Author: Prashant Shilimkar Description :This page will render UI for all tabs. ******************/ /******************************** <Shubha Downloader, It downloads end of day pricing data from publicly available sites and converts it different formats....> Copyright (C) 2013 Shubhalabha.in This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/> ***********************************/ Ext.require([ 'Ext.form.*', 'Ext.data.*', 'Ext.window.MessageBox' ]); Ext.onReady(function() { var check=false; Ext.apply(Ext.form.field.VTypes, { daterange: function(val, field) { var date = field.parseDate(val); if (!date) { return false; } if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) { var start = field.up('form').down('#' + field.startDateField); start.setMaxValue(date); start.validate(); this.dateRangeMax = date; } else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) { var end = field.up('form').down('#' + field.endDateField); end.setMinValue(date); end.validate(); this.dateRangeMin = date; } /* * Always return true since we're only using this vtype to set the * min/max allowed values (these are tested for after the vtype test) */ return true; }, daterangeText: 'Start date must be less than end date' }); var formPanel, // The data store for the State comboboxes statesStore = Ext.create('Ext.data.ArrayStore', { fields: ['abbr'], data : Ext.example.states // from states.js }), // The data store for the Month combobox monthsStore = Ext.create('Ext.data.Store', { fields: ['name', 'num'], data: (function() { var data = []; Ext.Array.forEach(Ext.Date.monthNames, function(name, i) { data[i] = {name: name, num: i + 1}; }); return data; })() }); /** * Common change listener for the Mailing Address fields - if the checkbox to use the same * values for Billing Address is checked, this copies the values over as they change. */ formPanel = Ext.widget('form', { renderTo: 'home', title: 'Shubha Downloader', frame: true, width: 697, height: 111, bodyPadding: 5, fieldDefaults: { labelAlign: 'right', labelWidth: 90, msgTarget: 'qtip' }, items: [ // Mailing Address { xtype: 'fieldset', title: '', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [ { xtype: 'container', layout: 'hbox', items: [ { xtype: 'fieldcontainer', fieldLabel: ' Date From', combineErrors: true, msgTarget : 'side', layout: 'hbox', defaults: { flex: 1, hideLabel: true }, items: [ { xtype : 'datefield', name : 'startDate', id: 'startDate', // value: new Date(), fieldLabel: 'Start', margin: '0 0 0 0', width: 100, itemId: 'startdt', vtype: 'daterange', endDateField: 'enddt' } ] }, { xtype: 'fieldcontainer', fieldLabel: 'Date To', combineErrors: true, msgTarget : 'side', layout: 'hbox', defaults: { flex: 1, hideLabel: true }, items: [ { xtype : 'datefield', name : 'startDate', id : 'endDate', //value: new Date(), fieldLabel: 'Start', margin: '0 0 0 0', width: 100, itemId: 'enddt', vtype: 'daterange', startDateField: 'startdt' } ] }, { xtype: 'checkboxgroup', fieldLabel: '', cls: 'x-check-group-alt', // Distribute controls across 3 even columns, filling each row // from left to right before starting the next row columns: 1, items: [ {boxLabel: 'Auto Update From ',id:'autoupdate', name: 'cb-horiz-4',listeners: {change: onMailingAddrFieldChange}} ] } ] } ] } ], buttons: [{ text: 'Stop', id:'stop', handler: function() { Ext.Msg.confirm('Message', 'Do you want to stop?<br /><br /><small><b>Note:-</b>it will reload application.</small>', function(btn, text){ if (btn == 'yes'){ window.location.reload(); } }); } },{ text: 'Reset', handler: function() { this.up('form').getForm().reset(); Ext.getCmp('startDate').setValue(new Date()); Ext.getCmp('endDate').setValue(new Date()); } }, { text: 'Download', width: 150, id: 'download', handler: function() { Ext.getCmp('tabpan').getComponent(1).setDisabled(true); Ext.getCmp('tabpan').getComponent(2).setDisabled(true); Ext.getCmp('tabpan').getComponent(3).setDisabled(true); Ext.getCmp('tabpan').getComponent(4).setDisabled(true); Ext.getCmp('tabpan').getComponent(5).setDisabled(true); Ext.getCmp('tabpan').getComponent(6).setDisabled(true); Ext.getCmp('tabpan').getComponent(7).setDisabled(true); var stop = Ext.getCmp('stop'); stop.enable(); if(check) { //Ext.Msg.alert('Message',check); autoload(); } else { loadevent1(); } } }] }); var stop = Ext.getCmp('stop'); stop.disable(); $("#autoupdate-inputEl").css("margin-left","13px"); $("#checkboxgroup-1034").css("margin-left","40px"); $("#toolbar-1035").css("top","78px"); //$("#form-1031").css("height","109px"); $("#form-1029-body").css("height","50px"); Ext.getCmp('startDate').setValue(new Date()); Ext.getCmp('endDate').setValue(new Date()); var fs=require('fs'); if(fs.existsSync('lastupdate.csv')) { var chk = Ext.getCmp('autoupdate'); chk.enable(); } else { var chk = Ext.getCmp('autoupdate'); chk.disable(); } function onMailingAddrFieldChange(field) { check=field.getValue(); if(check) { var stDate = Ext.getCmp('startDate'); stDate.disable(); var stDate = Ext.getCmp('endDate'); stDate.disable(); } else { var stDate = Ext.getCmp('startDate'); stDate.enable(); var eDate = Ext.getCmp('endDate'); eDate.enable(); } } var csv = require('ya-csv'); 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]); } });} if(fs.existsSync('settings.csv')){ reader = csv.createCsvFileReader('settings.csv',{'separator': ','}); reader.addListener('data', function(data) { if(data[0]=='datafolder') { mkdir(data[1]); } });} if(fs.existsSync('outputformat.csv')){ reader = csv.createCsvFileReader('outputformat.csv',{'separator': ','}); reader.addListener('data', function(data) { if(data[0]=='output') { $("#output_formate-inputEl").val(data[1].split('-')); } });} /* var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! var yyyy = today.getFullYear(); if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm} var today = mm+'/'+dd+'/'+yyyy; //document.getElementById("DATE").value = today; $("#startDate-inputEl").val(today) $("#endDate-inputEl").val(today);*/ Ext.create('Ext.Button', { text: 'Show Logs', id:'logsbutton', width:70, renderTo: "logbutton", handler: function() { logtoggle(); } }); });