The Security Characteristic Line (SCL) Analysis project aims to evaluate the performance of selected stocks in relation to market risk. This project leverages historical stock prices, market returns, and risk-free rates to compute expected returns, alpha, and beta, and visualizes the relationships through scatter plots and the SCL.
- Clone the repository:
git clone https://github.com/ejb1987/SCL.git cd SCL
- Install required packages:
Make sure you have pip installed. Then run:
pip install -r requirements.txt
Open the Jupyter Notebook:
jupyter notebook SCL.ipynb
Input your selected stock ticker (e.g., AAPL for Apple Inc.). For UK companies, use the format ticker.L (e.g., BP.L for BP).
Run the cells in the notebook to perform the CAPM analysis. You will obtain:
- Average annual returns and variance for the selected stock and the corresponding market index (US or UK).
- The computation of CAPM beta and Jensen's alpha, which quantify the sensitivity of the stock's returns to market movements and the stock's excess return, respectively.
- A scatter plot comparing the weekly returns of the stock and the market index, along with the Security Characteristic Line (SCL), which represents the relationship between the excess return of the stock and the excess return of the market.
- Average Annual Return Calculation: Computes the expected annual return for the selected stock and its corresponding market index.
- Risk-Free Rate Adjustment: Automatically selects the appropriate market index and risk-free rate based on the stock market.
- Beta and Alpha Calculation: Analyzes the stock's sensitivity to market movements and calculates its excess return, enabling an understanding of its risk-adjusted performance.
- Visualizations: Displays scatter plots of weekly returns and the Security Characteristic Line (SCL), providing insights into the stock's risk-return profile.
Contributions are welcome! Please feel free to fork the repository and submit a pull request. If you have any suggestions or find any bugs, please open an issue.
This project is licensed under the MIT License. See the LICENSE file for details.
Ehsan - [email protected]
Project Link: https://github.com/ejb1987/CAPM