translate Englishattach_moneyUSDQuick AI Login
emoji_food_beverage Exploremaps Maps Listcurrency_exchange Live Currency Ratesfoggy Global Weather Forecastmonitor_heart Commodities Futures Marketapi API Docs

Commodities API Documentation

Access real-time exchange rates for currencies & crypto. This API provides accurate, up-to-date rates for integrating into your financial applications.

Below are the endpoints for accessing exchange rates. Learn how to integrate the API into your application.

Route Parameters:

  • :region *Please check location table here
    (e.g., "SOUTH|ARAB|EAST|NORD").

Response based on params:

{
  "success": true,
  "data": {
    "commodities": [
      {
        "symbol": "HEUSX",
        "name": "Lean Hogs Futures",
        "price": 88.6,
        "changesPercentage": -0.02820874,
        "change": -0.025,
        "dayLow": 93.4,
        "dayHigh": 94.8,
        "yearHigh": 113.7,
        "yearLow": 75.1,
        "priceAvg50": 106.01,
        "priceAvg200": 92.30113,
        "volume": 29830,
        "avgVolume": 11280,
        "open": 88,
        "previousClose": 93.9,
        "timestamp": 1756317900
      },
      {
        "symbol": "ZCUSX",
        "name": "Corn Futures",
        "price": 406,
        "changesPercentage": 0,
        "change": 0,
        "dayLow": 405.25,
        "dayHigh": 406.75,
        "yearHigh": 504.5,
        "yearLow": 363.75,
        "priceAvg50": 400.89,
        "priceAvg200": 443.11874,
        "volume": 6977,
        "avgVolume": 128955,
        "open": 406,
        "previousClose": 406,
        "timestamp": 1756354080
      },
      {
        "symbol": "ALIUSD",
        "name": "Aluminum Futures",
        "price": 2540.25,
        "changesPercentage": -0.12778,
        "change": -3.25,
        "dayLow": 2526.75,
        "dayHigh": 2547.25,
        "yearHigh": 2694,
        "yearLow": 2155,
        "priceAvg50": 2493.9,
        "priceAvg200": 2490.795,
        "volume": 82,
        "avgVolume": 3,
        "open": 2579.5,
        "previousClose": 2543.5,
        "timestamp": 1756349750
      }
    ]
  }
}

GET

check_boxAll Commoditiescheck_box_outline_blankSpecific Futures

This endpoint provides the current exchange rates for the requested currencies.

JavaScript
Python
Php
Java
c#
Ruby
Go
Swift
import Foundation

struct APIClient {
    static let baseURL = "https://exchangegrid.api.mapwale.com/v1"
    
    static func fetchData() async throws -> [String: Any] {
        // API configuration
        let params = [
            "region": "YOUR_REGION"  // Replace with actual region value
        ]
        
        // Build URL
        var urlComponents = URLComponents(string: baseURL)!
        
        // Add path parameters
        let pathParams = ["region"]
        let pathItems = pathParams.map { params[$0]! }
        urlComponents.path += "/" + pathItems.joined(separator: "/")
        
        // Add query parameters
        let queryParams: [String: String] = {"show":"all","list":"USD,INR,JPY,BTC,DOGE"}
        urlComponents.queryItems = queryParams.map { URLQueryItem(name: $0.key, value: $0.value) }
        
        guard let url = urlComponents.url else {
            throw URLError(.badURL)
        }
        
        // Create request
        var request = URLRequest(url: url)
        request.httpMethod = "GET"
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        
        // Add body for POST/PUT requests
        if ["POST", "PUT"].contains("GET") {
            let bodyData = {}
            request.httpBody = try JSONSerialization.data(withJSONObject: bodyData)
        }
        
        // Send request
        let (data, response) = try await URLSession.shared.data(for: request)
        
        guard let httpResponse = response as? HTTPURLResponse else {
            throw URLError(.badServerResponse)
        }
        
        guard httpResponse.statusCode < 400 else {
            throw URLError(.badServerResponse)
        }
        
        guard let result = try JSONSerialization.jsonObject(with: data) as? [String: Any] else {
            throw URLError(.cannotParseResponse)
        }
        
        return result
    }
}

// Example usage
@main
struct APIExample {
    static func main() async {
        do {
            let result = try await APIClient.fetchData()
            let prettyJSON = try JSONSerialization.data(withJSONObject: result, options: .prettyPrinted)
            if let jsonString = String(data: prettyJSON, encoding: .utf8) {
                print(jsonString)
            }
        } catch {
            print("Error: \(error)")
        }
    }
}

Query Parameters:

  • authorization *Specify authorization for site
    (e.g., authorization="<API-KEY>").
  • show Specify which rates to show
    (e.g., show="commodities"|"stocks"|"index").
  • list Comma-separated list of tickers codes
    (e.g., list="GCUSD,ZCUSX,ALIUSD").

List parameter for Commodity Rates

expand_more