Skip to content

Get Iron Ore Rates Using Python With This API

Do you want to get iron ore rates using python? You should read this article, we will help you to get it by an API.

Iron Ore has become the most valuable metal for many industries, one of them is the steel industry that it is too important worldwide. As a consequence it has increased steel manufacturing, keeping track of iron ore pricing is crucial if you wish to invest in it. Finding a website, program, or software that gives this type of information in real-time is becoming increasingly difficult. 

You can get it, though, by utilizing an API, which is an interface that collects data from a place and then transmits it to the user who requested it. It’s that simple, and you’ll find it useful in a variety of scenarios.

For developers, this technology could be really useful in order to create applications or websites with this data because they obtain the prices of any metal in Python that is one of the most popular languages of programming. Besides, Python is used in web programming, artificial intelligence (AI), machine learning (ML), operating systems, mobile app development, and video game creation.

Get Iron Ore Rates Using Python With This API

If you want to be updated with the prices of metals, you should use  Metals-API, which is the most reliable API and receives data from over 15 credible data sources every minute. Among them are banks and financial data providers. As a result, you’ll get a very exact price.

Real-time iron ore, gold, silver, and other metal values are available. This data can be used in spreadsheets, websites, mobile apps, and other corporate applications.

It is available in many currencies more than 170, such as bitcoin, litecoin, and cryptocurrencies, this kind of currency is not easy to find on the internet. With Metals-API you will be able to convert any quantity from one currency to another

Get Iron Ore Rates Using Python With This API

The API is defined in JSON API (JavaScript Object Notation) and Python, each application does not need to develop its own ad-hoc code to connect to servers that communicate in a particular way.

How to do it 

1. Get your API key from www.metals-API.com.

2. In the website’s list, look for the lead symbol and currency sign you want to use.

3. Use these symbols to add metal and money to the list, then make the API call.

4- You have the option of using Python or JSON as a programming language.

You should use the Request module to get Python information. This is how it should appear like:

 import requests

    base_currency = 'USD'
    symbol = 'IRON' 
    endpoint = 'latest'
    access_key = 'API_KEY'

    resp = requests.get(
        'https://metals-api.com/api/'+endpoint+'?access_key='+access_key+'&base='+base_currency+'&symbols='+symbol)
    if resp.status_code != 200:
        # This means something went wrong.
        raise ApiError('GET /'+endpoint+'/ {}'.format(resp.status_code))
    print(resp.json())

Also published on Medium.

Published inAppsTechnology
%d bloggers like this: