Skip to main content
Glama

MCP Hybrid Forecasting

by j1c4b
test_arima_garch.pyโ€ข5.46 kB
# test_arima_garch.py - Test ARIMA-GARCH availability def test_imports(): """Test all imports and dependencies.""" print("๐Ÿงช TESTING ARIMA-GARCH DEPENDENCIES") print("=" * 50) # Test basic imports try: import yfinance as yf print("โœ… yfinance available") except ImportError: print("โŒ yfinance not available") return False try: import pandas as pd import numpy as np print("โœ… pandas & numpy available") except ImportError: print("โŒ pandas or numpy not available") return False # Test ARIMA-GARCH specific dependencies try: import arch print("โœ… arch package available") arch_available = True except ImportError: print("โŒ arch package not available") print(" Install with: pip install arch") arch_available = False try: import statsmodels from statsmodels.tsa.arima.model import ARIMA print("โœ… statsmodels available") statsmodels_available = True except ImportError: print("โŒ statsmodels not available") print(" Install with: pip install statsmodels") statsmodels_available = False # Test module import try: from models.arima_garch_model import check_dependencies, ARIMAGARCHForecaster, check_statsmodels_available, check_arch_available print("โœ… arima_garch_model module available") module_available = True # Test individual dependency checks print(f" Individual checks:") print(f" - check_arch_available(): {check_arch_available()}") print(f" - check_statsmodels_available(): {check_statsmodels_available()}") except ImportError as e: print(f"โŒ arima_garch_model module not available: {e}") print(" Create models/arima_garch_model.py") module_available = False # Test dependencies function if module_available: try: deps_result = check_dependencies() print(f"โœ… check_dependencies() result: {deps_result}") # Use the actual dependency check result for overall status overall_available = deps_result and module_available except Exception as e: print(f"โŒ check_dependencies() failed: {e}") overall_available = False else: overall_available = False # Overall status print(f"\n๐Ÿ“Š OVERALL STATUS:") if overall_available: print("โœ… ARIMA-GARCH fully available") else: print("โŒ ARIMA-GARCH not fully available") print("Missing or failing components:") if not arch_available: print(" - arch package") if not statsmodels_available: print(" - statsmodels package") if not module_available: print(" - arima_garch_model.py file") if module_available and not deps_result: print(" - dependency check failing") return overall_available def test_simple_forecast(): """Test a simple ARIMA-GARCH forecast.""" print(f"\n๐Ÿš€ TESTING SIMPLE ARIMA-GARCH FORECAST") print("=" * 50) try: from models.arima_garch_model import ARIMAGARCHForecaster # Test with COIN (high volatility crypto - better for ARIMA-GARCH testing) ticker = "COIN" print(f"Testing with {ticker} (high volatility crypto)...") forecaster = ARIMAGARCHForecaster(ticker) data = forecaster.download_data(period="1y") # 1 year for better GARCH fitting if data is not None and len(data) > 200: # Need more data for GARCH print(f"โœ… Data download successful: {len(data)} points") # Try to fit model (this might take a moment) print("Fitting ARIMA-GARCH model...") model_info = forecaster.fit_hybrid_model() print(f"โœ… Model fitted: ARIMA{model_info['arima_order']}-GARCH{model_info['garch_order']}") # Try forecast forecast_result = forecaster.forecast() print(f"โœ… Forecast successful: ${forecast_result['price_forecast']:.2f}") print(f" Last price: ${forecast_result['last_price']:.2f}") print(f" Volatility forecast: {forecast_result['volatility_forecast']:.2f}%") return True else: print(f"โŒ Insufficient data: {len(data) if data is not None else 0} points (need >200)") return False except Exception as e: print(f"โŒ ARIMA-GARCH test failed: {e}") import traceback traceback.print_exc() return False def main(): """Run all tests.""" # Test 1: Dependencies deps_ok = test_imports() if deps_ok: # Test 2: Simple forecast forecast_ok = test_simple_forecast() if forecast_ok: print(f"\n๐ŸŽ‰ ALL TESTS PASSED!") print("ARIMA-GARCH is ready to use in enhanced_main.py") else: print(f"\nโš ๏ธ Dependencies OK but forecast failed") print("Check ARIMA-GARCH implementation") else: print(f"\nโŒ DEPENDENCY ISSUES") print("Fix dependencies before testing forecast") if __name__ == "__main__": main()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/j1c4b/mcp-hybrid-forecasting'

If you have feedback or need assistance with the MCP directory API, please join our Discord server