|
1 |
| -Stock Price Data Extraction and Visualization task: |
2 |
| - |
3 |
| -1. Import the necessary libraries for web scraping, data manipulation, and plotting. |
4 |
| -2. Define the URLs for web search to retrieve the stock prices of Amazon and Walmart. |
5 |
| -3. Use web scraping techniques to extract the stock price data from the web pages Url = 'https://mocki.io/v1/a2491222-4058-40c5-8b1b-3f8f2e3df42a' |
6 |
| -4. Store the extracted data it has 'company','description','initial_price','price_2002','price_2007','symbol' fields in JSON response in a suitable data structure, such as a list or a pandas DataFrame. |
7 |
| -5. Plot the stock prices of Amazon and Walmart on the same chart using a plotting library like Matplotlib. |
8 |
| -6. Create a spreadsheet in table form using a library like pandas. |
9 |
| -7. Populate the spreadsheet with the stock price data for the two stocks. |
10 |
| -8. Save the chart and the spreadsheet to files using appropriate file formats. |
11 |
| -9. Check if the file exists in the current working directory. If not, create the file. |
12 |
| -10. Open the saved chart and spreadsheet files using the default applications on the system. |
| 1 | +Stock Price Data Extraction and Visualization application with GUI: |
| 2 | + |
| 3 | +1. **Define the requirements:** |
| 4 | + - The application should allow the user to enter a company name. |
| 5 | + - The application should fetch stock data for the entered company from a specified URL. |
| 6 | + - The application should display the fetched data in a table. |
| 7 | + - The application should plot the initial price, price in 2002, and price in 2007 for the entered company. |
| 8 | + - The application should display messages in a text box. |
| 9 | + |
| 10 | +2. **Design the UI:** |
| 11 | + - The UI should have a vertical layout. |
| 12 | + - The top of the UI should have a label instructing the user to enter a company name. |
| 13 | + - Below the label, there should be a text input field for the user to enter the company name. |
| 14 | + - Below the text input field, there should be a button that the user can click to start fetching and processing the data. |
| 15 | + - Below the button, there should be a text box to display messages. The text box should be read-only. |
| 16 | + - Below the text box, there should be a table to display the fetched data. |
| 17 | + - Below the table, there should be a plot to display the stock prices. |
| 18 | + |
| 19 | +3. **Fetch and process the data:** |
| 20 | + - Use a separate thread to fetch and process the data to avoid blocking the UI. |
| 21 | + - Use web scraping techniques to extract the stock price data from the web pages Url = 'https://mocki.io/v1/a2491222-4058-40c5-8b1b-3f8f2e3df42a' |
| 22 | + - Fetch the data from the URL using a library like requests. |
| 23 | + - Convert the fetched data into a format that can be displayed in the table and the plot. A library like pandas can be used for this. |
| 24 | + - The JSON response looks like this. |
| 25 | + ```json |
| 26 | + [ |
| 27 | + { |
| 28 | + "company": "3M", |
| 29 | + "description": "3M, based in Minnesota", |
| 30 | + "initial_price": 44.28, |
| 31 | + "price_2002": 56.27, |
| 32 | + "price_2007": 95.85, |
| 33 | + "symbol": "MMM" |
| 34 | + }, |
| 35 | + { |
| 36 | + "company": "Amazon.com", |
| 37 | + "description": "Amazon.com, Inc. is an online retailer in North America", |
| 38 | + "initial_price": 89.38, |
| 39 | + "price_2002": 17.01, |
| 40 | + "price_2007": 93.43, |
| 41 | + "symbol": "AMZN" |
| 42 | + }, |
| 43 | + .... |
| 44 | + .... |
| 45 | + ] |
| 46 | + ``` |
| 47 | + |
| 48 | +4. **Update the UI with the fetched data:** |
| 49 | + - When the data is ready, update the table and the plot in the UI. |
| 50 | + - If there's an error while fetching or processing the data, display an error message in the text box. |
| 51 | + |
| 52 | +5. **Handle user interaction:** |
| 53 | + - When the user clicks the button, start the thread to fetch and process the data. |
| 54 | + - When the user enters a company name in the text input field, use this name to fetch the data. |
| 55 | + |
| 56 | +6. **Test the application:** |
| 57 | + - Test the application with different company names to make sure the data is fetched and displayed correctly. |
| 58 | + - Test the application with invalid input to make sure errors are handled correctly. |
| 59 | + - Test the application with slow or no internet connection to make sure it doesn't crash or hang. |
0 commit comments