Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/AgriQuantAI/AgriQuant-AI
/ functions
Functions
214 in github.com/AgriQuantAI/AgriQuant-AI
⨍
Functions
214
◇
Types & classes
32
↳
Endpoints
8
↓ 8 callers
Method
predict
Make price prediction using trained model Args: recent_data: Recent historical data (at least sequence_length ro
lstm_predictor.py:325
↓ 6 callers
Method
analyze_freeze_event
Analyze freeze forecast and generate crop damage prediction Args: forecast_data: Weather forecast from NOAA
claude_engine.py:52
↓ 4 callers
Method
shutdown
Graceful shutdown
main.py:56
↓ 3 callers
Method
calculate_liquidity_metrics
Calculate market liquidity metrics Returns: Comprehensive liquidity analysis
microstructure_analyzer.py:119
↓ 2 callers
Method
_get_gfs_fallback
Fallback to NOAA GFS model data when INMET is unavailable. GFS provides global coverage including Brazil with 0.25deg resolution.
coffee_brazil_collector.py:126
↓ 2 callers
Method
calculate_metrics
Calculate performance metrics Args: days: Calculate for last N days (None = all time) Retur
performance_tracker.py:84
↓ 2 callers
Method
connect
Establish database connection
database.py:27
↓ 2 callers
Method
fetch_usda_crop_progress
Weekly USDA Crop Progress report. Released every Monday during growing season. Good/Excellent % is the single most market-mov
icco_usda_scraper.py:70
↓ 2 callers
Method
fit_garch_11
Fit GARCH(1,1) model to returns Args: returns: Returns series initial_params: Initial parameter gues
volatility_forecaster.py:130
↓ 2 callers
Method
get_state_forecast
NOAA forecast for a grain production state centroid
grains_collector.py:90
↓ 2 callers
Method
get_usda_crop_progress
Fetch weekly USDA Crop Progress ratings. Good/Excellent % is the most-watched ag data point each Monday. Drop of 5+ points we
grains_collector.py:195
↓ 2 callers
Method
monitor_weather_all_counties
Main monitoring loop - check all counties for weather threats
main.py:62
↓ 2 callers
Method
normalize_data
Normalize sequences and targets Args: sequences: Input sequences targets: Target values
lstm_predictor.py:183
↓ 2 callers
Method
prepare_sequences
Convert time series data into sequences for LSTM Args: data: DataFrame with features and target targ
lstm_predictor.py:151
↓ 1 callers
Method
__init__
(self, sequences: np.ndarray, targets: np.ndarray)
lstm_predictor.py:29
↓ 1 callers
Method
_aggregate_drought_risk
Weight drought risks by production share
coffee_brazil_collector.py:300
↓ 1 callers
Method
_aggregate_frost_risk
Weight frost risks by production share
coffee_brazil_collector.py:287
↓ 1 callers
Method
_apply_correlation_adjustments
Adjust signal confidence based on cross-commodity correlations. If Coffee AND Cocoa both show LONG signals, it suggests a shared
multi_commodity_engine.py:113
↓ 1 callers
Method
_assess_portfolio_risk
Assess overall portfolio risk across all positions. Prevents over-concentration in correlated weather events.
multi_commodity_engine.py:145
↓ 1 callers
Method
_calculate_confidence_calibration
Check if confidence scores are well-calibrated E.g., if AI says 80% confident, are 80% of those predictions accurate?
backtest.py:316
↓ 1 callers
Method
_calculate_max_drawdown
Calculate maximum drawdown percentage
performance_tracker.py:157
↓ 1 callers
Method
_calculate_summary_statistics
Calculate aggregate metrics
backtest.py:289
↓ 1 callers
Method
_create_alert
Create high-priority alert for significant predictions
main.py:201
↓ 1 callers
Method
_display_results
Display backtest results
backtest.py:344
↓ 1 callers
Method
_extract_signals
Extract trading signals from each commodity's data
multi_commodity_engine.py:100
↓ 1 callers
Method
_find_historical_analogs
Find historical frost events with similar temperature profiles
coffee_brazil_collector.py:243
↓ 1 callers
Method
_find_historical_precedents
Find similar historical events
market_impact_analyzer.py:156
↓ 1 callers
Method
_find_similar_freeze_events
Find historical freeze events with similar conditions
risk_analyzer.py:464
↓ 1 callers
Method
_format_alert_message
Format human-readable alert message
main.py:225
↓ 1 callers
Method
_generate_and_store_prediction
Generate AI prediction and store in database
main.py:145
↓ 1 callers
Method
_generate_trade_recommendations
Generate ranked trade recommendations with position sizing. Applies risk management rules from config.
multi_commodity_engine.py:199
↓ 1 callers
Method
_load_historical_database
Load historical weather events database
risk_analyzer.py:481
↓ 1 callers
Method
_load_trades
Load trade history from database
performance_tracker.py:26
↓ 1 callers
Method
_load_wallet
Load distribution wallet from environment
investor_distribution.py:37
↓ 1 callers
Method
_load_wallet
Load wallet from environment variable
crypto_fundraise.py:34
↓ 1 callers
Method
_record_airdrop
Record airdrop in database for transparency
investor_distribution.py:191
↓ 1 callers
Method
_record_buyback
Record buyback in database for transparency
crypto_fundraise.py:131
↓ 1 callers
Method
_save_trades
Save trades to database
performance_tracker.py:79
↓ 1 callers
Method
_send_alert
Send alert via configured channels In production: email, SMS, Slack, webhook
main.py:248
↓ 1 callers
Method
analyze_hurricane_threat
Analyze hurricane threat and predict crop impact
claude_engine.py:215
↓ 1 callers
Method
assess_brazil_drought
Drought assessment for Brazil Center-South sugarcane
sugar_collector.py:101
↓ 1 callers
Method
assess_corn_stress
Corn yield stress assessment. Critical periods: - Pollination (July): Heat > 95F or drought = yield loss - Grain fill (Aug):
grains_collector.py:111
↓ 1 callers
Method
assess_drought_risk
Assess drought risk - critical during flowering (Oct-Dec) and fruit development (Jan-Mar). El Nino years increase risk significantly.
coffee_brazil_collector.py:206
↓ 1 callers
Method
assess_drought_risk
Drought assessment for cocoa. Cocoa requires 1200-2500mm annual rainfall. Critical periods: flowering (Oct-Nov) and pod devel
cocoa_westafrica_collector.py:177
↓ 1 callers
Method
assess_freeze_risk
Assess crop damage risk from freeze event Based on: - Temperature thresholds (28°F = critical, 26°F = severe)
risk_analyzer.py:158
↓ 1 callers
Method
assess_frost_risk
Assess frost risk for a Brazilian coffee region. Frost below 0C causes leaf damage; below -2C causes branch kill; below -4C c
coffee_brazil_collector.py:159
↓ 1 callers
Method
assess_harmattan_risk
Harmattan: hot, dry, dusty wind from Sahara (Nov-Feb). Causes: pod dehydration, flower drop, reduced pod set. Severe Harmatta
cocoa_westafrica_collector.py:122
↓ 1 callers
Method
assess_india_monsoon
India monsoon assessment. June-September rainfall vs normal. IMD defines: >110% = excess, 90-110% = normal, 75-90% = deficient,
sugar_collector.py:73
↓ 1 callers
Method
assess_wheat_risk
Wheat risk assessment. HRW wheat: winterkill risk (Jan-Feb), drought at heading (Apr-May), heat at grain fill (May-Jun).
grains_collector.py:159
↓ 1 callers
Method
calculate_buyback_amount
Calculate 50% of monthly profits for buyback Args: monthly_profits_usdc: Total monthly trading profits in USDC
crypto_fundraise.py:41
↓ 1 callers
Method
calculate_garman_klass_volatility
Garman-Klass volatility estimator Most efficient estimator using OHLC data Args: open_prices: Opening pr
volatility_forecaster.py:304
↓ 1 callers
Method
calculate_holder_allocations
Calculate USDT allocation for each holder based on token percentage Args: total_usdt: Total USDT to distribute
investor_distribution.py:79
↓ 1 callers
Method
calculate_ndvi
Calculate Normalized Difference Vegetation Index NDVI = (NIR - Red) / (NIR + Red) Values: 0.8-1.0:
satellite_data_processor.py:49
↓ 1 callers
Method
calculate_order_flow_imbalance
Calculate order flow imbalance over recent period Args: window_minutes: Time window for calculation
microstructure_analyzer.py:66
↓ 1 callers
Method
calculate_parkinson_volatility
Parkinson volatility estimator (uses high-low range) More efficient than close-to-close for range data Args:
volatility_forecaster.py:282
↓ 1 callers
Method
calculate_quarterly_distribution
Calculate 50% of quarterly profits for USDT airdrop Args: quarterly_profits_usdc: Total quarterly trading profit
investor_distribution.py:44
↓ 1 callers
Method
calculate_realized_volatility
Calculate realized volatility from returns Args: returns: Array of returns window: Rolling window si
volatility_forecaster.py:40
↓ 1 callers
Method
calculate_rolling_correlation
Calculate rolling correlation between two series Args: series1: First time series series2: Second ti
correlation_analyzer.py:30
↓ 1 callers
Method
calculate_vulnerability_multiplier
Calculate how current grove health affects vulnerability Returns multiplier (1.0 = normal, >1.0 = more vulnerable)
risk_analyzer.py:64
↓ 1 callers
Method
calculate_water_stress_index
Calculate Normalized Difference Water Index (NDWI) NDWI = (NIR - SWIR) / (NIR + SWIR) High values: High veg
satellite_data_processor.py:77
↓ 1 callers
Method
classify_enso_phase
Classify current ENSO phase from ONI value
el_nino_monitor.py:101
↓ 1 callers
Method
collect_all_regions
Collect all sugar production region data
sugar_collector.py:126
↓ 1 callers
Method
create_tables
Create all necessary tables
database.py:45
↓ 1 callers
Function
demo_ai_analysis
Demo: Generate AI prediction using Claude Sonnet 4
demo.py:63
↓ 1 callers
Function
demo_complete_workflow
Run complete demo workflow
demo.py:251
↓ 1 callers
Function
demo_database_storage
Demo: Store data in database
demo.py:170
↓ 1 callers
Function
demo_performance_tracking
Demo: Show how performance is tracked
demo.py:208
↓ 1 callers
Function
demo_weather_collection
Demo: Collect real weather data from NOAA
demo.py:15
↓ 1 callers
Method
detect_canopy_coverage
Calculate percentage of grove area with healthy canopy Args: ndvi: NDVI array threshold: Minimum NDV
satellite_data_processor.py:98
↓ 1 callers
Method
detect_volatility_regime
Detect current volatility regime Args: current_volatility: Current volatility level historical_volat
volatility_forecaster.py:235
↓ 1 callers
Method
disconnect
Close database connection
database.py:37
↓ 1 callers
Method
ensemble_volatility_forecast
Combine multiple volatility models for robust forecast Args: returns: Returns series high_prices: Hi
volatility_forecaster.py:332
↓ 1 callers
Method
estimate_price_impact
Estimate price impact of a trade Args: order_size: Size of hypothetical order direction: 'buy' or 's
microstructure_analyzer.py:168
↓ 1 callers
Method
evaluate_prediction
Compare prediction to actual outcome
backtest.py:166
↓ 1 callers
Method
ewma_volatility
EWMA (Exponentially Weighted Moving Average) volatility Args: returns: Returns series lambda_param:
volatility_forecaster.py:63
↓ 1 callers
Method
execute_airdrop
Execute quarterly USDT airdrop to all holders Args: total_usdt: Total USDT to distribute dry_run: If
investor_distribution.py:110
↓ 1 callers
Method
execute_buyback
Execute token buyback and burn Args: usdc_amount: Amount of USDC to use for buyback dry_run: If True
crypto_fundraise.py:82
↓ 1 callers
Method
explain_prediction_to_user
Generate human-readable explanation of prediction
claude_engine.py:453
↓ 1 callers
Method
extract_features
Extract comprehensive feature set for prediction Args: weather_data: Current and forecasted weather conditions
ensemble_predictor.py:54
↓ 1 callers
Method
fetch_conab_coffee_estimate
CONAB (Brazil's national supply agency) monthly coffee crop estimates. CONAB revisions often move KC 2-5% on release day.
icco_usda_scraper.py:112
↓ 1 callers
Method
fetch_icco_supply_data
ICCO quarterly supply/demand data for cocoa. Deficit/surplus estimate is the primary CC price driver. 2023-24 saw record defi
icco_usda_scraper.py:131
↓ 1 callers
Method
fetch_usda_wasde
Fetch latest USDA WASDE (World Agricultural Supply and Demand Estimates). Published monthly. Contains S&D estimates for all grain and
icco_usda_scraper.py:52
↓ 1 callers
Method
forecast_garch_volatility
Forecast volatility using fitted GARCH model Args: last_return: Most recent return last_variance: Mo
volatility_forecaster.py:192
↓ 1 callers
Method
forecast_price_impact
Forecast price impact from supply disruption Args: supply_disruption_pct: Expected supply reduction (0.10 = 10%)
market_impact_analyzer.py:52
↓ 1 callers
Method
generate_monthly_report
Generate comprehensive monthly report Args: year: Year (e.g., 2026) month: Month (1-12)
performance_tracker.py:185
↓ 1 callers
Method
generate_performance_report
Generate comprehensive performance metrics
main.py:293
↓ 1 callers
Method
generate_prediction
Generate AI prediction based on simulated forecast
backtest.py:126
↓ 1 callers
Method
generate_risk_report
Generate formatted risk report
risk_analyzer.py:498
↓ 1 callers
Method
generate_trading_recommendation
Generate specific trading recommendation Returns entry, exit, stop loss levels
market_impact_analyzer.py:250
↓ 1 callers
Method
get_brazil_sugarcane_forecast
GFS forecast for Sao Paulo sugarcane belt
sugar_collector.py:58
↓ 1 callers
Method
get_commodity_signals
Generate commodity trading signals based on ENSO phase. These are medium-term (3-6 month) directional biases.
el_nino_monitor.py:114
↓ 1 callers
Method
get_enso_forecast
Fetch ENSO probability forecast from IRI (International Research Institute for Climate and Society). 9-month ahead probabilities.
el_nino_monitor.py:84
↓ 1 callers
Method
get_execution_quality_score
Calculate overall execution quality score (0-100) Higher = better execution environment Returns: Executi
microstructure_analyzer.py:355
↓ 1 callers
Method
get_ghana_met_forecast
Fetch from Ghana Meteorological Agency. Falls back to NOAA GFS for Ivory Coast where direct API unavailable.
cocoa_westafrica_collector.py:93
↓ 1 callers
Method
get_historical_analogs
Find historical events similar to current conditions
database.py:241
↓ 1 callers
Method
get_inmet_forecast
Fetch forecast from INMET (Instituto Nacional de Meteorologia) Brazil's national meteorological service
coffee_brazil_collector.py:96
↓ 1 callers
Method
get_modis_ndvi
Fetch MODIS MOD13Q1 NDVI — free, 250m, 16-day composite. Primary free satellite layer for vegetation health monitoring.
satellite_ndvi_processor.py:118
↓ 1 callers
Method
get_ndvi_vegetation_index
Fetch MODIS NDVI data for canopy health assessment. NDVI below 0.4 indicates significant vegetation stress. Used as leading i
cocoa_westafrica_collector.py:218
↓ 1 callers
Method
get_next_distribution_date
Calculate next scheduled distribution date
investor_distribution.py:200
↓ 1 callers
Method
get_oni_index
Fetch current ONI (Oceanic Nino Index) from NOAA CPC. This is the definitive ENSO indicator.
el_nino_monitor.py:62
next →
1–100 of 214, ranked by callers