Thanks to all of you guys for your support. Puzzledquant wouldn’t have been possible without its dedicated readers. We are glad to announce that we are starting a new series that will cover Finance, Machine Learning and even Statistics questions from today. So Stay Tuned as we got some crazy stuff brewing in the backend. 🤞🏻
You are a forex trader analysing the markets and think you have spotted an arbitrage opportunity. You have $1000 USD to start with, and can trade the following exchanges at the following rates. How much profit can you generate?
Bonus problem: if we expand it to n currencies with their conversion rates given, can you find a optimum algorithm to find the arbitrage opportunity ?
Hint: Think in terms of cycles and graphs !
Try to solve this problem yourself before moving on to the solution below
.
.
.
.
.
.
Solution
First you must sell Dollars for Euros,
You then exchange your Euros for Pounds,
And finally, Pounds for Dollars,
Which yields $20 in profit.
.
.
😃 Over to you: Were you able to solve this?
👉 If you liked this post, don’t forget to leave a like ❤️. It helps more people discover this newsletter on Substack and tells us that you appreciate solving these weekly questions. The button is located towards the bottom of this email.
👉 If you love reading this newsletter, feel free to share it with friends!
"How much profit can you generate". Well, if not specified - either 0 (if no arbitrage avaliable) or inf (do the cycle for eternity).
For arbitrary number of currencies and the algorithms - we need a criteria.
- Don't use the same edge twice
- Don't use the exact same path twice (it can be dodged by inserting a random vertex in the middle e.g. USD -> EUR -> GBP into USD -> EUR -> RUB -> GBP, RUB here just for condition not for profit).
If there are n currencies, we can construct a graph (Taking currencies as nodes and conversion rate as weights, for ex: CurrA/CurrB = x , then A ---w_X--->B)
And then in this graph if we can find a cycle whose product of weights of all the edges is greater than 1, then it's an arbitrage.