Let's say I want to import tickers from yahoo finance and want to create a function for the same. How can I create it a way that I can name the variable of the said ticker within the function?
For example:
def function(x, y):
x = pdr.get_data_yahoo(y, start, end)
return x
Here I want to take x
input as the name that the we want to assign to the variable and y
as the ticker. Which would be in a 'AAPL' format.
For example:
function(aapl, 'AAPL')
Is there any way to achieve this so I can quickly import a historical data and assign it to a variable?