The Calendar API offers fast and free access to the latest Forex news events from a variety of sources, including MQL5 and Forex Factory. Users can retrieve data through GET requests or by utilizing our libraries. We have a rate limit of one request per second to ensure service stability and fair usage.
To authenticate your GET requests, you must include your API key in the request header. You can generate and manage your API key via your profile. Additionally, you can monitor your API usage here.
Example Header:
{
"Content-Type": "application/json",
"Authorization": "Api-Key YOUR_API_KEY"
}
var request = URLRequest(url: URL(string: "https://www.jblanked.com/news/api/YOUR-END-POINT"))
request.addValue("Api-Key YOUR_API_KEY", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
string headers = "Content-Type: application/json" + "\r\n" + "Authorization: Api-Key YOUR_API_KEY";
Full Library Access
Platform | Link |
---|---|
GitHub | https://github.com/jblanked/JB-News |
Python | https://pypi.org/project/jb-news/ |
MQL | Github |
Swift | Github |
Endpoints
Endpoint: https://www.jblanked.com/news/api/mql5/calendar/today/
List of today's events ordered by time from MQL5 source.
List of today's events ordered by time from MQL5 source.
Endpoint: https://www.jblanked.com/news/api/forex-factory/calendar/today/
List of today's events ordered by time from Forex Factory source.
List of today's events ordered by time from Forex Factory source.
Endpoint: https://www.jblanked.com/news/api/mql5/calendar/week/
List of this week's events ordered by time from MQL5 source.
List of this week's events ordered by time from MQL5 source.
Endpoint: https://www.jblanked.com/news/api/forex-factory/calendar/week/
List of this week's events ordered by time from Forex Factory source.
List of this week's events ordered by time from Forex Factory source.
Example JSON Response:
{
"Name": "Core CPI m/m",
"Currency": "USD",
"Category": "Consumer Inflation Report",
"Date": "2024.02.08 15:30:00",
"Actual": 0.4,
"Forecast": 0.4,
"Previous": 0.2,
"Outcome": "Actual = Forecast > Previous",
"Projection": 0.5,
"Strength": "Strong Data",
"Quality": "Bad Data"
}
{
"Name": "Core CPI m/m",
"Currency": "USD",
"Category": "Consumer Inflation Report",
"Date": "2024.02.08 15:30:00",
"Actual": 0.4,
"Forecast": 0.4,
"Previous": 0.2,
"Outcome": "Actual = Forecast > Previous",
"Strength": "Strong Data",
"Quality": "Bad Data"
}
Usage: GET Requests
import Dispatch
import Foundation
if let url = URL(string: "https://www.jblanked.com/news/api/mql5/calendar/today/") {
let apiKey = "YOUR_API_KEY"
var request = URLRequest(url: url)
request.addValue("Api-Key \(apiKey)", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
do {
let (dataReturned, _) = try await URLSession.shared.data(for: request)
let decoder = JSONDecoder()
let newsList = try decoder.decode([HistoryData].self, from: dataReturned)
print(newsList)
} catch {
print("Error has occurred: \(error)")
}
}
struct HistoryData: Decodable, Hashable {
var Date: String
var Actual: Double
var Forecast: Double
var Previous: Double
var Outcome: String
private enum CodingKeys: String, CodingKey {
case Date
case Actual
case Forecast
case Previous
case Outcome
}
init() {
self.Date = ""
self.Actual = 0.0
self.Forecast = 0.0
self.Previous = 0.0
self.Outcome = ""
}
}
#include <jb-news\\news.mqh> // get from https://github.com/jblanked/MQL-Library
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
CRequests request;
request.url = "https://www.jblanked.com/news/api/mql5/calendar/today/";
request.key = "YOUR_API_KEY";
if(!request.GET())
{
Print("Failed to get data from the today endpoint");
return INIT_FAILED;
}
// print result
Print(request.result);
// or do something with the json data
string firstEventName = request.loader[0]["Name"].ToStr();
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
import requests
url: str = "https://www.jblanked.com/news/api/mql5/calendar/today/"
headers = {
"Content-Type": "application/json",
"Authorization": f"Api-Key YOUR_API_KEY",
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
print(data)
print(data[0]["Name"])
else:
print(f"Error: {response.status_code}")
print(response.json())
Usage: Library
import Dipsatch
import Foundation
import JBNews
let yourAPIKey: String = "YOUR-API-KEY"
let newsModel: JBNews = JBNews(yourAPIKey)
Task {
let calendar: [HistoryData] = await newsModel.calendar()
print(calendar)
}
#include <jb-news\\news.mqh>
CJBNews jb;
int OnInit(){
jb.api_key = "API_KEY";
jb.offset = 0; // GMT-3 = 0, GMT = 3, EST = 7, PST = 10
jb.chart(clrAliceBlue,clrWhite);
return INIT_SUCCEEDED;
}
from jb_news.news import CJBNews
jb = CJBNews()
api_key = "YOUR_API_KEY_HERE"
jb.offset = 7 # GMT-3 = 0, GMT = 3, EST = 7, PST = 10
if jb.calendar(api_key,today=True):
for event in jb.calendar_info:
name = event.name
currency = event.currency
event_id = event.eventID
category = event.category
date = event.date
actual = event.actual
forecast = event.forecast
previous = event.previous
outcome = event.outcome
strength = event.strength
quality = event.quality
# print the calendar info
print(f"Event Name: {name}\nEvent ID: {event_id}\nCurrency: {currency}\nDate: {date}\nActual: {actual}\nForecast: {forecast}\nPrevious: {previous}")