Script News Download

Avatar
  • updated

Hello Community,

I have created this Python script that downloads the news from the site www.forexfactory.com and saves it in the directory (C:\Users\your_name\AppData\Roaming\MetaQuotes\Terminal\Common\Files\News\FF\*. csv) that uses CP.

It does not insert the values of "revised" and "revised_time.", the rest of the values are the same as Andrey has in Google Drive.

You can read more about the News Filter

The news are downloaded from:

Image 3258

You need to download Python 3.x and install the plugins run "pip3 install beautifulsoup4" and all others that you do not have installed

Image 3260


CommunityPowerEA_News_Download.py

Avatar
th0mas51

Hey guys !

Thanks for this great script.

It looks like there's a new time format that is being used on FF, that is not correctly supported by the script, and throws an error.

This is the error:

Image 5606



And this is the problematic time format, from FF website:

Image 5605


I guess this time format means that the news will be released between 10:00 an 15:00.

I'm working on updating the function "time_2_digits" to be able to deal with this new time format without crashing.

In the case of the value 10th-15th, I'm going to set the time to "10:00", unless you guys suggest we set it to "All day" ?

I'll upload my updated version of the Python script here, in case other people are interested by that fix.

Also, I'm a bit confused with the decision to tag the "All day events" as 00:00, as I'm assuming there could be some news that are announced at 00:00.

What do you guys think ?

Avatar
Ulises Cune

With Andrey's permission, this would be the official script to download ForexFactory news and then use it in backtesting. Bug reports are welcome.

HistoryLoad_v2_run.bat
HistoryLoad_v2.py

Avatar
Ulises Cune

Talking to Andrey, the timezone CP uses is "America/New_York". I adjusted that

CommunityPowerEA_News_Download.py

CommunityPowerEA_News_Download_run.bat

Avatar
Ulises Cune
Quote from Andrey Khatimlianskyi

Ulises, great job!

I also switched to Python to make a history-download script, and it is almost ready.

We don't need to adjust news to the local timezone, archive should be the same for all users and should be converted to the broker's timezone on the fly.

Hello Andrey,

The timezone is now set to UTC, since forexfactory AUTOMATICALLY sets it and changes it. That's why I put these lines of code so that it is downloaded in UTC.

Image 5475

User Guide | Forex Factory

Default Time
Forex Factory automatically defaults to the time zone used in your country.

Avatar
Andrey Khatimlianskyi

Ulises, great job!

I also switched to Python to make a history-download script, and it is almost ready.

We don't need to adjust news to the local timezone, archive should be the same for all users and should be converted to the broker's timezone on the fly.

Avatar
Ulises Cune

When visiting the site www.forexfactory.com the timezone is adjusted according to the IP according to the country from which it is visited. There is a way to adjust the timezone without logging in. I am working on it.

Avatar
Ulises Cune

Hello, www.forexfactory.com has changed the code so it was not working. Here is the new version.

CommunityPowerEA_News_Download.py
CommunityPowerEA_News_Download_run.bat

Avatar

i am using windscrib app

can download past. But today cannot i dont know