Skip to main content

A Python package to get the latest metals prices from the Metals-API

Project description

Metals-API

Metals-API Python SDK - The ultimate API for accessing precious metals spot prices and historical data effortlessly. Explore real-time and historical metal rates with exceptional accuracy.

Key Features:

  • Built for Developers: Tailored for developers, ensuring ease of use and seamless integration.
  • Powerful JSON API: Robust JSON API designed for accurate and efficient data retrieval.
  • Bank-Level Security: Trust Metals-API with top-tier security measures to safeguard your data.
  • Reliable Data Sources: Benefit from reliable and accurate data derived from trusted sources.
  • Flexible Integration: Easily integrate Metals-API into any language, making it adaptable for diverse applications.
  • Historical Data Access: Dive into historical data for comprehensive analysis and informed decision-making.
  • Exceptional Accuracy: Rely on Metals-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 Symbols

Explore a wide range of supported symbols, including gold, silver, platinum, palladium, and various others. From LBMA Gold to LME Steel, we cover it all. View Symbols

Available Endpoints

The Metals-API API comes with multiple endpoints, each providing different functionality. However, in this section, we will focus on the Latest Rates endpoint, Historical Rates and Times Series

  1. Latest Rates Endpoint

    • Returns real-time exchange rate data for all available or a specific set of currencies. (The number of symbols per API request depends on the acquired plan).
  2. Historical Rates Endpoint

    • Returns historical exchange rate data for a specific set of currencies. (The number of symbols per API request depends on the acquired plan).
  3. Time-Series Data Endpoint

    • Returns daily historical exchange rate data between two specified dates for all available or a specific set of currencies. (The date limits per API request depend on the acquired plan).

Documentation

For detailed information on API endpoints, usage, and integration guidelines, check our API Documentation.

Start using Metals-API today for unparalleled access to precious metals data. Visit Metals-API.com and integrate in just minutes!

Installation

You can install Metals-API Python SDK with pip.

pip metals_api

Usage

The Metals-API Python SDK is a wrapper around the requests library. Metals-API supports a GET request for now.

Sign-up to Metals-API to get your API key and some credits to get started.

Making the GET request

>>> from metals_api import MetalsApiClient

>>> client = MetalsApiClient(access_key='REPLACE-WITH-YOUR-ACCESS-KEY')

>>> response = client.get_latest("base", ["symbols"])

Request Example

>>> from metals_api import MetalsApiClient

>>> client = MetalsApiClient(access_key='REPLACE-WITH-YOUR-ACCESS-KEY')

>>> response = client.get_latest("USD", ["XAU", "XAG", "XPT"])

Response Example

{
    "success": true,
    "timestamp": 1715695200,
    "date": "2024-05-14",
    "base": "USD",
    "rates": {
        "USD": 1,
        "XAG": 0.034989609514923,
        "XAU": 0.00042501745902135,
        "XPT": 0.0009786668257129,
        "USDXAG": 28.579913118878963,
        "USDXAU": 2352.8445214994495,
        "USDXPT": 1021.79819906694
    }
}

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

This version

0.4

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metals_api-0.4.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

metals_api-0.4-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file metals_api-0.4.tar.gz.

File metadata

  • Download URL: metals_api-0.4.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for metals_api-0.4.tar.gz
Algorithm Hash digest
SHA256 4e54831093d724797cd673029c6d128939142e20c4e101f9767815c762549f25
MD5 c50a1039ebb2f4c27f4c6f7c7a6f24b7
BLAKE2b-256 478b9e4dd88faca343f66d2f5c5d3d436c70a0aae11a013cba28f8692841f775

See more details on using hashes here.

File details

Details for the file metals_api-0.4-py3-none-any.whl.

File metadata

  • Download URL: metals_api-0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for metals_api-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 64ede1590a307859cf481a2283b221709c3415c5485b3919e753bb250bc90402
MD5 c9a06cfb7abcaa3575a1f89854c40e32
BLAKE2b-256 cda8f9a74761650c3af3f06743f7c1dc195d88800c79847fa2c0e35ff95c5225

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page