Retrieving and Using Data from a Website

Posted By: boatman

Retrieving and Using Data from a Website - 01/22/15 01:51

I've got a short-term strategy that performs well in general, but not so well around the release of major economic news. I would therefore like to test the impacts of not trading around news releases.

This leads me to the idea of pulling an economic calendar from the web, reading the data into a file, and then using that data to control my strategy. I'm still very much a beginner with this stuff, and I was hoping to get some feedback on whether my method would work, and if there are more efficient approaches.

This is how I am thinking of approaching this:

1. Use Zorro's exec function to open the website containing the data and download it to a CSV file. Using the address http://www.dailyfx.com/files/Calendar-MM-DD-YYYY.csv (where MM-DD-YYYY is the date of the Sunday of the current week) results in a download of the week's economic calendar in CSV format.
2. Use Zorro's file_read function to read the CSV file into an array.
3. Use the data from the array to modify the behavior of the script. For example, if a NFP release is detected, cease trading one hour before the release time.

I've been reading online about using APIs to access data from other sources, such as this one: https://www.quandl.com/
I'm not sure if this would be a better approach, or if using it is even feasible??

Can anyone out there comment on my approach above? Would I be better off directing my efforts towards a different approach, or is this one appropriate? Any comments or recommendations most appreciated!
Posted By: jcl

Re: Retrieving and Using Data from a Website - 01/26/15 17:51

I would not use the exec function to open the website in a browser. Better use the HTML functions for reading the website directly.
Posted By: boatman

Re: Retrieving and Using Data from a Website - 01/27/15 11:35

OK, thanks for the tip!
Posted By: yosoytrader

Re: Retrieving and Using Data from a Website - 02/06/15 13:00

- code an external program/script that automatically runs on Sundays, and downloads with Wget the HTML, extracts the news data and saves it to a .csv

- let Zorro read the .csv
© 2024 lite-C Forums