bmino / binance-triangle-arbitrage

Detect in-market cryptocurrency arbitrage
MIT License
1.07k stars 336 forks source link

Question: Does TRADING.PROFIT_THRESHOLD include fee? #100

Closed dlasher closed 4 years ago

dlasher commented 4 years ago

If my fee is 0.05%, the fee for (3) trades would be 0.15%. If my profit percent is set to 0.30%, is it not going to execute unless the profit is 0.45%, or will it trade at 0.30%, and it's my responsibility to make sure my fees are less than?

So I've been through the code, and I can't say for sure either way:

  calculated.percent = (calculated.a.delta / calculated.a.spent * 100) - (CONFIG.TRADING.TAKER_FEE * 3);

and

     if (calculated.percent < CONFIG.TRADING.PROFIT_THRESHOLD) return false;

If I read that right, I set it 0.30%, then calculated.percent would be 0.15%. In theory if i want to trade at 0% win, I could set the profit percent at 0.16%?

bmino commented 4 years ago

Hey great question! This can definitely be confusing.

With the following configuration, positions that are mathematically identified as profitable will be executed: TAKER_FEE=0.05 PROFIT_THRESHOLD=0.00

You could setup the exact same scenario with the following properties: TAKER_FEE=0.00 PROFIT_THRESHOLD=0.15

The only difference between the two configurations is the value shown in the HUD. The second example will show higher "Profit" values, and the first scenario will show lower "Profit" values. But the executed positions will be the SAME.

dlasher commented 4 years ago

Thank you @bmino - I think that makes sense, so it's additive.

So if I have 0.15% taker fee, and 0.15% profit threshold, trades would have to be 0.30% profitable in order to be executed?

By the same token, if I set 0.15% taker fee, and 0% profit, we'd trade at 0% total profit, but no loss, right? (In theory, as long as the taker fees are set right, it should be impossible to trade at a loss?)

bmino commented 4 years ago

So if I have 0.15% taker fee, and 0.15% profit threshold, trades would have to be 0.30% profitable in order to be executed?

I you have a 0.05% taker fee, and 0.15% profit threshold, trades would have to be 0.30% profitable in order to be executed

If I set 0.15% taker fee, and 0% profit, we'd trade at 0% total profit, but no loss, right

If you set 0.05% taker fee, and 0% profit, we'd trade at 0% total profit, but no loss.


All of this assumes that your connection speed is quick enough. Milliseconds count

dlasher commented 4 years ago

Bahh - you're right, forgot the 3x transaction in my math. That makes complete sense, thank you for the explanation!

TL;DR - get your taker fees right, then the "Profit Threshold" is exactly what you'd expect it would be, the profit on the END RESULT of the trade.

bmino commented 4 years ago

Awesome! Right on!