A Python package to get the latest commodities from the Commodities-API
Project description
Commodities-API
Commodities-API - The ultimate API for accessing comprehensive and accurate real-time and historical rates on various commodities effortlessly. Commodities-API supports 350+ symbols with updates every 60 seconds. Try the Start 7-Day Free Trial. Cancel anytime at your convenience.
Key Features:
- Built for Developers: Tailored for developers, ensuring ease of use and seamless integration.
- Robust JSON API: A powerful JSON API designed for accurate and efficient data retrieval.
- Top-Tier Security: Trust Commodities-API with advanced security measures to protect your data.
- Reliable Data Sources: Benefit from reliable and accurate data from trusted sources.
- Flexible Integration: Easily integrate Commodities-API into any language for diverse applications.
- Historical Data Access: Dive into historical data for comprehensive analysis and informed decision-making.
- Exceptional Accuracy: Rely on Commodities-API for spot-on accuracy in real-time and historical data.
- User-Friendly Documentation: Navigate through our comprehensive documentation for a smooth integration process.
- Specialized Support: Count on our dedicated support team for assistance tailored to your specific needs.
Supported Commodities
Explore a wide range of supported commodities, including precious metals, energy resources, agricultural products, and more. From coffee to electricity, we cover it all. View Supported Commodities
Documentation
For detailed information on API endpoints, usage, and integration guidelines, check our API Documentation.
Start using Commodities-API today for unparalleled access to commodities data. Visit Commodities-API.com and integrate in just minutes!
Installation
You can install Commodities-API Python SDK with pip.
pip commodities-api
Usage
The Commodities-API Python SDK is a wrapper around the requests library. Commodities-API supports a GET request for now.
Sign-up to Commodities-API to get your API key and some credits to get started.
Making the GET request
>>> from commodities_api import CommoditiesApiClient
>>> client = CommoditiesApiClient(access_key='REPLACE-WITH-YOUR-ACCESS-KEY')
>>> response = client.get_latest("base", ["symbols"])
Request Example
>>> from commodities_api import CommoditiesApiClient
>>> client = CommoditiesApiClient(access_key='REPLACE-WITH-YOUR-ACCESS-KEY')
>>> response = client.get_latest("USD", ["RICE", "WHEAT", "SUGAR"])
Response Example
{
"data": {
"success": true,
"timestamp": 1715796300,
"date": "2024-05-15",
"base": "USD",
"rates": {
"RICE": 0.052356020942408,
"SUGAR": 5.3676865271068,
"USD": 1,
"WHEAT": 0.0036618232950551,
"USDRICE": 19.100000000000136,
"USDSUGAR": 0.1863000000000006,
"USDWHEAT": 273.08799999999803
},
"unit": {
"RICE": "per cwt",
"WHEAT": "per metric ton",
"SUGAR": "per lb"
}
}
}
AVAILABLE METHODS
>>> get_latest(base: str, symbols: List[str])
>>> get_historical(date:str, base:str, symbols: List[str])
>>> get_time_series(start_date: str, end_date: str, symbol: str)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file commodities_api-0.3.tar.gz
.
File metadata
- Download URL: commodities_api-0.3.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb9b47919fc05a79d648fd899c2a1c41fc72fc2edda998f1dd4b8cca1a3da2de |
|
MD5 | 4435e0e85cc2672b74febdf5f26e2b15 |
|
BLAKE2b-256 | 0ed3a9f36bea897c9ccf439442e88c2fcddc4296fb0e8a0b73158e0b12713b65 |
File details
Details for the file commodities_api-0.3-py3-none-any.whl
.
File metadata
- Download URL: commodities_api-0.3-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4ce9c37b47008ff9d237a9dbce42b3732c876934c25f1221235e6d60252fb06 |
|
MD5 | c74d30b973f5310fb83665118fe3a8db |
|
BLAKE2b-256 | e9256d19deb34b1b727d271ae2178410d4c90ccd37dd4b08f7f822b45e0b50a6 |