Many traders, myself included, incorporate News Analysis and Fundamental Analysis (the analysis of News Events) into their trading strategies. Staying informed about relevant news events is a crucial aspect of making sound decisions. As traders, we recognize the impact that breaking news can have on the markets, shaping trends and influencing currency movements.
When it comes to trading the news, most retail traders rely on sites such as Forex Factory, FXStreet, MQL5, and more to gather economic data.
For MetaTrader 4 developers, accessing economic data typically involves:
- Web scraping Forex Factory's main page
- Web scraping Forex Factory's weekly XML
- Web scraping Forex Factory's weekly JSON
MetaTrader 5 developers, on the other hand, access economic data through:
- Utilizing MQL5's Economic Calendar functions
- Web scraping Forex Factory's main page
- Web scraping Forex Factory's weekly XML
- Web scraping Forex Factory's weekly JSON
While Forex Factory publicly lists its event data, ethical standards are still considered in web scraping. If Forex Factory intended traders to access their information via an API, similar to their weekly JSON and XML data, they would provide it. In contrast, Metaquotes's Economic Calendar can be directly accessed through MQL5's (a coding language for MT5) Economic Calendar functions.
Introducing the News API. This API utilizes Open AI's fine-tuning model, Scikit-Learn (Machine Learning), and MQL5’s Economic Calendar functions to provide News API access to developers across all computer languages, including MQL5, MQL4, and Python. It is completely free to use and can be accessed via GET requests or our News Library for Python and MQL.
The API comprises seven main endpoints:
1. Event List - List of News Events
2. Event Info - Name, ID, Currency, and Category
3. Event History - Name, ID, Currency, Category, and History with the Strength, Quality, Projection, and Outcome of each event and the 1 minute, 30 minute, and 1 hour price action of each event
4. Machine Learning - Name, ID, Currency, Category, and Machine Learning predictions (bullish/bearish) on each of the 13 possible event outcomes
5. Smart Analysis - Name, ID, Currency, Category, and Smart Analysis (bullish/bearish) on each of the 13 possible event outcomes
6. Full Event List - List of News Events with Name, ID, Currency, Category, History, Machine Learning, and Smart Analysis
7. Calendar - List of News Events, in order by time, with Name, ID, Currency, Category, Date, Actual, Forecast, Previous, Outcome, Strength, Quality, and Projection.
8. GPT - Bullish/Bearish sentiment on News Event outcomes, Hawkish/Dovish sentiment on Statements and Speeches, and education on forex and news analysis concepts.
Here are some of the potential use cases and benefits:
- Live trade news events
- Backtest news trading strategies with EAs and Indicators
- Use Machine learning to enhance your news analysis and provide your EA with a "brain"
- Display news event from day to day
For more information and access, refer to the documentation: News API Documentation
Here's how to access it via Python using a GET request:
import requests url = "https://www.jblanked.com/news/api/list/" headers = { "Content-Type": "application/json", "Authorization": "Api-Key YOUR-API-KEY-HERE", } response = requests.get(url, headers=headers) if response.status_code == 200: data = response.json() print(data) else: print(response.status_code)
Here's how to access it via MQL4/MQL5 using a GET request via Wininet.dll:
void GET() { uchar buffer[1024]; // Adjust the buffer size as needed int bytesRead = 0; string result = ""; CJAVal json_object; // saved variable as JSON object using jason_with_search.mqh string url = "https://www.jblanked.com/news/api/list/"; string key = "your-api-key"; // Specify the headers string headers = "Content-Type: application/json" + "\r\n" + "Authorization: Api-Key " + key; // Initialize WinHTTP int hInternet = InternetOpenW("MyApp", 1, NULL, NULL, 0); if (hInternet) { // Open a URL int hUrl = InternetOpenUrlW(hInternet, url, NULL, 0, 0, 0); if (hUrl) { // Send the request headers if (HttpSendRequestW(hUrl, headers, StringLen(headers), buffer, 0)) { // Read the response while (InternetReadFile(hUrl, buffer, ArraySize(buffer) - 1, bytesRead) && bytesRead > 0) { buffer[bytesRead] = 0; // Null-terminate the buffer result += CharArrayToString(buffer, 0, bytesRead, CP_UTF8); // Append the data to the result string } } InternetCloseHandle(hUrl); // Close the request handle InternetCloseHandle(hUrl); // Close the URL handle } InternetCloseHandle(hInternet); // Close the WinHTTP handle } if (result != "") { Print(result); // print result json_object.Deserialize(result, CP_UTF8); // deserialize into JSON format } }
Both the Python Library and MQL Library simplify this process by parsing the information and then organizing it into class variables. Checkout the full documentation here.