This week, you will focus on key financial metrics and their coding implementations. The assignment is designed to be easily gradable by ChatGPT based on the quality and correctness of your code, including plotting tasks.
- Write Python code to calculate the Pearson correlation coefficients between the returns of at least three stocks.
- Plot a heatmap of the correlation matrix using libraries like Seaborn.
Submission: Submit the Python code used to calculate and plot the correlation matrix.
Grading Criteria: Correctness and efficiency of the code, including the plot.
- Write Python code to calculate the average return and standard deviation (risk) for the same set of stocks.
- Plot a scatter plot to visualize the risk and return of the chosen stocks.
Submission: Submit the Python code used to calculate these metrics and plot the scatter plot.
Grading Criteria: Correctness and efficiency of the code, including the plot.
- Write Python code to fetch and interpret the performance of a chosen sector. The code should output specific metrics like YTD return, P/E ratio, etc.
- Plot a bar chart to visualize the performance metrics of the chosen sector.
Possible Data Source: You can use APIs like Alpha Vantage, Yahoo Finance, or Quandl to fetch sector performance data.
Submission: Submit the Python code along with the output metrics and bar chart.
Grading Criteria: Correctness and efficiency of the code, including the plot, as well as the relevance of the chosen metrics.
- Write Python code to simulate and plot the efficient frontier based on a set of portfolios generated from the chosen stocks.
Submission: Submit the Python code used to generate and plot the efficient frontier.
Grading Criteria: Correctness and efficiency of the code, including the plot, as well as the relevance of the chosen portfolios.
- Submit your Python code for each task in a format that can be easily evaluated by ChatGPT, including the plots.
Grading Criteria: Each task will be graded based on the correctness and efficiency of the submitted code, including the plots.
- For all tasks, you can use Python libraries like Pandas, NumPy, and Matplotlib, but the focus is on your ability to write correct and efficient code.
- Make sure to comment your code to explain what each part is doing. This will not only make it easier to grade but also help you understand your own work better.
- You can discuss your code and its outputs with your peers and also with ChatGPT before final submission.