経済指標API ドキュメント

リアルタイム経済指標データの取得と統計分析のための高性能APIシステム

📊

システム概要

2つの主要APIが連携して高精度な経済指標データサービスを提供

稼働中・リアルタイム更新
🚀 リアルタイムAPI
当日の経済指標をFinnhub APIから取得し、重要度に応じて整形・フィルタリング
  • 重要度別フィルタリング
  • サプライズ検出
  • 時刻順ソート
📈 統計分析API
過去5年間のデータを活用した高度な統計分析とシミュレーション
  • 価格影響予測
  • 確率分析
  • トレード戦略提案

リアルタイム経済指標API

indicators.php - 当日の経済指標データをリアルタイムで取得

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

当日に発表予定または発表済みの経済指標をリスト形式で返します。全データは自動的にデータベースにアーカイブされます。

📋 パラメータ一覧

パラメータ 説明
debug string 任意 - デバッグモード設定
1: デバッグ情報を含むレスポンス
raw: Finnhub APIの生データを返却
db: データベース状態と最新5件のデータを表示
test string 任意 - finnhub指定で接続テスト実行

📤 レスポンス形式

JSON レスポンス例
{ "success": true, "source": "finnhub_api_realtime_display_simple_logic_fixed", "indicators": [ { "id": "us_md5hashstring", "date": "08/07 (今日)", "time": "12:30", "country": "US", "name": "非農業部門雇用者数", "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": "非農業部門雇用者数", "time": "12:30", "country": "US", "importance": "high", "unix_time": 1723033800 }, "recent_results": [ { "name": "製造業PMI", "country": "JP", "time": "08:30", "forecast": "50.5", "actual": "51.0", "impact": "positive" } ], "timestamp": 1723001041, "last_update": "2025-08-07 08:24:01 GMT" }

🔍 主要フィールド詳細

indicators[]
経済指標配列。各指標には発表時刻、重要度、予想値、実際値などが含まれます
next_indicator
次に発表予定の重要指標情報(トレーダー向けアラート機能)
recent_results
直近に発表された指標の結果とその市場への影響度
💡 使用例:重要指標の監視
JavaScript での活用例
// 高重要度指標のみを監視 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('監視すべき重要指標:', highImportanceIndicators); // 次の重要指標までの時間を計算 if (data.next_indicator) { const timeUntilNext = data.next_indicator.unix_time * 1000 - Date.now(); console.log(`次の重要指標まで: ${Math.round(timeUntilNext / 1000 / 60)}分`); } });
📊

統計分析API

indicators_statistics.php - 過去データに基づく高度な分析とシミュレーション

過去5年間に蓄積された経済指標データを活用し、統計分析、価格影響予測、トレード戦略の提案を行います。

GET https://signupexpert.co.th/analysis/api/indicators_statistics.php?action={アクション名}

actionパラメータで実行する機能を選択します。各アクションは特定の分析機能に対応しています。

🎯 利用可能なアクション

📈 過去データ取得 (historical_data)
指定した指標の過去5年間のデータを統計情報と共に取得します。
パラメータ 説明
indicator string 必須 - 検索したい指標名(部分一致)例: "CPI", "雇用"
country string 必須 - 国コード(US, EU, JP など)
💡 使用例
米国CPIの過去データ取得
GET https://signupexpert.co.th/analysis/api/indicators_statistics?action=historical_data&indicator=CPI&country=US // レスポンス例 { "success": true, "indicator_info": { "name": "消費者物価指数", "country": "US", "importance": "high" }, "historical_data": [...], // 過去5年分のデータ "statistics_summary": { "positive_surprise_rate": 0.45, "negative_surprise_rate": 0.35, "neutral_rate": 0.20 } }
🎲 当日シミュレーション (today_simulation)
指定日の重要指標について3つのシナリオ(上振れ・予想通り・下振れ)での価格変動を予測します。
パラメータ 説明
date string 任意 - YYYY-MM-DD形式。未指定時は当日
country string 任意 - 特定国にフィルタリング
💡 トレーディング戦略例
当日シミュレーション実行
GET https://signupexpert.co.th/analysis/api/indicators_statistics?action=today_simulation&country=US // レスポンス例(抜粋) { "simulations": [ { "indicator_name": "非農業部門雇用者数", "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_see" }, "exceeds_forecast": { "probability": 0.35, "price_impact": { "5min_after": {"up_probability": 0.75, "avg_pips": 15} }, "trading_strategy": "long_gold_recommended" } } } ] }
🔧 データベース診断 (debug_data)
データベースの整合性チェックと統計情報の表示(開発者向け)
📖 API仕様表示 (usage)
利用可能な全機能の詳細仕様を表示(デフォルトアクション)
💻

実践的な使用例

実際のトレーディングシステムでの活用方法

🚨 リアルタイム監視システム
重要指標の自動監視
class EconomicIndicatorMonitor { constructor() { this.checkInterval = 30000; // 30秒ごと 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(); // 高重要度で未発表の指標をチェック const upcomingHighImpact = data.indicators .filter(ind => ind.importance === 'high' && !ind.has_actual) .filter(ind => this.importantCountries.includes(ind.country)); // アラート通知 upcomingHighImpact.forEach(indicator => { const timeUntil = indicator.sort_time * 1000 - Date.now(); if (timeUntil <= 300000) { // 5分前 this.sendAlert(indicator); } }); // 発表済み指標のサプライズチェック const recentSurprises = data.recent_results .filter(result => result.impact !== 'neutral'); if (recentSurprises.length > 0) { this.analyzePriceImpact(recentSurprises); } } catch (error) { console.error('監視エラー:', error); } }, this.checkInterval); } sendAlert(indicator) { console.log(`🚨 アラート: ${indicator.name} (${indicator.country}) 発表まで5分以内 - 予想: ${indicator.forecast}`); } }
📊 トレード戦略分析
過去データを基にした戦略立案
class TradingStrategyAnalyzer { constructor() { this.apiBase = 'https://signupexpert.co.th/analysis/api'; } async analyzeIndicatorImpact(indicatorName, country) { // 過去データ取得 const historyUrl = `${this.apiBase}/indicators_statistics?action=historical_data&indicator=${indicatorName}&country=${country}`; const historyData = await fetch(historyUrl).then(r => r.json()); // 当日シミュレーション const simUrl = `${this.apiBase}/indicators_statistics?action=today_simulation&country=${country}`; const simData = await fetch(simUrl).then(r => r.json()); // 戦略提案 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) { // サプライズ発生率が高い場合の戦略 if (stats.positive_surprise_rate > 0.4) { return { primary: "volatility_strategy", description: "高いボラティリティを想定したレンジトレード推奨" }; } // 安定的な指標の場合 return { primary: "trend_following", description: "トレンドフォロー戦略を基本とする" }; } }
🛟

サポート・トラブルシューティング

よくある問題と解決方法

⚠️ 重要な制限事項
統計分析APIでは、指標の識別に indicator_namecountry_code の両方が必要です。同じ名称の指標でも国によってデータが異なるため、必ず国コードを指定してください。

🔍 トラブルシューティング

データが取得できない
1. APIキーの有効性を確認
2. パラメータの形式をチェック
3. debug=1 でデバッグ情報を確認
統計分析で結果が空
1. 指標名の部分一致検索を試す
2. 国コードが正確か確認
3. 過去データの蓄積状況を確認
レスポンスが遅い
1. リクエスト頻度を調整
2. 必要最小限のデータのみ要求
3. キャッシュの活用を検討