# Calculating most profitable arbitrage orders on multiple market with fixed and variable fees

If I have multiple markets (let's say 5, but the solution should be generic) trading the same stock/commodity/whatever, and the markets differ in both variable fees (which are in % of the trade order) and fix fees (which are in absolute number of $per trade order), and suppose there exists an arbitrage opportunity on more than 2 markets at the same time, how do you calculate the absolutely most profitable sequence of market orders? (order of orders matters) The variable fees are not a problem, but the fix fees complicate the whole algorithm tremendously. Is this a traveling salesman type of problem? Or, is there any paper which deals with this problem. The fees might be something like this (shown as an example): • 1st market:$5 + 1 %

• 2nd market: $4 + 2 % • 3rd market:$0 + 5 %

• 4th market: $10 + 0 % • 5th market:$3 + 3 %

• I find your question slightly confusing. Why you need more than 2 markets to present an arbitrage opportunity, 2 or more are already sufficient. And why is it complicated to add in your execution related fees, whether stated as a percentage of notional traded or as fixed fee per trade? – Matt Jul 10 '13 at 1:20
• Example: Market1(fixed fee: 1, variable fee: 2%, BBO: 105/107), Market2(fixed fee: 0.5, variable fee 1%, BBO: 98/100). Variable Fees -> Buy asset at M2 for (100 + 1) and sell to M1 for (105-2.1). PnL with fixed fees applied: (105-0.5) - (100+1). -> Apply same logic to all markets and chose the most profitable one. – Matt Jul 10 '13 at 1:27
• Well, the idea is that the arbitrage opportunity can be at more than 2 markets at the same time. And the market depth at each exchange is finite IN VOLUME. What I mean is that at price 107, there might be only 3 pieces of the stock. – Paya Jul 10 '13 at 2:00
• that does not change the kind of algorithm you need to run the markets over. You need to include your all-in execution related costs and may find out that low volume will not push you over the "hurdle-rate", which may rank this particular arbitrage lower or even net-unprofitable. – Matt Jul 10 '13 at 3:37
• Have you made any progress on this question? Is there anything in my answer which you have trouble following? – user5399 Jul 15 '13 at 6:18

For exchange, with a 2% variable fee, a book 98 bid 100, resting offer at $100 would go up too$102 and bid go down to \$96.04.