**Tags: Python, Financial Analysis, Portfolio Management, Portfolio Performance, Visualization, matplotlib, Trading Strategy**

**Introduction**

Beating the market consistently is a holy grail of any money manager. In the context of stocks, the market is the stock market index.

**Objectives**

The main objective of this project is to help you acquire the skill to construct and re-balance market asset holdings, and to measure their performances and metrics to execute a trading strategy to outperform the benchmark market.

**Data**

Data source(s) for the entire assignment needs to be the same across all sections and has to be mentioned at the beginning of your report.

Sample period for the assignment is from 1 April 2016 till 1 October 2019

**Assignment – Section A (Submission by Mid-day, 02/12/2019)**

**Answer all parts of the following questions using solutions coded in Python 3.6+. Marks allocated to each part in square brackets.**

. 1) Using the 20 September 2019 listing of FTSE100 firms, use the 100 stock listings (ignore the Royal Dutch Shell – B Class Shares) and construct a price-weighted index. Also, download the FTSE100 index data for the sample period. After you have constructed the price-weighted index, and have the FTSE100 data, plot the time series of your indexes using **matplotlib** library.
[30]

. 2) Calculate the following performance measures for your price-weighted index and FTSE100 index time series (plot graphical results where possible):

A. Compounded Annual Growth Rate which will give the average annual return

B. Standard deviation of daily returns

C. Rolling standard deviation with a frequency of 30 days

D. Annualised Sharpe ratio using LIBOR as risk-free rate

E. Maximum drawdown

F. Maximum drawdown duration

**Assignment – Section B (Submission by Mid-day, 31/01/2020)**

1) Create a trading strategy using performance analysis completed in Section A, where you can utilise FTSE 100 stocks / FTSE 100 index and associated derivatives to setup a portfolio allocation using user input to take into account an investor’s risk tolerance in terms of maximum drawdown and expected return. The goal of the trading strategy is to outperform the FTSE100 index. Describe your own trading strategy based on the findings, to include writing the code for your trading strategy and execution of the strategy with relevant output in plots. [50]

2) Now that you’ve got your trading strategy at hand, it’s a good idea to also backtest it and calculate its performance. However, when you’re backtesting, it’s a good idea to keep in mind that there are some pitfalls. For example, external events such as market regime shifts, which are regulatory changes or macroeconomic events. Also, liquidity constraints, could affect your backtesting heavily. Consider answering these questions:

A. Is it possible to make money using your strategy for the entire sample period?

B. If it is possible, what is your trading strategy? Think about details of entry (buy) and exit (sell), how many days would you hold? C. Is this a risky strategy?

C. How much do you expect to make on each trade?

D. How many times do you expect to be able to act on this opportunity each year?

E. Is there some way to reduce the risk?

F. How would you improve your trading strategy based on your backtesting results?