Cryptourrency Price In Python with 5 Lines of code.

·

1 min read

Using pandas_datareader(package of pandas) and Yahoo Finance Api you can pull the price chart of Stocks or Cryptocurrency.Before starting, Install the package using pip command, pip install pandas_datareader.

import pandas_datareader as pdr
import datetime as dt

start = dt.datetime(2021,11,8)
end = dt.datetime(2021,11,13)

# for crypto prices
doge_price = pdr.get_data_yahoo('DOGE-USD', start, end)
print(doge_price)

# for stock prices
amazn_stock = pdr.get_data_yahoo('AMZN', start, end)
print(amazn_stock)