# How to execute orders for triangular arbitrage?

As a study, I've developed a simple algorithm to detect market discrepancies for triangular arbitrage opportunities through the OANDA REST API. To my surprise, it actually discovered a few of said discrepancies due to the recent fall of the Turkish Lira. However, I do not know how to execute orders in such a way as to capitalize on these opportunities.

Since every trade is closed by entering into a trade that takes the opposite position, how is it possible to trade triangularly?

For example, if there was a discrepancy that allowed me to profit by trading USD > EUR > TRY > USD, how would I actually close this trade triangle?

Logically, I would buy EUR/USD, sell EUR/TRY, and buy USD/TRY. I would be buying EUR with USD, selling those EUR for TRY, and then buying back my USD with that TRY.

However, if none of these trades are opposite to one another, then none of the trades actually close, and the profit is never realized.

How exactly, then, can one capitalize on a triangular arbitrage opportunity? Does it require a particular broker or account that allows for triangular closing of trades?

• You could do the arbitrage if you do it in actual currency as suggested in your alternative statement ("I would be buying EUR with USD..."), because then you would begin with USD and end with USD. I'm not sure how you could accomplish this in practice. – BrenBarn Apr 23 '17 at 5:25

## 2 Answers

I dont think what you are attempting to do is possible with a retail forex account. Imagine you buy 10,000 EUR/USD, meaning you will profit from a rise in the euro or a fall in the dollar or both. However you do not actually have the right to ownership on those 10,000 euros, you only have the right to make a profit or loss from movements in the exchange rate. This is how brokers allow such leverage on small forex accounts. In order to actually take advantage of such opportunities you would need to be trading in the inter-bank market,on behalf of an institution big enough to take full ownership of these currencies without the need for margin trading. I hope this makes sense and answers your question to some degree. Might also be worth contacting your broker to see if they can allow this, but as far as I know, it is not possible from a retail account.

How to execute orders for triangular arbitrage?

Arbitrage is not allowed in OANDA and most other forex brokers.

According to the API License Agreement which I found on the OANDA United States Legal Documents webpage:

1. DEFINITIONS

[...]

(m) “Unauthorized Activity” means any money laundering, arbitrage, scalping or pip-hunting activities, or any other activity involving the purchase of currency on one market for the immediate resale on another market in order to profit from a price discrepancy or price error.

14.0 NO ARBITRAGE

Licensee agrees and acknowledges that it shall not use the FXTrade System or the Licensed Materials in order to engage in any Unauthorized Activity. OANDA reserves the right to reverse any Transaction, where in OANDA’s reasonable opinion, such Transaction involved any Unauthorized Activity.

Similar language exists in the license agreements for other regions.

• Good spot. Do you know if these rules were in place at the time the question was asked? The bottom of each page has "OANDA API License Agreement – 01/15" which could mean January 2015, so I suspect they may have been. – TripeHound Nov 7 '20 at 12:37
• @TripeHound I don't know, but I would think so. I am under the impression that forex brokers dislike arbitrage as much as bookmakers do. When I saw this question, I went straight to the terms of service fully expecting to see a clause that forbids arbitrage. – Flux Nov 7 '20 at 14:31
• @TripeHound From the Wayback Machine, I found an older version of the agreement dated "09/09" (September 2009). The clauses forbidding arbitrage remained unchanged between the "09/09" and "01/15" versions. – Flux Nov 8 '20 at 7:51