<p>nmat: i think you got the signs wrong in there somewhere. the fees will /decrease/ your effective selling price, and /increase/ your effective purchase price. so it should in fact be:</p>

<pre><code>ExchangeA_sell * (1 - ExchangeA_fee) - ExchangeB_buy * (1 + ExchangeB_fee)
</code></pre>

<p>and also, you should take into account any deposit/withdrawal fees (E.g., when you withdraw via LR from mtgox, that's a 2% hit, when you use dwolla, that's 0.25USD fee, etc) that you'd incur when moving money between the exchanges.</p>

CC BY-SA 3.0
2011-09-19T19:38:01.827Z
2011-09-19T19:38:01.827Z
nanotube
<p>It's pretty simple. Like you said, you only have to add the fees to the selling price and subtract them from the buying price. Considering that the fee is a number between 0 and 1 that represents the percentage, here is an example:</p>

<pre><code>ExchangeB_bidPrice * (1 - ExchangeB_fee) - ExchangeA_askPrice * (1 + ExchangeA_fee)
</code></pre>

<p>This will give you the <strong>profit per coin</strong> for buying at ExchangeA and selling at ExchangeB.</p>

CC BY-SA 3.0
2011-09-17T02:00:00.103Z
2011-09-19T20:18:57.820Z
2011-09-19T20:18:57.820Z
nmat
<p>I'm currently writing something to script arbitrage between two exchanges to test the concept.</p>

<p>I know I can determine the difference in prices by using</p>

<p>(ExhangeA_sell - ExchangeB_buy) &lt;- this will give me the price difference. i.e. gross profit (before fee's)</p>

<p>My question, how do I take the fee's into account when calculating net profit?</p>

<p>Currently my thinking is that I add the commission % to the buy price on ExchangeA and subtract the commission % from the sell price on ExchangeB.</p>

<p>Any ideas on this?</p>

<p>Thanks.</p>

CC BY-SA 3.0
2011-09-21T14:41:36.757Z
Hi Conor, just wanted to explain the close votes that are starting to pop up on this question.  It's a perfectly valid question, but because it's not specifically unique to Bitcoin, it may be better suited to a site like http://money.stackexchange.com/ or http://math.stackexchange.com/ so don't be surprised if it gets moved there.
eMansipater
<exchange-rate><arbitrage>
Costing arbitrage between exchanges
jim
# Costing arbitrage between exchanges

(Asked by: username_0 on 2011-09-17)

I'm currently writing something to script arbitrage between two exchanges to test the concept.

I know I can determine the difference in prices by using

(ExhangeA\_sell - ExchangeB\_buy) <- this will give me the price difference. i.e. gross profit (before fee's)

My question, how do I take the fee's into account when calculating net profit?

Currently my thinking is that I add the commission % to the buy price on ExchangeA and subtract the commission % from the sell price on ExchangeB.

Any ideas on this?

Thanks.

**Tags:** exchange-rate, arbitrage

> **Comments:**
> **username_1**: Hi Conor, just wanted to explain the close votes that are starting to pop up on this question.  It's a perfectly valid question, but because it's not specifically unique to Bitcoin, it may be better suited to a site like http://money.stackexchange.com/ or http://math.stackexchange.com/ so don't be surprised if it gets moved there.  

---

## 2 answers

### Answer by username_2 on 2011-09-19. Score: 5

username_3: i think you got the signs wrong in there somewhere. the fees will /decrease/ your effective selling price, and /increase/ your effective purchase price. so it should in fact be:

```
ExchangeA_sell * (1 - ExchangeA_fee) - ExchangeB_buy * (1 + ExchangeB_fee)

```

and also, you should take into account any deposit/withdrawal fees (E.g., when you withdraw via LR from mtgox, that's a 2% hit, when you use dwolla, that's 0.25USD fee, etc) that you'd incur when moving money between the exchanges.


---

### Answer by username_3 on 2011-09-17. Score: 2

It's pretty simple. Like you said, you only have to add the fees to the selling price and subtract them from the buying price. Considering that the fee is a number between 0 and 1 that represents the percentage, here is an example:

```
ExchangeB_bidPrice * (1 - ExchangeB_fee) - ExchangeA_askPrice * (1 + ExchangeA_fee)

```

This will give you the **profit per coin** for buying at ExchangeA and selling at ExchangeB.


---

