How to include the fee of a sell order in itself.

40 Views Asked by At

Sorry for the poor title, I am sure there is a name for this problem (and an easy solution)

I have an account balance of \$1000. When I want to buy some EUR, I need to sell USD with a fee of 1%. That means, if I want to sell \$1000 I can only sell \$990 because of the 1% fee.

But when I then choose to sell \$990, the fee logically decreases from \$10 to \$9.90 thus leaving me with a rest of \$0.10 in my balance.

How can I calculate the amount of USD I need to sell, to have as close to \$0.00 account balance as possible?

3

There are 3 best solutions below

1
On BEST ANSWER

Solve for $x$, the amount, in US dollars, that you need to sell: $$x + 0.01x = 1.01x = 1000$$

$$x = \dfrac{1000}{1.01} \approx \$990.099 \approx \$990.10$$

0
On

The 1% is the fee on what you sell, not the total amount.

So, with $D$ the dollar amount you sell, and $T$ the total,

$$D + 0.01 D = T \to D = T/1.01.$$

For a total $T = 1000,$

$$D = 1000/1.01 \approx 990.10.$$

1
On

Here is a variable free solution, the way I learned it in school ages ago: What you sell plus the 1% fee will be 101% of what you sell. So $\$1000$ is 101% of what you can sell, so 1% is $\$1000/101$, and the total amount you can sell (100%) is $\$1000/101×100$.