Untitled
unknown
plain_text
3 months ago
1.1 kB
5
Indexable
Suppose you are given a set of exchange rates among certain currencies and you want to determine if an arbitrage is possible, i.e, if there is a way by which you can start with one unit of some currency C and perform a series of barters which results in having more than one unit of C. Let's assume that transaction costs are zero exchange rates do not fluctuate fractional quantities of items can be sold The above picture shows such chart. Let's see what happens if I get exchange currency in the following sequence : USD -> EUR -> CAD -> USD Let's suppose we start with 10000 USD then exchange it for EUR. We get 7410 EUR. Now I want to exchange this with CAD. 7410 EUR = 7410 * 1.366 = 10122 CAD Now let's exchange this for USD. 10122 CAD = 10122 * 0.995 = 10071 There you go. We started with 10000 USD and ended up having 10071 USD. That is a good 71 USD profit. Design an efficient algorithm to determine whether there exists an arbitrage - a way to start with a single unit of some currency and convert it back to more than one unit of that currency through a sequence of exchanges.
Editor is loading...
Leave a Comment