Question: Write a function named read_prices that takes one parameter that is a list of ticker symbols that your company owns in their portfolio. You are

Write a function named "read_prices" that takes one parameter that is a list of ticker symbols that your company owns in their portfolio. You are to read a CSV file for each of these tickers which contains the price of each stock throughout the year and return these prices in a single dictionary. The returned dictionary will contain ticker symbols as keys and dictionaries as values where the inner dictionaries will have dates as keys (as strings in the format "YYYY-MM-DD") and prices as values as floats. All said this dictionary will contain the price for any stock on any date over the past year. You may assume there will be files named ".csv" for each ticker symbol in the input list. For example, if "TXN" is in the ticker list then a file named "TXN.csv" will be in the same directory as your code during testing and each row of this CSV file will be in the format "date,price,volume" where date is in the format YYYY-MM-DD, the price is a float, and volume is an integer representing the number of shares that were traded on that day by all traders (you will not need the trading volume for this prelab). Example line for AAPL stock: "2015-10-20,112.673677,48967800"

(It is python)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!