indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > Matlab

DPonline
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 28-04-2015, 05:06 AM
Oxymoron's Avatar
Oxymoron Oxymoron is offline
Super Moderator
 
Join Date: Mar 2009
Location: Chennai
Posts: 1,275
Thanks: 4,471
Thanked 4,829 Times in 1,156 Posts
Oxymoron has a reputation beyond repute
Oxymoron has a reputation beyond reputeOxymoron has a reputation beyond reputeOxymoron has a reputation beyond reputeOxymoron has a reputation beyond reputeOxymoron has a reputation beyond reputeOxymoron has a reputation beyond reputeOxymoron has a reputation beyond reputeOxymoron has a reputation beyond reputeOxymoron has a reputation beyond reputeOxymoron has a reputation beyond reputeOxymoron has a reputation beyond reputeOxymoron has a reputation beyond repute
Default Moneycontrol Results Calendar - Automatic Download

Objective:
To auto extract several years of results calendar data from Moneycontrol.com which publishes in the following link (different days are reflected in the web link):
http://www.moneycontrol.com/earnings...015-02-03.html


Requirements:
1) MATLAB 2014b+ (May not work in 2014a or below - untested)
2) Access to Internet (duh)
3) getTableFromWeb_mod.m file

Procedure:
1) Create a new directory. Place the downloaded program in that path.
2) Enter this code in the MATLAB Editor and run (modify the path and start date)
Code:
% Inputs
Start_Date = '01-01-2012';
End_Date = '04-28-2012';
Path = 'C:\Users\Admin\Documents\MATLAB\2015_04_27_Faith_Moneycontrol_Request\';

% Add Path to Library
addpath(Path);

% Loop Through The Link
Start_Date = datenum(Start_Date);
Total = {}; % Preallocating Cell Array;
i = 0;

for i = Start_Date:datenum(End_Date)
    DateStr = datestr(i,'yyyy-mm-dd');
    Link = strcat('http://www.moneycontrol.com/earnings/results-calender_',DateStr,'.html');
    
    Curr = getTableFromWeb_mod(Link,3);
    
    if cellfun(@isempty,Curr(2,2)) == 0
        Total = [Total; Curr(2:end,:)];
    end
end

% Append Header;
Total = [Curr(1,:) ; Total];

xlswrite(strcat(Path,'Output.xlsx'),Total)
It will output an excel file in the path location

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 7 Users Say Thank You to Oxymoron For This Useful Post:
Reply

indiTraders - Forum for the Active Indian Trader > Tools > Software > Matlab


Tags
data extraction, html, matlab, moneycontrol, results calendar

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


DPonline

All times are GMT +5.5. The time now is 02:12 AM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2