Elevate Your Metal Trading Game with Python-Powered Live Prices.

Why invest in metals ?


Investments in metals is considered as a very efficient way to protect your money in case of an economic instability. Precious metals are a secure investment as they are not subject to the dramatic volatility as stocks and other ways of investments. Also, in case of the stock market crash, the value of precious metals increases at the same time.

Thus, precious metals play the role of the stabilizer of the investors' portfolio and you should consider the certain part of it to be in metals and other low risk stocks.

Live Metal Prices.



How to get live metal prices ?


In our case we will use Python to access free online Live Metal Prices APIs from rapidapi.com, you need to get "your-api-key". Free API key will allow certain amount of requests per day and per month, in case of wider commercial use you can chose sutable paid subscription.

You will get access to Real-time prices for Gold, Silver, Palladium and Platinum in 160+ currencies including USD, GBP and EUR. Output data is in JSON format which can be easily converted to any suitable form for further visualisation and analysis, live metal prices data will definetely help you to gain stable profitable market profits.



Python code to obtain Metal Prices data:


Output data: Real-time Gold, Silver, Palladium, Platinum and 160+ currency rates based on selected Currency.



import requests

url = "https://live-metal-prices.p.rapidapi.com/v1/latest/XAU,XAG,PA,PL,GBP,EUR/EUR"

headers = {
"X-RapidAPI-Key": "your-api-key",
"X-RapidAPI-Host": "live-metal-prices.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

Metal Prices data output:



{"success":true,"validationMessage":[],"baseCurrency":"EUR","unit":"ounce","rates":{"XAU":1650.3580459999998,"XAG":19.328373,"PA":1915.275175,"PL":953.3725,"GBP":0.8580240147476459,"EUR":1}}


Python code to obtain Metal Prices data In Grams:


Output data: Real-time Gold, Silver, Palladium, Platinum and 160+ currency rates based on selected Currency In Grams.



import requests

url = "https://live-metal-prices.p.rapidapi.com/v1/latest/XAU,XAG,PA,PL,GBP,EUR/EUR/gram"

headers = {
"X-RapidAPI-Key": "your-api-key",
"X-RapidAPI-Host": "live-metal-prices.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

Metal Prices data output In Grams:



{"success":true,"validationMessage":[],"baseCurrency":"EUR","unit":"gram","rates":{"XAU":53.06016642953219,"XAG":0.6214207218111,"PA":61.5774375688725,"PL":30.651593235749996,"GBP":0.8580240147476459,"EUR":1}}




See also related topics: