Projects · competition · 2024

Morgan Stanley Coding Challenge 2024

EMA-based algorithmic currency trading bot. Placed 7th out of 27 teams in a Morgan Stanley-hosted competition.

Role
Algorithm Developer
Team
5 members
Period
1–15 Oct 2024
Duration
14 days
Status
Shipped
Category
competition

Gallery

Screenshot 1

Tech Stack

Python REST APIs Git

Overview

Participating in the Morgan Stanley Coding Challenge, our task revolved around financial markets — specifically currency exchange between GBP and EUR. The EUR/GBP trading pair is a quotation on the current value of the Euro against the Pound.

We were grouped into teams of 5 and given £1,000,000 in startup capital. Based on market predictions, we were to move our assets for the highest return while minimising losses, with final ranking determined by portfolio value at the close of the simulation.

Approach & Architecture

As this was an introductory project into financial trading bots, our team decided on the EMA (Exponential Moving Average) trading strategy. EMA assigns greater weight to the most recent price data, making it more responsive to recent market moves than a simple moving average.

By using a short-term EMA (5 periods) and a long-term EMA (20 periods), the crossing of these two graphs triggered a trade signal within the program to buy or sell.

Risk and Reward Management

The bot incorporated a risk management system by adjusting trade size based on a fixed risk percentage and a reward ratio of 2:1. This meant that our take profit was set at twice the distance of the stop-loss.

Development & Learning

Given that teams were randomly assigned, it was important to first assess each member’s strengths to better distribute the workload. We ended up with a 3-2 split:

  • 3 members working on developing the trading strategy
  • 2 members working on API calls — GETting current market data from the simulation, and POSTing buy/sell orders based on the strategy output

My role was programming the trading strategy based on research into the EMA approach conducted by one of my sub-team members. This required accurately interpreting the workings of the strategy into code and creating signals for when the API should buy or sell based on previous price data.

Results

  • Placed 7th out of 27 competing teams.
  • The EMA parameters (5 and 20 periods) may have been too short, causing high-frequency trades and excessive losses during volatile periods.
  • The simulation included hindsight on certain major market fluctuations which we did not optimise for, limiting potential gains.
  • Additional filters used alongside EMA in professional settings were not implemented, which limited the strategy's full effectiveness.
  • As a team we achieved a fair amount in a short time — with more testing and refinement the bot could have performed significantly better.

Reflection

The project stands as a foundational introduction to algorithmic market trading. The core EMA strategy worked and the bot ran reliably throughout the simulation, but there are clear areas where more refinement would have improved the result.

The most significant lesson was around parameter tuning: a data point captured each second meant 5 and 20 periods represented a very short time window, likely causing excessive trades. Longer periods or adaptive tuning based on live volatility would have been more robust.

<add content here — any personal reflections on what you learned beyond the technical points>

← All projects

Open to opportunities.
Let's connect.

I'm looking for my first software engineering role and open to conversations about engineering, collaboration, and interesting problems. I read every message.