Skip to content

Downloading yfinance Data for Consumer Technology Companies

To download the stock data for consumer technology companies, we can use the yfinance library in Python. Let's start by installing the library.

!pip install yfinance

Now that we have installed the yfinance library, let's import it and download the stock data for some consumer technology companies.

import yfinance as yf

# Define the list of ticker symbols for consumer technology companies
tickers = ['AAPL', 'MSFT', 'GOOGL', 'AMZN', 'FB']

# Download the stock data for the tickers
data = yf.download(tickers, start='2021-01-01', end='2021-12-31')

data.head()

Visualizing the Stock Data using Plotly

To visualize the downloaded stock data, we can use the plotly library in Python. Let's start by installing the library.

!pip install plotly

Now that we have installed the plotly library, let's import it and create a line chart to visualize the stock data.

import plotly.express as px
import pandas as pd

# Assuming you have a data frame named 'data' with the required columns
#data1 = pd.DataFrame(data)  # Replace ... with your actual data

# Create a line chart
fig = px.line(data_frame=data, x=data.index, y='Close', title='Stock Prices of Consumer Technology Companies')

# Show the chart
fig.show()