Market Data API

This section contains all the endpoints related to agricultural market data, including crop prices, price history, and market insights.

GET /v1/market/prices
Rate Limit: 1000/min Cost: ₦0.0100

Get Crop Prices

Get current market prices for agricultural crops.

Example API Call

curl -X GET "https://api.riwe.io/v1/market/prices" \
  -H "X-API-KEY: your_api_key_here"

Parameters

Name Type Required Description

Example Response

{
    "date": "2023-08-01",
    "prices": [
        {
            "name": "Maize",
            "unit": "kg",
            "market": "Mile 12 Market",
            "crop_id": 1,
            "variety": "Yellow",
            "location": "Lagos",
            "price_trend": "+5%",
            "last_updated": "2023-08-01T08:30:00Z",
            "retail_price": 220,
            "wholesale_price": 180
        },
        {
            "name": "Rice",
            "unit": "kg",
            "market": "Mile 12 Market",
            "crop_id": 2,
            "variety": "Local",
            "location": "Lagos",
            "price_trend": "-2%",
            "last_updated": "2023-08-01T08:30:00Z",
            "retail_price": 650,
            "wholesale_price": 550
        }
    ],
    "currency": "NGN"
}
GET /v1/market/insights
Rate Limit: 300/min Cost: ₦0.0300

Get Market Insights

Get market insights and forecasts for agricultural commodities.

Example API Call

curl -X GET "https://api.riwe.io/v1/market/insights" \
  -H "X-API-KEY: your_api_key_here"

Parameters

Name Type Required Description

Example Response

{
    "date": "2023-08-01",
    "insights": [
        {
            "name": "Maize",
            "crop_id": 1,
            "factors": [
                "Delayed rainfall affecting planting in northern regions",
                "Increased demand from poultry sector",
                "Rising input costs affecting farmer margins"
            ],
            "demand_trend": "Increasing",
            "supply_status": "Moderate",
            "price_forecast": {
                "1_month": "+5% to +10%",
                "3_month": "+2% to +8%",
                "6_month": "-5% to +5%"
            },
            "recommendations": [
                "Consider forward contracts to lock in current prices",
                "Monitor rainfall patterns for potential supply disruptions",
                "Watch for government import policy changes"
            ],
            "current_price_range": "\u20a6170-\u20a6190/kg"
        }
    ],
    "last_updated": "2023-08-01T10:15:00Z",
    "market_overview": "Agricultural markets are showing moderate volatility due to seasonal factors and macroeconomic pressures."
}
GET /v1/market/price-history
Rate Limit: 500/min Cost: ₦0.0200

Get Price History

Get historical price data for a specific crop.

Example API Call

curl -X GET "https://api.riwe.io/v1/market/price-history" \
  -H "X-API-KEY: your_api_key_here"

Parameters

Name Type Required Description

Example Response

{
    "name": "Maize",
    "unit": "kg",
    "market": "Mile 12 Market",
    "crop_id": 1,
    "variety": "Yellow",
    "currency": "NGN",
    "end_date": "2023-03-01",
    "interval": "weekly",
    "location": "Lagos",
    "price_data": [
        {
            "date": "2023-01-01",
            "retail_price": 210,
            "wholesale_price": 170
        },
        {
            "date": "2023-01-08",
            "retail_price": 215,
            "wholesale_price": 175
        }
    ],
    "start_date": "2023-01-01"
}