How To Get Silver Price Data In Python Using Yfinance

There are several ways to get silver prices data in python, such as using an API, doing web scraping and many more.

This can be tedious, can cost you money (depending on the API) and, most importantly, is very time-consuming.

However, the simplest and free solution to get silver prices is by retrieving them straight from yahoo finance, using the yfinance package.

Below you can find a solution to get silver price data using yfinance package.

What is Yfinance?

Yfinance is a is a package that you can use to access financial data within yahoo finance. By doing so, this allows you to skip the usage of API’s and webscraping since the package does all the work for you.

How To Get Silver Price Data In Python

Step 1: Install and import yfinance package

The simplest way to install the yfinance package is by using pip install.

pip install yfinance

Step 2: Import yfinance package

Next, we want to import our newly downloaded package into our development platform, this can be done by using the import function.

import yfinance as yf

Step 3: Get Silver Ticker Symbol

Now that we have our packages all installed, we need to tell yahoo finance that we want silver prices data.

We can use yfinance’s method yf.Ticker() to get the data of our silver price.

To find out the ticker symbol of silver, you can just go to “” and search for silver prices.

Silver’s ticker symbol is currently reporting as “SI=F” on yahoo.

yahoosilver = yf.Ticker("SI=F")

Step 4: Get the current market price of silver

There are many attributes that you can call in yfinance, one of them is the “regularMarketPrice” by inputting this value, yfinance automatically retrieves the latest price of silver.

So, in our yahoosilver variable, we want to access the info method and get the “regularMarketPrice” of silver.

currentsilverprice =['regularMarketPrice']

However, by using this method you should be aware, that there are some price differences. This is due to yahoo retrieving the information from the comex exchange or CME group.

But by using this method, it is by far one of the most quickest and easiest way to get silver prices in python.