Economic Indicators API Documentation

An API system for fetching real-time economic indicator data and performing statistical analysis efficiently.

📊

System Overview

Two primary APIs working in tandem to deliver highly accurate economic indicator data.

System Operational — Live Data Updates
🚀 Live Data API
Fetch today's economic indicators from the Finnhub API with sorting and filtering by importance level.
  • Filter by importance level
  • Detect deviation from forecasts
  • Sort by time
📈 Statistics Analysis API
Advanced statistical analysis and scenario simulation using 5 years of historical data.
  • Price impact forecasting
  • Probability analysis
  • Trading strategy recommendations

Real-Time Economic Indicators API

indicators.php — Fetch today's economic indicators in real time.

GET https://signupexpert.co.th/analysis/api/indicators.php

Returns a list of economic indicators announced or scheduled for announcement today. All data is automatically stored to the database.

📋 Parameters

Parameter Type Description
debug string Optional — Debug mode
1: Response with debug information
raw: Returns raw data from the Finnhub API
db: Displays database status and the 5 most recent records
test string Optional — Specify finnhub to test the connection.

📤 Response Format

Example JSON Response
{ "success": true, "source": "finnhub_api_realtime_display_simple_logic_fixed", "indicators": [ { "id": "us_md5hashstring", "date": "08/07 (Today)", "time": "12:30", "country": "US", "name": "Non-Farm Payrolls", "importance": "high", "forecast": "185.0K", "previous": "210.0K", "actual": "-", "surprise_type": "none", "has_actual": false, "status": "upcoming", "is_ended": false, "sort_time": 1723033800 } ], "next_indicator": { "name": "Non-Farm Payrolls", "time": "12:30", "country": "US", "importance": "high", "unix_time": 1723033800 }, "recent_results": [ { "name": "Manufacturing PMI Index", "country": "JP", "time": "08:30", "forecast": "50.5", "actual": "51.0", "impact": "positive" } ], "timestamp": 1723001041, "last_update": "2025-08-07 08:24:01 GMT" }

🔍 Key Field Details

indicators[]
Array of economic indicators. Each item includes the announcement time, importance level, forecast value, and actual value.
next_indicator
Details of the next significant indicator to be announced (used for trader alerts).
recent_results
Results of the most recently announced indicators and their market impact.
💡 Example: Tracking Key Indicators
Usage Example in JavaScript
// Track only high-importance indicators fetch('/api/indicators.php') .then(response => response.json()) .then(data => { const highImportanceIndicators = data.indicators .filter(indicator => indicator.importance === 'high') .filter(indicator => !indicator.has_actual); console.log('Key indicators to watch:', highImportanceIndicators); // Calculate time remaining until the next key indicator if (data.next_indicator) { const timeUntilNext = data.next_indicator.unix_time * 1000 - Date.now(); console.log(`Time until next key indicator: ${Math.round(timeUntilNext / 1000 / 60)} minutes`); } });
📊

Statistical Analysis API

indicators_statistics.php — Advanced analysis and scenario simulation from historical data.

Uses 5 years of accumulated economic indicator data to perform statistical analysis, forecast price impact, and recommend trading strategies.

GET https://signupexpert.co.th/analysis/api/indicators_statistics.php?action={action_name}

Use the action parameter to select the desired function. Each action provides analysis tailored to a specific area.

🎯 Available Actions

📈 Fetch Historical Data (historical_data)
Retrieves 5 years of historical data for a specified indicator, along with statistical summaries.
Parameter Type Description
indicator string Required — Name of the indicator to search for (partial match supported), e.g. "CPI", "employment".
country string Required — Country code (e.g. US, EU, JP).
💡 Usage Example
Fetch Historical US CPI Data
GET https://signupexpert.co.th/analysis/api/indicators_statistics?action=historical_data&indicator=CPI&country=US // Example Response { "success": true, "indicator_info": { "name": "Consumer Price Index", "country": "US", "importance": "high" }, "historical_data": [...], // 5 years of historical data "statistics_summary": { "positive_surprise_rate": 0.45, "negative_surprise_rate": 0.35, "neutral_rate": 0.20 } }
🎲 Today's Scenario Simulation (today_simulation)
Forecasts price movements across 3 scenarios (above forecast / in line with forecast / below forecast) for key indicators on the specified date.
Parameter Type Description
date string Optional — Format: YYYY-MM-DD. Defaults to today if not specified.
country string Optional — Filter results by a specific country.
💡 Trading Strategy Example
Call Today's Scenario Simulation
GET https://signupexpert.co.th/analysis/api/indicators_statistics?action=today_simulation&country=US // Example Response (abridged) { "simulations": [ { "indicator_name": "Non-Farm Payrolls", "patterns": { "below_forecast": { "probability": 0.35, "price_impact": { "5min_after": {"up_probability": 0.25, "avg_pips": -12}, "30min_after": {"up_probability": 0.30, "avg_pips": -8}, "1hour_after": {"up_probability": 0.40, "avg_pips": -5} }, "trading_strategy": "Short gold recommended" }, "meets_forecast": { "probability": 0.30, "trading_strategy": "Wait and observe" }, "exceeds_forecast": { "probability": 0.35, "price_impact": { "5min_after": {"up_probability": 0.75, "avg_pips": 15} }, "trading_strategy": "Long gold recommended" } } } ] }
🔧 Database Diagnostics (debug_data)
Verifies database integrity and displays statistical information. (For developers.)
📖 Display Usage Guide (usage)
Displays detailed documentation for all available features. (Default action.)
💻

Practical Usage Examples

How to apply this API within a live trading system.

🚨 Real-Time Monitoring System
Automated Key Indicator Monitoring
class EconomicIndicatorMonitor { constructor() { this.checkInterval = 30000; // Every 30 seconds this.importantCountries = ['US', 'EU', 'JP']; this.apiBase = 'https://signupexpert.co.th/analysis/api'; } async startMonitoring() { setInterval(async () => { try { const response = await fetch(`${this.apiBase}/indicators`); const data = await response.json(); // Check for high-importance indicators not yet announced const upcomingHighImpact = data.indicators .filter(ind => ind.importance === 'high' && !ind.has_actual) .filter(ind => this.importantCountries.includes(ind.country)); // Send alerts upcomingHighImpact.forEach(indicator => { const timeUntil = indicator.sort_time * 1000 - Date.now(); if (timeUntil <= 300000) { // 5 minutes before announcement this.sendAlert(indicator); } }); // Check for forecast deviations in recently announced indicators const recentSurprises = data.recent_results .filter(result => result.impact !== 'neutral'); if (recentSurprises.length > 0) { this.analysePriceImpact(recentSurprises); } } catch (error) { console.error('Monitoring error:', error); } }, this.checkInterval); } sendAlert(indicator) { console.log(`🚨 Alert: ${indicator.name} (${indicator.country}) Less than 5 minutes until announcement — Forecast: ${indicator.forecast}`); } }
📊 Trading Strategy Analysis
Strategy Planning from Historical Data
class TradingStrategyAnalyser { constructor() { this.apiBase = 'https://signupexpert.co.th/analysis/api'; } async analyseIndicatorImpact(indicatorName, country) { // Fetch historical data const historyUrl = `${this.apiBase}/indicators_statistics?action=historical_data&indicator=${indicatorName}&country=${country}`; const historyData = await fetch(historyUrl).then(r => r.json()); // Today's scenario simulation const simUrl = `${this.apiBase}/indicators_statistics?action=today_simulation&country=${country}`; const simData = await fetch(simUrl).then(r => r.json()); // Generate strategy recommendation const strategy = this.generateStrategy(historyData, simData); return strategy; } generateStrategy(history, simulation) { const stats = history.statistics_summary; const currentSim = simulation.simulations[0]; return { recommendation: this.getRecommendation(stats, currentSim), confidence: this.calculateConfidence(stats), riskLevel: this.assessRisk(currentSim), entry_points: this.suggestEntryPoints(currentSim.patterns), stop_loss: this.calculateStopLoss(currentSim.patterns) }; } getRecommendation(stats, simulation) { // Strategy for indicators that frequently deviate from forecasts if (stats.positive_surprise_rate > 0.4) { return { primary: "Volatility Strategy", description: "Range trading recommended, anticipating high volatility." }; } // Strategy for stable indicators return { primary: "Trend-Following Strategy", description: "Apply a trend-following approach as the primary method." }; } }
🛟

Support & Troubleshooting

Common issues and how to resolve them.

⚠️ Important Limitation
The Statistics Analysis API requires both indicator_name and country_code to be specified, as the same indicator name may carry different data across countries. Always include the country code.

🔍 Troubleshooting

Unable to fetch data
1. Verify your API key is correct.
2. Check that parameter formats are valid.
3. Use debug=1 to view debug information.
Statistical analysis returns no results
1. Try searching with a partial indicator name.
2. Verify the country code is correct.
3. Check the status of historical data in the system.
Slow response times
1. Reduce the frequency of requests.
2. Request only the data you need.
3. Consider implementing a caching layer.