Question: Objective: In this project, you will create a stock price tracker program that: Reads initial stock prices for multiple companies from a file. Processes daily
Objective:
In this project, you will create a stock price tracker program that:
Reads initial stock prices for multiple companies from a file.
Processes daily updates to the stock prices based on data from another file, which includes price changes increases or decreases
Outputs the daily updated stock prices to a new file, showing prices after each update.
This project will help you practice essential programming concepts, including:
File InputOutput reading from and writing to files
Data structures for organizing stock data.
Loops and conditional logic for processing stock price changes.
Functions to structure your code.
Exception handling to manage filerelated or data processing errors.
By the end of this project, you will have a working program that processes stock price changes for these companies.
Provided Files:
You will be given two files:
stockprices.csv: This file contains the starting stock prices for several companies eg TSLA, AAPL, MSFT
stockupdates.csv: This file contains daily updates to the stock prices. Each row represents a day's change in price for each company, with positive numbers indicating an increase and negative numbers indicating a decrease.
StepbyStep Instructions:
Step : Set up the Basic Structure of the Program
Define a function that will simulate a stock price tracker. This function will:
Read the initial stock prices.
Process daily updates from the second file.
Write the daily updated prices to a new file, with each row showing the prices for a specific day.
Start by defining the function and printing a message that confirms the program is running.
Step : Reading the Initial Stock Prices from the File
Use thestockprices.csv file that is provided. It contains the starting stock prices for several companies.
In your program:
Open stockprices.csv for reading.
For each line in the file, extract the ticker symbol eg "TSLA" and the stock price eg
Store this information in a suitable data structure such as a dictionary where the key is the ticker symbol and the value is the stock price.
After reading the file, print the initial stock prices to the screen to confirm they were loaded correctly.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
