Setup First we import the mandatory libraries, together with yfinance for fetching the inventory information. import…