### Swift Code Example Source: https://www.jblanked.com/news/api/docs/gpt Example of how to use the GPT API with Swift for mobile applications. ```Swift import Foundation let baseURL = "https://www.jblanked.com/news/api/gpt/mobile/" var components = URLComponents(string: baseURL)! components.queryItems = [ URLQueryItem(name: "message", value: "What does bullish mean?") ] var request = URLRequest(url: components.url!) request.addValue("Api-Key YOUR_API_KEY", forHTTPHeaderField: "Authorization") request.addValue("application/json", forHTTPHeaderField: "Content-Type") // Note: This example assumes you have a way to handle async operations and JSON decoding. // The actual implementation might involve URLSession.shared.data(for: request) and try/catch blocks. // The provided code snippet in the source is incomplete for a full runnable example. // For demonstration, let's assume a simplified structure: struct GPTResponse: Decodable { var task_id: String var message: String } // Example of how you might call it (requires async context): /* Task { do { let (data, _) = try await URLSession.shared.data(for: request) let response = try JSONDecoder().decode(GPTResponse.self, from: data) print("Task ID: \(response.task_id)") // You would then poll the status URL using response.task_id } catch { print("Error: \(error)") } } */ // The provided MQL code snippet is a direct translation of the request logic. // For a complete Swift example, you would need to implement the polling mechanism. print("Swift example requires async context and error handling.") ``` -------------------------------- ### Install Python Library Source: https://www.jblanked.com/news/api/docs Use pip to install the jb-news Python package for easy integration with the API. ```bash pip install jb-news ``` -------------------------------- ### MQL Code Example Source: https://www.jblanked.com/news/api/docs/gpt Example of how to use the GPT API with MQL for MetaTrader platforms. ```MQL #include int OnInit() { CRequests request; request.url = "https://www.jblanked.com/news/gpt/"; request.key = "YOUR_API_KEY"; request.loader["content"] = "What does bullish mean?"; if(!request.POST()) { Print("Failed to send GPT request"); return INIT_FAILED; } Print(request.result); string taskID = request.loader["task_id"].ToStr(); // You would then use taskID to poll the status endpoint. Print("Task ID: ", taskID); return(INIT_SUCCEEDED); } // Note: The provided MQL code snippet focuses on sending the initial POST request. // To retrieve results, you would need to implement a separate GET request to the status endpoint using the obtained taskID. ``` -------------------------------- ### Python Code Example Source: https://www.jblanked.com/news/api/docs/gpt Example of how to use the GPT API with Python, including sending a POST request and polling for results. ```Python import requests url = "https://www.jblanked.com/news/api/gpt/" headers = { "Content-Type": "application/json", "Authorization": "Api-Key YOUR_API_KEY" } data = {"content": "In less than 8 words, what does bullish mean?"} response = requests.post(url, headers=headers, json=data) if response.status_code == 200: task_id = response.json()["task_id"] print(f"Task ID: {task_id}") # Poll for the result status_url = f"https://www.jblanked.com/news/api/gpt/status/{task_id}" result = requests.get(status_url, headers=headers) print(result.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Install PyCalendar Dependencies Source: https://www.jblanked.com/news/api/docs/projects Use this command to set up a virtual environment and install the necessary Python packages for the PyCalendar application. Ensure you activate the environment before running the application. ```bash python -m venv venv pip install -r requirements.txt source venv/bin/activate python main.py ``` -------------------------------- ### Example JSON Request Body Source: https://www.jblanked.com/news/api/docs/gpt This is an example of the JSON request body to be sent to the GPT API. ```json { "content": "In less than 8 words, what does bullish mean?" } ``` -------------------------------- ### Example JSON Response Body Source: https://www.jblanked.com/news/api/docs/gpt This is an example of the JSON response received from the GPT API after a task is completed. ```json { "status": "complete", "message": "Expecting rising prices or market growth." } ``` -------------------------------- ### Example Response for News Events List Source: https://www.jblanked.com/news/api/docs/backtesting This is an example JSON response for the list of available News Events. It shows the structure of a single event object. ```json [ { "Name": "Adjusted Current Account", "Currency": "JPY", "Event_ID": 39207008, "Category": "Currency Report", "Impact": "Low" } ] ``` -------------------------------- ### Initialize and Chart Calendar in MQL Source: https://www.jblanked.com/news/api/docs/calendar This MQL code initializes the CJBNews library, sets the API key and time offset, and prepares for charting calendar events. The `OnInit` function is crucial for setup. ```mql #include CJBNews jb; int OnInit(){ jb.api_key = "API_KEY"; jb.offset = 0; // GMT-3 = 0, GMT = 3, EST = 7, PST = 10 jb.chart(); return INIT_SUCCEEDED; } ``` -------------------------------- ### Date Range Filter Example (FxStreet) Source: https://www.jblanked.com/news/api/docs/calendar Get news events for a given date range from FxStreet. Use YYYY-MM-DD format for 'from' and 'to' parameters. ```url GET /news/api/fxstreet/calendar/range/?from=2025-09-17&to=2025-09-24 ``` -------------------------------- ### Example Response for Event History (Forex Factory) Source: https://www.jblanked.com/news/api/docs/backtesting This is an example JSON response for the history of a specific news event from Forex Factory. It includes event details and a 'History' array with historical data points. ```json { "Name": "Average Hourly Earnings m/m", "Currency": "USD", "Event_ID": 840030018, "Category": "Job Inflation Report", "Impact": "High", "History": [ { "Date": "2023.12.08 15:30:00", "Actual": 0.4, "Forecast": 0.4, "Previous": 0.2, "Outcome": "Actual = Forecast > Previous", "Strength": "Strong Data", "Quality": "Bad Data" } ] } ``` -------------------------------- ### Date Range Filter Example (MQL5) Source: https://www.jblanked.com/news/api/docs/calendar Retrieve news events for a specific date range from MQL5. Filter by currency and impact. Dates must be in YYYY-MM-DD format. ```url GET /news/api/mql5/calendar/range/?from=2025-09-17&to=2025-09-24¤cy=USD&impact=High ``` -------------------------------- ### Example Response for Event History Source: https://www.jblanked.com/news/api/docs/backtesting This is an example JSON response for the history of a specific news event. It includes event details and a 'History' array with historical data points. ```json { "Name": "Average Hourly Earnings m/m", "Currency": "USD", "Event_ID": 840030018, "Category": "Job Inflation Report", "Impact": "High", "History": [ { "Date": "2023.12.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" } ] } ``` -------------------------------- ### Install PyCalendar-MT5 Dependencies Source: https://www.jblanked.com/news/api/docs/projects Install the required Python package for the PyCalendar-MT5 application. This application integrates directly with MetaTrader 5. ```bash pip install metatrader5 ``` -------------------------------- ### Date Range Filter Example (Forex Factory) Source: https://www.jblanked.com/news/api/docs/calendar Fetch news events within a specified date range from Forex Factory. Dates should be in YYYY-MM-DD format. ```url GET /news/api/forex-factory/calendar/range/?from=2025-09-17&to=2025-09-24 ``` -------------------------------- ### MQL GET Request for Calendar Data Source: https://www.jblanked.com/news/api/docs/calendar This MQL code snippet utilizes the `CRequests` class from the Jblanked MQL Library to make a GET request to the calendar API. It requires the `news.mqh` header file and your API key. The example shows how to print the raw result or access specific JSON fields. ```mql #include // 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); } //+------------------------------------------------------------------+ ``` -------------------------------- ### JSON Authentication Headers Source: https://www.jblanked.com/news/api/docs/calendar Include these headers in your GET requests for authentication. Replace 'YOUR_API_KEY' with your actual API key. ```json { "Content-Type": "application/json", "Authorization": "Api-Key YOUR_API_KEY" } ``` -------------------------------- ### Example JSON Response for Calendar Data Source: https://www.jblanked.com/news/api/docs/calendar This is an example of the JSON structure returned by the calendar API endpoints. It includes details about economic events such as name, currency, impact, date, and actual, forecast, and previous values. ```json { "Name": "Core CPI m/m", "Currency": "USD", "Category": "Consumer Inflation Report", "Impact": "High", "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" } ``` ```json { "Name": "Core CPI m/m", "Currency": "USD", "Category": "Consumer Inflation Report", "Impact": "High", "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" } ``` ```json { "Name": "Core CPI m/m", "Currency": "USD", "Category": "Consumer Inflation Report", "Impact": "High", "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" } ``` -------------------------------- ### Fetch Today's News Calendar (MQL4/MQL5) Source: https://www.jblanked.com/news/api/docs This MQL snippet demonstrates how to fetch today's news calendar using a custom requests class. Set the URL and API key, then execute a GET request. ```mql #include CRequests request; request.url = "https://www.jblanked.com/news/api/mql5/calendar/today/"; request.key = "YOUR_API_KEY"; if(request.GET()) { Print(request.result); } ``` -------------------------------- ### Fetch Today's News Calendar (Python) Source: https://www.jblanked.com/news/api/docs Use the requests library to make a GET request to the today's news calendar endpoint. Ensure your API key is correctly formatted in the Authorization header. ```python import requests url = "https://www.jblanked.com/news/api/mql5/calendar/today/" headers = { "Content-Type": "application/json", "Authorization": "Api-Key YOUR_API_KEY" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Python GET Request for Calendar Data Source: https://www.jblanked.com/news/api/docs/calendar This Python snippet demonstrates how to make a GET request to the calendar API. Ensure you replace 'YOUR_API_KEY' with your actual API key. The code handles successful responses by printing the JSON data and the 'Name' of the first event, and prints error information for unsuccessful requests. ```python import requests url = "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()) ``` -------------------------------- ### Add Offset Parameter to Calendar Endpoints Source: https://www.jblanked.com/news/api/docs/changelog Use the `offset` URL parameter to specify a starting point for calendar data retrieval. ```url /news/api/mql5/calendar/week/?offset=3 ``` -------------------------------- ### Fetch Today's News Calendar (Swift) Source: https://www.jblanked.com/news/api/docs Utilize URLSession to perform a GET request for the news calendar data. The API key must be included in the Authorization header and Content-Type set to application/json. ```swift import Foundation let url = URL(string: "https://www.jblanked.com/news/api/mql5/calendar/today/")! var request = URLRequest(url: url) request.addValue("Api-Key YOUR_API_KEY", forHTTPHeaderField: "Authorization") request.addValue("application/json", forHTTPHeaderField: "Content-Type") let (data, _) = try await URLSession.shared.data(for: request) print(String(data: data, encoding: .utf8)!) ``` -------------------------------- ### Swift GET Request for Calendar Data Source: https://www.jblanked.com/news/api/docs/calendar This Swift code shows how to fetch calendar data using URLSession. It requires a valid API key and handles JSON decoding into a custom `HistoryData` struct. Error handling is included for network or decoding issues. ```swift 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 = "" } } ``` -------------------------------- ### Retrieve GPT Analysis Status and Result Source: https://www.jblanked.com/news/api/docs/gpt Retrieve the sentiment analysis results by sending a GET request to the status endpoint using the task ID obtained from the initial POST request. ```APIDOC ## GET /news/api/gpt/status/{task_id} ### Description Retrieves the status and result of a previously submitted GPT sentiment analysis task. ### Method GET ### Endpoint https://www.jblanked.com/news/api/gpt/status/YOUR-TASK-ID ### Parameters #### Path Parameters - **YOUR-TASK-ID** (string) - Required - The unique identifier of the task to retrieve. ### Response #### Success Response (200) - **status** (string) - The current status of the task (e.g., "complete"). - **message** (string) - The result of the sentiment analysis. #### Response Example ```json { "status": "complete", "message": "Expecting rising prices or market growth." } ``` ``` -------------------------------- ### Swift Authentication Headers Source: https://www.jblanked.com/news/api/docs Set up authentication headers for your Swift requests. Ensure 'YOUR_API_KEY' is replaced with your valid API key. ```swift var request = URLRequest(url: URL(string: "https://www.jblanked.com/news/api/YOUR-ENDPOINT")!) request.addValue("Api-Key YOUR_API_KEY", forHTTPHeaderField: "Authorization") request.addValue("application/json", forHTTPHeaderField: "Content-Type") ``` -------------------------------- ### Fetch Calendar Data in Swift Source: https://www.jblanked.com/news/api/docs/calendar Use this Swift snippet to initialize the JBNews library and fetch calendar events. Ensure you replace 'YOUR-API-KEY' with your actual API key. ```swift import Dispatch import Foundation import JBNews let yourAPIKey: String = "YOUR-API-KEY" let newsModel: JBNews = JBNews(yourAPIKey) Task { let calendar: [HistoryData] = await newsModel.calendar() print(calendar) } ``` -------------------------------- ### MQL Authentication Headers Source: https://www.jblanked.com/news/api/docs Configure authentication headers for MQL requests. Remember to substitute 'YOUR_API_KEY' with your unique API key. ```mql string headers = "Content-Type: application/json\r\n" + "Authorization: Api-Key YOUR_API_KEY"; ``` -------------------------------- ### Swift Integration for News API Source: https://www.jblanked.com/news/api/docs/changelog Initialize the JBNews client with your API key and use the `gpt` method for inquiries. Ensure you are using Swift 5.10 or later. ```swift let newsModel = JBNews("YOUR-API-KEY") Task { let response = await newsModel.gpt(message: "What does bullish mean?") print(response) } ``` -------------------------------- ### Clone GitHub Repository Source: https://www.jblanked.com/news/api/docs Clone the full repository from GitHub to access the complete source code and contribute. ```bash git clone ``` -------------------------------- ### Monthly and Yearly Calendar Endpoints Source: https://www.jblanked.com/news/api/docs/changelog Retrieve calendar data for the current month or year up to the current date. Available for MQL5 and Forex Factory sources. ```url /news/api/mql5/calendar/month ``` ```url /news/api/mql5/calendar/year ``` ```url /news/api/forex-factory/calendar/month ``` ```url /news/api/forex-factory/calendar/year ``` -------------------------------- ### Fetch and Process Calendar Events in Python Source: https://www.jblanked.com/news/api/docs/calendar This Python snippet demonstrates how to use the CJBNews library to fetch today's calendar events. It includes setting the API key and time offset, and then iterating through the retrieved event details. ```python 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 impact = event.impact 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}") ``` -------------------------------- ### Python Authentication Headers Source: https://www.jblanked.com/news/api/docs Include these headers in your Python requests to authenticate with the API. Replace 'YOUR_API_KEY' with your actual API key. ```python headers = { "Content-Type": "application/json", "Authorization": "Api-Key YOUR_API_KEY" } ``` -------------------------------- ### Configure PyCalendar Settings Source: https://www.jblanked.com/news/api/docs/projects Set your API key, time zone offset, and preferred news data source in this configuration block. The offset is relative to GMT. ```python API_KEY = "YOUR_API_KEY_HERE" OFFSET = 7 # GMT-3=0, GMT=3, EST=7, PST=10 SOURCE = "mql5" # Options: "mql5", "forex-factory" ``` -------------------------------- ### Full Event List Endpoints Source: https://www.jblanked.com/news/api/docs/backtesting Retrieve a comprehensive list of all events from different data sources. Use these endpoints to fetch all available economic calendar data. ```text Data Source| Endpoint ---|--- MQL5| `GET /news/api/mql5/full-list/` Forex Factory| `GET /news/api/forex-factory/full-list/` FxStreet| `GET /news/api/fxstreet/full-list/` ``` -------------------------------- ### Today MQL5 Events Source: https://www.jblanked.com/news/api/docs/calendar Retrieves a list of today's Forex news events from MQL5, ordered by time. Supports filtering by currency and impact. ```APIDOC ## GET /news/api/mql5/calendar/today/ ### Description List of today's events ordered by time from MQL5. Optional params: `currency` (USD, CAD, EUR, GBP, AUD, CHF, JPY, NZD) and `impact` (High, Medium, Low, None). ### Method GET ### Endpoint /news/api/mql5/calendar/today/ ### Parameters #### Query Parameters - **currency** (string) - Optional - Filter by currency (USD, CAD, EUR, GBP, AUD, CHF, JPY, NZD). - **impact** (string) - Optional - Filter by impact level (High, Medium, Low, None). ``` -------------------------------- ### This Week MQL5 Events Source: https://www.jblanked.com/news/api/docs/calendar Retrieves a list of this week's Forex news events from MQL5, ordered by time. Supports filtering by currency, impact, and offset. ```APIDOC ## GET /news/api/mql5/calendar/week/ ### Description List of this week's events ordered by time from MQL5. Optional: `currency`, `impact`, `offset`. ### Method GET ### Endpoint /news/api/mql5/calendar/week/ ### Parameters #### Query Parameters - **currency** (string) - Optional - Filter by currency (USD, CAD, EUR, GBP, AUD, CHF, JPY, NZD). - **impact** (string) - Optional - Filter by impact level (High, Medium, Low, None). - **offset** (integer) - Optional - Timezone offset. ``` -------------------------------- ### MQL5 and Forex Factory Calendar Range Filtering Source: https://www.jblanked.com/news/api/docs/changelog Filter calendar data by specifying a date range using `from` and `to` parameters. Supported for both MQL5 and Forex Factory endpoints. ```url /news/api/mql5/calendar/range/?from=YYYY-MM-DD&to=YYYY-MM-DD ``` ```url /news/api/forex-factory/calendar/range/?from=YYYY-MM-DD&to=YYYY-MM-DD ``` -------------------------------- ### Swift Request to GPT API Source: https://www.jblanked.com/news/api/docs/gpt Initiate a GPT API request in Swift using URLComponents and URLSession. The response is decoded into a custom GPTResponse struct. ```swift import Foundation let baseURL = "https://www.jblanked.com/news/api/gpt/mobile/" var components = URLComponents(string: baseURL)! components.queryItems = [ URLQueryItem(name: "message", value: "What does bullish mean?") ] var request = URLRequest(url: components.url!) request.addValue("Api-Key YOUR_API_KEY", forHTTPHeaderField: "Authorization") request.addValue("application/json", forHTTPHeaderField: "Content-Type") let (data, _) = try await URLSession.shared.data(for: request) let response = try JSONDecoder().decode(GPTResponse.self, from: data) print(response.task_id) struct GPTResponse: Decodable { var task_id: String var message: String } ``` -------------------------------- ### This Week Forex Factory Events Source: https://www.jblanked.com/news/api/docs/calendar Retrieves a list of this week's Forex news events from Forex Factory, ordered by time. Supports filtering by currency, impact, and offset. ```APIDOC ## GET /news/api/forex-factory/calendar/week/ ### Description List of this week's events ordered by time from Forex Factory. Supports filtering by currency, impact, and offset. ### Method GET ### Endpoint /news/api/forex-factory/calendar/week/ ### Parameters #### Query Parameters - **currency** (string) - Optional - Filter by currency (USD, CAD, EUR, GBP, AUD, CHF, JPY, NZD). - **impact** (string) - Optional - Filter by impact level (High, Medium, Low, None). - **offset** (integer) - Optional - Timezone offset. ``` -------------------------------- ### Full Event List Source: https://www.jblanked.com/news/api/docs/backtesting Retrieves a full list of events from various data sources. ```APIDOC ## Full Event List Data Source| Endpoint ---|--- MQL5| `GET /news/api/mql5/full-list/` Forex Factory| `GET /news/api/forex-factory/full-list/` FxStreet| `GET /news/api/fxstreet/full-list/` ``` -------------------------------- ### MQL5 Machine Learning Predictions Source: https://www.jblanked.com/news/api/docs/backtesting Retrieve machine learning predictions for MQL5 data, including bullish/bearish probabilities and accuracy scores for 1-min, 30-min, and 1-hour intervals. This endpoint is useful for quantitative analysis and strategy development. ```json { "Name": "Average Hourly Earnings m/m", "Currency": "USD", "Event_ID": 840030018, "Category": "Job Inflation Report", "Impact": "High", "MachineLearning": { "Outcomes": { "Actual < Forecast < Previous": { "1 Hour": {"Bearish": 36.77, "Bullish": 61.21}, "1 Minute": {"Bearish": 33.23, "Bullish": 65.27}, "30 Minute": {"Bearish": 33.80, "Bullish": 65.07} } }, "Accuracy": { "1 Hour": 0.57, "1 Minute": 0.71, "30 Minute": 0.43 } } } ``` -------------------------------- ### Event List Source: https://www.jblanked.com/news/api/docs/backtesting Returns a JSON list of all available News Events from different data sources. ```APIDOC ## GET /news/api/mql5/list/ ### Description Returns a JSON list of all available News Events from MQL5. ### Method GET ### Endpoint /news/api/mql5/list/ ### Response #### Success Response (200) - **Name** (string) - The name of the event. - **Currency** (string) - The currency associated with the event. - **Event_ID** (integer) - The unique identifier for the event. - **Category** (string) - The category of the event. - **Impact** (string) - The impact level of the event (e.g., Low, Medium, High). #### Response Example ```json [ { "Name": "Adjusted Current Account", "Currency": "JPY", "Event_ID": 39207008, "Category": "Currency Report", "Impact": "Low" } ] ``` ``` ```APIDOC ## GET /news/api/forex-factory/list/ ### Description Returns a JSON list of all available News Events from Forex Factory. ### Method GET ### Endpoint /news/api/forex-factory/list/ ### Response #### Success Response (200) - **Name** (string) - The name of the event. - **Currency** (string) - The currency associated with the event. - **Event_ID** (integer) - The unique identifier for the event. - **Category** (string) - The category of the event. - **Impact** (string) - The impact level of the event (e.g., Low, Medium, High). #### Response Example ```json [ { "Name": "Adjusted Current Account", "Currency": "JPY", "Event_ID": 39207008, "Category": "Currency Report", "Impact": "Low" } ] ``` ``` ```APIDOC ## GET /news/api/fxstreet/list/ ### Description Returns a JSON list of all available News Events from FxStreet. ### Method GET ### Endpoint /news/api/fxstreet/list/ ### Response #### Success Response (200) - **Name** (string) - The name of the event. - **Currency** (string) - The currency associated with the event. - **Event_ID** (integer) - The unique identifier for the event. - **Category** (string) - The category of the event. - **Impact** (string) - The impact level of the event (e.g., Low, Medium, High). #### Response Example ```json [ { "Name": "Adjusted Current Account", "Currency": "JPY", "Event_ID": 39207008, "Category": "Currency Report", "Impact": "Low" } ] ``` ``` -------------------------------- ### Today Forex Factory Events Source: https://www.jblanked.com/news/api/docs/calendar Retrieves a list of today's Forex news events from Forex Factory, ordered by time. Supports filtering by currency and impact. ```APIDOC ## GET /news/api/forex-factory/calendar/today/ ### Description List of today's events ordered by time from Forex Factory. Same optional params as MQL5 endpoint. ### Method GET ### Endpoint /news/api/forex-factory/calendar/today/ ### Parameters #### Query Parameters - **currency** (string) - Optional - Filter by currency (USD, CAD, EUR, GBP, AUD, CHF, JPY, NZD). - **impact** (string) - Optional - Filter by impact level (High, Medium, Low, None). ``` -------------------------------- ### MQL Request to GPT API Source: https://www.jblanked.com/news/api/docs/gpt Send a POST request to the GPT API using the jb-requests.mqh library in MQL. Extracts and prints the task ID from the response. ```mql #include int OnInit() { CRequests request; request.url = "https://www.jblanked.com/news/api/gpt/"; request.key = "YOUR_API_KEY"; request.loader["content"] = "What does bullish mean?"; if(!request.POST()) { Print("Failed to send GPT request"); return INIT_FAILED; } Print(request.result); string taskID = request.loader["task_id"].ToStr(); return(INIT_SUCCEEDED); } ``` -------------------------------- ### Date Range Events (All Sources) Source: https://www.jblanked.com/news/api/docs/calendar Filters Forex news events by a specified date range across all sources. Supports filtering by currency and impact. ```APIDOC ## GET /news/api/[source]/calendar/range/ ### Description Filter events by date range using `from` and `to` parameters. Supports filtering by currency and impact. ### Method GET ### Endpoint /news/api/[source]/calendar/range/ ### Parameters #### Query Parameters - **from** (string) - Required - Start date in YYYY-MM-DD format. - **to** (string) - Required - End date in YYYY-MM-DD format. - **currency** (string) - Optional - Filter by currency (USD, CAD, EUR, GBP, AUD, CHF, JPY, NZD). - **impact** (string) - Optional - Filter by impact level (High, Medium, Low, None). ### Example Usage `GET /news/api/mql5/calendar/range/?from=2025-09-17&to=2025-09-24¤cy=USD&impact=High` `GET /news/api/forex-factory/calendar/range/?from=2025-09-17&to=2025-09-24` `GET /news/api/fxstreet/calendar/range/?from=2025-09-17&to=2025-09-24` ``` -------------------------------- ### Smart Analysis Source: https://www.jblanked.com/news/api/docs/backtesting Provides automatic directional analysis for each possible outcome scenario based on MQL5 data. ```APIDOC ## GET /news/api/mql5/ID/smart-analysis/ ### Description Returns a JSON object with automatic directional analysis for each possible outcome scenario for MQL5 data. ### Method GET ### Endpoint /news/api/mql5/ID/smart-analysis/ ### Response #### Success Response (200) - **Name** (string) - The name of the event. - **Currency** (string) - The currency associated with the event. - **Event_ID** (integer) - The unique identifier for the event. - **Category** (string) - The category of the event. - **Impact** (string) - The impact level of the event. - **SmartAnalysis** (object) - Contains directional analysis for different scenarios. - **Actual < Forecast < Previous** (string) - Directional analysis for this scenario. - **Actual < Forecast = Previous** (string) - Directional analysis for this scenario. - **Actual = Forecast < Previous** (string) - Directional analysis for this scenario. - **Actual = Forecast = Previous** (string) - Directional analysis for this scenario. - **Actual = Forecast > Previous** (string) - Directional analysis for this scenario. - **Actual > Forecast > Previous** (string) - Directional analysis for this scenario. #### Response Example { "Name": "Average Hourly Earnings m/m", "Currency": "USD", "Event_ID": 840030018, "Category": "Job Inflation Report", "Impact": "High", "SmartAnalysis": { "Actual < Forecast < Previous": "Bullish", "Actual < Forecast = Previous": "Bullish", "Actual = Forecast < Previous": "Bullish", "Actual = Forecast = Previous": "Neither_Bearish_or_Bullish", "Actual = Forecast > Previous": "Bearish", "Actual > Forecast > Previous": "Bearish" } } ``` -------------------------------- ### Machine Learning Predictions Source: https://www.jblanked.com/news/api/docs/backtesting Retrieves machine learning predictions, including bullish/bearish probabilities and accuracy scores for MQL5 data at different time intervals. ```APIDOC ## GET /news/api/mql5/ID/machine-learning/ ### Description Returns a JSON object with ML predictions including bullish/bearish probabilities at 1-min, 30-min, and 1-hour intervals, plus accuracy scores for MQL5 data. ### Method GET ### Endpoint /news/api/mql5/ID/machine-learning/ ### Response #### Success Response (200) - **Name** (string) - The name of the event. - **Currency** (string) - The currency associated with the event. - **Event_ID** (integer) - The unique identifier for the event. - **Category** (string) - The category of the event. - **Impact** (string) - The impact level of the event. - **MachineLearning** (object) - Contains ML prediction data. - **Outcomes** (object) - Probabilities for different outcomes. - **Actual < Forecast < Previous** (object) - Bearish/Bullish probabilities for this outcome. - **1 Hour** (object) - Bearish/Bullish probabilities for 1 hour. - **Bearish** (number) - Probability of a bearish outcome. - **Bullish** (number) - Probability of a bullish outcome. - **1 Minute** (object) - Bearish/Bullish probabilities for 1 minute. - **Bearish** (number) - Probability of a bearish outcome. - **Bullish** (number) - Probability of a bullish outcome. - **30 Minute** (object) - Bearish/Bullish probabilities for 30 minutes. - **Bearish** (number) - Probability of a bearish outcome. - **Bullish** (number) - Probability of a bullish outcome. - **Accuracy** (object) - Accuracy scores for predictions. - **1 Hour** (number) - Accuracy score for 1-hour predictions. - **1 Minute** (number) - Accuracy score for 1-minute predictions. - **30 Minute** (number) - Accuracy score for 30-minute predictions. #### Response Example { "Name": "Average Hourly Earnings m/m", "Currency": "USD", "Event_ID": 840030018, "Category": "Job Inflation Report", "Impact": "High", "MachineLearning": { "Outcomes": { "Actual < Forecast < Previous": { "1 Hour": {"Bearish": 36.77, "Bullish": 61.21}, "1 Minute": {"Bearish": 33.23, "Bullish": 65.27}, "30 Minute": {"Bearish": 33.80, "Bullish": 65.07} } }, "Accuracy": { "1 Hour": 0.57, "1 Minute": 0.71, "30 Minute": 0.43 } } } ``` -------------------------------- ### Event Info Source: https://www.jblanked.com/news/api/docs/backtesting Retrieve specific event information by providing the Event ID. ```APIDOC ## GET /news/api/mql5/{ID} ### Description Retrieve specific event information from MQL5 by replacing `{ID}` with the Event Identification number. ### Method GET ### Endpoint /news/api/mql5/{ID} ### Parameters #### Path Parameters - **ID** (integer) - Required - The unique identification number of the event. ### Response #### Success Response (200) - **Name** (string) - The name of the event. - **Currency** (string) - The currency associated with the event. - **Event_ID** (integer) - The unique identifier for the event. - **Category** (string) - The category of the event. - **Impact** (string) - The impact level of the event (e.g., Low, Medium, High). #### Response Example ```json { "Name": "Adjusted Current Account", "Currency": "JPY", "Event_ID": 39207008, "Category": "Currency Report", "Impact": "Low" } ``` ``` ```APIDOC ## GET /news/api/forex-factory/{ID} ### Description Retrieve specific event information from Forex Factory by replacing `{ID}` with the Event Identification number. ### Method GET ### Endpoint /news/api/forex-factory/{ID} ### Parameters #### Path Parameters - **ID** (integer) - Required - The unique identification number of the event. ### Response #### Success Response (200) - **Name** (string) - The name of the event. - **Currency** (string) - The currency associated with the event. - **Event_ID** (integer) - The unique identifier for the event. - **Category** (string) - The category of the event. - **Impact** (string) - The impact level of the event (e.g., Low, Medium, High). #### Response Example ```json { "Name": "Adjusted Current Account", "Currency": "JPY", "Event_ID": 39207008, "Category": "Currency Report", "Impact": "Low" } ``` ``` ```APIDOC ## GET /news/api/fxstreet/{ID} ### Description Retrieve specific event information from FxStreet by replacing `{ID}` with the Event Identification number. ### Method GET ### Endpoint /news/api/fxstreet/{ID} ### Parameters #### Path Parameters - **ID** (integer) - Required - The unique identification number of the event. ### Response #### Success Response (200) - **Name** (string) - The name of the event. - **Currency** (string) - The currency associated with the event. - **Event_ID** (integer) - The unique identifier for the event. - **Category** (string) - The category of the event. - **Impact** (string) - The impact level of the event (e.g., Low, Medium, High). #### Response Example ```json { "Name": "Adjusted Current Account", "Currency": "JPY", "Event_ID": 39207008, "Category": "Currency Report", "Impact": "Low" } ``` ``` -------------------------------- ### Submit GPT Analysis Request Source: https://www.jblanked.com/news/api/docs/gpt Send a POST request to the GPT endpoint with your query to initiate sentiment analysis. You will receive a task ID and a confirmation message. ```APIDOC ## POST /news/api/gpt/ ### Description Initiates an AI-powered sentiment analysis on forex news content. ### Method POST ### Endpoint https://www.jblanked.com/news/api/gpt/ ### Parameters #### Request Body - **content** (string) - Required - The text content for sentiment analysis. ### Request Example ```json { "content": "In less than 8 words, what does bullish mean?" } ``` ### Response #### Success Response (200) - **task_id** (string) - The unique identifier for the analysis task. - **message** (string) - A confirmation message indicating the task has started. #### Response Example ```json { "task_id": "your-task-id", "message": "Task started successfully." } ``` ``` -------------------------------- ### Python Library Usage for GPT Source: https://www.jblanked.com/news/api/docs/gpt Utilize the jb_news library in Python to interact with the GPT API for sentiment analysis. Requires an API key and the news content. ```python from jb_news.news import CJBNews jb = CJBNews() api_key = "YOUR_API_KEY_HERE" gpt_response = jb.GPT(api_key, "What does bullish mean in forex?") print(gpt_response) ``` -------------------------------- ### Today FxStreet Events Source: https://www.jblanked.com/news/api/docs/calendar Retrieves a list of today's Forex news events from FxStreet, ordered by time. Supports filtering by currency and impact. ```APIDOC ## GET /news/api/fxstreet/calendar/today/ ### Description List of today's events ordered by time from FxStreet. Same optional params as MQL5 endpoint. ### Method GET ### Endpoint /news/api/fxstreet/calendar/today/ ### Parameters #### Query Parameters - **currency** (string) - Optional - Filter by currency (USD, CAD, EUR, GBP, AUD, CHF, JPY, NZD). - **impact** (string) - Optional - Filter by impact level (High, Medium, Low, None). ``` -------------------------------- ### MQL5 Smart Analysis Results Source: https://www.jblanked.com/news/api/docs/backtesting Obtain automatic directional analysis for MQL5 data, indicating the likely market direction for various outcome scenarios. This is helpful for quickly assessing potential event impacts. ```json { "Name": "Average Hourly Earnings m/m", "Currency": "USD", "Event_ID": 840030018, "Category": "Job Inflation Report", "Impact": "High", "SmartAnalysis": { "Actual < Forecast < Previous": "Bullish", "Actual < Forecast = Previous": "Bullish", "Actual = Forecast < Previous": "Bullish", "Actual = Forecast = Previous": "Neither_Bearish_or_Bullish", "Actual = Forecast > Previous": "Bearish", "Actual > Forecast > Previous": "Bearish" } } ``` -------------------------------- ### Swift Library Usage for GPT Source: https://www.jblanked.com/news/api/docs/gpt Integrate the JBNews library in Swift to perform GPT-based sentiment analysis. Asynchronously fetches the response for a given message. ```swift import JBNews let yourAPIKey = "YOUR-API-KEY" let newsModel = JBNews(yourAPIKey) Task { let response: String = await newsModel.gpt( message: "In less than 8 words, what does bullish mean?" ) print(response) } ``` -------------------------------- ### This Week FxStreet Events Source: https://www.jblanked.com/news/api/docs/calendar Retrieves a list of this week's Forex news events from FxStreet, ordered by time. Supports filtering by currency, impact, and offset. ```APIDOC ## GET /news/api/fxstreet/calendar/week/ ### Description List of this week's events ordered by time from FxStreet. Supports filtering by currency, impact, and offset. ### Method GET ### Endpoint /news/api/fxstreet/calendar/week/ ### Parameters #### Query Parameters - **currency** (string) - Optional - Filter by currency (USD, CAD, EUR, GBP, AUD, CHF, JPY, NZD). - **impact** (string) - Optional - Filter by impact level (High, Medium, Low, None). - **offset** (integer) - Optional - Timezone offset. ``` -------------------------------- ### FxStreet API Endpoints Source: https://www.jblanked.com/news/api/docs/changelog Access news data from FxStreet using the provided list endpoints. These follow a similar structure to MQL5 and Forex Factory. ```url /news/api/fxstreet/list/ ``` ```url /news/api/fxstreet/{ID}/ ``` ```url /news/api/fxstreet/{ID}/history/ ``` ```url /news/api/fxstreet/calendar/today/ ``` ```url /news/api/fxstreet/calendar/week/ ``` ```url /news/api/fxstreet/calendar/month/ ``` ```url /news/api/fxstreet/calendar/year/ ``` ```url /news/api/fxstreet/calendar/range/?from=YYYY-MM-DD&to=YYYY-MM-DD ``` -------------------------------- ### Python Request to GPT API Source: https://www.jblanked.com/news/api/docs/gpt Send a POST request to the GPT API to initiate a sentiment analysis task and then poll for the result using the returned task ID. ```python import requests url = "https://www.jblanked.com/news/api/gpt/" headers = { "Content-Type": "application/json", "Authorization": "Api-Key YOUR_API_KEY" } data = {"content": "In less than 8 words, what does bullish mean?"} response = requests.post(url, headers=headers, json=data) if response.status_code == 200: task_id = response.json()["task_id"] print(f"Task ID: {task_id}") # Poll for the result status_url = f"https://www.jblanked.com/news/api/gpt/status/{task_id}" result = requests.get(status_url, headers=headers) print(result.json()) ```